[PATCH] D89936: [clang-tidy] adding "--config-file=<file-path>" to specify custom config file.

Dmitry Polukhin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 29 04:35:48 PDT 2020


DmitryPolukhin added a comment.

In D89936#2361580 <https://reviews.llvm.org/D89936#2361580>, @njames93 wrote:

> It's also be nice if --config-file would also support being passed a directory. If a directory was passed it would append ".clang-tidy" to the path and load that file, WDYT?

It might be misleading what "InheritParentConfig: true" in the file means in this case. Current implementation that it will use directory structure of the source file and I think it is right approach. I would prefer to keep things simple and straightforward: `--config-file` should be file and it is simple helper for `--config` for the cases when you cannot use shell power to read file content to the command line or you exceed limit on command line length.



================
Comment at: clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp:320-324
+    if (!Checks.empty()) {
+      llvm::errs() << "Error: --config-file and --checks are mutually "
+                      "exclusive. Specify only one.\n";
+      return nullptr;
+    }
----------------
njames93 wrote:
> I disagree with this check here, `Config` is not mutually exclusive with `Checks`, `Checks` gets applied atop of `Config`. So the same should happen when using `ConfigFile` with `Checks`
+1


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89936/new/

https://reviews.llvm.org/D89936



More information about the cfe-commits mailing list