Commit Graph

9 Commits

Author SHA1 Message Date
Andrew Halberstadt
f354075c7a Bug 1434430 - [flake8] Fix blank 'except' statements r=rwood
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
2018-01-31 14:32:08 -05:00
Andrew Halberstadt
2255a9eed7 Bug 1395126 - Support cascading configuration for flake8, r=bc
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
2017-08-29 17:32:31 -04:00
Andrew Halberstadt
958af4447e Bug 1288432 - Use new mozlint configuration for flake8 linter, r=bc
MozReview-Commit-ID: 9vC6lI2j5nS

--HG--
rename : tools/lint/flake8.lint.py => tools/lint/flake8_/__init__.py
rename : tools/lint/flake8/flake8_requirements.txt => tools/lint/flake8_/flake8_requirements.txt
extra : rebase_source : 1cc39782391fa15100bf0765c28f21eb11b115e4
2017-06-02 09:46:01 -04:00
James Graham
221562f1a8 Bug 1321956 - Disable flake8 check for 'visually indented line with same indent as next logical line', r=ahal
MozReview-Commit-ID: ChaHkeSDNY8
2016-12-08 09:53:21 -10:00
Prabhjyot Singh Sodhi
ebb9f983f1 Bug 1280571 - Add testing/mochitest to the flake8 linter, r=ahal
MozReview-Commit-ID: INBZaZzcPmF

--HG--
extra : rebase_source : c0ba416f110b2768fc744de0fbee21c765081400
2016-09-28 08:28:04 -04:00
Wes Kocher
765926408d Backed out changeset e1d144423657 (bug 1280571) for making leaks hard to diagnose a=backout CLOSED TREE 2016-09-21 16:56:50 -07:00
Prabhjyot Singh Sodhi
58b6130e52 Bug 1280571 - Add testing/mochitest to the flake8 linter, r=ahal
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
2016-09-21 08:49:46 -04:00
Andrew Halberstadt
0094830f2b Bug 1283129 - Flake8 linter is accidentally linting some eslint related .lint files, r=maja_zf
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
2016-06-29 10:37:27 -04:00
Andrew Halberstadt
b1445349ea Bug 1270506 - [mozlint] Add python flake8 linter, r=smacleod
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
2016-05-05 17:21:12 -04:00