Skip to content

linting: Always use latest versions of linting tools; Upgrade clang-format config. #384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions components/core/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
13 changes: 8 additions & 5 deletions components/core/src/clp/BufferReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
27 changes: 15 additions & 12 deletions components/core/src/clp/BufferedFileReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion components/core/src/clp/Thread.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Thread {
};

// Constructors
Thread() : m_thread_running(false){};
Thread() : m_thread_running(false) {};

// Destructor
virtual ~Thread();
Expand Down
16 changes: 8 additions & 8 deletions components/core/src/clp/ir/LogEventDeserializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

namespace clp::ir {
template <typename encoded_variable_t>
auto LogEventDeserializer<encoded_variable_t>::create(ReaderInterface& reader)
-> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<encoded_variable_t>> {
auto LogEventDeserializer<encoded_variable_t>::create(ReaderInterface& reader
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<encoded_variable_t>> {
ffi::ir_stream::encoded_tag_t metadata_type{0};
std::vector<int8_t> metadata;
auto ir_error_code = ffi::ir_stream::deserialize_preamble(reader, metadata_type, metadata);
Expand Down Expand Up @@ -66,8 +66,8 @@ auto LogEventDeserializer<encoded_variable_t>::create(ReaderInterface& reader)
}

template <typename encoded_variable_t>
auto LogEventDeserializer<encoded_variable_t>::deserialize_log_event()
-> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEvent<encoded_variable_t>> {
auto LogEventDeserializer<encoded_variable_t>::deserialize_log_event(
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEvent<encoded_variable_t>> {
epoch_time_ms_t timestamp_or_timestamp_delta{};
std::string logtype;
std::vector<std::string> dict_vars;
Expand Down Expand Up @@ -109,8 +109,8 @@ template auto LogEventDeserializer<eight_byte_encoded_variable_t>::create(Reader
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<eight_byte_encoded_variable_t>>;
template auto LogEventDeserializer<four_byte_encoded_variable_t>::create(ReaderInterface& reader
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<four_byte_encoded_variable_t>>;
template auto LogEventDeserializer<eight_byte_encoded_variable_t>::deserialize_log_event()
-> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEvent<eight_byte_encoded_variable_t>>;
template auto LogEventDeserializer<four_byte_encoded_variable_t>::deserialize_log_event()
-> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEvent<four_byte_encoded_variable_t>>;
template auto LogEventDeserializer<eight_byte_encoded_variable_t>::deserialize_log_event(
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEvent<eight_byte_encoded_variable_t>>;
template auto LogEventDeserializer<four_byte_encoded_variable_t>::deserialize_log_event(
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEvent<four_byte_encoded_variable_t>>;
} // namespace clp::ir
11 changes: 5 additions & 6 deletions components/core/src/clp/ir/LogEventDeserializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<LogEventDeserializer<encoded_variable_t>>;
static auto create(ReaderInterface& reader
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<encoded_variable_t>>;

// Delete copy constructor and assignment
LogEventDeserializer(LogEventDeserializer const&) = delete;
Expand All @@ -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<LogEvent<encoded_variable_t>>;
[[nodiscard]] auto deserialize_log_event(
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEvent<encoded_variable_t>>;

private:
// Constructors
Expand All @@ -74,8 +74,7 @@ class LogEventDeserializer {
[[no_unique_address]] std::conditional_t<
std::is_same_v<encoded_variable_t, four_byte_encoded_variable_t>,
epoch_time_ms_t,
EmptyType>
m_prev_msg_timestamp{};
EmptyType> m_prev_msg_timestamp{};
ReaderInterface& m_reader;
};
} // namespace clp::ir
Expand Down
16 changes: 8 additions & 8 deletions components/core/src/clp/streaming_archive/MetadataDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace clp::streaming_archive::reader {
class Segment {
public:
// Constructor
Segment() : m_segment_path({}){};
Segment() : m_segment_path({}) {};

// Destructor
~Segment();
Expand Down
2 changes: 1 addition & 1 deletion components/core/src/clp_s/Utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ template <typename T>
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; }

Expand Down
2 changes: 1 addition & 1 deletion components/core/src/clp_s/search/BooleanLiteral.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 6 additions & 2 deletions components/core/src/clp_s/search/Output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<DateStringColumnReader*>(column.second))
} else if (auto date_column_reader
= dynamic_cast<DateStringColumnReader*>(column.second))
{
m_datestring_readers[column.first] = date_column_reader;
m_other_columns.push_back(column.second);
Expand Down Expand Up @@ -1091,7 +1092,10 @@ Output::constant_propagate(std::shared_ptr<Expression> 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;
Expand Down
2 changes: 1 addition & 1 deletion components/core/src/clp_s/search/OutputHandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion components/core/src/clp_s/search/clp_search/Grep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
13 changes: 8 additions & 5 deletions components/core/src/glt/BufferReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
27 changes: 15 additions & 12 deletions components/core/src/glt/BufferedFileReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
16 changes: 8 additions & 8 deletions components/core/src/glt/ir/LogEventDeserializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

namespace glt::ir {
template <typename encoded_variable_t>
auto LogEventDeserializer<encoded_variable_t>::create(ReaderInterface& reader)
-> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<encoded_variable_t>> {
auto LogEventDeserializer<encoded_variable_t>::create(ReaderInterface& reader
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<encoded_variable_t>> {
ffi::ir_stream::encoded_tag_t metadata_type{0};
std::vector<int8_t> metadata;
auto ir_error_code = ffi::ir_stream::deserialize_preamble(reader, metadata_type, metadata);
Expand Down Expand Up @@ -66,8 +66,8 @@ auto LogEventDeserializer<encoded_variable_t>::create(ReaderInterface& reader)
}

template <typename encoded_variable_t>
auto LogEventDeserializer<encoded_variable_t>::deserialize_log_event()
-> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEvent<encoded_variable_t>> {
auto LogEventDeserializer<encoded_variable_t>::deserialize_log_event(
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEvent<encoded_variable_t>> {
epoch_time_ms_t timestamp_or_timestamp_delta{};
std::string logtype;
std::vector<std::string> dict_vars;
Expand Down Expand Up @@ -109,8 +109,8 @@ template auto LogEventDeserializer<eight_byte_encoded_variable_t>::create(Reader
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<eight_byte_encoded_variable_t>>;
template auto LogEventDeserializer<four_byte_encoded_variable_t>::create(ReaderInterface& reader
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEventDeserializer<four_byte_encoded_variable_t>>;
template auto LogEventDeserializer<eight_byte_encoded_variable_t>::deserialize_log_event()
-> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEvent<eight_byte_encoded_variable_t>>;
template auto LogEventDeserializer<four_byte_encoded_variable_t>::deserialize_log_event()
-> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEvent<four_byte_encoded_variable_t>>;
template auto LogEventDeserializer<eight_byte_encoded_variable_t>::deserialize_log_event(
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEvent<eight_byte_encoded_variable_t>>;
template auto LogEventDeserializer<four_byte_encoded_variable_t>::deserialize_log_event(
) -> BOOST_OUTCOME_V2_NAMESPACE::std_result<LogEvent<four_byte_encoded_variable_t>>;
} // namespace glt::ir
Loading
Loading