Skip to content

ENH: Add empty .pre-commit-config.yaml for release-5.4 - #6837

Merged
blowekamp merged 1 commit into
InsightSoftwareConsortium:release-5.4from
blowekamp:release-5.4-add-empty-pre-commit
Sep 4, 2026
Merged

ENH: Add empty .pre-commit-config.yaml for release-5.4#6837
blowekamp merged 1 commit into
InsightSoftwareConsortium:release-5.4from
blowekamp:release-5.4-add-empty-pre-commit

Conversation

@blowekamp

Copy link
Copy Markdown
Member

Prevents pre-commit errors when backporting commits from branches where pre-commit hooks are configured.

PR Checklist

  • No API changes were made (or the changes have been approved)
  • No major design changes were made (or the changes have been approved)
  • Added test (or behavior not changed)
  • Updated API documentation (or API not changed)
  • Added license to new files (if any)
  • Added Python wrapping to new files (if any) as described in ITK Software Guide Section 9.5
  • Added ITK examples for all new major features (if any)

Refer to the ITK Software Guide for
further development details if necessary.

@github-actions github-actions Bot added the type:Enhancement Improvement of existing methods or implementation label Sep 4, 2026

@dzenanz dzenanz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me. Someone else should preferably review.

@greptile-apps

greptile-apps Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Summary

  • Adds an empty pre-commit configuration for the release-5.4 branch.
  • The configuration is accepted by pre-commit and completes an all-files run without executing hooks, preserving the intended branch behavior.

Merge safety

Safe to merge.

Confidence Score: 5/5

Safe to merge: the added configuration is valid and retains the intended no-hook behavior.

No issues were found. The configuration was validated and an all-files pre-commit run completed successfully without hook output.

Files Needing Attention: None.

T-Rex T-Rex Logs

What T-Rex did

  • I authored the executable precommit-empty-repos-validation script to perform the empty-repos validation.
  • I captured before and after logs for the empty-repos validation to illustrate the state before and after execution.
  • I validated that the added configuration declares only an empty repos list and compared it against the missing-configuration case.
  • I ran pre-commit across all files and confirmed that it completed with no hooks running.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (1): Last reviewed commit: "ENH: Add empty .pre-commit-config.yaml f..." | Re-trigger Greptile

@hjmjohnson hjmjohnson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Love it! This is 95% of what I think should be done.

The last 5% is completely optional, and should not hold this up. I would want to backport the items that are "free" to backport.

@hjmjohnson

Copy link
Copy Markdown
Member

Love it! This is 95% of what I think should be done.

The last 5% is completely optional, and should not hold this up. I would want to backport the items that are "free" to backport.

I dropped main's pre-commit-hooks block verbatim into a release-5.4 worktree and ran it against the whole tree. 17 of the 21 hooks pass clean today — they'd be pure no-ops on this branch, at zero cost and with byte-identical configuration to main. The other 4 fail, but the total debt is one URL, one file mode, and whitespace.

Full hook-by-hook result on release-5.4
Hook Result
check-added-large-files, check-ast, check-case-conflict, check-json, check-merge-conflict, check-toml, check-xml, check-yaml, debug-statements, destroyed-symlinks, detect-private-key, mixed-line-ending, no-commit-to-branch Passed
check-illegal-windows-names, forbid-new-submodules, forbid-submodules, name-tests-test Skipped (no matching files)
check-vcs-permalinks Failed — 1 line
check-shebang-scripts-are-executable Failed — 1 file
end-of-file-fixer + trailing-whitespace Failed — 17 files, +40/-52

Reproduce with:

git worktree add /tmp/r54 upstream/release-5.4
# copy the pre-commit-hooks repo block from main's .pre-commit-config.yaml
pre-commit run --all-files
The 4 failures, in full
  1. check-vcs-permalinks — one non-permanent GitHub link:
    CMake/ITKSetStandardCompilerFlags.cmake:232 uses blob/master/... and wants a SHA permalink.

  2. check-shebang-scripts-are-executable — one file:
    Utilities/Maintenance/VCL_ModernizeNaming.py has a shebang but is not marked executable. Fixed with git add --chmod=+x.

  3. end-of-file-fixer + trailing-whitespace — 17 files, whitespace only, no compiled content:

    • 7 × Documentation/Doxygen/*.dox
    • 4 × Documentation/docs/releases/*.md
    • 2 × Modules/Nonunit/IntegratedTest/test/*.mm
    • Modules/Nonunit/IntegratedTest/wrapping/test/CMakeLists.txt
    • Modules/Numerics/FEM/test/README
    • Utilities/Debugger/ITK.natvis
    • Documentation/docs/_static/icon/html_head_content.txt
Why the whitespace hooks in particular are worth having here

This PR's own justification is that commits get backported from main. main enforces trailing-whitespace and end-of-file-fixer; release-5.4 currently does not. So a cherry-pick carries main-normalized whitespace into a branch holding 17 files of un-normalized whitespace, and the divergence accumulates precisely along the paths backports travel.

Worth noting the 4 failures are all genuine defects of the kind these hooks exist to catch — a master-branch link that will rot, a script that cannot be executed, and trailing whitespace. That 17 hooks pass untouched says release-5.4 is in better shape than its lack of enforcement would predict.

Tiny nit, take it or leave it: COMP: may fit better than ENH: here, since this is build/CI tooling rather than new functionality.

Either way — none of this should block merging as-is. The empty config solves the stated problem, and the hook enablement is a clean follow-up whenever it suits.

Prevents pre-commit errors when backporting commits from branches
where pre-commit hooks are configured.
@blowekamp
blowekamp force-pushed the release-5.4-add-empty-pre-commit branch from 90e8157 to f42c5d9 Compare September 4, 2026 14:10
@blowekamp
blowekamp merged commit 695bb17 into InsightSoftwareConsortium:release-5.4 Sep 4, 2026
16 checks passed
@blowekamp

Copy link
Copy Markdown
Member Author

@hjmjohnson Your suggested followup would be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:Enhancement Improvement of existing methods or implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants