Search code examples
clang-tidy

No `-line-filter` equivalent in clang-tidy config?


I want to configure my -line-filter= arguments in the .clang-tidy file instead of in a cmake source file where the command is generated. Adding a LineFilter key to the file only gets me a "unknown key" error. Is this really not supported via the config file? Is there an alternative option?


Solution

  • Unfortunately this is not supported, see source of ClangTidyOptions.h

    /// Global options. These options are neither stored nor read from
     /// configuration files.
     struct ClangTidyGlobalOptions {
       /// Output warnings from certain line ranges of certain files only.
       /// If empty, no warnings will be filtered.
       std::vector<FileFilter> LineFilter;
     };