Closed Bug 1398765 Opened 4 years ago Closed 4 years ago
py2/py3 linters don't exclude directories properly
59 bytes, text/x-review-board-request
Currently the py2 and py3 linters use a big blacklist to exclude directories. For example, testing/mochitest is excluded, and if you run any of: ./mach lint -l py2 . ./mach lint -l py2 testing/mochitest The exclusion is properly detected and the linter passes. But if you run: ./mach lint -l py2 testing The exclusion is not picked up and mochitest files will be linted (and fail). This is happening because in FileFinder, the base is '/path/to/src/testing' but the exclusion is 'testing/mochitest'. This means we ultimately end up calling: mozpack.match('mochitest/runtests.py', 'testing/mochitest') This doesn't match up. To fix this, we need to preprocess the exclusions so they are relative to whatever FileFinder.base is (and discard exclusions that are outside of the base). I suspect this is something that would ideally be handled in FileFinder itself, but I'm afraid to change too much there as a ton of stuff depends on it. Plus solving it generically will involve thinking about a whole bunch of edge cases. I'd rather just solve this in the compat linter for now.
Comment on attachment 8906684 [details] Bug 1398765 - Fix directory exclusion bug in py-compat linters, https://reviewboard.mozilla.org/r/178392/#review183954 LGTM. There may be a pre-existing bug in here where a file can occur multiple times in ``files`` due to matching multiple patterns. But that's for another patch.
Attachment #8906684 - Flags: review?(gps) → review+
Pushed by firstname.lastname@example.org: https://hg.mozilla.org/integration/autoland/rev/237a3f842dc1 Fix directory exclusion bug in py-compat linters, r=gps
You need to log in before you can comment on or make changes to this bug.