Skip to content

Fix #12: Add warnings-as-errors check: warnings fail the build - #37

Merged
lefticus merged 3 commits into
cpp-best-practices:mainfrom
leftibot:fix/issue-12-add-warnings-as-errors-check-warnings-fa
Nov 3, 2026
Merged

lefticus merged 3 commits into
cpp-best-practices:mainfrom
leftibot:fix/issue-12-add-warnings-as-errors-check-warnings-fa

Conversation

@leftibot

Copy link
Copy Markdown
Contributor

Automated fix by @leftibot.

What changed

Fix #12: Add warnings-as-errors check
There was no check that compiler warnings fail the build. The new
warnings-as-errors check searches CMake files (comments stripped) and CI
configuration for -Werror, /WX, or COMPILE_WARNING_AS_ERROR /
CMAKE_COMPILE_WARNING_AS_ERROR set to a true value, and fails if none is found.
Partial or disabling forms (-Werror=, -Wno-error, /WX:NO, OFF) do not
count; the well_configured fixture gains a WARNINGS_AS_ERRORS option to match.
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com

Files

 project_validator/checks/warnings_as_errors.py | 26 +++++++++++++
 tests/fixtures/well_configured/CMakeLists.txt  |  5 +++
 tests/test_checks.py                           | 52 ++++++++++++++++++++++++++
 tests/test_cli.py                              |  4 +-
 tests/test_plugins.py                          |  2 +-
 5 files changed, 86 insertions(+), 3 deletions(-)

Closes #12

Triggered by @lefticus.

There was no check that compiler warnings fail the build. The new
`warnings-as-errors` check searches CMake files (comments stripped) and CI
configuration for -Werror, /WX, or COMPILE_WARNING_AS_ERROR /
CMAKE_COMPILE_WARNING_AS_ERROR set to a true value, and fails if none is found.
Partial or disabling forms (-Werror=<warning>, -Wno-error, /WX:NO, OFF) do not
count; the well_configured fixture gains a WARNINGS_AS_ERRORS option to match.

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

codecov Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.80%. Comparing base (2b3ab9f) to head (2699c77).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #37      +/-   ##
==========================================
+ Coverage   96.75%   96.80%   +0.04%     
==========================================
  Files          29       30       +1     
  Lines        1018     1032      +14     
  Branches       80       81       +1     
==========================================
+ Hits          985      999      +14     
  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

Copy link
Copy Markdown
Member

@leftibot fix merge conflicts

@leftibot

leftibot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ leftibot finished addressing the review feedback.

…check

Kept both the warnings-as-errors and cxx-extensions tests and check lists;
the colored-output test now expects 7 passing checks.

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

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

Copy link
Copy Markdown
Contributor Author

Addressed review feedback from @lefticus. New commits:

8dcac30 Address review: merge main and resolve conflicts with cxx-extensions check
40f4097 Fix #20: Add cxx-extensions check that compiler extensions are disabled (#36)

@lefticus

lefticus commented Nov 3, 2026

Copy link
Copy Markdown
Member

@leftibot fix merge conflicts and get tests up to current standards

@leftibot

leftibot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ leftibot finished addressing the review feedback.

…urrent standards

Resolved conflicts with main's one-test-file-per-check layout: the
warnings-as-errors tests move from tests/test_checks.py (deleted on main)
to tests/checks/test_warnings_as_errors.py and now run in every C/C++
project layout via run_in_every_layout, cover every CI provider, and check
the declared languages. test_cli.py and test_plugins.py take main's
versions, which no longer hard-code the list of checks.

To match the other checks on main, warnings-as-errors now declares
languages=C_FAMILY (so Python and Rust projects skip it; their equivalents
are judged by compiler-warnings) and also reads CMakePresets.json /
CMakeUserPresets.json, including the {"type": ..., "value": ...} form.

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

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:

2699c77 Address review: merge main and bring warnings-as-errors tests up to current standards
2b3ab9f Fix #34: Add CI static code quality and copy-paste detection (#43)
7ee859e Bump actions/setup-node from 4 to 7 (#51)
193835f Bump actions/setup-python from 5 to 7 (#50)
a35f4f4 Bump actions/checkout from 4 to 7 (#53)

@lefticus
lefticus merged commit 25f278b 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 warnings-as-errors check: warnings fail the build

2 participants