Skip to content

clang-tidy header filter fails with regex #25590

Open
@gnzlbg

Description

@gnzlbg
mannequin
Bugzilla Link 25216
Version unspecified
OS Linux

Extended Description

I'm passing

-header-filter="^((?!ThisNeverMatches).)*$"

so that clang-tidy matches all files whose path does not contain ThisNeverMatches in them.

That is:

home/files/foo.hpp (matches)
home/files/ThisNeverMatches.hpp (doesn't match)
home/files/ThisNeverMatches/foo.hpp (doesn't match)
home/files/ThisNeverMatches-1.2/foo.hpp (doesn't match)
home/files/ThisNeverMatches-1.2.hpp (doesn't match)

Clang-tidy doesn't display any errors for the regex, and it doesn't show any warnings for any files...

So that's the bug.

Here are some other related things that could be improved:

  • it is not clear which kind of regex clang-tidy expects (there are a lot of different varieties, with and without lookahead). This should be documented.
  • it is not clear if the regex is applied to the absolute file path, some relative file path, or only to the file name. This should be documented.
  • writing a regex that doesn't match something is much harder than writing a regex for matching something. It would be better if there also was a -header-remove=regex that allows writing a patter to remove some headers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang-tidyenhancementImproving things as opposed to bug fixing, e.g. new or missing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions