Skip to content

ci(rat): enforce the ASF licence header on .gitignore files#847

Merged
potiuk merged 1 commit into
apache:mainfrom
potiuk:feature/rat-enforce-gitignore
Jul 12, 2026
Merged

ci(rat): enforce the ASF licence header on .gitignore files#847
potiuk merged 1 commit into
apache:mainfrom
potiuk:feature/rat-enforce-gitignore

Conversation

@potiuk

@potiuk potiuk commented Jul 12, 2026

Copy link
Copy Markdown
Member

Why

RAT already runs in CI, but it was not scanning .gitignore files — its
--input-exclude-parsed-scm GIT reads the .gitignore files and self-excludes
them, so the ASF headers stamped by the prek add-license-headers hook (added
in #846) were not actually enforced. A future headerless .gitignore would
slip through CI.

What

Add --input-include '**/.gitignore' to the RAT invocation in
.github/workflows/rat.yml. --input-include overrides the SCM/std
exclusions for exactly the tracked .gitignore files, so RAT scans them and
requires an approved header.

Verification (apache-rat 0.18, run locally)

  • With the flag: +8 .gitignore files move into scope (Standards
    2292 → 2300), all Approved, Unapproved: 0.
  • Negative test: a .gitignore with no header is reported Unapproved and
    fails the check.
  • .git/ stays excluded as a hidden dir; .apache-magpie-overrides/.gitignore
    stays excluded under its hidden dir (no behaviour change there).

Follow-up to #846

#846 (headers + prek stamper) is merged; this PR is rebased onto it, so the
diff is just the one-line workflow change.

RAT's parsed-scm GIT exclusion self-excludes the tracked .gitignore files,
so the headers stamped by add-license-headers were not actually enforced
in CI. Add `--input-include '**/.gitignore'` to override that exclusion so
RAT scans (and requires an approved header on) every tracked .gitignore.

Verified locally with apache-rat 0.18: +8 .gitignore files move into scope,
all Approved (0 unapproved); a headerless .gitignore is reported Unapproved
and fails the check. `.git/` stays excluded as a hidden dir, and
.apache-magpie-overrides/.gitignore stays excluded under its hidden dir.
@potiuk potiuk force-pushed the feature/rat-enforce-gitignore branch from 8b13d04 to 54cb335 Compare July 12, 2026 21:49
@potiuk potiuk merged commit 7a77fbc into apache:main Jul 12, 2026
10 checks passed
@justinmclean

Copy link
Copy Markdown
Member

a git ignore is is just a list of files aand as such is can't have copyright - I suggest no header is needed

@potiuk

potiuk commented Jul 13, 2026

Copy link
Copy Markdown
Member Author

a git ignore is is just a list of files aand as such is can't have copyright - I suggest no header is needed

Yeah. Currently RAT will flag them - unfortunately - at least the RAT run in ATR - there are some flags that exclude those files. For next version I will just add them to .rat-excludes

@potiuk

potiuk commented Jul 13, 2026

Copy link
Copy Markdown
Member Author

(but it's not blocking the release I guess)

@potiuk

potiuk commented Jul 13, 2026

Copy link
Copy Markdown
Member Author

Reversed in #849: dropped the headers and excluded .gitignore in .rat-excludes instead, per your point here that a git ignore file is just a list of files and needs no header. Thanks @justinmclean.

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.

2 participants