-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[clang-tidy][doc][NFC] extract common global options in doc #119842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-github-workflow @llvm/pr-subscribers-clang-tools-extra Author: Congcong Cai (HerrCai0907) ChangesPatch is 20.60 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/119842.diff 33 Files Affected:
diff --git a/clang-tools-extra/docs/clang-tidy/GlobalOptions.rst b/clang-tools-extra/docs/clang-tidy/GlobalOptions.rst
new file mode 100644
index 00000000000000..c717784eb2dff3
--- /dev/null
+++ b/clang-tools-extra/docs/clang-tidy/GlobalOptions.rst
@@ -0,0 +1,21 @@
+==============
+Global Options
+==============
+
+Some options apply to multiple checks. This page lists all the available
+globally options.
+
+.. option:: IncludeStyle
+
+ A string specifying which include-style is used, `llvm` or `google`. Default
+ is `llvm`.
+
+.. option:: IgnoreMacros
+
+ If set to `true`, the check will not give warnings inside macros. Default
+ is `true`.
+
+.. option:: StrictMode
+
+ When `true`, some checkers will be more stringent. The default value depends
+ on the checks.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-startswith.rst b/clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-startswith.rst
index 41a7ab500d7ce0..a8b7b234cc7c23 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-startswith.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-startswith.rst
@@ -39,8 +39,7 @@ Options
.. option:: IncludeStyle
- A string specifying which include-style is used, `llvm` or `google`. Default
- is `llvm`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
.. option:: AbseilStringsMatchHeader
diff --git a/clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-str-contains.rst b/clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-str-contains.rst
index 042fbdb3f29a94..4eedd8c0b57f0a 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-str-contains.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/abseil/string-find-str-contains.rst
@@ -43,8 +43,7 @@ Options
.. option:: IncludeStyle
- A string specifying which include-style is used, `llvm` or `google`. Default
- is `llvm`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
.. option:: AbseilStringsMatchHeader
diff --git a/clang-tools-extra/docs/clang-tidy/checks/boost/use-ranges.rst b/clang-tools-extra/docs/clang-tidy/checks/boost/use-ranges.rst
index 4c032ad32f4fd8..847875b4df3b63 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/boost/use-ranges.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/boost/use-ranges.rst
@@ -162,8 +162,7 @@ Options
.. option:: IncludeStyle
- A string specifying which include-style is used, `llvm` or `google`. Default
- is `llvm`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
.. option:: IncludeBoostSystem
diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/avoid-do-while.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/avoid-do-while.rst
index 4b195c92e1f762..b5d0494b8c7ca2 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/avoid-do-while.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/avoid-do-while.rst
@@ -26,7 +26,8 @@ Options
.. option:: IgnoreMacros
- Ignore the check when analyzing macros. This is useful for safely defining function-like macros:
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
+ This is useful for safely defining function-like macros:
.. code-block:: c++
diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/init-variables.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/init-variables.rst
index 0465436234b13f..114c05fd6b5b44 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/init-variables.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/init-variables.rst
@@ -62,8 +62,7 @@ Options
.. option:: IncludeStyle
- A string specifying which include-style is used, `llvm` or `google`. Default
- is `llvm`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
.. option:: MathHeader
diff --git a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/pro-bounds-constant-array-index.rst b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/pro-bounds-constant-array-index.rst
index 4e877676cf1fe2..f267bd70cf3b09 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/pro-bounds-constant-array-index.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines/pro-bounds-constant-array-index.rst
@@ -24,5 +24,4 @@ Options
.. option:: IncludeStyle
- A string specifying which include-style is used, `llvm` or `google`. Default
- is `llvm`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc/uniqueptr-reset-release.rst b/clang-tools-extra/docs/clang-tidy/checks/misc/uniqueptr-reset-release.rst
index 8d48fa192e69fd..526037f519e106 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/misc/uniqueptr-reset-release.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/misc/uniqueptr-reset-release.rst
@@ -20,5 +20,4 @@ Options
.. option:: IncludeStyle
- A string specifying which include-style is used, `llvm` or `google`. Default
- is `llvm`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/loop-convert.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/loop-convert.rst
index 9aa655feb53389..a98e8b25947848 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/loop-convert.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/loop-convert.rst
@@ -169,8 +169,7 @@ lives.
.. option:: IncludeStyle
- A string specifying which include-style is used, `llvm` or `google`. Default
- is `llvm`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
Limitations
-----------
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/make-shared.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/make-shared.rst
index 9c1fceaa060002..cb6fbd4a7d30dc 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/make-shared.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/make-shared.rst
@@ -41,13 +41,11 @@ Options
.. option:: IncludeStyle
- A string specifying which include-style is used, `llvm` or `google`. Default
- is `llvm`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
.. option:: IgnoreMacros
- If set to `true`, the check will not give warnings inside macros. Default
- is `true`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
.. option:: IgnoreDefaultInitialization
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/make-unique.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/make-unique.rst
index cd474d352bac0d..762f8167c4692a 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/make-unique.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/make-unique.rst
@@ -41,13 +41,11 @@ Options
.. option:: IncludeStyle
- A string specifying which include-style is used, `llvm` or `google`. Default
- is `llvm`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
.. option:: IgnoreMacros
- If set to `true`, the check will not give warnings inside macros. Default
- is `true`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
.. option:: IgnoreDefaultInitialization
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/min-max-use-initializer-list.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/min-max-use-initializer-list.rst
index d6721a25629b05..da9b4ba3102ae3 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/min-max-use-initializer-list.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/min-max-use-initializer-list.rst
@@ -37,8 +37,7 @@ Options
.. option:: IncludeStyle
- A string specifying which include-style is used, `llvm` or `google`. Default
- is `llvm`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
.. option:: IgnoreNonTrivialTypes
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/pass-by-value.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/pass-by-value.rst
index e884cf3c4f5dfb..52b09dd08977da 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/pass-by-value.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/pass-by-value.rst
@@ -157,8 +157,7 @@ Options
.. option:: IncludeStyle
- A string specifying which include-style is used, `llvm` or `google`. Default
- is `llvm`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
.. option:: ValuesOnly
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/replace-auto-ptr.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/replace-auto-ptr.rst
index 87321316e000d0..4e0f60acb5a33c 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/replace-auto-ptr.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/replace-auto-ptr.rst
@@ -75,5 +75,4 @@ Options
.. option:: IncludeStyle
- A string specifying which include-style is used, `llvm` or `google`. Default
- is `llvm`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/type-traits.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/type-traits.rst
index c2abde856c90ff..bf418904f30007 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/type-traits.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/type-traits.rst
@@ -29,7 +29,7 @@ Options
.. option:: IgnoreMacros
- If `true` don't diagnose traits defined in macros.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
Note: Fixes will never be emitted for code inside of macros.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-bool-literals.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-bool-literals.rst
index 27cf79b6e3a8c7..0ca3d06b4cbee9 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-bool-literals.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-bool-literals.rst
@@ -24,5 +24,4 @@ Options
.. option:: IgnoreMacros
- If set to `true`, the check will not give warnings inside macros. Default
- is `true`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-default-member-init.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-default-member-init.rst
index 2d3ed380149373..339d4ec941f720 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-default-member-init.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-default-member-init.rst
@@ -50,5 +50,4 @@ Options
.. option:: IgnoreMacros
- If this option is set to `true` (default is `true`), the check will not warn
- about members declared inside macros.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-default.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-default.rst
index 7bd6fa93ba1ea1..c806a4b1a3af7d 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-default.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-default.rst
@@ -32,6 +32,7 @@ Options
.. option:: IgnoreMacros
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
If set to `true`, the check will not give warnings inside macros and will
ignore special members with bodies contain macros or preprocessor directives.
Default is `true`.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
index d354fcc6060ce2..499702283605c2 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-equals-delete.rst
@@ -41,5 +41,4 @@ for manually relocating functions to the ``public`` section.
.. option:: IgnoreMacros
- If this option is set to `true` (default is `true`), the check will not warn
- about functions declared inside macros.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-ranges.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-ranges.rst
index 1ce866ca1f66a0..041f58d6fee36b 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-ranges.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-ranges.rst
@@ -127,8 +127,7 @@ Options
.. option:: IncludeStyle
- A string specifying which include-style is used, `llvm` or `google`. Default
- is `llvm`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
.. option:: UseReversePipe
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-numbers.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-numbers.rst
index 207e9c00e74ba0..52389ab1fc525f 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-numbers.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-numbers.rst
@@ -70,5 +70,4 @@ Options
.. option:: IncludeStyle
- A string specifying which include-style is used, `llvm` or `google`. Default
- is `llvm`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-using.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-using.rst
index 32272a07994c22..9bf93ea88b105d 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-using.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-using.rst
@@ -43,8 +43,7 @@ Options
.. option:: IgnoreMacros
- If set to `true`, the check will not give warnings inside macros. Default
- is `true`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
.. option:: IgnoreExternC
diff --git a/clang-tools-extra/docs/clang-tidy/checks/performance/unnecessary-value-param.rst b/clang-tools-extra/docs/clang-tidy/checks/performance/unnecessary-value-param.rst
index cc5e1ae73508c5..daa2720adf668d 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/performance/unnecessary-value-param.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/performance/unnecessary-value-param.rst
@@ -59,8 +59,7 @@ Options
.. option:: IncludeStyle
- A string specifying which include-style is used, `llvm` or `google`. Default
- is `llvm`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
.. option:: AllowedTypes
diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/avoid-const-params-in-decls.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/avoid-const-params-in-decls.rst
index b1146e9da79ba4..033c39a666f367 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/readability/avoid-const-params-in-decls.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability/avoid-const-params-in-decls.rst
@@ -21,5 +21,4 @@ Options
.. option:: IgnoreMacros
- If set to `true`, the check will not give warnings inside macros. Default
- is `true`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/const-return-type.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/const-return-type.rst
index ec81d46750d443..59e3a6ddc4a91e 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/readability/const-return-type.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability/const-return-type.rst
@@ -31,5 +31,4 @@ Options
.. option:: IgnoreMacros
- If set to `true`, the check will not give warnings inside macros. Default
- is `true`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/function-cognitive-complexity.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/function-cognitive-complexity.rst
index ffd2b2c68c8d23..fa8aa93ac27a1a 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/readability/function-cognitive-complexity.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability/function-cognitive-complexity.rst
@@ -26,8 +26,9 @@ Options
.. option:: IgnoreMacros
- If set to `true`, the check will ignore code inside macros. Note, that also
- any macro arguments are ignored, even if they should count to the complexity.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
+ Note, that also any macro arguments are ignored, even if they should count
+ to the complexity.
As this might change in the future, this option isn't guaranteed to be
forward-compatible. Default is `false`.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/inconsistent-declaration-parameter-name.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/inconsistent-declaration-parameter-name.rst
index 95341d52da4f62..2ca5656511fda7 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/readability/inconsistent-declaration-parameter-name.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability/inconsistent-declaration-parameter-name.rst
@@ -54,8 +54,7 @@ the definition or the first declaration seen in a translation unit.
.. option:: IgnoreMacros
- If this option is set to `true` (default is `true`), the check will not warn
- about names declared inside macros.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
.. option:: Strict
diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-casting.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-casting.rst
index 23eaa225f03a3c..2718542f349b2f 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-casting.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-casting.rst
@@ -27,8 +27,7 @@ Options
.. option:: IgnoreMacros
- If set to `true`, the check will not give warnings inside macros. Default
- is `true`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
.. option:: IgnoreTypeAliases
diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-declaration.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-declaration.rst
index 2a7ecac73c4c1a..b12011e88da442 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-declaration.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-declaration.rst
@@ -33,5 +33,4 @@ Options
.. option:: IgnoreMacros
- If set to `true`, the check will not give warnings inside macros. Default
- is `true`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-smartptr-get.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-smartptr-get.rst
index 20851b0acad974..7635c8aad1bc6e 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-smartptr-get.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability/redundant-smartptr-get.rst
@@ -17,5 +17,5 @@ Examples:
.. option:: IgnoreMacros
- If this option is set to `true` (default is `true`), the check will not warn
- about calls inside macros.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
+
diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/simplify-boolean-expr.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/simplify-boolean-expr.rst
index 3d00d5b043a60e..337c4b4cbe8059 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/readability/simplify-boolean-expr.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability/simplify-boolean-expr.rst
@@ -84,8 +84,7 @@ Options
.. option:: IgnoreMacros
- If `true`, ignore boolean expressions originating from expanded macros.
- Default is `false`.
+ See :doc:`global options <clang-tidy/GlobalOptions>`.
.. option:: ChainedConditionalReturn
diff --git a/clang-tools-extra/docs/clang-tidy/checks/readability/uppercase-literal-suffix.rst b/clang-tools-extra/docs/clang-tidy/checks/readability/uppercase-literal-suffix.rst
index f2809dbc0b5f9a..3cb4c2da7b8d7f 100644
--- a/clang-tools-extra/docs/clang-tidy/checks/readability/uppercase-literal-suffix.rst
+++ b/clang-tools-extra/docs/clang-tidy/checks/readability/uppercase-literal-suffix.rst
@@ -52,5 +52,4 @@ Given a list `L;uL`:
.. option:: IgnoreMacros
- If this option is set to `true` (default is `true`), the check will not warn
- about literal suffixes inside macros....
[truncated]
|
9554b38
to
cbb2948
Compare
A string specifying which include-style is used, `llvm` or `google`. Default | ||
is `llvm`. | ||
|
||
.. option:: IgnoreMacros |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this one should not be global. The same is done for clang warnings. Sometimes it may make sense to ignore macros, sometimes not, depending on the check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according to current implement of clangtidy, lots of checks will read ignores macros from global scope. i don't think it is a good idea to change lots of checks behavior.
maybe i can notices something in this file to explain global option doesn't apply for every check?
If set to `true`, the check will not give warnings inside macros. Default | ||
is `true`. | ||
|
||
.. option:: StrictMode |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This option does not have any meaning in this context. Therefore I believe it should be kept local.
@@ -26,7 +26,8 @@ Options | |||
|
|||
.. option:: IgnoreMacros | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I don't see much benefit in this change, it makes the documentation harder to read as one has to go back and forth. I don't see the trouble with this duplication, since it's not really a problem if the sentences don't match exactly with each other - it does not add maintenance cost.
Sometimes DRY can cause more trouble that it's worth - a bit of duplication makes sense in benefit of usability and readability.
But #113577 is still open. Also local |
I think the confusion comes from calling these "Global Options". They are not global, they "exist in multiple checks", however they can (and probably should) change independently of each other. My understanding is that the scope of this NFC patch is to DRY the documentation and put it in a common place like we do with regular code. Like I wrote in the code comments, I don't believe we should DRY the documentation, as it makes it less usable. The clearest issue to tackle IMO would be #113577 |
but in code level, we already use the getLocalOrGlobal. but unfortunately, i don't find any description about it. we should have the relative clean map between what we did in code and what we write in doc. |
They use getLocalOrGlobal probably by mistake, copy-pasting existing code. We should document what we believe makes sense, and fix the implementation accordingly. The current documentation says these options are check-specific, so users should be using them per-check instead of globally. Thus, we wouldn't break users if we change the implementation. So I would vote for replacing the getLocalOrGlobal with getLocal instead. If we believe the current implementation is faulty, and document that implementation, then we'll have a much harder time to refactor the implementation to what we want (since by documenting, we "promise" a behavior). I remember now that the true global options are documented here: So if we create more global options (like |
It could also be that |
then I think the only option worth to promote is include style. |
The list of clang-tidy checks <checks/list> | ||
The list of clang-tidy global options <GlobalOptions> | ||
Clang-tidy IDE/Editor Integrations <Integrations> | ||
Getting Involved <Contributing> | ||
External Clang-Tidy Examples <ExternalClang-TidyExamples> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a drive-by comment, noticed this list sometimes uses clang-tidy, sometimes Clang-Tidy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the root cause is the style of titles. Some titles uppercase each word some not.
It looks like in clang/docs, most of rst files' titles use uppercase each word.
This PR is not in the correct way. see https://discourse.llvm.org/t/rfc-global-option-rules-for-clang-tidy/83647 |
Uppercase each word in title and toctree _Originally posted by @nicovank in llvm#119842 (comment).
) Uppercase each word in title and toctree _Originally posted by @nicovank in #119842 (comment). --------- Co-authored-by: Nicolas van Kempen <[email protected]>
No description provided.