[PATCH] D120385: [clang-tidy][run-clang-tidy.py] Mutual exclusion of -config and -config-file

Shreyas via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 22 21:09:41 PST 2022


SAtacker created this revision.
SAtacker added a reviewer: JonasToth.
Herald added subscribers: carlosgalvezp, xazax.hun.
SAtacker published this revision for review.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

Depends on D120331 <https://reviews.llvm.org/D120331>

- Ensures that both options -config and -config-file exclude each other

Signed-off-by: Shreyas Atre <shreyasatre16 at gmail.com>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120385

Files:
  clang-tools-extra/clang-tidy/tool/run-clang-tidy.py


Index: clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
===================================================================
--- clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+++ clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
@@ -225,7 +225,8 @@
   parser.add_argument('-checks', default=None,
                       help='checks filter, when not specified, use clang-tidy '
                       'default')
-  parser.add_argument('-config', default=None,
+  group = parser.add_mutually_exclusive_group()
+  group.add_argument('-config', default=None,
                       help='Specifies a configuration in YAML/JSON format: '
                       '  -config="{Checks: \'*\', '
                       '                       CheckOptions: [{key: x, '
@@ -233,9 +234,9 @@
                       'When the value is empty, clang-tidy will '
                       'attempt to find a file named .clang-tidy for '
                       'each source file in its parent directories.')
-  parser.add_argument('-config-file', default=None,
+  group.add_argument('-config-file', default=None,
                       help='Specify the path of .clang-tidy or custom config'
-                      'file: e.g. -config-file=/some/path/myTidyConfigFile'
+                      ' file: e.g. -config-file=/some/path/myTidyConfigFile'
                       'This option internally works exactly the same way as'
                       '-config option after reading specified config file.'
                       'Use either -config-file or -config, not both.')


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120385.410703.patch
Type: text/x-patch
Size: 1564 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220223/1e0a3925/attachment.bin>


More information about the cfe-commits mailing list