We need to keep util.py python 2 compatible. The Python 3 helper class
that's used to generate conditioned profiles is moved to its own
module and we're reactivating util.py in flake8
Differential Revision: https://phabricator.services.mozilla.com/D46259
--HG--
extra : moz-landing-system : lando
The current setup, where gtest/libxul uses the static library in
the same directory as the shared libxul, and somehow the backend ignores
gkrust for gtest/libxul, is fragile.
Differential Revision: https://phabricator.services.mozilla.com/D42246
--HG--
rename : toolkit/library/dependentlibs.py => toolkit/library/build/dependentlibs.py
extra : moz-landing-system : lando
Leaving one fix for an explicit review.
Lint python/mozbuild/{mozbuild,mozpack}. r=#build
Differential Revision: https://phabricator.services.mozilla.com/D26641
--HG--
extra : moz-landing-system : lando
Leaving one fix for an explicit review.
Lint python/mozbuild/{mozbuild,mozpack}. r=#build
Differential Revision: https://phabricator.services.mozilla.com/D26641
--HG--
extra : rebase_source : e14d7762c7802d98e24ee8f86b0167d96666d288
extra : intermediate-source : 79b0d1678dd2f6aadf60f480d902ddeca4a52c3a
extra : source : faadf440e7d7b0a8c473e2dee3fc90b27023814a
Before this change linting python/mozbuild brought about many errors. Some of this errors could be fixed using |mach lint --fix|. The remaining errors where fixed in this bug.
Differential Revision: https://phabricator.services.mozilla.com/D20138
--HG--
extra : rebase_source : 8bd3d622d2221b981f08b8a080c1198b002cdc49
extra : amend_source : 3f6a70c1b7104a7c2d83e11fe911942771e331ea
This ensures that the default for new python files is to be linted by flake8.
Depends on D20496
Differential Revision: https://phabricator.services.mozilla.com/D20497
--HG--
extra : moz-landing-system : lando
This allows us to only skip the "unused import" config in these files rather
than the entire thing. This also removes the only two uses of "**" in the
exclusion rules which made things a bit simpler for me later on in the series.
Differential Revision: https://phabricator.services.mozilla.com/D20493
--HG--
extra : moz-landing-system : lando
This removes all .flake8 files except for the one at the root of the repo.
Instead we use the new 'per-file-ignores' config introduced in 3.7. To ignore
specific errors in a subdirectory, add a line like this to the root .flake8:
[per-file-ignores]
path/to/subdir/*: E100, F200, ...
The reasons for this change are:
1. Unblock flake8 blacklist (bug 1367092).
2. Simplify configuration and code.
3. Encourage more consistent styling.
4. Improve performance.
5. Greater editor consistency.
Differential Revision: https://phabricator.services.mozilla.com/D18354
--HG--
extra : moz-landing-system : lando
This bumps flake8 to version 3.7.5.
This also ignores the new lint rules that were added in the new versions.
These rules are de-marked via comment so we know that they should be enabled at
some point (as opposed to the other rules that are (presumably) ignored
intentionally.
Differential Revision: https://phabricator.services.mozilla.com/D18353
--HG--
extra : moz-landing-system : lando
With `ac_add_options --enable-project=tools/crashreporter` in a
mozconfig, `./mach build` builds minidump_stackwalk, dump_syms
and fileid.
One caveat is that due to limitation in how the build system works
currently, it's cumbersome to keep dump_syms as a host program for
Gecko, and to make it a target program for this project. For now,
keep it as a host program. We're not going to use it on automation,
but it's still convenient to have for quick local builds (I've had
to resort to awful hacks downstream).
Differential Revision: https://phabricator.services.mozilla.com/D16299
--HG--
extra : moz-landing-system : lando
The ipc/chromium tree has been forked from its former upstream and
heavily modified, so it's safe to reformat and lint.
However, ipc/chromium/src/third_party (a copy of libevent) is following
its upstream, so that should remain exempt.
Differential Revision: https://phabricator.services.mozilla.com/D12498
--HG--
extra : moz-landing-system : lando
Now autotest does not require java to be installed, but
it will let the user know that infer is not being tested if java
is missing.
Differential Revision: https://phabricator.services.mozilla.com/D7326
--HG--
extra : moz-landing-system : lando
We're supposed to be linting both .py and .configure files with flake8. However
we never inform flake8 of this fact.
So e.g running:
./mach lint -l flake8 mobile/android
Will not lint mobile/android/gradle.configure. However since flake8 will run on
a file regardless of its extension if you pass that file in directly, it means
that running:
./mach lint -l flake8 mobile/android/gradle.configure
*Will* cause the file to be linted (and subsequently fail). This fix makes sure
that flake8 knows to look at .configure files in addition to .py. Since this
means many .configure files around the tree will start getting linted for the
first time, we need to exclude them until they can be fixed.
Differential Revision: https://phabricator.services.mozilla.com/D1975
--HG--
extra : moz-landing-system : lando
This essentially tests tools/lint/python/flake8.py. Though it also adds
a basic framework for testing all the other linters as well. Getting this
added now will allow others to collaborate on adding more tests without
needing to get to 100% coverage for all linters right off the bat.
All python tests under tools/lint/test will run as part of the 'ml' task
on Linux, and the build task on Windows (OSX coverage is currently missing
for python tests).
The flake8 linter currently has a bug where the 'exclude' argument is
ignored. This is why we need to also exclude 'tools/lint/test/files' in
topsrcdir/.flake8, even though it is already listed in the
'mach_commands.py'. Other linters shouldn't need to do this, the exclusion
in 'mach_commands.py' should be good enough. See bug 1277851 for more
details.
MozReview-Commit-ID: 9ho8C83eeuj
--HG--
extra : rebase_source : 0adb01aa81c06f26cb891ae9f92a17f8f9fdf111
This is a new issue that gets linted with flake8 3.5.0. Basically you should
never use a blank except: statement.
This will catch all exceptions, including KeyboardInterrupt and SystemExit
(which is likely not intended). If a catch all is needed, use
`except: Exception`. If you *really* mean to also catch KeyboardInterrupt et
al, use `except: BaseException`.
Of course, being specific is often better than a catch all.
MozReview-Commit-ID: FKx80MLO4RN
--HG--
extra : rebase_source : 7c74a7d0d81f2c984b47aff3a0ee3448b791177b
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
This also adds E402 (no imports at top of file) to the global ignore list. The
other error codes added were previously ignored by default, but now that we
have started a custom ignore list, need to be listed explicitly.
MozReview-Commit-ID: RtMuVEX6i5
--HG--
extra : rebase_source : 939bc9354f5891c680513d7e9068d0438e169132
If you run |mach eslint| it will install a bunch of eslint related node_modules. Some of these
modules have '.lint' files in them which erroneously get picked up by the flake8 linter. This
patch makes sure that bare '.lint' files do not get included, they must have some kind of file
name first.
MozReview-Commit-ID: IvBfErnV6jm
--HG--
extra : rebase_source : f8d7aea88a68d830b06c4591ac6862b02554d21c
For now, only the following two directories will be linted:
python/mozlint
tools/lint
New directories can be added by adding them to the 'include'
directive in tools/lint/flake8.lint. They all default to the
configuration specified in topsrcdir/.flake8. Subdirectories
can override this configuration by creating their own .flake8
file.
MozReview-Commit-ID: Eag48Lnkp3l
--HG--
extra : rebase_source : 6d98c9fef80055a48cc2622848aa04c3045b747e