Closed Bug 1391231 Opened 6 years ago Closed 6 years ago

Use the list provided by .clang-format-ignore instead of only thirdpartypath.txt


(Developer Infrastructure :: Source Code Analysis, enhancement)

Not set


(firefox57 fixed)

Tracking Status
firefox57 --- fixed


(Reporter: Sylvestre, Assigned: Sylvestre)


(Blocks 1 open bug)



(1 file)

The thirdparty list only contains thirdparty code but we also want to ignore some of our code.

As .clang-format-ignore also contains the content of thirdparthpath.txt, let's us this one (especially as we can use regexp now)
As an example:
$ ./mach clang-format -p dom/presentation/ toolkit/components/protobuf/  config/gcc-stl-wrapper.template.h
clang-format: Ignored third party code 'toolkit/components/protobuf/'
clang-format: Ignored third party code 'config/gcc-stl-wrapper.template.h'

I landed this patch upstream:
to have a better display in the tool
The ignore list will be also used when doing
./mach clang-format -p .
Comment on attachment 8898271 [details]
Bug 1391231 - Use the list provided by .clang-format-ignore instead of only thirdpartypath.txt

FWIW, the use of regular expressions for path matching as employed by ``.clang-ignore-patterns`` and used in this file hits scaling limits. I know because Mercurial has dealt with this problem on several fronts. glob based matching (using ``*``) to denote wildcards is much better (especially if you can limit the wildcard to only occurring at the end of the string). I'm not sure if this will be a problem for us. But it is worth mentioning just so it is on your radar.

::: tools/
(Diff revision 2)
> +        ignored_dir_re = '(%s)' % '|'.join(ignored_dir)
>          extensions = ('.cpp', '.c', '.h')
>          path_list = []
>          for f in paths:
> -            if f.startswith(ignored_dir):
> +            import re

You can move this to module level: this module is already imported elsewhere.
Attachment #8898271 - Flags: review?(gps) → review+
Pushed by
Use the list provided by .clang-format-ignore instead of only thirdpartypath.txt r=gps
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Product: Core → Firefox Build System
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.