Skip to content

Commit

Permalink
refactor: Fix clang-tidy warnings in Query. (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinZhihao-723 authored Jan 12, 2025
1 parent 83794f9 commit 301b510
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
2 changes: 2 additions & 0 deletions lint-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ tasks:
- "{{.CLP_FFI_PY_CPP_SRC_DIR}}/ir/native/PyQuery.hpp"
- "{{.CLP_FFI_PY_CPP_SRC_DIR}}/ir/native/PySerializer.cpp"
- "{{.CLP_FFI_PY_CPP_SRC_DIR}}/ir/native/PySerializer.hpp"
- "{{.CLP_FFI_PY_CPP_SRC_DIR}}/ir/native/Query.cpp"
- "{{.CLP_FFI_PY_CPP_SRC_DIR}}/ir/native/Query.hpp"
- "{{.CLP_FFI_PY_CPP_SRC_DIR}}/modules"
- "{{.CLP_FFI_PY_CPP_SRC_DIR}}/Py_utils.cpp"
- "{{.CLP_FFI_PY_CPP_SRC_DIR}}/Py_utils.hpp"
Expand Down
18 changes: 7 additions & 11 deletions src/clp_ffi_py/ir/native/Query.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@ auto Query::matches_wildcard_queries(std::string_view log_message) const -> bool
if (m_wildcard_queries.empty()) {
return true;
}
return std::any_of(
m_wildcard_queries.begin(),
m_wildcard_queries.end(),
[&](auto const& wildcard_query) {
return clp::string_utils::wildcard_match_unsafe(
log_message,
wildcard_query.get_wildcard_query(),
wildcard_query.is_case_sensitive()
);
}
);
return std::ranges::any_of(m_wildcard_queries, [&](auto const& wildcard_query) {
return clp::string_utils::wildcard_match_unsafe(
log_message,
wildcard_query.get_wildcard_query(),
wildcard_query.is_case_sensitive()
);
});
}
} // namespace clp_ffi_py::ir::native
3 changes: 2 additions & 1 deletion src/clp_ffi_py/ir/native/Query.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
#include <limits>
#include <string>
#include <string_view>
#include <utility>
#include <vector>

#include <clp/ErrorCode.hpp>
#include <clp/ffi/encoding_methods.hpp>
#include <clp/ir/types.hpp>

#include <clp_ffi_py/ExceptionFFI.hpp>
#include <clp_ffi_py/ir/native/LogEvent.hpp>
Expand Down

0 comments on commit 301b510

Please sign in to comment.