Closed Bug 1391231 Opened 6 years ago Closed 6 years ago
Use the list provided by .clang-format-ignore instead of only thirdpartypath
59 bytes, text/x-review-board-request
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: https://reviews.llvm.org/rL310778 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 https://reviewboard.mozilla.org/r/169636/#review175392 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/mach_commands.py:293 (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 firstname.lastname@example.org: https://hg.mozilla.org/integration/autoland/rev/b6c847346cb6 Use the list provided by .clang-format-ignore instead of only thirdpartypath.txt r=gps
You need to log in before you can comment on or make changes to this bug.