Skip to content

Support pre-commit and apply changes#20

Open
knoepfel wants to merge 1 commit into
mainfrom
enable-pre-commit
Open

Support pre-commit and apply changes#20
knoepfel wants to merge 1 commit into
mainfrom
enable-pre-commit

Conversation

@knoepfel

@knoepfel knoepfel commented Jul 10, 2026

Copy link
Copy Markdown
Member

The pre-commit configuration is very similar to that of https://github.com/Framework-R-D/phlex, with a few exceptions:

  • The markdown checks are slightly different (suppressing long-line warnings in code blocks)
  • The scripts/tests directory doesn't exist, so the corresponding unit-tests check has been removed
  • All code in migration/gauss_hit_finder/copied_from_larsoft_minor_edits is excluded from pre-commit and clang-tidy
  • Tooling & CI

    • Added pre-commit configuration with whitespace, YAML/TOML, Ruff, clang-format, gersemi, Jsonnet, Prettier, MarkdownLint, and header-guard checks.
    • Added scripts/fix_header_guards.py to validate and repair C/C++ include guards.
    • Excluded copied LArSoft sources from pre-commit and clang-tidy checks.
    • Added .gersemirc and updated MarkdownLint configuration to allow long lines in code blocks.
  • Code quality

    • Applied formatter-driven updates across C++, Python, CMake, Jsonnet, YAML, and Markdown files.
    • Corrected include guards in Gauss hit finder headers.
    • Preserved existing algorithms, interfaces, serialization layout, and test behavior.
  • Build & tests

    • Reformatted Gauss hit finder CMake targets and platform-specific comparison tests without changing their semantics.
  • Documentation

    • Reflowed repository and Gauss hit finder README content and cleaned up Sphinx documentation formatting.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This change standardizes repository formatter configuration and pre-commit checks, reflows documentation, introduces header-guard tooling, renames migration include guards, and reformats Gauss hit finder implementations, registrations, serialization, and tests without reported behavioral changes.

Changes

Repository formatting and migration cleanup

Layer / File(s) Summary
Formatter configuration and hook wiring
.clang-format, .gersemirc, .markdownlint.yaml, .pre-commit-config.yaml
Adds and normalizes formatter settings and pre-commit hooks for repository source, documentation, configuration, and header guards.
Documentation and formatter-readable text
README.md, migration/doc/*, migration/gauss_hit_finder/README.md, migration/gauss_hit_finder/compare_hits.py
Reflows documentation, Sphinx configuration, and comparison-script output without changing documented procedures or control flow.
Header guard enforcement and migration
scripts/fix_header_guards.py, migration/gauss_hit_finder/*.{h,hpp}, migration/gauss_hit_finder/copied_from_larsoft_minor_edits/.clang-format
Adds header-guard validation/fixing and updates migration header guards while excluding copied content from automated formatting.
Gauss implementation and serialization
migration/gauss_hit_finder/*.cpp, migration/gauss_hit_finder/*.hpp
Applies formatting and equivalent pointer/type spelling changes while preserving hit-finding, wire serialization, provisioning, and output behavior.
Gauss build, registration, and validation wiring
migration/gauss_hit_finder/CMakeLists.txt, migration/gauss_hit_finder/register_*.cpp, migration/gauss_hit_finder/test_*.jsonnet, split_square_verify.cpp, subtract.py
Reformats targets, platform-specific tests, Phlex registrations, and standalone algorithm wiring while retaining existing arguments, selectors, dependencies, and test semantics.

Estimated code review effort: 2 (Simple) | ~15 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately captures the main change: adding pre-commit support and applying the resulting formatting updates.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch enable-pre-commit

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.markdownlint.yaml:
- Around line 1-2: Replace the deprecated MD013 option `code_blocks` with its
supported replacement `ignore_code_blocks` in the markdownlint configuration.

In `@scripts/fix_header_guards.py`:
- Around line 30-31: Update check_header_guard so missing or incomplete guard
directives return an invalid result instead of (True, None), including the
short-file path and the corresponding checks around lines 52-53. Ensure fix mode
inserts the appropriate guard for guardless .h/.hpp files, or explicitly
excludes such files from validation.
- Around line 38-43: The scanner may rewrite unrelated conditionals because it
independently selects the first `#ifndef` and later `#define`. Update the
guard-detection logic used by the scanning and fix paths to require a leading,
structurally paired include guard: the first relevant directive must be `#ifndef`,
immediately followed by a matching `#define` for the same macro, with no
intervening directives. Only perform rewrites when this validated pair is found.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 4f4459d6-b4c3-41ba-ae99-3643f560a2d4

📥 Commits

Reviewing files that changed from the base of the PR and between c389997 and 88e4ee7.

📒 Files selected for processing (29)
  • .clang-format
  • .gersemirc
  • .markdownlint.yaml
  • .pre-commit-config.yaml
  • README.md
  • migration/doc/conf.py
  • migration/doc/index.rst
  • migration/gauss_hit_finder/CMakeLists.txt
  • migration/gauss_hit_finder/README.md
  • migration/gauss_hit_finder/compare_hits.py
  • migration/gauss_hit_finder/copied_from_larsoft_minor_edits/.clang-format
  • migration/gauss_hit_finder/find_hits_with_gaussians.cpp
  • migration/gauss_hit_finder/find_hits_with_gaussians.hpp
  • migration/gauss_hit_finder/find_hits_with_gaussians_design1.cpp
  • migration/gauss_hit_finder/find_hits_with_gaussians_design1.hpp
  • migration/gauss_hit_finder/print_hits_to_file.cpp
  • migration/gauss_hit_finder/print_hits_to_file.hpp
  • migration/gauss_hit_finder/register_find_hits_with_gaussians.cpp
  • migration/gauss_hit_finder/register_find_hits_with_gaussians_cell_id.cpp
  • migration/gauss_hit_finder/register_find_hits_with_gaussians_design1.cpp
  • migration/gauss_hit_finder/register_print_hits_to_file.cpp
  • migration/gauss_hit_finder/test_find_hits_with_gaussians.jsonnet
  • migration/gauss_hit_finder/test_find_hits_with_gaussians_design1.jsonnet
  • migration/gauss_hit_finder/wire_serialization.cpp
  • migration/gauss_hit_finder/wire_serialization.hpp
  • migration/gauss_hit_finder/wires_source.cpp
  • scripts/fix_header_guards.py
  • split_square_verify.cpp
  • subtract.py
💤 Files with no reviewable changes (1)
  • migration/doc/index.rst
📜 Review details
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2026-07-08T20:31:37.310Z
Learnt from: wddgit
Repo: Framework-R-D/phlex-examples PR: 18
File: migration/gauss_hit_finder/register_find_hits_with_gaussians_design1.cpp:49-63
Timestamp: 2026-07-08T20:31:37.310Z
Learning: In Framework-R-D/phlex-examples, files under `migration/` that are LArSoft-derived copies should be kept as close as possible to the original LArSoft implementation. During code review, avoid suggesting behavioral changes or extra “hardening” (e.g., new validation, altered logic, different edge-case handling) beyond what is strictly needed to support the phlex migration/demo or to make the code compile/integrate. If a deviation from upstream is required, keep it minimal and document the reason.

Applied to files:

  • migration/gauss_hit_finder/register_find_hits_with_gaussians_cell_id.cpp
  • migration/gauss_hit_finder/wires_source.cpp
  • migration/gauss_hit_finder/register_print_hits_to_file.cpp
  • migration/gauss_hit_finder/register_find_hits_with_gaussians.cpp
  • migration/gauss_hit_finder/print_hits_to_file.cpp
  • migration/gauss_hit_finder/find_hits_with_gaussians_design1.cpp
  • migration/gauss_hit_finder/wire_serialization.cpp
  • migration/gauss_hit_finder/register_find_hits_with_gaussians_design1.cpp
  • migration/gauss_hit_finder/find_hits_with_gaussians.cpp
🪛 ast-grep (0.44.1)
migration/doc/conf.py

[error] 19-19: Command coming from incoming request
Context: subprocess.check_output(["git", "rev-parse", "--short", "HEAD"])
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(subprocess-from-request)


[error] 19-19: Avoid command injection
Context: subprocess.check_output(["git", "rev-parse", "--short", "HEAD"])
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').

(command-injection-python)

🪛 Clang (14.0.6)
migration/gauss_hit_finder/print_hits_to_file.cpp

[warning] 16-16: 2 adjacent parameters of 'print_hits_to_file' of similar type are easily swapped by mistake

(bugprone-easily-swappable-parameters)


[note] 16-16: the first parameter in the range is 'cell_id'

(clang)


[note] 16-16: the last parameter in the range is 'input_hits'

(clang)


[note] 16-16: 'int' and 'const int &' parameters accept and bind the same kind of values

(clang)

migration/gauss_hit_finder/find_hits_with_gaussians_design1.cpp

[warning] 42-42: constructor does not initialize these fields: begin_, end_

(cppcoreguidelines-pro-type-member-init)


[warning] 55-55: use a trailing return type for this function

(modernize-use-trailing-return-type)

migration/gauss_hit_finder/find_hits_with_gaussians.cpp

[warning] 24-24: use a trailing return type for this function

(modernize-use-trailing-return-type)


[warning] 24-24: parameter name 'x' is too short, expected at least 3 characters

(readability-identifier-length)


[warning] 26-26: statement should be inside braces

(readability-braces-around-statements)


[warning] 30-30: statement should be inside braces

(readability-braces-around-statements)


[warning] 33-33: statement should be inside braces

(readability-braces-around-statements)


[warning] 40-40: use a trailing return type for this function

(modernize-use-trailing-return-type)


[warning] 42-42: 2 adjacent parameters of 'find_hits_with_gaussians' of similar type ('const int &') are easily swapped by mistake

(bugprone-easily-swappable-parameters)


[note] 42-42: the first parameter in the range is 'wires'

(clang)


[note] 43-43: the last parameter in the range is 'cand_hit_standard'

(clang)

migration/gauss_hit_finder/find_hits_with_gaussians_design1.hpp

[warning] 81-81: use a trailing return type for this function

(modernize-use-trailing-return-type)

🪛 Cppcheck (2.21.0)
migration/gauss_hit_finder/wires_source.cpp

[style] 35-35: The function 'isValidChannelID' is never used.

(unusedFunction)

migration/gauss_hit_finder/print_hits_to_file.cpp

[style] 16-16: The function 'print_hits_to_file' is never used.

(unusedFunction)

migration/gauss_hit_finder/find_hits_with_gaussians_design1.cpp

[style] 55-55: The function 'predicate' is never used.

(unusedFunction)

migration/gauss_hit_finder/wire_serialization.cpp

[style] 35-35: The function 'isValidChannelID' is never used.

(unusedFunction)


[style] 124-124: The function 'to_int' is never used.

(unusedFunction)


[style] 6-6: The function 'write_wires_to_file' is never used.

(unusedFunction)


[style] 59-59: The function 'read_wires_from_file' is never used.

(unusedFunction)

migration/gauss_hit_finder/find_hits_with_gaussians.cpp

[style] 35-35: The function 'isValidChannelID' is never used.

(unusedFunction)


[style] 40-40: The function 'find_hits_with_gaussians' is never used.

(unusedFunction)


[style] 124-124: The function 'to_int' is never used.

(unusedFunction)

🪛 LanguageTool
migration/gauss_hit_finder/README.md

[style] ~95-~95: The expression “make sense” can be too colloquial for certain contexts. For a more formal tone, try using an alternative.
Context: ...lemented as a single phlex transform. Does it make sense to split it with unfolds and folds? Doe...

(WOULD_IT_MAKE_SENSE)


[style] ~96-~96: The expression “make sense” can be too colloquial for certain contexts. For a more formal tone, try using an alternative.
Context: ...nse to split it with unfolds and folds? Does it make sense to have multiple transforms? We don't k...

(WOULD_IT_MAKE_SENSE)


[grammar] ~180-~180: Use a hyphen to join words.
Context: ...mber for each wire. For now, I just hard coded the plane number to 0. The signal ...

(QB_NEW_EN_HYPHEN)

🪛 Ruff (0.15.20)
migration/doc/conf.py

[error] 16-16: Variable copyright is shadowing a Python builtin

(A001)


[error] 20-20: Starting a process with a partial executable path

(S607)

scripts/fix_header_guards.py

[warning] 105-105: Too many branches (14 > 12)

(PLR0912)


[warning] 126-127: Use elif instead of else then if, to reduce indentation

Convert to elif

(PLR5501)


[warning] 137-138: Use elif instead of else then if, to reduce indentation

Convert to elif

(PLR5501)

🔇 Additional comments (30)
.clang-format (1)

2-72: LGTM!

Also applies to: 92-114, 126-133, 144-159, 168-190, 213-216, 226-226, 245-245, 255-276

.gersemirc (1)

1-13: LGTM!

.pre-commit-config.yaml (2)

1-10: LGTM!

Also applies to: 20-31, 39-60


12-19: 🩺 Stability & Availability

No newline fix needed here. The header-guard hook only rewrites .h/.hpp, and the tracked headers are already LF-only, so this hook order doesn’t create a mixed-ending conflict in this repo.

			> Likely an incorrect or invalid review comment.
README.md (1)

14-21: LGTM!

Also applies to: 99-100, 123-123

migration/doc/conf.py (1)

10-40: LGTM!

Also applies to: 59-71

migration/gauss_hit_finder/README.md (1)

3-67: LGTM!

Also applies to: 82-139, 160-220

migration/gauss_hit_finder/compare_hits.py (1)

6-6: LGTM!

Also applies to: 16-19

migration/gauss_hit_finder/find_hits_with_gaussians.cpp (1)

18-46: LGTM!

Also applies to: 87-87, 124-130, 141-141, 156-157, 196-197, 206-207, 259-259, 303-304, 337-382, 405-405, 425-425, 437-454

migration/gauss_hit_finder/find_hits_with_gaussians_design1.cpp (1)

18-19: LGTM!

Also applies to: 42-42, 55-58

migration/gauss_hit_finder/wire_serialization.cpp (1)

1-5: LGTM!

Also applies to: 6-57, 59-135

migration/gauss_hit_finder/wires_source.cpp (1)

26-35: LGTM!

migration/gauss_hit_finder/CMakeLists.txt (1)

3-16: LGTM!

Also applies to: 25-58, 70-98, 101-114, 115-155

migration/gauss_hit_finder/register_find_hits_with_gaussians_cell_id.cpp (1)

13-14: LGTM!

split_square_verify.cpp (1)

35-47: LGTM!

Also applies to: 48-50

migration/gauss_hit_finder/print_hits_to_file.cpp (1)

16-17: LGTM!

Also applies to: 26-26, 39-39

migration/gauss_hit_finder/register_find_hits_with_gaussians.cpp (1)

15-16: LGTM!

Also applies to: 34-34, 43-48, 57-77

migration/gauss_hit_finder/register_find_hits_with_gaussians_design1.cpp (1)

44-44: LGTM!

Also applies to: 53-58, 67-96

migration/gauss_hit_finder/register_print_hits_to_file.cpp (1)

20-21: LGTM!

migration/gauss_hit_finder/test_find_hits_with_gaussians.jsonnet (1)

36-36: LGTM!

migration/gauss_hit_finder/test_find_hits_with_gaussians_design1.jsonnet (1)

37-37: LGTM!

subtract.py (1)

7-7: LGTM!

Also applies to: 40-42

migration/gauss_hit_finder/copied_from_larsoft_minor_edits/.clang-format (1)

1-1: LGTM!

scripts/fix_header_guards.py (2)

1-24: LGTM!


105-143: 📐 Maintainability & Code Quality

Resolve the reported pre-commit lint diagnostics.

Ruff reports PLR0912 for main and PLR5501 for both else/if branches. If those rules are enabled by the new pre-commit configuration, this script will fail the hook; refactor these branches or configure the rules explicitly.

Source: Linters/SAST tools

migration/gauss_hit_finder/find_hits_with_gaussians.hpp (1)

1-2: LGTM!

Also applies to: 46-61, 64-64

migration/gauss_hit_finder/find_hits_with_gaussians_design1.hpp (2)

1-2: LGTM!

Also applies to: 71-79, 88-92


81-86: 📐 Maintainability & Code Quality

Verify the clang-tidy policy for this declaration.

Clang reports modernize-use-trailing-return-type here. If clang-tidy is enforced by pre-commit, this header may still fail despite the formatting cleanup; apply the project-wide convention or disable/suppress the check consistently.

Source: Linters/SAST tools

migration/gauss_hit_finder/print_hits_to_file.hpp (1)

1-13: LGTM!

migration/gauss_hit_finder/wire_serialization.hpp (1)

1-14: LGTM!

Comment thread .markdownlint.yaml
Comment on lines +1 to +2
MD013:
code_blocks: false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '--- .markdownlint.yaml ---\n'
cat -n .markdownlint.yaml

printf '\n--- markdownlint references ---\n'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' --glob '!coverage' 'markdownlint|markdownlint-cli|MD013|ignore_code_blocks|code_blocks' .

Repository: Framework-R-D/phlex-examples

Length of output: 257


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- .markdownlint.yaml ---'
cat -n .markdownlint.yaml

echo
echo '--- markdownlint references ---'
rg -n --hidden --glob '!node_modules' --glob '!dist' --glob '!build' --glob '!coverage' 'markdownlint|markdownlint-cli|MD013|ignore_code_blocks|code_blocks' .

echo
echo '--- dependency manifests mentioning markdownlint ---'
git ls-files | rg '(^|/)(package\.json|package-lock\.json|pnpm-lock\.yaml|yarn\.lock|bun\.lockb|requirements\.txt|poetry\.lock|Gemfile.lock|go\.mod|Cargo\.toml)$' | while read -r f; do
  if rg -n 'markdownlint' "$f" >/dev/null 2>&1; then
    echo "### $f"
    rg -n 'markdownlint' "$f"
  fi
done

Repository: Framework-R-D/phlex-examples

Length of output: 542


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- .pre-commit-config.yaml (markdownlint section) ---'
nl -ba .pre-commit-config.yaml | sed -n '48,72p'

Repository: Framework-R-D/phlex-examples

Length of output: 261


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- .pre-commit-config.yaml (markdownlint section) ---'
cat -n .pre-commit-config.yaml | sed -n '48,72p'

echo
echo '--- markdownlint-cli2 version refs in repo ---'
rg -n 'markdownlint-cli2|markdownlint' .pre-commit-config.yaml .github .gitlab-ci.yml .circleci . 2>/dev/null

Repository: Framework-R-D/phlex-examples

Length of output: 973


🌐 Web query:

markdownlint MD013 code_blocks deprecated ignore_code_blocks markdownlint-cli2 v0.22.1

💡 Result:

The parameter code_blocks for rule MD013 has been deprecated in favor of ignore_code_blocks [1][2][3]. To align with consistent naming conventions across markdownlint rules, ignore_code_blocks was introduced as a more descriptive alternative [4][5]. When using the deprecated code_blocks parameter (specifically if set to false), the tool will output a deprecation warning advising you to replace it with ignore_code_blocks: true [1][2][3]. If you are using markdownlint-cli2 v0.22.1, it inherits this behavior because it relies on the underlying markdownlint library where these changes were implemented [6][7]. To update your configuration, change your MD013 settings as follows: Deprecated: "MD013": { "code_blocks": false } Recommended: "MD013": { "ignore_code_blocks": true } [1][2][3]

Citations:


Use ignore_code_blocks for MD013

code_blocks is the deprecated form here; switch to the replacement to avoid noisy lint warnings going forward.

Suggested change
 MD013:
-  code_blocks: false
+  ignore_code_blocks: true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
MD013:
code_blocks: false
MD013:
ignore_code_blocks: true
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.markdownlint.yaml around lines 1 - 2, Replace the deprecated MD013 option
`code_blocks` with its supported replacement `ignore_code_blocks` in the
markdownlint configuration.

Comment on lines +30 to +31
if len(lines) < 3:
return True, None

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Do not treat guardless headers as valid.

check_header_guard returns (True, None) when either directive is missing, so the pre-commit hook silently accepts unguarded .h/.hpp files; fix mode also declines to add a guard. Reject these files and either insert the guard or explicitly exclude guardless headers.

Also applies to: 52-53

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/fix_header_guards.py` around lines 30 - 31, Update check_header_guard
so missing or incomplete guard directives return an invalid result instead of
(True, None), including the short-file path and the corresponding checks around
lines 52-53. Ensure fix mode inserts the appropriate guard for guardless .h/.hpp
files, or explicitly excludes such files from validation.

Comment on lines +38 to +43
for i in range(min(10, len(lines))):
if m := re.match(r"#ifndef\s+(\w+)\s*$", lines[i]):
ifndef_idx, ifndef_macro = i, m.group(1)
elif m := re.match(r"#define\s+(\w+)\s*$", lines[i]):
define_idx, define_macro = i, m.group(1)
break

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Only rewrite a proven include-guard pair.

The scanner assumes the first #ifndef and first later #define are the guard directives. A header with an unrelated conditional in its first ten lines could therefore have that conditional rewritten by fix mode. Require a leading, structurally paired guard before modifying anything.

Also applies to: 73-78, 90-98

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/fix_header_guards.py` around lines 38 - 43, The scanner may rewrite
unrelated conditionals because it independently selects the first `#ifndef` and
later `#define`. Update the guard-detection logic used by the scanning and fix
paths to require a leading, structurally paired include guard: the first
relevant directive must be `#ifndef`, immediately followed by a matching `#define`
for the same macro, with no intervening directives. Only perform rewrites when
this validated pair is found.

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