From a857eb8b2334e49e8af1b453c57fcc163beb78f3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 4 Sep 2026 18:03:16 +0000 Subject: [PATCH 1/3] Initial plan From 6fb970393c131980376a1613afed9f66e67df512 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 4 Sep 2026 18:14:09 +0000 Subject: [PATCH 2/3] Add passing/failing tests for IncludeGuardsNotUsed exclusion behavior Co-authored-by: mbaluda <5237080+mbaluda@users.noreply.github.com> --- .../includeguardsnotused/IncludeGuardsNotUsed.expected | 1 + .../headers/excluded/coding-standards.xml | 10 ++++++++++ .../headers/excluded/coding-standards.yml | 3 +++ .../includeguardsnotused/headers/excluded/test8.h | 2 ++ .../test/rules/includeguardsnotused/headers/test8.h | 2 ++ c/common/test/rules/includeguardsnotused/test.c | 6 +++++- .../includeguardsnotused/IncludeGuardsNotUsed.expected | 1 + .../headers/excluded/coding-standards.xml | 10 ++++++++++ .../headers/excluded/coding-standards.yml | 3 +++ .../includeguardsnotused/headers/excluded/test7.hpp | 2 ++ .../test/rules/includeguardsnotused/headers/test7.hpp | 2 ++ cpp/common/test/rules/includeguardsnotused/test.cpp | 6 +++++- 12 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 c/common/test/rules/includeguardsnotused/headers/excluded/coding-standards.xml create mode 100644 c/common/test/rules/includeguardsnotused/headers/excluded/coding-standards.yml create mode 100644 c/common/test/rules/includeguardsnotused/headers/excluded/test8.h create mode 100644 c/common/test/rules/includeguardsnotused/headers/test8.h create mode 100644 cpp/common/test/rules/includeguardsnotused/headers/excluded/coding-standards.xml create mode 100644 cpp/common/test/rules/includeguardsnotused/headers/excluded/coding-standards.yml create mode 100644 cpp/common/test/rules/includeguardsnotused/headers/excluded/test7.hpp create mode 100644 cpp/common/test/rules/includeguardsnotused/headers/test7.hpp diff --git a/c/common/test/rules/includeguardsnotused/IncludeGuardsNotUsed.expected b/c/common/test/rules/includeguardsnotused/IncludeGuardsNotUsed.expected index 8d72392ed5..07d19e7cf3 100644 --- a/c/common/test/rules/includeguardsnotused/IncludeGuardsNotUsed.expected +++ b/c/common/test/rules/includeguardsnotused/IncludeGuardsNotUsed.expected @@ -2,3 +2,4 @@ | headers/test4.h:0:0:0:0 | headers/test4.h | Header file test4.h is missing expected include guard. | headers/test4.h:0:0:0:0 | headers/test4.h | | | headers/test5.h:0:0:0:0 | headers/test5.h | Header file test5.h is missing expected include guard. | headers/test5.h:0:0:0:0 | headers/test5.h | | | headers/test7.h:0:0:0:0 | headers/test7.h | Header file test7.h is never included by reusing the include guard used by $@. | headers/test6.h:0:0:0:0 | headers/test6.h | include guard | +| headers/test8.h:0:0:0:0 | headers/test8.h | Header file test8.h is missing expected include guard. | headers/test8.h:0:0:0:0 | headers/test8.h | | diff --git a/c/common/test/rules/includeguardsnotused/headers/excluded/coding-standards.xml b/c/common/test/rules/includeguardsnotused/headers/excluded/coding-standards.xml new file mode 100644 index 0000000000..adf7df0ce6 --- /dev/null +++ b/c/common/test/rules/includeguardsnotused/headers/excluded/coding-standards.xml @@ -0,0 +1,10 @@ + + + + + + cpp-test-dummy + This header is deliberately excluded to test the exclusion mechanism. + + + diff --git a/c/common/test/rules/includeguardsnotused/headers/excluded/coding-standards.yml b/c/common/test/rules/includeguardsnotused/headers/excluded/coding-standards.yml new file mode 100644 index 0000000000..d4ea695e26 --- /dev/null +++ b/c/common/test/rules/includeguardsnotused/headers/excluded/coding-standards.yml @@ -0,0 +1,3 @@ +deviations: + - rule-id: cpp-test-dummy + justification: This header is deliberately excluded to test the exclusion mechanism. diff --git a/c/common/test/rules/includeguardsnotused/headers/excluded/test8.h b/c/common/test/rules/includeguardsnotused/headers/excluded/test8.h new file mode 100644 index 0000000000..9d07b4b188 --- /dev/null +++ b/c/common/test/rules/includeguardsnotused/headers/excluded/test8.h @@ -0,0 +1,2 @@ +// COMPLIANT - excluded via deviation +int g7; diff --git a/c/common/test/rules/includeguardsnotused/headers/test8.h b/c/common/test/rules/includeguardsnotused/headers/test8.h new file mode 100644 index 0000000000..fc82ac2a01 --- /dev/null +++ b/c/common/test/rules/includeguardsnotused/headers/test8.h @@ -0,0 +1,2 @@ +// NON_COMPLIANT +int g6; diff --git a/c/common/test/rules/includeguardsnotused/test.c b/c/common/test/rules/includeguardsnotused/test.c index 8c63904fc4..15b066be14 100644 --- a/c/common/test/rules/includeguardsnotused/test.c +++ b/c/common/test/rules/includeguardsnotused/test.c @@ -11,4 +11,8 @@ #include "headers/test6.h" //NON_COMPLIANT - non unique and reported in alert for the next -#include "headers/test7.h" //NON_COMPLIANT - non unique \ No newline at end of file +#include "headers/test7.h" //NON_COMPLIANT - non unique + +#include "headers/test8.h" //NON_COMPLIANT - missing include guard, not excluded + +#include "headers/excluded/test8.h" //COMPLIANT - missing include guard, but excluded via deviation \ No newline at end of file diff --git a/cpp/common/test/rules/includeguardsnotused/IncludeGuardsNotUsed.expected b/cpp/common/test/rules/includeguardsnotused/IncludeGuardsNotUsed.expected index f915e37ec1..dda204cd18 100644 --- a/cpp/common/test/rules/includeguardsnotused/IncludeGuardsNotUsed.expected +++ b/cpp/common/test/rules/includeguardsnotused/IncludeGuardsNotUsed.expected @@ -2,3 +2,4 @@ | headers/test4.hpp:0:0:0:0 | headers/test4.hpp | Header file test4.hpp is missing expected include guard. | headers/test4.hpp:0:0:0:0 | headers/test4.hpp | | | headers/test5.hpp:0:0:0:0 | headers/test5.hpp | Header file test5.hpp is missing expected include guard. | headers/test5.hpp:0:0:0:0 | headers/test5.hpp | | | headers/test6.hpp:0:0:0:0 | headers/test6.hpp | Header file test6.hpp is missing expected include guard. | headers/test6.hpp:0:0:0:0 | headers/test6.hpp | | +| headers/test7.hpp:0:0:0:0 | headers/test7.hpp | Header file test7.hpp is missing expected include guard. | headers/test7.hpp:0:0:0:0 | headers/test7.hpp | | diff --git a/cpp/common/test/rules/includeguardsnotused/headers/excluded/coding-standards.xml b/cpp/common/test/rules/includeguardsnotused/headers/excluded/coding-standards.xml new file mode 100644 index 0000000000..adf7df0ce6 --- /dev/null +++ b/cpp/common/test/rules/includeguardsnotused/headers/excluded/coding-standards.xml @@ -0,0 +1,10 @@ + + + + + + cpp-test-dummy + This header is deliberately excluded to test the exclusion mechanism. + + + diff --git a/cpp/common/test/rules/includeguardsnotused/headers/excluded/coding-standards.yml b/cpp/common/test/rules/includeguardsnotused/headers/excluded/coding-standards.yml new file mode 100644 index 0000000000..d4ea695e26 --- /dev/null +++ b/cpp/common/test/rules/includeguardsnotused/headers/excluded/coding-standards.yml @@ -0,0 +1,3 @@ +deviations: + - rule-id: cpp-test-dummy + justification: This header is deliberately excluded to test the exclusion mechanism. diff --git a/cpp/common/test/rules/includeguardsnotused/headers/excluded/test7.hpp b/cpp/common/test/rules/includeguardsnotused/headers/excluded/test7.hpp new file mode 100644 index 0000000000..9d07b4b188 --- /dev/null +++ b/cpp/common/test/rules/includeguardsnotused/headers/excluded/test7.hpp @@ -0,0 +1,2 @@ +// COMPLIANT - excluded via deviation +int g7; diff --git a/cpp/common/test/rules/includeguardsnotused/headers/test7.hpp b/cpp/common/test/rules/includeguardsnotused/headers/test7.hpp new file mode 100644 index 0000000000..fc82ac2a01 --- /dev/null +++ b/cpp/common/test/rules/includeguardsnotused/headers/test7.hpp @@ -0,0 +1,2 @@ +// NON_COMPLIANT +int g6; diff --git a/cpp/common/test/rules/includeguardsnotused/test.cpp b/cpp/common/test/rules/includeguardsnotused/test.cpp index 356710eb5f..624bd31da0 100644 --- a/cpp/common/test/rules/includeguardsnotused/test.cpp +++ b/cpp/common/test/rules/includeguardsnotused/test.cpp @@ -9,4 +9,8 @@ #include "headers/test5.hpp" //COMPLIANT - non unique precedes malformed -#include "headers/test6.hpp" //COMPLIANT - non unique \ No newline at end of file +#include "headers/test6.hpp" //COMPLIANT - non unique + +#include "headers/test7.hpp" //NON_COMPLIANT - missing include guard, not excluded + +#include "headers/excluded/test7.hpp" //COMPLIANT - missing include guard, but excluded via deviation \ No newline at end of file From 35c888229e056155688c03618aac97a6cf702018 Mon Sep 17 00:00:00 2001 From: Mauro Baluda Date: Fri, 4 Sep 2026 20:22:47 +0200 Subject: [PATCH 3/3] Update include guard compliance comments in test.cpp Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- cpp/common/test/rules/includeguardsnotused/test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpp/common/test/rules/includeguardsnotused/test.cpp b/cpp/common/test/rules/includeguardsnotused/test.cpp index 624bd31da0..82170197f2 100644 --- a/cpp/common/test/rules/includeguardsnotused/test.cpp +++ b/cpp/common/test/rules/includeguardsnotused/test.cpp @@ -13,4 +13,4 @@ #include "headers/test7.hpp" //NON_COMPLIANT - missing include guard, not excluded -#include "headers/excluded/test7.hpp" //COMPLIANT - missing include guard, but excluded via deviation \ No newline at end of file +#include "headers/excluded/test7.hpp" // COMPLIANT - excluded via deviation \ No newline at end of file