Skip to content

Fix #54: add validation check for .gitignore - #55

Merged
lefticus merged 4 commits into
cpp-best-practices:mainfrom
leftibot:fix/issue-54-add-validation-check-for-gitignore
Nov 3, 2026
Merged

lefticus merged 4 commits into
cpp-best-practices:mainfrom
leftibot:fix/issue-54-add-validation-check-for-gitignore

Conversation

@leftibot

@leftibot leftibot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Automated fix by @leftibot.

What changed

Fix #54: Add a gitignore check that build outputs are ignored
The validator had no check for a .gitignore, so projects could commit
build directories and other generated files without being flagged. The new
gitignore check fails when there is no .gitignore and warns, per ecosystem,
when it does not ignore the top-level build outputs (build/ or out/ for C/C++,
pycache/ or *.py[cod] for Python, /target for Rust). The well-configured
fixtures now include a .gitignore.
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

Files

 project_validator/checks/gitignore.py            |  67 ++++++++++++
 tests/checks/test_gitignore.py                   | 128 +++++++++++++++++++++++
 tests/fixtures/well_configured/.gitignore        |   2 +
 tests/fixtures/well_configured_python/.gitignore |   2 +
 tests/fixtures/well_configured_rust/.gitignore   |   1 +
 5 files changed, 200 insertions(+)

Closes #54

Triggered by @lefticus.

…re ignored

The validator had no check for a .gitignore, so projects could commit
build directories and other generated files without being flagged. The new
`gitignore` check fails when there is no .gitignore and warns, per ecosystem,
when it does not ignore the top-level build outputs (build/ or out/ for C/C++,
__pycache__/ or *.py[cod] for Python, /target for Rust). The well-configured
fixtures now include a .gitignore.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.03%. Comparing base (2b3ab9f) to head (8edf2c6).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #55      +/-   ##
==========================================
+ Coverage   96.75%   97.03%   +0.27%     
==========================================
  Files          29       30       +1     
  Lines        1018     1113      +95     
  Branches       80       91      +11     
==========================================
+ Hits          985     1080      +95     
  Misses         28       28              
  Partials        5        5              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lefticus

lefticus commented Nov 3, 2026

Copy link
Copy Markdown
Member

@leftibot add a .gitignore file to this project. Also consider equivalent checks for other source control systems and enhance the check and tests as necessary

@leftibot

leftibot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ leftibot finished addressing the review feedback.

leftibot and others added 2 commits November 2, 2026 23:14
Requested by @lefticus in PR cpp-best-practices#55 review.

The check is renamed from `gitignore` to `vcs-ignore` (module vcs_ignore.py)
because it now accepts .gitignore, .hgignore, .bzrignore and
.fossil-settings/ignore-glob. It fails when none is present, and warns when
any present ignore file does not ignore an ecosystem's build outputs.
Each file is read in its own syntax: .hgignore regexps (the default),
`syntax:` switches and per-entry prefixes; Bazaar RE:, ./, ! and !!; and
Fossil's comma or whitespace separated globs. Regular expressions are judged
by whether they match the build output paths. Jujutsu uses .gitignore;
Subversion keeps svn:ignore in properties, not files, so it cannot be checked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Requested by @lefticus in PR cpp-best-practices#55 review.

Ignores Python bytecode and tool caches, virtual environments, packaging
outputs and coverage reports, so the project passes its own vcs-ignore check.
(The run instructions said not to modify .gitignore, but @lefticus asked for
this file explicitly.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@leftibot

leftibot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Addressed review feedback from @lefticus. New commits:

3bc2773 Address review: add a .gitignore to this project
94249cb Address review: check Mercurial, Bazaar and Fossil ignore files too

@lefticus

lefticus commented Nov 3, 2026

Copy link
Copy Markdown
Member

@leftibot remove pyc files from this pr branch

@leftibot

leftibot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ leftibot finished addressing the review feedback.

Requested by @lefticus in PR cpp-best-practices#55 review.

The compiled __pycache__/*.pyc files were committed on main and this
branch had modified them. They are now removed from version control
(kept on disk) and remain ignored by the project's .gitignore.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@leftibot

leftibot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Addressed review feedback from @lefticus. New commits:

8edf2c6 Address review: remove tracked .pyc bytecode files

@lefticus
lefticus merged commit ed3da4e into cpp-best-practices:main Nov 3, 2026
13 checks passed
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.

add validation check for .gitignore

2 participants