[PATCH] D127446: [clang-tidy] Add `-verify-config` command line argument

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 21 09:24:29 PDT 2022


aaron.ballman added a comment.

Thanks for this, it seems like an interesting feature!



================
Comment at: clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp:263
+Check the config files to ensure each check and
+option is recognised.
+)"),
----------------



================
Comment at: clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp:436
+        llvm::WithColor::error(llvm::errs(), Source)
+            << "building CheckGlob '" << Cur << "' " << Error << "'\n";
+        continue;
----------------
`Building check glob` instead?


================
Comment at: clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp:450
+      llvm::raw_ostream &Output = llvm::WithColor::warning(llvm::errs(), Source)
+                                  << "Unknown Check '" << Cur << '\'';
+      llvm::StringRef Closest = closest(Cur, AllChecks);
----------------
`Unknown check` instead?


================
Comment at: clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp:573
+            llvm::WithColor::warning(llvm::errs(), OptionWithSource.second)
+            << "Unknown Check Option '" << Key << '\'';
+        llvm::StringRef Closest = closest(Key, Valid.Options);
----------------
`Unknown check option` instead?


================
Comment at: clang-tools-extra/test/clang-tidy/infrastructure/verify-config.cpp:12
+
+// CHECK-VERIFY-DAG: command-line option '-config': warning: Unknown Check 'readability-else-after-ret'; did you mean 'readability-else-after-return'
+// CHECK-VERIFY-DAG: command-line option '-config': warning: Unknown Check Option 'modernize-lop-convert.UseCxx20ReverseRanges'; did you mean 'modernize-loop-convert.UseCxx20ReverseRanges'
----------------
It's unfortunate that `warning: ` appears in the middle of the diagnostic as opposed to at the start. I wonder if this can be reworked to say: `warning: Unknown check 'whatever'; did you mean 'whatever'? [-verify-config]` or something?

Also, no test coverage for the error case and for the unknown check case where there's no closest match worth talking about.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127446



More information about the cfe-commits mailing list