Skip to content

ENH: Update ITKClangFormatLinterAction to use 'main' branch - #26

Merged
dzenanz merged 1 commit into
mainfrom
linterMasterMain
Sep 23, 2026
Merged

dzenanz merged 1 commit into
mainfrom
linterMasterMain

Conversation

@dzenanz

@dzenanz dzenanz commented Sep 22, 2026

Copy link
Copy Markdown
Member

No description provided.

@dzenanz

dzenanz commented Sep 22, 2026

Copy link
Copy Markdown
Member Author

Linter job now passes. But looking at the log:

Run clang-format check
0s
Run set -euo pipefail
    set -euo pipefail
    ./clang-format.bash --tracked
    if ! git diff-index --diff-filter=M --quiet HEAD -- ':!.clang-format'; then
      echo "::error::Code is inconsistent with ITK Coding Style."
      echo ""
      echo "Changes required:"
      echo ""
      echo "Files:"
      git diff-index --diff-filter=M --name-only HEAD -- ':!.clang-format'
      echo ""
      echo "Changes:"
      git diff HEAD -- ':!.clang-format'
      exit 1
    fi
    echo "clang-format ITK Coding Style check completed successfully."
    shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
  error: cannot use -i when reading from stdin.
  clang-format ITK Coding Style check completed successfully.

I wonder whether it is doing what we expect.

@dzenanz
dzenanz requested a review from hjmjohnson September 22, 2026 19:00
@dzenanz

dzenanz commented Sep 23, 2026

Copy link
Copy Markdown
Member Author

Claude's analysis:

The job passes because it checks zero files, not because the code is clean.

Why nothing gets checked

  • clang-format.bash --tracked doesn't format every tracked file. It lists git ls-files, then keeps only files whose hooks.style git attribute contains clangformat.
  • ITKThinShellDemons has no .gitattributes, so every file reports hooks.style: unspecified and the list comes out empty.
  • The script ends with xargs -0 clang-format -i. GNU xargs still runs the command once when its input is empty, so clang-format -i runs with no file names. It then tries to read stdin and prints the error you saw.
  • clang-format exits 0 on that error; I confirmed this locally. So the script succeeds, no file changes, git diff-index finds nothing, and the step reports success.

Real errors do still fail the job. When I gave the script actual files and a config clang-format couldn't parse, it exited 123. Only the empty file list passes silently.

This problem isn't caused by your PR. The old Docker entrypoint.sh on master ran the same script the same way, so the linter has probably never checked anything in this repo.

@dzenanz
dzenanz merged commit 61cb09e into main Sep 23, 2026
52 of 54 checks passed
@dzenanz
dzenanz deleted the linterMasterMain branch September 23, 2026 17:22
@dzenanz

dzenanz commented Sep 29, 2026

Copy link
Copy Markdown
Member Author

The recommended fix was merged via InsightSoftwareConsortium/ITKClangFormatLinterAction#24.

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