From 2210b2cf501ec068f80ba87dc8abde77bde885ff Mon Sep 17 00:00:00 2001 From: LinZhihao-723 Date: Mon, 6 May 2024 00:03:39 -0400 Subject: [PATCH 1/2] Drop lint tools version and always use the latest --- components/core/src/clp/BufferReader.hpp | 13 +++++---- .../core/src/clp/BufferedFileReader.hpp | 27 ++++++++++--------- components/core/src/clp/Thread.hpp | 2 +- .../core/src/clp/clo/CommandLineArguments.cpp | 12 ++++----- .../core/src/clp/ir/LogEventDeserializer.cpp | 16 +++++------ .../core/src/clp/ir/LogEventDeserializer.hpp | 11 ++++---- .../src/clp/streaming_archive/MetadataDB.cpp | 16 +++++------ .../clp/streaming_archive/reader/Segment.hpp | 2 +- .../core/src/clp_s/CommandLineArguments.cpp | 20 ++++++-------- components/core/src/clp_s/Utils.hpp | 2 +- .../core/src/clp_s/search/BooleanLiteral.hpp | 2 +- components/core/src/clp_s/search/Output.cpp | 8 ++++-- .../core/src/clp_s/search/OutputHandler.hpp | 2 +- .../core/src/clp_s/search/clp_search/Grep.cpp | 3 ++- components/core/src/glt/BufferReader.hpp | 13 +++++---- .../core/src/glt/BufferedFileReader.hpp | 27 ++++++++++--------- .../core/src/glt/ir/LogEventDeserializer.cpp | 16 +++++------ .../core/src/glt/ir/LogEventDeserializer.hpp | 11 ++++---- .../src/glt/streaming_archive/MetadataDB.cpp | 14 +++++----- .../reader/LogtypeTableManager.hpp | 2 +- .../glt/streaming_archive/reader/Segment.hpp | 2 +- .../reader/SingleLogtypeTableManager.hpp | 2 +- lint-requirements.txt | 8 +++--- 23 files changed, 121 insertions(+), 110 deletions(-) diff --git a/components/core/src/clp/BufferReader.hpp b/components/core/src/clp/BufferReader.hpp index 108d52543..349697d34 100644 --- a/components/core/src/clp/BufferReader.hpp +++ b/components/core/src/clp/BufferReader.hpp @@ -63,8 +63,8 @@ class BufferReader : public ReaderInterface { * @return ErrorCode_EndOfFile if the buffer doesn't contain any more data * @return ErrorCode_Success on success */ - [[nodiscard]] auto try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) - -> ErrorCode override; + [[nodiscard]] auto + try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) -> ErrorCode override; /** * Tries to seek to the given position, relative to the beginning of the buffer @@ -88,9 +88,12 @@ class BufferReader : public ReaderInterface { * @param str Returns the content read from the buffer * @return Same as BufferReader::try_read_to_delimiter(char, bool, std::string&, bool&, size_t&) */ - [[nodiscard]] auto - try_read_to_delimiter(char delim, bool keep_delimiter, bool append, std::string& str) - -> ErrorCode override; + [[nodiscard]] auto try_read_to_delimiter( + char delim, + bool keep_delimiter, + bool append, + std::string& str + ) -> ErrorCode override; private: // Methods diff --git a/components/core/src/clp/BufferedFileReader.hpp b/components/core/src/clp/BufferedFileReader.hpp index e2b69cd0c..dd55e658e 100644 --- a/components/core/src/clp/BufferedFileReader.hpp +++ b/components/core/src/clp/BufferedFileReader.hpp @@ -41,11 +41,11 @@ class BufferedFileReader : public ReaderInterface { // Constructors OperationFailed(ErrorCode error_code, char const* const filename, int line_number) : OperationFailed( - error_code, - filename, - line_number, - "BufferedFileReader operation failed" - ) {} + error_code, + filename, + line_number, + "BufferedFileReader operation failed" + ) {} OperationFailed( ErrorCode error_code, @@ -127,8 +127,8 @@ class BufferedFileReader : public ReaderInterface { * @return ErrorCode_NotInit if the file is not opened * @return ErrorCode_Success on success */ - [[nodiscard]] auto try_peek_buffered_data(char const*& buf, size_t& peek_size) const - -> ErrorCode; + [[nodiscard]] auto + try_peek_buffered_data(char const*& buf, size_t& peek_size) const -> ErrorCode; /** * Peeks the remaining buffered content without advancing the read head. @@ -191,8 +191,8 @@ class BufferedFileReader : public ReaderInterface { * @return ErrorCode_EndOfFile on EOF * @return ErrorCode_Success on success */ - [[nodiscard]] auto try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) - -> ErrorCode override; + [[nodiscard]] auto + try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) -> ErrorCode override; /** * Tries to read up to an occurrence of the given delimiter @@ -206,9 +206,12 @@ class BufferedFileReader : public ReaderInterface { * @return Same as BufferReader::try_read_to_delimiter if it fails * @return ErrorCode_Success on success */ - [[nodiscard]] auto - try_read_to_delimiter(char delim, bool keep_delimiter, bool append, std::string& str) - -> ErrorCode override; + [[nodiscard]] auto try_read_to_delimiter( + char delim, + bool keep_delimiter, + bool append, + std::string& str + ) -> ErrorCode override; private: // Methods diff --git a/components/core/src/clp/Thread.hpp b/components/core/src/clp/Thread.hpp index 8774a9f40..f6d8ba15b 100644 --- a/components/core/src/clp/Thread.hpp +++ b/components/core/src/clp/Thread.hpp @@ -28,7 +28,7 @@ class Thread { }; // Constructors - Thread() : m_thread_running(false){}; + Thread() : m_thread_running(false) {}; // Destructor virtual ~Thread(); diff --git a/components/core/src/clp/clo/CommandLineArguments.cpp b/components/core/src/clp/clo/CommandLineArguments.cpp index 8f7d54a12..f41389a83 100644 --- a/components/core/src/clp/clo/CommandLineArguments.cpp +++ b/components/core/src/clp/clo/CommandLineArguments.cpp @@ -249,24 +249,24 @@ CommandLineArguments::parse_arguments(int argc, char const* argv[]) { cerr << R"( # Search ARCHIVE_PATH for " ERROR " and send results to )" "a network destination" << endl; - cerr << " " << get_program_name() << R"( ARCHIVE_PATH " ERROR ")" - << " " << static_cast(cNetworkOutputHandlerName) + cerr << " " << get_program_name() << R"( ARCHIVE_PATH " ERROR ")" << " " + << static_cast(cNetworkOutputHandlerName) << " --host localhost --port 18000" << endl; cerr << endl; cerr << R"( # Search ARCHIVE_PATH for " ERROR " and output the results )" "by performing a count aggregation" << endl; - cerr << " " << get_program_name() << R"( ARCHIVE_PATH " ERROR ")" - << " " << static_cast(cReducerOutputHandlerName) << " --count" + cerr << " " << get_program_name() << R"( ARCHIVE_PATH " ERROR ")" << " " + << static_cast(cReducerOutputHandlerName) << " --count" << " --host localhost --port 14009 --job-id 1" << endl; cerr << endl; cerr << R"( # Search ARCHIVE_PATH for " ERROR " and send results to)" R"( mongodb://127.0.0.1:27017/test "result" collection )" << endl; - cerr << " " << get_program_name() << R"( ARCHIVE_PATH " ERROR ")" - << " " << static_cast(cResultsCacheOutputHandlerName) + cerr << " " << get_program_name() << R"( ARCHIVE_PATH " ERROR ")" << " " + << static_cast(cResultsCacheOutputHandlerName) << R"( --uri mongodb://127.0.0.1:27017/test --collection result)" << endl; cerr << endl; diff --git a/components/core/src/clp/ir/LogEventDeserializer.cpp b/components/core/src/clp/ir/LogEventDeserializer.cpp index 6ab643142..5f1677b43 100644 --- a/components/core/src/clp/ir/LogEventDeserializer.cpp +++ b/components/core/src/clp/ir/LogEventDeserializer.cpp @@ -10,8 +10,8 @@ namespace clp::ir { template -auto LogEventDeserializer::create(ReaderInterface& reader) - -> BOOST_OUTCOME_V2_NAMESPACE::std_result> { +auto LogEventDeserializer::create(ReaderInterface& reader +) -> BOOST_OUTCOME_V2_NAMESPACE::std_result> { ffi::ir_stream::encoded_tag_t metadata_type{0}; std::vector metadata; auto ir_error_code = ffi::ir_stream::deserialize_preamble(reader, metadata_type, metadata); @@ -66,8 +66,8 @@ auto LogEventDeserializer::create(ReaderInterface& reader) } template -auto LogEventDeserializer::deserialize_log_event() - -> BOOST_OUTCOME_V2_NAMESPACE::std_result> { +auto LogEventDeserializer::deserialize_log_event( +) -> BOOST_OUTCOME_V2_NAMESPACE::std_result> { epoch_time_ms_t timestamp_or_timestamp_delta{}; std::string logtype; std::vector dict_vars; @@ -109,8 +109,8 @@ template auto LogEventDeserializer::create(Reader ) -> BOOST_OUTCOME_V2_NAMESPACE::std_result>; template auto LogEventDeserializer::create(ReaderInterface& reader ) -> BOOST_OUTCOME_V2_NAMESPACE::std_result>; -template auto LogEventDeserializer::deserialize_log_event() - -> BOOST_OUTCOME_V2_NAMESPACE::std_result>; -template auto LogEventDeserializer::deserialize_log_event() - -> BOOST_OUTCOME_V2_NAMESPACE::std_result>; +template auto LogEventDeserializer::deserialize_log_event( +) -> BOOST_OUTCOME_V2_NAMESPACE::std_result>; +template auto LogEventDeserializer::deserialize_log_event( +) -> BOOST_OUTCOME_V2_NAMESPACE::std_result>; } // namespace clp::ir diff --git a/components/core/src/clp/ir/LogEventDeserializer.hpp b/components/core/src/clp/ir/LogEventDeserializer.hpp index e6f43aca6..683bea966 100644 --- a/components/core/src/clp/ir/LogEventDeserializer.hpp +++ b/components/core/src/clp/ir/LogEventDeserializer.hpp @@ -33,8 +33,8 @@ class LogEventDeserializer { * - std::errc::protocol_not_supported if the IR stream contains an unsupported metadata format * or uses an unsupported version */ - static auto create(ReaderInterface& reader) - -> BOOST_OUTCOME_V2_NAMESPACE::std_result>; + static auto create(ReaderInterface& reader + ) -> BOOST_OUTCOME_V2_NAMESPACE::std_result>; // Delete copy constructor and assignment LogEventDeserializer(LogEventDeserializer const&) = delete; @@ -58,8 +58,8 @@ class LogEventDeserializer { * - std::errc::result_out_of_range if the IR stream is truncated * - std::errc::result_out_of_range if the IR stream is corrupted */ - [[nodiscard]] auto deserialize_log_event() - -> BOOST_OUTCOME_V2_NAMESPACE::std_result>; + [[nodiscard]] auto deserialize_log_event( + ) -> BOOST_OUTCOME_V2_NAMESPACE::std_result>; private: // Constructors @@ -74,8 +74,7 @@ class LogEventDeserializer { [[no_unique_address]] std::conditional_t< std::is_same_v, epoch_time_ms_t, - EmptyType> - m_prev_msg_timestamp{}; + EmptyType> m_prev_msg_timestamp{}; ReaderInterface& m_reader; }; } // namespace clp::ir diff --git a/components/core/src/clp/streaming_archive/MetadataDB.cpp b/components/core/src/clp/streaming_archive/MetadataDB.cpp index 69f7dc395..dcdd7e750 100644 --- a/components/core/src/clp/streaming_archive/MetadataDB.cpp +++ b/components/core/src/clp/streaming_archive/MetadataDB.cpp @@ -303,14 +303,14 @@ MetadataDB::FileIterator::FileIterator( bool order_by_segment_end_ts ) : Iterator(get_files_select_statement( - db, - begin_timestamp, - end_timestamp, - file_path, - in_specific_segment, - segment_id, - order_by_segment_end_ts - )) {} + db, + begin_timestamp, + end_timestamp, + file_path, + in_specific_segment, + segment_id, + order_by_segment_end_ts + )) {} MetadataDB::EmptyDirectoryIterator::EmptyDirectoryIterator(SQLiteDB& db) : Iterator(get_empty_directories_select_statement(db)) {} diff --git a/components/core/src/clp/streaming_archive/reader/Segment.hpp b/components/core/src/clp/streaming_archive/reader/Segment.hpp index c17334772..9ed40ea60 100644 --- a/components/core/src/clp/streaming_archive/reader/Segment.hpp +++ b/components/core/src/clp/streaming_archive/reader/Segment.hpp @@ -20,7 +20,7 @@ namespace clp::streaming_archive::reader { class Segment { public: // Constructor - Segment() : m_segment_path({}){}; + Segment() : m_segment_path({}) {}; // Destructor ~Segment(); diff --git a/components/core/src/clp_s/CommandLineArguments.cpp b/components/core/src/clp_s/CommandLineArguments.cpp index 402c30c69..2a80f6c28 100644 --- a/components/core/src/clp_s/CommandLineArguments.cpp +++ b/components/core/src/clp_s/CommandLineArguments.cpp @@ -107,9 +107,7 @@ CommandLineArguments::parse_arguments(int argc, char const** argv) { std::cerr << " x - decompress" << std::endl; std::cerr << " s - search" << std::endl; std::cerr << std::endl; - std::cerr << "Try " - << " c --help OR" - << " x --help OR" + std::cerr << "Try " << " c --help OR" << " x --help OR" << " s --help for command-specific details." << std::endl; po::options_description visible_options; @@ -484,8 +482,8 @@ CommandLineArguments::parse_arguments(int argc, char const** argv) { std::cerr << " # Search archives in archives-dir for logs matching a KQL query" R"( "level: INFO" and output to the results cache)" << std::endl; - std::cerr << " " << m_program_name << R"( s archives-dir "level: INFO")" - << " " << cResultsCacheOutputHandlerName + std::cerr << " " << m_program_name << R"( s archives-dir "level: INFO")" << " " + << cResultsCacheOutputHandlerName << " --uri mongodb://127.0.0.1:27017/test" " --collection test" << std::endl; @@ -494,8 +492,8 @@ CommandLineArguments::parse_arguments(int argc, char const** argv) { std::cerr << " # Search archives in archives-dir for logs matching a KQL query" R"( "level: INFO" and output to a network destination)" << std::endl; - std::cerr << " " << m_program_name << R"( s archives-dir "level: INFO")" - << " " << cNetworkOutputHandlerName + std::cerr << " " << m_program_name << R"( s archives-dir "level: INFO")" << " " + << cNetworkOutputHandlerName << " --host localhost" " --port 18000" << std::endl; @@ -504,11 +502,9 @@ CommandLineArguments::parse_arguments(int argc, char const** argv) { std::cerr << " # Search archives in archives-dir for logs matching a KQL query" R"( "level: INFO" and output perform a count aggregation)" << std::endl; - std::cerr << " " << m_program_name << R"( s archives-dir "level: INFO")" - << " " << cReducerOutputHandlerName << " --count" - << " --host localhost" - << " --port 14009" - << " --job-id 1" << std::endl; + std::cerr << " " << m_program_name << R"( s archives-dir "level: INFO")" << " " + << cReducerOutputHandlerName << " --count" << " --host localhost" + << " --port 14009" << " --job-id 1" << std::endl; po::options_description visible_options; visible_options.add(general_options); diff --git a/components/core/src/clp_s/Utils.hpp b/components/core/src/clp_s/Utils.hpp index 1cc7a4a4d..fefdce07c 100644 --- a/components/core/src/clp_s/Utils.hpp +++ b/components/core/src/clp_s/Utils.hpp @@ -254,7 +254,7 @@ template class Span { public: Span() = default; - Span(T* begin, size_t size) : m_begin(begin), m_size(size){}; + Span(T* begin, size_t size) : m_begin(begin), m_size(size) {}; T* begin() { return m_begin; } diff --git a/components/core/src/clp_s/search/BooleanLiteral.hpp b/components/core/src/clp_s/search/BooleanLiteral.hpp index af409b81d..a22022b7b 100644 --- a/components/core/src/clp_s/search/BooleanLiteral.hpp +++ b/components/core/src/clp_s/search/BooleanLiteral.hpp @@ -51,7 +51,7 @@ class BooleanLiteral : public Literal { // Constructors BooleanLiteral() = default; - explicit BooleanLiteral(bool v) : m_v(v){}; + explicit BooleanLiteral(bool v) : m_v(v) {}; }; } // namespace clp_s::search diff --git a/components/core/src/clp_s/search/Output.cpp b/components/core/src/clp_s/search/Output.cpp index 70dcb7a64..61edd2cd1 100644 --- a/components/core/src/clp_s/search/Output.cpp +++ b/components/core/src/clp_s/search/Output.cpp @@ -146,7 +146,8 @@ void Output::init( } else if (var_reader != nullptr && var_reader->get_type() == NodeType::VARSTRING) { m_var_string_readers[column.first] = var_reader; m_other_columns.push_back(column.second); - } else if (auto date_column_reader = dynamic_cast(column.second)) + } else if (auto date_column_reader + = dynamic_cast(column.second)) { m_datestring_readers[column.first] = date_column_reader; m_other_columns.push_back(column.second); @@ -1091,7 +1092,10 @@ Output::constant_propagate(std::shared_ptr const& expr, int32_t sche // trivially matching // FIXME: have an edgecase to handle with NEXISTS on pure wildcard columns return EvaluatedValue::True; - } else if (filter->get_column()->is_pure_wildcard() && filter->get_column()->matches_any(LiteralType::ClpStringT | LiteralType::VarStringT)) + } else if (filter->get_column()->is_pure_wildcard() + && filter->get_column()->matches_any( + LiteralType::ClpStringT | LiteralType::VarStringT + )) { auto wildcard = filter->get_column().get(); bool has_var_string = false; diff --git a/components/core/src/clp_s/search/OutputHandler.hpp b/components/core/src/clp_s/search/OutputHandler.hpp index fbf449adf..624c006be 100644 --- a/components/core/src/clp_s/search/OutputHandler.hpp +++ b/components/core/src/clp_s/search/OutputHandler.hpp @@ -30,7 +30,7 @@ class OutputHandler { // Constructors explicit OutputHandler(bool should_output_timestamp, bool should_marshal_records) : m_should_output_timestamp(should_output_timestamp), - m_should_marshal_records(should_marshal_records){}; + m_should_marshal_records(should_marshal_records) {}; // Destructor virtual ~OutputHandler() = default; diff --git a/components/core/src/clp_s/search/clp_search/Grep.cpp b/components/core/src/clp_s/search/clp_search/Grep.cpp index 54031446a..5cdb2fd9b 100644 --- a/components/core/src/clp_s/search/clp_search/Grep.cpp +++ b/components/core/src/clp_s/search/clp_search/Grep.cpp @@ -366,7 +366,8 @@ SubQueryMatchabilityResult generate_logtypes_and_vars_for_subquery( } else { if (false == query_token.is_var()) { logtype += query_token.get_value(); - } else if (false == process_var_token(query_token, var_dict, ignore_case, sub_query, logtype)) + } else if (false + == process_var_token(query_token, var_dict, ignore_case, sub_query, logtype)) { return SubQueryMatchabilityResult::WontMatch; } diff --git a/components/core/src/glt/BufferReader.hpp b/components/core/src/glt/BufferReader.hpp index 3956b6360..aec2f53fe 100644 --- a/components/core/src/glt/BufferReader.hpp +++ b/components/core/src/glt/BufferReader.hpp @@ -63,8 +63,8 @@ class BufferReader : public ReaderInterface { * @return ErrorCode_EndOfFile if the buffer doesn't contain any more data * @return ErrorCode_Success on success */ - [[nodiscard]] auto try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) - -> ErrorCode override; + [[nodiscard]] auto + try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) -> ErrorCode override; /** * Tries to seek to the given position, relative to the beginning of the buffer @@ -88,9 +88,12 @@ class BufferReader : public ReaderInterface { * @param str Returns the content read from the buffer * @return Same as BufferReader::try_read_to_delimiter(char, bool, std::string&, bool&, size_t&) */ - [[nodiscard]] auto - try_read_to_delimiter(char delim, bool keep_delimiter, bool append, std::string& str) - -> ErrorCode override; + [[nodiscard]] auto try_read_to_delimiter( + char delim, + bool keep_delimiter, + bool append, + std::string& str + ) -> ErrorCode override; private: // Methods diff --git a/components/core/src/glt/BufferedFileReader.hpp b/components/core/src/glt/BufferedFileReader.hpp index e5b08fac6..3e45f2056 100644 --- a/components/core/src/glt/BufferedFileReader.hpp +++ b/components/core/src/glt/BufferedFileReader.hpp @@ -41,11 +41,11 @@ class BufferedFileReader : public ReaderInterface { // Constructors OperationFailed(ErrorCode error_code, char const* const filename, int line_number) : OperationFailed( - error_code, - filename, - line_number, - "BufferedFileReader operation failed" - ) {} + error_code, + filename, + line_number, + "BufferedFileReader operation failed" + ) {} OperationFailed( ErrorCode error_code, @@ -127,8 +127,8 @@ class BufferedFileReader : public ReaderInterface { * @return ErrorCode_NotInit if the file is not opened * @return ErrorCode_Success on success */ - [[nodiscard]] auto try_peek_buffered_data(char const*& buf, size_t& peek_size) const - -> ErrorCode; + [[nodiscard]] auto + try_peek_buffered_data(char const*& buf, size_t& peek_size) const -> ErrorCode; /** * Peeks the remaining buffered content without advancing the read head. @@ -191,8 +191,8 @@ class BufferedFileReader : public ReaderInterface { * @return ErrorCode_EndOfFile on EOF * @return ErrorCode_Success on success */ - [[nodiscard]] auto try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) - -> ErrorCode override; + [[nodiscard]] auto + try_read(char* buf, size_t num_bytes_to_read, size_t& num_bytes_read) -> ErrorCode override; /** * Tries to read up to an occurrence of the given delimiter @@ -206,9 +206,12 @@ class BufferedFileReader : public ReaderInterface { * @return Same as BufferReader::try_read_to_delimiter if it fails * @return ErrorCode_Success on success */ - [[nodiscard]] auto - try_read_to_delimiter(char delim, bool keep_delimiter, bool append, std::string& str) - -> ErrorCode override; + [[nodiscard]] auto try_read_to_delimiter( + char delim, + bool keep_delimiter, + bool append, + std::string& str + ) -> ErrorCode override; private: // Methods diff --git a/components/core/src/glt/ir/LogEventDeserializer.cpp b/components/core/src/glt/ir/LogEventDeserializer.cpp index 3b36d570a..00cd880e9 100644 --- a/components/core/src/glt/ir/LogEventDeserializer.cpp +++ b/components/core/src/glt/ir/LogEventDeserializer.cpp @@ -10,8 +10,8 @@ namespace glt::ir { template -auto LogEventDeserializer::create(ReaderInterface& reader) - -> BOOST_OUTCOME_V2_NAMESPACE::std_result> { +auto LogEventDeserializer::create(ReaderInterface& reader +) -> BOOST_OUTCOME_V2_NAMESPACE::std_result> { ffi::ir_stream::encoded_tag_t metadata_type{0}; std::vector metadata; auto ir_error_code = ffi::ir_stream::deserialize_preamble(reader, metadata_type, metadata); @@ -66,8 +66,8 @@ auto LogEventDeserializer::create(ReaderInterface& reader) } template -auto LogEventDeserializer::deserialize_log_event() - -> BOOST_OUTCOME_V2_NAMESPACE::std_result> { +auto LogEventDeserializer::deserialize_log_event( +) -> BOOST_OUTCOME_V2_NAMESPACE::std_result> { epoch_time_ms_t timestamp_or_timestamp_delta{}; std::string logtype; std::vector dict_vars; @@ -109,8 +109,8 @@ template auto LogEventDeserializer::create(Reader ) -> BOOST_OUTCOME_V2_NAMESPACE::std_result>; template auto LogEventDeserializer::create(ReaderInterface& reader ) -> BOOST_OUTCOME_V2_NAMESPACE::std_result>; -template auto LogEventDeserializer::deserialize_log_event() - -> BOOST_OUTCOME_V2_NAMESPACE::std_result>; -template auto LogEventDeserializer::deserialize_log_event() - -> BOOST_OUTCOME_V2_NAMESPACE::std_result>; +template auto LogEventDeserializer::deserialize_log_event( +) -> BOOST_OUTCOME_V2_NAMESPACE::std_result>; +template auto LogEventDeserializer::deserialize_log_event( +) -> BOOST_OUTCOME_V2_NAMESPACE::std_result>; } // namespace glt::ir diff --git a/components/core/src/glt/ir/LogEventDeserializer.hpp b/components/core/src/glt/ir/LogEventDeserializer.hpp index b45f04c49..9667f889a 100644 --- a/components/core/src/glt/ir/LogEventDeserializer.hpp +++ b/components/core/src/glt/ir/LogEventDeserializer.hpp @@ -33,8 +33,8 @@ class LogEventDeserializer { * - std::errc::protocol_not_supported if the IR stream contains an unsupported metadata format * or uses an unsupported version */ - static auto create(ReaderInterface& reader) - -> BOOST_OUTCOME_V2_NAMESPACE::std_result>; + static auto create(ReaderInterface& reader + ) -> BOOST_OUTCOME_V2_NAMESPACE::std_result>; // Delete copy constructor and assignment LogEventDeserializer(LogEventDeserializer const&) = delete; @@ -58,8 +58,8 @@ class LogEventDeserializer { * - std::errc::result_out_of_range if the IR stream is truncated * - std::errc::result_out_of_range if the IR stream is corrupted */ - [[nodiscard]] auto deserialize_log_event() - -> BOOST_OUTCOME_V2_NAMESPACE::std_result>; + [[nodiscard]] auto deserialize_log_event( + ) -> BOOST_OUTCOME_V2_NAMESPACE::std_result>; private: // Constructors @@ -74,8 +74,7 @@ class LogEventDeserializer { [[no_unique_address]] std::conditional_t< std::is_same_v, epoch_time_ms_t, - EmptyType> - m_prev_msg_timestamp{}; + EmptyType> m_prev_msg_timestamp{}; ReaderInterface& m_reader; }; } // namespace glt::ir diff --git a/components/core/src/glt/streaming_archive/MetadataDB.cpp b/components/core/src/glt/streaming_archive/MetadataDB.cpp index ba620ce4f..7f250b947 100644 --- a/components/core/src/glt/streaming_archive/MetadataDB.cpp +++ b/components/core/src/glt/streaming_archive/MetadataDB.cpp @@ -288,13 +288,13 @@ MetadataDB::FileIterator::FileIterator( segment_id_t segment_id ) : Iterator(get_files_select_statement( - db, - begin_timestamp, - end_timestamp, - file_path, - in_specific_segment, - segment_id - )) {} + db, + begin_timestamp, + end_timestamp, + file_path, + in_specific_segment, + segment_id + )) {} MetadataDB::EmptyDirectoryIterator::EmptyDirectoryIterator(SQLiteDB& db) : Iterator(get_empty_directories_select_statement(db)) {} diff --git a/components/core/src/glt/streaming_archive/reader/LogtypeTableManager.hpp b/components/core/src/glt/streaming_archive/reader/LogtypeTableManager.hpp index 445cfb3fa..f4334d417 100644 --- a/components/core/src/glt/streaming_archive/reader/LogtypeTableManager.hpp +++ b/components/core/src/glt/streaming_archive/reader/LogtypeTableManager.hpp @@ -25,7 +25,7 @@ class LogtypeTableManager { } }; - LogtypeTableManager() : m_is_open(false){}; + LogtypeTableManager() : m_is_open(false) {}; /** * Open the concated variable segment file and metadata associated with the segment diff --git a/components/core/src/glt/streaming_archive/reader/Segment.hpp b/components/core/src/glt/streaming_archive/reader/Segment.hpp index 51ca004ac..d2caecfba 100644 --- a/components/core/src/glt/streaming_archive/reader/Segment.hpp +++ b/components/core/src/glt/streaming_archive/reader/Segment.hpp @@ -20,7 +20,7 @@ namespace glt::streaming_archive::reader { class Segment { public: // Constructor - Segment() : m_segment_path({}){}; + Segment() : m_segment_path({}) {}; // Destructor ~Segment(); diff --git a/components/core/src/glt/streaming_archive/reader/SingleLogtypeTableManager.hpp b/components/core/src/glt/streaming_archive/reader/SingleLogtypeTableManager.hpp index 8cd23bec5..46e9dfe45 100644 --- a/components/core/src/glt/streaming_archive/reader/SingleLogtypeTableManager.hpp +++ b/components/core/src/glt/streaming_archive/reader/SingleLogtypeTableManager.hpp @@ -11,7 +11,7 @@ namespace glt::streaming_archive::reader { class SingleLogtypeTableManager : public streaming_archive::reader::LogtypeTableManager { public: - SingleLogtypeTableManager() : m_logtype_table_loaded(false){}; + SingleLogtypeTableManager() : m_logtype_table_loaded(false) {}; void open_logtype_table(logtype_dictionary_id_t logtype_id); void close_logtype_table(); diff --git a/lint-requirements.txt b/lint-requirements.txt index df8eb63d3..a44ab4308 100644 --- a/lint-requirements.txt +++ b/lint-requirements.txt @@ -1,4 +1,4 @@ -black~=24.1 -clang-format~=17.0 -ruff~=0.1 -yamllint~=1.33 +black>=* +clang-format>=* +ruff>=* +yamllint>=* From 8219b509ea46bbade95cf1ff6c4e6c65bbe2f0ab Mon Sep 17 00:00:00 2001 From: LinZhihao-723 Date: Fri, 10 May 2024 17:54:02 -0400 Subject: [PATCH 2/2] Update clang-format config; Add lint requirements with a min version required --- components/core/.clang-format | 12 +++++++---- .../core/src/clp/clo/CommandLineArguments.cpp | 12 +++++------ .../core/src/clp_s/CommandLineArguments.cpp | 20 +++++++++++-------- lint-requirements.txt | 8 ++++---- 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/components/core/.clang-format b/components/core/.clang-format index 4daf17173..8baf38399 100644 --- a/components/core/.clang-format +++ b/components/core/.clang-format @@ -18,8 +18,10 @@ AlignTrailingComments: Kind: "Never" AllowAllArgumentsOnNextLine: false AllowAllParametersOfDeclarationOnNextLine: false +AllowBreakBeforeNoexceptSpecifier: "OnlyWithParen" AllowShortBlocksOnASingleLine: "Always" AllowShortCaseLabelsOnASingleLine: false +AllowShortCompoundRequirementOnASingleLine: true AllowShortEnumsOnASingleLine: false AllowShortFunctionsOnASingleLine: "Inline" AllowShortIfStatementsOnASingleLine: "Never" @@ -146,16 +148,18 @@ SpaceBeforeParens: "ControlStatements" SpaceBeforeRangeBasedForLoopColon: true SpaceBeforeSquareBrackets: false SpaceInEmptyBlock: false -SpaceInEmptyParentheses: false SpacesBeforeTrailingComments: 2 SpacesInAngles: false -SpacesInConditionalStatement: false SpacesInContainerLiterals: false -SpacesInCStyleCastParentheses: false SpacesInLineCommentPrefix: Minimum: 1 Maximum: -1 -SpacesInParentheses: false +SpacesInParens: "Custom" +SpacesInParensOptions: + InConditionalStatements: false + InCStyleCasts: false + InEmptyParentheses: false + Other: false SpacesInSquareBrackets: false Standard: "Latest" TabWidth: 4 diff --git a/components/core/src/clp/clo/CommandLineArguments.cpp b/components/core/src/clp/clo/CommandLineArguments.cpp index f41389a83..8f7d54a12 100644 --- a/components/core/src/clp/clo/CommandLineArguments.cpp +++ b/components/core/src/clp/clo/CommandLineArguments.cpp @@ -249,24 +249,24 @@ CommandLineArguments::parse_arguments(int argc, char const* argv[]) { cerr << R"( # Search ARCHIVE_PATH for " ERROR " and send results to )" "a network destination" << endl; - cerr << " " << get_program_name() << R"( ARCHIVE_PATH " ERROR ")" << " " - << static_cast(cNetworkOutputHandlerName) + cerr << " " << get_program_name() << R"( ARCHIVE_PATH " ERROR ")" + << " " << static_cast(cNetworkOutputHandlerName) << " --host localhost --port 18000" << endl; cerr << endl; cerr << R"( # Search ARCHIVE_PATH for " ERROR " and output the results )" "by performing a count aggregation" << endl; - cerr << " " << get_program_name() << R"( ARCHIVE_PATH " ERROR ")" << " " - << static_cast(cReducerOutputHandlerName) << " --count" + cerr << " " << get_program_name() << R"( ARCHIVE_PATH " ERROR ")" + << " " << static_cast(cReducerOutputHandlerName) << " --count" << " --host localhost --port 14009 --job-id 1" << endl; cerr << endl; cerr << R"( # Search ARCHIVE_PATH for " ERROR " and send results to)" R"( mongodb://127.0.0.1:27017/test "result" collection )" << endl; - cerr << " " << get_program_name() << R"( ARCHIVE_PATH " ERROR ")" << " " - << static_cast(cResultsCacheOutputHandlerName) + cerr << " " << get_program_name() << R"( ARCHIVE_PATH " ERROR ")" + << " " << static_cast(cResultsCacheOutputHandlerName) << R"( --uri mongodb://127.0.0.1:27017/test --collection result)" << endl; cerr << endl; diff --git a/components/core/src/clp_s/CommandLineArguments.cpp b/components/core/src/clp_s/CommandLineArguments.cpp index 2a80f6c28..402c30c69 100644 --- a/components/core/src/clp_s/CommandLineArguments.cpp +++ b/components/core/src/clp_s/CommandLineArguments.cpp @@ -107,7 +107,9 @@ CommandLineArguments::parse_arguments(int argc, char const** argv) { std::cerr << " x - decompress" << std::endl; std::cerr << " s - search" << std::endl; std::cerr << std::endl; - std::cerr << "Try " << " c --help OR" << " x --help OR" + std::cerr << "Try " + << " c --help OR" + << " x --help OR" << " s --help for command-specific details." << std::endl; po::options_description visible_options; @@ -482,8 +484,8 @@ CommandLineArguments::parse_arguments(int argc, char const** argv) { std::cerr << " # Search archives in archives-dir for logs matching a KQL query" R"( "level: INFO" and output to the results cache)" << std::endl; - std::cerr << " " << m_program_name << R"( s archives-dir "level: INFO")" << " " - << cResultsCacheOutputHandlerName + std::cerr << " " << m_program_name << R"( s archives-dir "level: INFO")" + << " " << cResultsCacheOutputHandlerName << " --uri mongodb://127.0.0.1:27017/test" " --collection test" << std::endl; @@ -492,8 +494,8 @@ CommandLineArguments::parse_arguments(int argc, char const** argv) { std::cerr << " # Search archives in archives-dir for logs matching a KQL query" R"( "level: INFO" and output to a network destination)" << std::endl; - std::cerr << " " << m_program_name << R"( s archives-dir "level: INFO")" << " " - << cNetworkOutputHandlerName + std::cerr << " " << m_program_name << R"( s archives-dir "level: INFO")" + << " " << cNetworkOutputHandlerName << " --host localhost" " --port 18000" << std::endl; @@ -502,9 +504,11 @@ CommandLineArguments::parse_arguments(int argc, char const** argv) { std::cerr << " # Search archives in archives-dir for logs matching a KQL query" R"( "level: INFO" and output perform a count aggregation)" << std::endl; - std::cerr << " " << m_program_name << R"( s archives-dir "level: INFO")" << " " - << cReducerOutputHandlerName << " --count" << " --host localhost" - << " --port 14009" << " --job-id 1" << std::endl; + std::cerr << " " << m_program_name << R"( s archives-dir "level: INFO")" + << " " << cReducerOutputHandlerName << " --count" + << " --host localhost" + << " --port 14009" + << " --job-id 1" << std::endl; po::options_description visible_options; visible_options.add(general_options); diff --git a/lint-requirements.txt b/lint-requirements.txt index a44ab4308..0c58ad2af 100644 --- a/lint-requirements.txt +++ b/lint-requirements.txt @@ -1,4 +1,4 @@ -black>=* -clang-format>=* -ruff>=* -yamllint>=* +black>=24.4.2 +clang-format>=18.1.5 +ruff>=0.4.4 +yamllint>=1.35.1