The excluded directories aren't being properly handled in the py2/py3 compat
linters. In order for FileFinder to apply the exclusions properly they need
to either be relative to or contained by the base.
This means that currently the following will work:
./mach lint -l py2 <topsrcdir>
./mach lint -l py2 testing/mochitest
But this is broken:
./mach lint -l py2 testing
This change fixes the compat linters so exclude paths will be made relative
to the FileFinder base before passing them in. Any exclude not contained by
the base is simply discarded as it won't be relevant to that FileFinder
instance anyway.
MozReview-Commit-ID: LJx97TvKlSa
--HG--
extra : rebase_source : b8f0cb20ec5a88a33c26ace699ed9216b070f443
check_compat.py was adapted from gps' check-py3-compat.py in mercurial:
https://www.mercurial-scm.org/repo/hg/file/tip/contrib/check-py3-compat.py
The py3 linter simply runs ast.parse(f) for each file being linted. Any syntax errors
are formatted as mozlint results and dumped to stdout as json. I looked into also
importing the file (using 3.5+'s importlib.util.spec_from_file_location), but there
were too many problems:
1. Lots of false positives (e.g module not found)
2. Some files seemed to run indefinitely on import
I decided to punt on importing for now, we can always investigate in a follow-up.
The py2 linter runs ast.parse(f), and also checks that the file has:
from __future__ import absolute_import, print_function
Initially every python file in the tree is excluded from the py2 check, though
at least this makes it easy to find+fix, and new files in un-excluded
directories will automatically be linted.
MozReview-Commit-ID: ABtq9dnPo9T
--HG--
extra : rebase_source : 60762937284d498514cd020b90cbfd2ba23f0b70
This will allow us keep python related linting files in the same place.
MozReview-Commit-ID: ABtq9dnPo9T
--HG--
rename : tools/lint/flake8_/__init__.py => tools/lint/python/__init__.py
rename : tools/lint/flake8_/__init__.py => tools/lint/python/flake8.py
rename : tools/lint/flake8_/flake8_requirements.txt => tools/lint/python/flake8_requirements.txt
extra : rebase_source : 2568bc0bf8f4adbf8e0be73a54d5da068a8d81b0
This allows .flake8 files to override one another, and fixes a pretty bad known
bug with our flake8 implementation. For example, say we have a .flake8 file at:
/foo/.flake8
Before this patch, if we ran |mach lint foo/bar|, the configuration defined in
that .flake8 file wouldn't get picked up. It would only work if running the
specific directory that contains it, e.g |mach lint foo|.
This change additionally allows multiple .flake8 files to be used. So if
there's one defined at both:
/.flake8
/foo/.flake8
Then running |mach lint foo/bar| will first apply the root .flake8, then the
one under /foo (overriding earlier configuration).
This bug still doesn't make flake8 configuration perfect though. Any directory
containing a .flake8 file still needs to be explicitly listed in the "include"
section of /tools/lint/flake8.yml. Otherwise in the example above, if running
|mach lint /|, it wouldn't be able to find /foo/.flake8. This is a hard problem
and is likely best solved by fixing flake8's upstream configuration handling.
Unfortunately this means we still can't switch from a whitelist to a blacklist.
MozReview-Commit-ID: 3DZAi1QHYYo
--HG--
extra : rebase_source : 51298c5847f6c2792581d9b312c87b70fa716ee1
There's a lot of overhead to loading scripts from <script> tags in
browser.xul. They're loaded asynchronously, and can't begin loading until
after we begin loading browser.xul. They're loaded using off-main-thread
compilation, which means we need to create and merge a new JS zone for each
script we load that way. They don't benefit from the startup cache at all.
If we load those scripts using the subscript loader, they're loaded from the
preloader cache, and begin loading as early as possible. And they're all
loaded into a single off-thread zone, which means there are less zones to
create and merge. From a quick test, this seems to save about 20-40ms on
Windows ts_paint talos runs.
The main downside is that subscript loader scripts don't benefit from lazy
parsing, so we might wind up increasing memory usage if most of the functions
in those scripts aren't used very often. But we should hopefully be able to
fix that by migrating more browser JS to lazy loading.
MozReview-Commit-ID: Lozb0d0QweC
--HG--
extra : rebase_source : 069a003dfd1d6d66540da814a1fd19742c4fca26
extra : amend_source : b93e0ef7b320c99f4a27ddf6e8af6a681b6dba0f
This makes configuration files for yamllint work a bit better. It's still not perfect, but it's an improvement
on the current situation.
MozReview-Commit-ID: IKxgQm1a7bP
--HG--
extra : rebase_source : 051fafe21337f0557ee39ec71c90e74fd61d3da7
We should have CI Lint YAML files in the tree.
MozReview-Commit-ID: F8hTBerSNIj
--HG--
extra : rebase_source : 87f84b855f29b5625bacae5c199d99d144c02bc8
We should have CI Lint YAML files in the tree.
MozReview-Commit-ID: ATX5IOK747y
--HG--
extra : rebase_source : c7a5a0e7a33a6a52ec92d6d6fd8a7c35bfdfa5c0
We should have CI Lint YAML files in the tree.
MozReview-Commit-ID: IMOKGhxKFJW
--HG--
extra : rebase_source : 8c695dcb3a81b6683bc76ba663feeacb3126691e
We should have CI Lint YAML files in the tree.
MozReview-Commit-ID: 758kdSddjJN
--HG--
extra : rebase_source : d538b8400a92d14ab6b397f33327619e885106cc
We should have CI Lint YAML files in the tree.
MozReview-Commit-ID: L83j6SODA3w
--HG--
extra : rebase_source : afb1a26e4a6819fc326f3bd1e9b856d6104597a8
We should have CI Lint YAML files in the tree.
MozReview-Commit-ID: HYVWXzNnnzG
--HG--
rename : tools/lint/flake8_/__init__.py => tools/lint/yamllint_/__init__.py
extra : rebase_source : f4919be1341f6081b99d8b122004f9c2978cc677
We should have CI Lint YAML files in the tree.
MozReview-Commit-ID: F8hTBerSNIj
--HG--
extra : rebase_source : 2d1d3d8d98fd3f0abe3494c49ad01072181c4e08