Skip to content

Fix C++ lint issues: clang-format and missing includes - #473

Merged
hendrikmuhs merged 1 commit into
KeyviDev:masterfrom
hendrikmuhs:fix-cpp-lint
Oct 20, 2026
Merged

hendrikmuhs merged 1 commit into
KeyviDev:masterfrom
hendrikmuhs:fix-cpp-lint

Conversation

@hendrikmuhs

Copy link
Copy Markdown
Contributor

fix C++ pre-commit issue

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 43. Check the log or trigger a new build to see more.

Comment thread keyvi/include/keyvi/dictionary/fsa/comparable_state_traverser.h
Comment thread keyvi/include/keyvi/dictionary/fsa/comparable_state_traverser.h Outdated
Comment thread keyvi/include/keyvi/dictionary/fsa/comparable_state_traverser.h
Comment thread keyvi/include/keyvi/dictionary/fsa/comparable_state_traverser.h Outdated
Comment thread keyvi/include/keyvi/dictionary/fsa/comparable_state_traverser.h Outdated
Comment thread keyvi/include/keyvi/dictionary/fsa/comparable_state_traverser.h Outdated
Comment thread keyvi/include/keyvi/dictionary/fsa/comparable_state_traverser.h Outdated
Comment thread keyvi/include/keyvi/dictionary/fsa/comparable_state_traverser.h Outdated
Comment thread keyvi/include/keyvi/dictionary/fsa/internal/lru_generation_cache.h
Comment thread keyvi/include/keyvi/dictionary/fsa/internal/lru_generation_cache.h

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 23. Check the log or trigger a new build to see more.

}

StateTraverser(automata_t f, const uint64_t start_state, traversal::TraversalPayload<TransitionT> &&payload,
StateTraverser(automata_t f, const uint64_t start_state, traversal::TraversalPayload<TransitionT>&& payload,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: parameter name 'f' is too short, expected at least 3 characters [readability-identifier-length]

  StateTraverser(automata_t f, const uint64_t start_state, traversal::TraversalPayload<TransitionT>&& payload,
                            ^

Comment thread keyvi/include/keyvi/dictionary/fsa/state_traverser.h Outdated
StateTraverser(const StateTraverser& that) = delete;

StateTraverser(StateTraverser &&other)
StateTraverser(StateTraverser&& other)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: move constructors should be marked noexcept [cppcoreguidelines-noexcept-move-operations]

keyvi/include/keyvi/dictionary/fsa/state_traverser.h:88:

-       : fsa_(other.fsa_),
+  noexcept       : fsa_(other.fsa_),


struct TraverserCompare {
bool operator()(const traverser_t &t1, const traverser_t &t2) const { return *t1 > *t2; }
bool operator()(const traverser_t& t1, const traverser_t& t2) const { return *t1 > *t2; }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: parameter name 't1' is too short, expected at least 3 characters [readability-identifier-length]

    bool operator()(const traverser_t& t1, const traverser_t& t2) const { return *t1 > *t2; }
                                       ^


struct TraverserCompare {
bool operator()(const traverser_t &t1, const traverser_t &t2) const { return *t1 > *t2; }
bool operator()(const traverser_t& t1, const traverser_t& t2) const { return *t1 > *t2; }

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: parameter name 't2' is too short, expected at least 3 characters [readability-identifier-length]

    bool operator()(const traverser_t& t1, const traverser_t& t2) const { return *t1 > *t2; }
                                                              ^

explicit ZipStateTraverser(const std::vector<automata_t>& fsas, const bool advance = true) {
size_t order = 0;
for (const automata_t &f : fsas) {
for (const automata_t& f : fsas) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable name 'f' is too short, expected at least 3 characters [readability-identifier-length]

    for (const automata_t& f : fsas) {
                           ^

explicit ZipStateTraverser(std::vector<std::tuple<automata_t, uint64_t, traversal::TraversalPayload<transition_t>>>
&&fsa_start_state_payloads,
explicit ZipStateTraverser(std::vector<std::tuple<automata_t, uint64_t, traversal::TraversalPayload<transition_t>>>&&
fsa_start_state_payloads,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: rvalue reference parameter 'fsa_start_state_payloads' is never moved from inside the function body [cppcoreguidelines-rvalue-reference-param-not-moved]

                                 fsa_start_state_payloads,
                                 ^

size_t order = 0;

for (auto &f : fsa_start_state_payloads) {
for (auto& f : fsa_start_state_payloads) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable name 'f' is too short, expected at least 3 characters [readability-identifier-length]

    for (auto& f : fsa_start_state_payloads) {
               ^

ZipStateTraverser(const ZipStateTraverser& that) = delete;

ZipStateTraverser(ZipStateTraverser &&other)
ZipStateTraverser(ZipStateTraverser&& other)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: move constructors should be marked noexcept [cppcoreguidelines-noexcept-move-operations]

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:142:

-       : traverser_queue_(std::move(other.traverser_queue_)),
+  noexcept       : traverser_queue_(std::move(other.traverser_queue_)),


if (!traverser_queue_.empty()) {
const traverser_t &t = traverser_queue_.top();
const traverser_t& t = traverser_queue_.top();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable name 't' is too short, expected at least 3 characters [readability-identifier-length]

      const traverser_t& t = traverser_queue_.top();
                         ^

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 14. Check the log or trigger a new build to see more.

}

StateTraverser(automata_t f, const uint64_t start_state, traversal::TraversalPayload<TransitionT> &&payload,
StateTraverser(const automata_t& f, const uint64_t start_state, traversal::TraversalPayload<TransitionT>&& payload,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: parameter name 'f' is too short, expected at least 3 characters [readability-identifier-length]

  StateTraverser(const automata_t& f, const uint64_t start_state, traversal::TraversalPayload<TransitionT>&& payload,
                                   ^

// 1st pass collect all weights per label
for (const auto &t : traversers) {
for (const transition_t &transition : t->GetStates().traversal_state_payload.transitions) {
for (const auto& t : traversers) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable name 't' is too short, expected at least 3 characters [readability-identifier-length]

    for (const auto& t : traversers) {
                     ^

// 2nd pass apply global weights
for (const auto &t : traversers) {
for (transition_t &transition : t->GetStates().traversal_state_payload.transitions) {
for (const auto& t : traversers) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable name 't' is too short, expected at least 3 characters [readability-identifier-length]

    for (const auto& t : traversers) {
                     ^


template <>
inline ZipStateTraverser<WeightedStateTraverser>::ZipStateTraverser(const std::vector<automata_t> &fsas,
inline ZipStateTraverser<WeightedStateTraverser>::ZipStateTraverser(const std::vector<automata_t>& fsas,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'ZipStateTraverser' has cognitive complexity of 30 (threshold 25) [readability-function-cognitive-complexity]

inline ZipStateTraverser<WeightedStateTraverser>::ZipStateTraverser(const std::vector<automata_t>& fsas,
                                                  ^
Additional context

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:409: +1, including nesting penalty of 0, nesting level increased to 1

  if (fsas.size() < 2) {
  ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:410: +2, including nesting penalty of 1, nesting level increased to 2

    for (auto f : fsas) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:413: +3, including nesting penalty of 2, nesting level increased to 3

      if (*traverser) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:417: +1, nesting level increased to 1

  } else {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:421: +2, including nesting penalty of 1, nesting level increased to 2

    for (auto f : fsas) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:427: +2, including nesting penalty of 1, nesting level increased to 2

    for (const auto& t : traversers) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:428: +3, including nesting penalty of 2, nesting level increased to 3

      for (const transition_t& transition : t->GetStates().traversal_state_payload.transitions) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:429: +4, including nesting penalty of 3, nesting level increased to 4

        if (global_weights.count(transition.label) == 0 || global_weights.at(transition.label) < transition.weight) {
        ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:429: +1

        if (global_weights.count(transition.label) == 0 || global_weights.at(transition.label) < transition.weight) {
                                                        ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:435: +2, including nesting penalty of 1, nesting level increased to 2

    for (const auto& t : traversers) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:436: +3, including nesting penalty of 2, nesting level increased to 3

      for (transition_t& transition : t->GetStates().traversal_state_payload.transitions) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:443: +3, including nesting penalty of 2, nesting level increased to 3

      if (advance) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:447: +3, including nesting penalty of 2, nesting level increased to 3

      if (*t) {
      ^

// 1st pass collect all weights per label
for (const auto &t : traversers) {
for (const transition_t &transition : t->GetStates().traversal_state_payload.transitions) {
for (const auto& t : traversers) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable name 't' is too short, expected at least 3 characters [readability-identifier-length]

    for (const auto& t : traversers) {
                     ^

// 2nd pass apply global weights
for (const auto &t : traversers) {
for (transition_t &transition : t->GetStates().traversal_state_payload.transitions) {
for (const auto& t : traversers) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable name 't' is too short, expected at least 3 characters [readability-identifier-length]

    for (const auto& t : traversers) {
                     ^

@@ -454,7 +456,7 @@ inline ZipStateTraverser<WeightedStateTraverser>::ZipStateTraverser(const std::v

template <>
inline ZipStateTraverser<WeightedStateTraverser>::ZipStateTraverser(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'ZipStateTraverser' has cognitive complexity of 37 (threshold 25) [readability-function-cognitive-complexity]

inline ZipStateTraverser<WeightedStateTraverser>::ZipStateTraverser(
                                                  ^
Additional context

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:461: +1, including nesting penalty of 0, nesting level increased to 1

  if (fsa_start_state_pairs.size() < 2) {
  ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:462: +2, including nesting penalty of 1, nesting level increased to 2

    for (auto f : fsa_start_state_pairs) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:463: +3, including nesting penalty of 2, nesting level increased to 3

      if (f.second > 0) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:467: +4, including nesting penalty of 3, nesting level increased to 4

        if (*traverser) {
        ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:472: +1, nesting level increased to 1

  } else {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:476: +2, including nesting penalty of 1, nesting level increased to 2

    for (auto f : fsa_start_state_pairs) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:477: +3, including nesting penalty of 2, nesting level increased to 3

      if (f.second > 0) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:484: +2, including nesting penalty of 1, nesting level increased to 2

    for (const auto& t : traversers) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:485: +3, including nesting penalty of 2, nesting level increased to 3

      for (const transition_t& transition : t->GetStates().traversal_state_payload.transitions) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:486: +4, including nesting penalty of 3, nesting level increased to 4

        if (global_weights.count(transition.label) == 0 || global_weights.at(transition.label) < transition.weight) {
        ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:486: +1

        if (global_weights.count(transition.label) == 0 || global_weights.at(transition.label) < transition.weight) {
                                                        ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:492: +2, including nesting penalty of 1, nesting level increased to 2

    for (const auto& t : traversers) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:493: +3, including nesting penalty of 2, nesting level increased to 3

      for (transition_t& transition : t->GetStates().traversal_state_payload.transitions) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:502: +3, including nesting penalty of 2, nesting level increased to 3

      if (advance) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:507: +3, including nesting penalty of 2, nesting level increased to 3

      if (*t) {
      ^

// 1st pass collect all weights per label
for (const auto &t : traversers) {
for (const transition_t &transition : t->GetStates().traversal_state_payload.transitions) {
for (const auto& t : traversers) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable name 't' is too short, expected at least 3 characters [readability-identifier-length]

    for (const auto& t : traversers) {
                     ^

// 2nd pass apply global weights
for (const auto &t : traversers) {
for (transition_t &transition : t->GetStates().traversal_state_payload.transitions) {
for (const auto& t : traversers) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable name 't' is too short, expected at least 3 characters [readability-identifier-length]

    for (const auto& t : traversers) {
                     ^


BOOST_AUTO_TEST_CASE(insert) {
MinimizationHash<PackedState<>> *hash = new MinimizationHash<PackedState<>>();
MinimizationHash<PackedState<>>* hash = new MinimizationHash<PackedState<>>();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: initializing non-owner 'MinimizationHash<PackedState<>> *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]

  MinimizationHash<PackedState<>>* hash = new MinimizationHash<PackedState<>>();
  ^

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 20. Check the log or trigger a new build to see more.

Comment thread keyvi/include/keyvi/dictionary/fsa/state_traverser.h Outdated
Comment thread keyvi/include/keyvi/dictionary/fsa/state_traverser.h Outdated
Comment thread keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h Outdated
Comment thread keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h Outdated
Comment thread keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h Outdated
Comment thread keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h Outdated

template <>
inline ZipStateTraverser<WeightedStateTraverser>::ZipStateTraverser(const std::vector<automata_t> &fsas,
inline ZipStateTraverser<WeightedStateTraverser>::ZipStateTraverser(const std::vector<automata_t>& fsas,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'ZipStateTraverser' has cognitive complexity of 30 (threshold 25) [readability-function-cognitive-complexity]

inline ZipStateTraverser<WeightedStateTraverser>::ZipStateTraverser(const std::vector<automata_t>& fsas,
                                                  ^
Additional context

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:409: +1, including nesting penalty of 0, nesting level increased to 1

  if (fsas.size() < 2) {
  ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:410: +2, including nesting penalty of 1, nesting level increased to 2

    for (auto fsa : fsas) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:413: +3, including nesting penalty of 2, nesting level increased to 3

      if (*traverser) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:417: +1, nesting level increased to 1

  } else {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:421: +2, including nesting penalty of 1, nesting level increased to 2

    for (auto fsa : fsas) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:427: +2, including nesting penalty of 1, nesting level increased to 2

    for (const auto& trav : traversers) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:428: +3, including nesting penalty of 2, nesting level increased to 3

      for (const transition_t& transition : trav->GetStates().traversal_state_payload.transitions) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:429: +4, including nesting penalty of 3, nesting level increased to 4

        if (global_weights.count(transition.label) == 0 || global_weights.at(transition.label) < transition.weight) {
        ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:429: +1

        if (global_weights.count(transition.label) == 0 || global_weights.at(transition.label) < transition.weight) {
                                                        ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:435: +2, including nesting penalty of 1, nesting level increased to 2

    for (const auto& trav : traversers) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:436: +3, including nesting penalty of 2, nesting level increased to 3

      for (transition_t& transition : trav->GetStates().traversal_state_payload.transitions) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:443: +3, including nesting penalty of 2, nesting level increased to 3

      if (advance) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:447: +3, including nesting penalty of 2, nesting level increased to 3

      if (*trav) {
      ^

Comment thread keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h Outdated
Comment thread keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h Outdated
Comment thread keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h Outdated
@hendrikmuhs
hendrikmuhs force-pushed the fix-cpp-lint branch 2 times, most recently from 51fe5df to 313f43d Compare October 19, 2026 21:11

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 10 out of 11. Check the log or trigger a new build to see more.


template <>
inline ZipStateTraverser<WeightedStateTraverser>::ZipStateTraverser(const std::vector<automata_t> &fsas,
inline ZipStateTraverser<WeightedStateTraverser>::ZipStateTraverser(const std::vector<automata_t>& fsas,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'ZipStateTraverser' has cognitive complexity of 30 (threshold 25) [readability-function-cognitive-complexity]

inline ZipStateTraverser<WeightedStateTraverser>::ZipStateTraverser(const std::vector<automata_t>& fsas,
                                                  ^
Additional context

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:411: +1, including nesting penalty of 0, nesting level increased to 1

  if (fsas.size() < 2) {
  ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:412: +2, including nesting penalty of 1, nesting level increased to 2

    for (const auto& fsa : fsas) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:416: +3, including nesting penalty of 2, nesting level increased to 3

      if (*traverser) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:420: +1, nesting level increased to 1

  } else {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:424: +2, including nesting penalty of 1, nesting level increased to 2

    for (const auto& fsa : fsas) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:430: +2, including nesting penalty of 1, nesting level increased to 2

    for (const auto& trav : traversers) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:431: +3, including nesting penalty of 2, nesting level increased to 3

      for (const transition_t& transition : trav->GetStates().traversal_state_payload.transitions) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:432: +4, including nesting penalty of 3, nesting level increased to 4

        if (global_weights.count(transition.label) == 0 || global_weights.at(transition.label) < transition.weight) {
        ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:432: +1

        if (global_weights.count(transition.label) == 0 || global_weights.at(transition.label) < transition.weight) {
                                                        ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:438: +2, including nesting penalty of 1, nesting level increased to 2

    for (const auto& trav : traversers) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:439: +3, including nesting penalty of 2, nesting level increased to 3

      for (transition_t& transition : trav->GetStates().traversal_state_payload.transitions) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:446: +3, including nesting penalty of 2, nesting level increased to 3

      if (advance) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:450: +3, including nesting penalty of 2, nesting level increased to 3

      if (*trav) {
      ^

for (auto f : fsas) {
traverser_t traverser = std::make_shared<ComparableStateTraverser<WeightedStateTraverser>>(f, false, order++);
for (const auto& fsa : fsas) {
traverser_t traverser = std::make_shared<ComparableStateTraverser<WeightedStateTraverser>>(fsa, false, order++);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'traverser' of type 'traverser_t' (aka 'shared_ptr<ComparableStateTraverser<keyvi::dictionary::fsa::StateTraverserkeyvi::dictionary::fsa::traversal::WeightedTransition>>') can be declared 'const' [misc-const-correctness]

Suggested change
traverser_t traverser = std::make_shared<ComparableStateTraverser<WeightedStateTraverser>>(fsa, false, order++);
traverser_t const traverser = std::make_shared<ComparableStateTraverser<WeightedStateTraverser>>(fsa, false, order++);

@@ -454,14 +459,14 @@ inline ZipStateTraverser<WeightedStateTraverser>::ZipStateTraverser(const std::v

template <>
inline ZipStateTraverser<WeightedStateTraverser>::ZipStateTraverser(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'ZipStateTraverser' has cognitive complexity of 37 (threshold 25) [readability-function-cognitive-complexity]

inline ZipStateTraverser<WeightedStateTraverser>::ZipStateTraverser(
                                                  ^
Additional context

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:464: +1, including nesting penalty of 0, nesting level increased to 1

  if (fsa_start_state_pairs.size() < 2) {
  ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:465: +2, including nesting penalty of 1, nesting level increased to 2

    for (auto pair : fsa_start_state_pairs) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:466: +3, including nesting penalty of 2, nesting level increased to 3

      if (pair.second > 0) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:470: +4, including nesting penalty of 3, nesting level increased to 4

        if (*traverser) {
        ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:475: +1, nesting level increased to 1

  } else {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:479: +2, including nesting penalty of 1, nesting level increased to 2

    for (auto pair : fsa_start_state_pairs) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:480: +3, including nesting penalty of 2, nesting level increased to 3

      if (pair.second > 0) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:487: +2, including nesting penalty of 1, nesting level increased to 2

    for (const auto& trav : traversers) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:488: +3, including nesting penalty of 2, nesting level increased to 3

      for (const transition_t& transition : trav->GetStates().traversal_state_payload.transitions) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:489: +4, including nesting penalty of 3, nesting level increased to 4

        if (global_weights.count(transition.label) == 0 || global_weights.at(transition.label) < transition.weight) {
        ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:489: +1

        if (global_weights.count(transition.label) == 0 || global_weights.at(transition.label) < transition.weight) {
                                                        ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:495: +2, including nesting penalty of 1, nesting level increased to 2

    for (const auto& trav : traversers) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:496: +3, including nesting penalty of 2, nesting level increased to 3

      for (transition_t& transition : trav->GetStates().traversal_state_payload.transitions) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:505: +3, including nesting penalty of 2, nesting level increased to 3

      if (advance) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:510: +3, including nesting penalty of 2, nesting level increased to 3

      if (*trav) {
      ^

if (f.second > 0) {
traverser_t traverser =
std::make_shared<ComparableStateTraverser<WeightedStateTraverser>>(f.first, f.second, advance, order++);
for (auto pair : fsa_start_state_pairs) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]

Suggested change
for (auto pair : fsa_start_state_pairs) {
for (const auto& pair : fsa_start_state_pairs) {

std::make_shared<ComparableStateTraverser<WeightedStateTraverser>>(f.first, f.second, advance, order++);
for (auto pair : fsa_start_state_pairs) {
if (pair.second > 0) {
traverser_t traverser = std::make_shared<ComparableStateTraverser<WeightedStateTraverser>>(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'traverser' of type 'traverser_t' (aka 'shared_ptr<ComparableStateTraverser<keyvi::dictionary::fsa::StateTraverserkeyvi::dictionary::fsa::traversal::WeightedTransition>>') can be declared 'const' [misc-const-correctness]

Suggested change
traverser_t traverser = std::make_shared<ComparableStateTraverser<WeightedStateTraverser>>(
traverser_t const traverser = std::make_shared<ComparableStateTraverser<WeightedStateTraverser>>(

std::vector<traverser_t> traversers;
for (auto f : fsa_start_state_pairs) {
if (f.second > 0) {
for (auto pair : fsa_start_state_pairs) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]

Suggested change
for (auto pair : fsa_start_state_pairs) {
for (const auto& pair : fsa_start_state_pairs) {

inline void ZipStateTraverser<WeightedStateTraverser>::SetMinWeight(uint32_t weight) {
for (auto t : traverser_queue_) {
t->SetMinWeight(weight);
for (auto trav : traverser_queue_) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: loop variable is copied but only used as const reference; consider making it a const reference [performance-for-range-copy]

Suggested change
for (auto trav : traverser_queue_) {
for (const auto& trav : traverser_queue_) {


BOOST_AUTO_TEST_CASE(insert) {
MinimizationHash<PackedState<>> *hash = new MinimizationHash<PackedState<>>();
MinimizationHash<PackedState<>>* hash = new MinimizationHash<PackedState<>>();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use auto when initializing with new to avoid duplicating the type name [hicpp-use-auto]

Suggested change
MinimizationHash<PackedState<>>* hash = new MinimizationHash<PackedState<>>();
auto* hash = new MinimizationHash<PackedState<>>();


BOOST_AUTO_TEST_CASE(reset) {
MinimizationHash<PackedState<>> *hash = new MinimizationHash<PackedState<>>();
MinimizationHash<PackedState<>>* hash = new MinimizationHash<PackedState<>>();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: initializing non-owner 'MinimizationHash<PackedState<>> *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]

  MinimizationHash<PackedState<>>* hash = new MinimizationHash<PackedState<>>();
  ^


BOOST_AUTO_TEST_CASE(reset) {
MinimizationHash<PackedState<>> *hash = new MinimizationHash<PackedState<>>();
MinimizationHash<PackedState<>>* hash = new MinimizationHash<PackedState<>>();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use auto when initializing with new to avoid duplicating the type name [hicpp-use-auto]

Suggested change
MinimizationHash<PackedState<>>* hash = new MinimizationHash<PackedState<>>();
auto* hash = new MinimizationHash<PackedState<>>();

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

Comment thread keyvi/tests/keyvi/dictionary/fsa/zip_state_traverser_test.cpp

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

}

std::vector<std::string> GetAllKeys(ZipStateTraverser<StateTraverser<>> *zip_traverser) {
static std::vector<std::string> GetAllKeys(ZipStateTraverser<StateTraverser<>>* zip_traverser) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'GetAllKeys' declared 'static', move to anonymous namespace instead [misc-use-anonymous-namespace]

static std::vector<std::string> GetAllKeys(ZipStateTraverser<StateTraverser<>>* zip_traverser) {
                                ^

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions


template <>
inline ZipStateTraverser<WeightedStateTraverser>::ZipStateTraverser(const std::vector<automata_t> &fsas,
inline ZipStateTraverser<WeightedStateTraverser>::ZipStateTraverser(const std::vector<automata_t>& fsas,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'ZipStateTraverser' has cognitive complexity of 30 (threshold 25) [readability-function-cognitive-complexity]

inline ZipStateTraverser<WeightedStateTraverser>::ZipStateTraverser(const std::vector<automata_t>& fsas,
                                                  ^
Additional context

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:411: +1, including nesting penalty of 0, nesting level increased to 1

  if (fsas.size() < 2) {
  ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:412: +2, including nesting penalty of 1, nesting level increased to 2

    for (const auto& fsa : fsas) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:416: +3, including nesting penalty of 2, nesting level increased to 3

      if (*traverser) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:420: +1, nesting level increased to 1

  } else {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:424: +2, including nesting penalty of 1, nesting level increased to 2

    for (const auto& fsa : fsas) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:431: +2, including nesting penalty of 1, nesting level increased to 2

    for (const auto& trav : traversers) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:432: +3, including nesting penalty of 2, nesting level increased to 3

      for (const transition_t& transition : trav->GetStates().traversal_state_payload.transitions) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:433: +4, including nesting penalty of 3, nesting level increased to 4

        if (global_weights.count(transition.label) == 0 || global_weights.at(transition.label) < transition.weight) {
        ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:433: +1

        if (global_weights.count(transition.label) == 0 || global_weights.at(transition.label) < transition.weight) {
                                                        ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:439: +2, including nesting penalty of 1, nesting level increased to 2

    for (const auto& trav : traversers) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:440: +3, including nesting penalty of 2, nesting level increased to 3

      for (transition_t& transition : trav->GetStates().traversal_state_payload.transitions) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:447: +3, including nesting penalty of 2, nesting level increased to 3

      if (advance) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:451: +3, including nesting penalty of 2, nesting level increased to 3

      if (*trav) {
      ^

@@ -454,14 +460,14 @@ inline ZipStateTraverser<WeightedStateTraverser>::ZipStateTraverser(const std::v

template <>
inline ZipStateTraverser<WeightedStateTraverser>::ZipStateTraverser(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: function 'ZipStateTraverser' has cognitive complexity of 37 (threshold 25) [readability-function-cognitive-complexity]

inline ZipStateTraverser<WeightedStateTraverser>::ZipStateTraverser(
                                                  ^
Additional context

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:465: +1, including nesting penalty of 0, nesting level increased to 1

  if (fsa_start_state_pairs.size() < 2) {
  ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:466: +2, including nesting penalty of 1, nesting level increased to 2

    for (const auto& pair : fsa_start_state_pairs) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:467: +3, including nesting penalty of 2, nesting level increased to 3

      if (pair.second > 0) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:471: +4, including nesting penalty of 3, nesting level increased to 4

        if (*traverser) {
        ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:476: +1, nesting level increased to 1

  } else {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:480: +2, including nesting penalty of 1, nesting level increased to 2

    for (const auto& pair : fsa_start_state_pairs) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:481: +3, including nesting penalty of 2, nesting level increased to 3

      if (pair.second > 0) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:488: +2, including nesting penalty of 1, nesting level increased to 2

    for (const auto& trav : traversers) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:489: +3, including nesting penalty of 2, nesting level increased to 3

      for (const transition_t& transition : trav->GetStates().traversal_state_payload.transitions) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:490: +4, including nesting penalty of 3, nesting level increased to 4

        if (global_weights.count(transition.label) == 0 || global_weights.at(transition.label) < transition.weight) {
        ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:490: +1

        if (global_weights.count(transition.label) == 0 || global_weights.at(transition.label) < transition.weight) {
                                                        ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:496: +2, including nesting penalty of 1, nesting level increased to 2

    for (const auto& trav : traversers) {
    ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:497: +3, including nesting penalty of 2, nesting level increased to 3

      for (transition_t& transition : trav->GetStates().traversal_state_payload.transitions) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:506: +3, including nesting penalty of 2, nesting level increased to 3

      if (advance) {
      ^

keyvi/include/keyvi/dictionary/fsa/zip_state_traverser.h:511: +3, including nesting penalty of 2, nesting level increased to 3

      if (*trav) {
      ^

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions


BOOST_AUTO_TEST_CASE(insert) {
MinimizationHash<PackedState<>> *hash = new MinimizationHash<PackedState<>>();
auto* hash = new MinimizationHash<PackedState<>>();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: initializing non-owner 'MinimizationHash<PackedState<>> *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]

  auto* hash = new MinimizationHash<PackedState<>>();
  ^


BOOST_AUTO_TEST_CASE(reset) {
MinimizationHash<PackedState<>> *hash = new MinimizationHash<PackedState<>>();
auto* hash = new MinimizationHash<PackedState<>>();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: initializing non-owner 'MinimizationHash<PackedState<>> *' with a newly created 'gsl::owner<>' [cppcoreguidelines-owning-memory]

  auto* hash = new MinimizationHash<PackedState<>>();
  ^

@hendrikmuhs
hendrikmuhs merged commit 650caca into KeyviDev:master Oct 20, 2026
23 of 24 checks passed
@hendrikmuhs
hendrikmuhs deleted the fix-cpp-lint branch October 20, 2026 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant