Skip to content

Commit a78cbdf

Browse files
joaodinissfclaude
andcommitted
ci: add line-endings check as a parallel verify job
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>
1 parent 7069be3 commit a78cbdf

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

.github/workflows/verify.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,24 @@ jobs:
2828
run: echo "WORKSPACE=${{ github.workspace }}" >> $GITHUB_ENV
2929
- name: Checkstyle Check
3030
run: mvn checkstyle:checkstyle checkstyle:check -f ./ddk-parent/pom.xml --batch-mode --fail-at-end
31+
line-endings:
32+
runs-on: ubuntu-24.04
33+
steps:
34+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
35+
- name: Check LF line endings in index
36+
# .gitattributes declares `* text=auto eol=lf` with .bat/.cmd/.ps1
37+
# exempted. Git's clean filter normalizes on commit, but verify it
38+
# explicitly in case a file is miscategorized as binary or a filter
39+
# is bypassed.
40+
run: |
41+
violations=$(git ls-files --eol \
42+
| grep -E "^i/(crlf|mixed)" \
43+
| grep -vE "\.(bat|cmd|ps1)$" || true)
44+
if [ -n "$violations" ]; then
45+
echo "Files with CRLF/mixed line endings stored in the index:"
46+
echo "$violations"
47+
exit 1
48+
fi
3149
maven-verify:
3250
runs-on: ubuntu-24.04
3351
steps:

0 commit comments

Comments
 (0)