ci: add line-endings check as a parallel verify job#1316
Merged
joaodinissf merged 1 commit intoMay 6, 2026
Conversation
e662364 to
a78cbdf
Compare
Add a new `line-endings` job to `verify.yml` that runs alongside `pmd`, `checkstyle`, and `maven-verify`. It uses `git ls-files --eol` to check every text file in the index is stored as LF, exempting the `.bat`/`.cmd`/`.ps1` extensions that `.gitattributes` keeps on CRLF for Windows compatibility. The check is redundant with Git's own clean filter (which normalizes on commit per `.gitattributes: * text=auto eol=lf`) but catches two gaps: * A file that Git's `text=auto` heuristic misclassifies as binary (e.g., an early null byte) silently keeps whatever line endings it was committed with. * A filter-bypass via `--literally` or a custom hook path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
a78cbdf to
4b94672
Compare
rubenporras
approved these changes
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
line-endingsjob toverify.ymlthat runs in parallel withpmd,checkstyle, andmaven-verify. It usesgit ls-files --eolto check every text file in the index is stored as LF, exempting.bat/.cmd/.ps1(the exceptions that.gitattributeskeeps on CRLF for Windows compatibility).A second layer of defence on top of the normalization filter introduced in #1314.
Why a second layer?
Git's clean filter (driven by
.gitattributes: * text=auto eol=lf) normalizes text files at commit time. Two gaps slip through:text=autouses a null-byte heuristic to decide if a file is text. A text file with an early null byte (rare but possible — certain XML CDATA blocks, certain encoded configs) is treated as binary and not normalized. CRLF sneaks in unchanged.--literallycommit or a custom hook path can skip the filter.Neither is common, but both are silent. This check surfaces them before they matter.
Depends on
Depends on #1314 landing first so the repo is actually LF-clean when this check starts enforcing. Opened on top of
lf-normalizebranch content.Verification that the check catches real violations
A test commit with a CRLF file pushed onto this branch (subsequently removed) showed the job correctly flagging the file:
Job completed in ~5s. Git's own clean filter caught the first attempt (writing a CRLF file through normal
git add); bypassing the filter requiredgit hash-object --no-filters+git update-index --cacheinfo, simulating a real filter-bypass scenario.🤖 Generated with Claude Code