Clang-tidy header-filter regex: Makefile -> .clang-tidy

Viewed 5432

I'm attempting to move the hardcoded config option of clang-tidy from our Makefile to a .clang-tidy YAML file. As of now, we call run-clang-tidy-6.0.py as such:

# Run clang-tidy. The header filter includes files in the foo and bar/baz directories
# but it excludes files ending in .g.h (auto-generated headers).
run-clang-tidy-6.0.py -header-filter='.*(foo|bar\/baz).*(?<!\.g\.h)$$' > clang-tidy-output.txt

This works fine. But if I have HeaderFilterRegex: '.*(foo|bar\/baz).*(?<!\.g\.h)$$' in .clang-tidy, the filtering doesn't work as expected.

I attempted various things surrounding what characters were escaped / not escaped as I know Make and YAML have different expectations but I can't get it just right. i.e:

  • Replace $$ -> $
  • Double escaping \ ( \ -> \\)
  • Removing '' Could someone explain to me the appropriate format of this regex in a YAML file?
0 Answers
Related