Skip to content

Fixing false positives for MISRA C++ 2023 Rule 6.5.1 on googletest ma…#8081

Closed
mueller-florian wants to merge 1 commit intocppcheck-opensource:mainfrom
mueller-florian:fix_googletest_misra-cpp-2023-6.5.1
Closed

Fixing false positives for MISRA C++ 2023 Rule 6.5.1 on googletest ma…#8081
mueller-florian wants to merge 1 commit intocppcheck-opensource:mainfrom
mueller-florian:fix_googletest_misra-cpp-2023-6.5.1

Conversation

@mueller-florian
Copy link
Copy Markdown
Contributor

When running cppcheck premium with MISRA C++2023 Rule 6.5.1 enabled on unittests using googletests with --library=googletest, cppcheck is flagging each TEST(test_suite_name, test_name) with violation of Rule 6.5.1.

Encapsulating the definition in an anonymous namespace ensures MIRSA compliance.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jan 2, 2026

@danmar
Copy link
Copy Markdown
Collaborator

danmar commented Jan 2, 2026

thanks.. there are CI failures. it seems the googletest tests needs update..

@mueller-florian
Copy link
Copy Markdown
Contributor Author

Thanks for letting me know @danmar.
I'll look into it, I guess I need to familiarize myself with the tests first.

@mueller-florian
Copy link
Copy Markdown
Contributor Author

After thinking about the modification, I no longer think that my changes make sense at all, sorry.
It would only include the function signature in the namespace but not the function body, which is what I intended.

With this insight, I withdraw this PR, to make room for a better approach

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