Closed Bug 1411004 Opened 2 years ago Closed 2 years ago
mach clang-format doesn't respect .clang-format-ignore
59 bytes, text/x-review-board-request
This is a recent regression, not sure what is going on. As example: $ ./mach clang-format -p config/ config/gcc-stl-wrapper.template.h should not be touched
Actually, the command "./mach clang-format -p config/" is fine but "./mach clang-format -p ./config/" is not
Attachment #8923493 - Flags: review?(nika)
Comment on attachment 8923493 [details] Bug 1411004 - ./mach clang-format: Better handling of relative paths =mystor https://reviewboard.mozilla.org/r/194630/#review200032 r=me, but if this doesn't work when running ./mach clang-format outside of topsrcdir I'd love a follow up to fix that :-). ::: tools/mach_commands.py:308 (Diff revision 1) > for line in open(pathToThirdparty): > # Remove comments and empty lines > if line.startswith('#') or len(line.strip()) == 0: > continue > - ignored_dir.append(line.rstrip()) > + # The regexp is to make sure we are managing relative paths > + ignored_dir.append("^[\./]*" + line.rstrip()) So, this doesn't perfectly manage relative paths, it only handles ./foo/bar, foo/bar. ././foo/bar, right? I'm worried a bit about trying to run clang-format from a directory other than $topsrcdir. Do these path whitelists just stop working if we do that?
Attachment #8923493 - Flags: review?(nika) → review+
(In reply to Nika Layzell [:mystor] from comment #4) > So, this doesn't perfectly manage relative paths, it only handles ./foo/bar, > foo/bar. ././foo/bar, right? It doesn't indeed. We discussed about that with Calixte but felt that it wasn't a comment pattern. Are we wrong? Thanks for the review
Pushed by firstname.lastname@example.org: https://hg.mozilla.org/integration/autoland/rev/31f259ee387b /mach clang-format: Better handling of relative paths r=mystor=mystor
(In reply to Sylvestre Ledru [:sylvestre] from comment #5) > It doesn't indeed. > We discussed about that with Calixte but felt that it wasn't a comment > pattern. Are we wrong? > > > Thanks for the review I don't think it's super common to run outside of topsrcdir, but it might be good to at least fail gracefully in that situation.
Backed out for failing flake8 at tools/mach_commands.py:307:14 | indentation is not a multiple of four: https://hg.mozilla.org/integration/autoland/rev/19f207add6c8ba25e25273e807a9fff22fa41b84 Push with failure: https://treeherder.mozilla.org/#/jobs?repo=autoland&revision=31f259ee387b61199ae3ea2f92d68fea45d88db2&filter-resultStatus=testfailed&filter-resultStatus=busted&filter-resultStatus=exception&filter-resultStatus=runnable&filter-resultStatus=retry&filter-resultStatus=usercancel Failure log: https://treeherder.mozilla.org/logviewer.html#?job_id=141073039&repo=autoland
Pushed by email@example.com: https://hg.mozilla.org/integration/autoland/rev/e1b4f786f584 /mach clang-format: Better handling of relative paths r=mystor=mystor
You need to log in before you can comment on or make changes to this bug.