Skip to content

fix pre-existing dev clang-format violations - #246

Merged
cameroncuster merged 6 commits into
devfrom
fix/dev-clang-format-violations
Jul 19, 2026
Merged

fix pre-existing dev clang-format violations#246
cameroncuster merged 6 commits into
devfrom
fix/dev-clang-format-violations

Conversation

@cameroncuster

Copy link
Copy Markdown
Member

What

The grep_clangformat_cppcheck CI job is currently failing on dev
due to 5 files that violate the dev clang-format config (ColumnLimit
59). These violations are pre-existing and unrelated to any single
feature change — they appear to be lines formatted for the main
config (ColumnLimit 1000) that were never re-wrapped for dev.

This PR runs clang-format with the dev config on those 5 files.

Files (line-wrapping only, no behavior change)

  • library/dsu/kruskal_tree.hpp
  • library/strings/longest_common_subsequence/lcs_dp.hpp
  • library/strings/manacher/manacher.hpp
  • tests/library_checker_aizu_tests/data_structures/bit_ordered_set.test.cpp
  • tests/library_checker_aizu_tests/strings/sa_sort_pairs.test.cpp

Verification

  • clang-format --dry-run --Werror with the dev config passes on all
    5 files (clang-format 22, matching CI's clang-format-22).
  • Tests including the changed headers compile cleanly under g++.

Unblocks the format check for other PRs targeting dev.

cameroncuster and others added 6 commits July 19, 2026 14:11
Reformat 5 files that violated the dev clang-format config
(ColumnLimit 59) so the grep_clangformat_cppcheck CI job passes.
Line-wrapping only; no behavior change.

- library/dsu/kruskal_tree.hpp
- library/strings/longest_common_subsequence/lcs_dp.hpp
- library/strings/manacher/manacher.hpp
- tests/.../data_structures/bit_ordered_set.test.cpp
- tests/.../strings/sa_sort_pairs.test.cpp
The line-anchored knownConditionTrueFalse suppressions had drifted
out of sync with their source lines, causing both unmatchedSuppression
and now-unsuppressed errors in the cppcheck CI step:

- kruskal_tree.hpp: 13 -> 15 (shifted by the clang-format reflow in
  the previous commit)
- suffix_array.hpp: 62 -> 63 (pre-existing drift)
- suffix_array_short.hpp: 34 -> 35 (pre-existing drift)
cppcheck flags mixing iterators from two different expressions when the
erase-remove idiom is written as erase(begin(ranges::unique(x)), end(x)):
the first iterator comes from the returned subrange while the second
comes from the container. Store the returned subrange in a local and
erase [begin, end) of that single subrange, which is semantically
identical (the subrange spans the trailing removed elements) and keeps
both iterators from one expression.

Applies to ranges::unique and ranges::remove_if call sites introduced in
the ranges-algorithm migration (#244):

- library/trees/extra_members/virtual_tree.hpp
- tests .../bit_ordered_set.test.cpp
- tests .../kth_smallest_pst.test.cpp
- tests .../mode_query.test.cpp
- tests .../sa_sort_pairs.test.cpp
- tests .../single_matching_bs.test.cpp
Keep the terse erase-remove one-liners from the ranges migration (#244)
and silence cppcheck's mismatchingContainerExpression false positive
instead. The warning fires because a range algorithm returns a subrange,
so the first iterator's source expression (ranges::unique(x)) differs
syntactically from the second (end(x)) even though end(subrange) is
end(x) by construction.

Reverts the earlier local-variable rewrite and adds line-anchored
suppressions for the six affected call sites.
@cameroncuster
cameroncuster merged commit 360f1dc into dev Jul 19, 2026
8 checks passed
@cameroncuster
cameroncuster deleted the fix/dev-clang-format-violations branch July 19, 2026 22:32
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.

2 participants