[clang-tools-extra] added option `google-readability-namespace-comments.AllowNoNamespaceComments` (PR #124265)

Carlos Galvez via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 5 04:32:32 PDT 2025


================
@@ -0,0 +1,19 @@
+// RUN: %check_clang_tidy %s google-readability-namespace-comments %t -std=c++20 \
+// RUN:   '-config={CheckOptions: { \
+// RUN:     google-readability-namespace-comments.AllowOmittingNamespaceComments: true, \
+// RUN:     google-readability-namespace-comments.ShortNamespaceLines: 0, \
+// RUN:   }}'
----------------
carlosgalvezp wrote:

I agree with your interpretation, we should not duplicate the main file into the option file, but we still need to test the behaviors that we promise. As per the docs, we promise 2 behaviors:

-   When `true`, the check will accept if no namespace comment is present.
-   The check will only fail if the specified namespace comment is different
   than expected.

So the tests should reflect those behaviors when the option is True.

I think the newly added test case is fine, can you please add it also to the other test file (readability-namespace-comments-missing.cpp) for consistency?

https://github.com/llvm/llvm-project/pull/124265


More information about the cfe-commits mailing list