Skip to content

Add passing and failing tests for IncludeGuardsNotUsed exclusion check feedback - #1195

Merged
mbaluda merged 3 commits into
mbaluda/exp37-cfrom
copilot/wip-add-passing-and-failing-tests
Sep 4, 2026
Merged

Add passing and failing tests for IncludeGuardsNotUsed exclusion check feedback#1195
mbaluda merged 3 commits into
mbaluda/exp37-cfrom
copilot/wip-add-passing-and-failing-tests

Conversation

Copilot AI commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Description

Addresses review feedback on #1194 (#1194 (comment)) by adding a passing and a failing test that exercise the not isExcluded(file, getQuery()) check added to the shared IncludeGuardsNotUsed query.

For both the C and C++ variants of the shared query test:

  • Added a header with a missing include guard that is not excluded (headers/test7.hpp / headers/test8.h), which still alerts (failing/NON_COMPLIANT case).
  • Added an equivalent header under headers/excluded/ (headers/excluded/test7.hpp / headers/excluded/test8.h), together with a coding-standards.yml (and generated coding-standards.xml) deviation record targeting the test harness's TestQuery rule id, so its alert is suppressed via isExcluded (passing/COMPLIANT case).
  • Updated the corresponding .expected files.

Verified locally with codeql test run that both tests pass, and that temporarily reverting the not isExcluded(...) check causes both new tests to fail, confirming they correctly exercise the exclusion behavior.

Original PR: #1194

Change request type

  • Release or process automation (GitHub workflows, internal scripts)
  • Internal documentation
  • External documentation
  • Query files (.ql, .qll, .qls or unit tests)
  • External scripts (analysis report or other code shipped as part of a release)

Rules with added or modified queries

  • No rules added
  • Queries have been added for the following rules:
    • rule number here
  • Queries have been modified for the following rules:
    • rule number here

Release change checklist

A change note (development_handbook.md#change-notes) is required for any pull request which modifies:

  • The structure or layout of the release artifacts.
  • The evaluation performance (memory, execution time) of an existing query.
  • The results of an existing query in any circumstance.

If you are only adding new rule queries, a change note is not required.

Author: Is a change note required?

  • Yes
  • No (only test fixtures were added/modified; no production query logic changed)

🚨

Co-authored-by: mbaluda <5237080+mbaluda@users.noreply.github.com>
Copilot AI changed the title [WIP] [WIP] Add passing and failing tests for IncludeGuardsNotUsed exclusion check feedback Add passing and failing tests for IncludeGuardsNotUsed exclusion check feedback Sep 4, 2026
Copilot AI requested a review from mbaluda September 4, 2026 18:15
@mbaluda
mbaluda marked this pull request as ready for review September 4, 2026 18:16
Copilot AI balanced review requested due to automatic review settings September 4, 2026 18:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

One changed C++ test line exceeds the mandatory 100-character limit.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds C and C++ regression coverage for IncludeGuardsNotUsed exclusion handling.

Changes:

  • Adds excluded and non-excluded header fixtures.
  • Adds deviation configurations using the test rule ID.
  • Updates expected alerts. No change note is required for test-only changes.
File summaries
File Description
cpp/common/test/rules/includeguardsnotused/test.cpp Includes new C++ fixtures.
cpp/common/test/rules/includeguardsnotused/IncludeGuardsNotUsed.expected Adds the non-excluded C++ alert.
cpp/common/test/rules/includeguardsnotused/headers/test7.hpp Adds the failing C++ fixture.
cpp/common/test/rules/includeguardsnotused/headers/excluded/test7.hpp Adds the excluded C++ fixture.
cpp/common/test/rules/includeguardsnotused/headers/excluded/coding-standards.yml Configures the C++ deviation.
cpp/common/test/rules/includeguardsnotused/headers/excluded/coding-standards.xml Adds generated C++ deviation data.
c/common/test/rules/includeguardsnotused/test.c Includes new C fixtures.
c/common/test/rules/includeguardsnotused/IncludeGuardsNotUsed.expected Adds the non-excluded C alert.
c/common/test/rules/includeguardsnotused/headers/test8.h Adds the failing C fixture.
c/common/test/rules/includeguardsnotused/headers/excluded/test8.h Adds the excluded C fixture.
c/common/test/rules/includeguardsnotused/headers/excluded/coding-standards.yml Configures the C deviation.
c/common/test/rules/includeguardsnotused/headers/excluded/coding-standards.xml Adds generated C deviation data.
Review details
  • Files reviewed: 12/12 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cpp/common/test/rules/includeguardsnotused/test.cpp Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@mbaluda mbaluda closed this Sep 4, 2026
@mbaluda mbaluda reopened this Sep 4, 2026
@mbaluda
mbaluda merged commit 4480120 into mbaluda/exp37-c Sep 4, 2026
24 of 25 checks passed
@mbaluda
mbaluda deleted the copilot/wip-add-passing-and-failing-tests branch September 4, 2026 18:56
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.

3 participants