Commit graph

140 commits

Author SHA1 Message Date
Geoff Brown
323a22df14 Bug 1858451 - Use subprocess instead of mozprocess in linters r=sylvestre
Convert mozprocess references in tools/lint to use subprocess instead: with this change, subprocess is used consistently throughout tools/lint. mozprocess is poorly maintained and can be easily replaced with modern subprocess.

Differential Revision: https://phabricator.services.mozilla.com/D190696
2023-10-16 13:24:46 +00:00
serge-sans-paille
a6838d00a5 Bug 1836901 - Use taskcluster-built python for source-test task r=glandium
Because we use an older version of Python than the one generally used on
the host system, this implied enforcing a few package requirements.

Differential Revision: https://phabricator.services.mozilla.com/D180057
2023-09-20 04:49:03 +00:00
Logan Rosen
f024d94b2b Bug 1786490 - reformat the tree using black 23.3.0 r=sylvestre,webdriver-reviewers,taskgraph-reviewers,whimboo,jmaher,ahal,perftest-reviewers,geckoview-reviewers,afinder,m_kato
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D186092
2023-09-06 16:14:30 +00:00
Logan Rosen
658caae5b1 Bug 1786490 - update to black 23.3.0 r=sylvestre,mach-reviewers,ahochheiden
Differential Revision: https://phabricator.services.mozilla.com/D186086
2023-09-06 16:14:29 +00:00
Sylvestre Ledru
9dde27ae07 no bug - mozlint/ruff: log.debug the arguments r=linter-reviewers,ahal DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D179371
2023-06-02 13:39:57 +00:00
az
a5c1b9b0e6 Bug 1822416 - Upgrade typed_ast package to 1.5.4 to fix compilation errors running ./mach lint with Python 3.11 r=sylvestre
Please see comments in bug report for more details. I'm unfamiliar with this part of the codebase / typed_ast, so hopefully somebody with more experience can take a look at this.

Differential Revision: https://phabricator.services.mozilla.com/D172611
2023-03-29 19:04:33 +00:00
Andrew Halberstadt
577c4dacfe Bug 1811850 - [lint] Fix ruff errors resulting from new configuration, r=webdriver-reviewers,perftest-reviewers,whimboo,sparky,firefox-build-system-reviewers,ahochheiden
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D172359
2023-03-20 13:06:28 +00:00
Andrew Halberstadt
82d9947901 Bug 1811850 - [lint] Replace pylint linter with ruff, r=linter-reviewers,marco
This is enabling the PLE and PLC rules across a much larger swatch of the code
base. The PLR and PLW are additionally enabled at the warning level (introduces
~2500 new warnings).

To avoid extraneous changes in people's patches, rules at the warning level are
excluded from --fix.

Differential Revision: https://phabricator.services.mozilla.com/D172358
2023-03-20 13:06:28 +00:00
Andrew Halberstadt
441546dc79 Bug 1811850 - [lint] Replace isort linter with ruff, r=taskgraph-reviewers,linter-reviewers,marco,jcristau
This results in some changes from our current `isort` configuration. I'm
unclear if it's because ruff isn't at 100% parity with isort, they choose
different defaults or if I missed some configuration.

Either way, the changes all look reasonable to me (see child commit), so I'm
inclined to just accept the new import format it imposes.

Differential Revision: https://phabricator.services.mozilla.com/D172348
2023-03-20 13:06:27 +00:00
Andrew Halberstadt
dd673c2fb2 Bug 1811850 - [lint] Replace flake8 linter with ruff, r=linter-reviewers,sylvestre
Ruff is a very fast linter implemented in Rust and it can act as a drop-in
replacement for flake8. When running the same set of rules across all files
in mozilla-central (without mozlint), flake8 takes 900 seconds whereas ruff
takes 0.9 seconds.

Ruff also implements rules from other popular Python linters such as pylint,
isort and pyupgrade. There are even plans to implement feature parity with
black in the future. Ultimately, it can become our one stop shop for all Python
linting and formatting.

This stack will swap out all our Python lint tools for ruff (excluding black
for now).

Differential Revision: https://phabricator.services.mozilla.com/D172313
2023-03-20 13:06:27 +00:00
Cristian Tuns
c1b52fd95e Backed out 5 changesets (bug 1811850) for causing linting bustages(bugzilla) CLOSED TREE
Backed out changeset e8fcfc7f8108 (bug 1811850)
Backed out changeset f8950d716c9e (bug 1811850)
Backed out changeset f650123cc188 (bug 1811850)
Backed out changeset d96f90c2c58b (bug 1811850)
Backed out changeset c3b0f9666183 (bug 1811850)
2023-03-16 22:16:30 -04:00
Andrew Halberstadt
d93be6a402 Bug 1811850 - [lint] Fix ruff errors resulting from new configuration, r=webdriver-reviewers,perftest-reviewers,whimboo,sparky,firefox-build-system-reviewers,ahochheiden
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D172359
2023-03-17 01:54:00 +00:00
Andrew Halberstadt
054d07c54f Bug 1811850 - [lint] Replace pylint linter with ruff, r=linter-reviewers,marco
This is enabling the PLE and PLC rules across a much larger swatch of the code
base. The PLR and PLW are additionally enabled at the warning level (introduces
~2500 new warnings).

To avoid extraneous changes in people's patches, rules at the warning level are
excluded from --fix.

Differential Revision: https://phabricator.services.mozilla.com/D172358
2023-03-17 01:54:00 +00:00
Andrew Halberstadt
8b4f890651 Bug 1811850 - [lint] Replace isort linter with ruff, r=taskgraph-reviewers,linter-reviewers,marco,jcristau
This results in some changes from our current `isort` configuration. I'm
unclear if it's because ruff isn't at 100% parity with isort, they choose
different defaults or if I missed some configuration.

Either way, the changes all look reasonable to me (see child commit), so I'm
inclined to just accept the new import format it imposes.

Differential Revision: https://phabricator.services.mozilla.com/D172348
2023-03-17 01:53:59 +00:00
Andrew Halberstadt
8a4d48a70d Bug 1811850 - [lint] Replace flake8 linter with ruff, r=linter-reviewers,sylvestre
Ruff is a very fast linter implemented in Rust and it can act as a drop-in
replacement for flake8. When running the same set of rules across all files
in mozilla-central (without mozlint), flake8 takes 900 seconds whereas ruff
takes 0.9 seconds.

Ruff also implements rules from other popular Python linters such as pylint,
isort and pyupgrade. There are even plans to implement feature parity with
black in the future. Ultimately, it can become our one stop shop for all Python
linting and formatting.

This stack will swap out all our Python lint tools for ruff (excluding black
for now).

Differential Revision: https://phabricator.services.mozilla.com/D172313
2023-03-17 01:53:58 +00:00
Marco Castelluccio
f69e697461 Bug 1801836 - Remove no longer necessary 'from __future__' imports. r=linter-reviewers,glandium,webdriver-reviewers,perftest-reviewers,geckoview-reviewers,jld,ahal,owlish,afinder DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D165395
2022-12-23 22:45:46 +00:00
Rob Lemley
90925f3d53 Bug 1806157 - Allow l10n linter to use a repository other than "gecko-strings". r=linter-reviewers,ahal
Moves the lint and setup functions to more generic versions that accept "locale"
and "repo" as arguments. Functions with the original names call these with the
module globals.
This will allow for the l10n linter configuration in comm-central to have just
lint and setup functions that pass appropriate values rather than duplicating
most of the code in this file. See bug 1799496.

Differential Revision: https://phabricator.services.mozilla.com/D164922
2022-12-22 22:17:32 +00:00
Erich Gubler
89db16af34 Bug 1806174: Fix R1705 lint for tools/lint/python/isort.py:33 r=linter-reviewers,sylvestre
Differential Revision: https://phabricator.services.mozilla.com/D164949
2022-12-16 22:33:15 +00:00
Sylvestre Ledru
5cf9e6300f Bug 1806109 - Update to pylint v2.15.8 r=linter-reviewers,marco DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D164912
2022-12-16 17:25:54 +00:00
Norisz Fay
081bdcdf0c Backed out changeset c41cb5ac4dbd (bug 1806098) for causing lint failures on lints.py, isort.py CLOSED TREE 2022-12-16 18:13:59 +02:00
Sylvestre Ledru
c55679e14a Bug 1806098 - Enable pylint on tools/lint/ & tools/moztreedocs/ r=jlorenzo,linter-reviewers,marco DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D164894
2022-12-16 14:07:46 +00:00
Marco Castelluccio
6217704534 Bug 1803510 - Set up isort as a separate linter. r=linter-reviewers,ahal DONTBUILD
This makes it possible to use the resolve all configs option and set up
different first party modules for different directories.

The downside is that configuration options (e.g. profile = black) have to
be repeated in every .isort.cfg file, because isort never merges configuration
files.

Differential Revision: https://phabricator.services.mozilla.com/D163567
2022-12-16 10:40:45 +00:00
Marco Castelluccio
de29bc2f0e Bug 1790816 - Reformat tools/ with isort. r=linter-reviewers,perftest-reviewers,sparky,sylvestre DONTBUILD
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D162660
2022-11-24 10:58:05 +00:00
Marco Castelluccio
4653814bfe Bug 1492495 - Add flake8-isort plugin to sort Python includes, with support for autofixing through isort. r=linter-reviewers,ahal
Differential Revision: https://phabricator.services.mozilla.com/D157320
2022-11-03 13:50:46 +00:00
Sylvestre Ledru
3de663bf52 Bug 1782696 - Update dependency pylint to v2.14.5 r=linter-reviewers,andi DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D153955
2022-08-23 09:55:19 +00:00
renovate[bot]
078e93eeac no bug - Update dependency colorama to v0.4.5 r=linter-reviewers,ahal DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D154874
2022-08-17 13:46:04 +00:00
Sylvestre Ledru
4def815e85 Bug 1784857 - be consistent in the mccabe version r=linter-reviewers,andi
Depends on D154642

Differential Revision: https://phabricator.services.mozilla.com/D154643
2022-08-15 20:09:06 +00:00
Sylvestre Ledru
a516a4f498 Bug 1784857 - Update to flake8 5.0.4 r=linter-reviewers,ahal
One of the argument has been renamed here:
8d3afe40e1

Depends on D154641

Differential Revision: https://phabricator.services.mozilla.com/D154642
2022-08-15 20:09:06 +00:00
Iulian Moraru
480242bffe Backed out changeset aac498e445a2 (bug 1782696) for causing py3 mozlint failures. CLOSED TREE 2022-08-09 14:40:44 +03:00
renovate[bot]
8c730122d1 Bug 1782696 - Update dependency pylint to v2.14.5 r=linter-reviewers,andi DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D153955
2022-08-09 09:18:00 +00:00
Sylvestre Ledru
961144a29f Bug 1762038 - mozlint: Update to pylint v2.13.5 r=linter-reviewers,ahal
Depends on D142376

Differential Revision: https://phabricator.services.mozilla.com/D142171
2022-08-01 17:29:20 +00:00
Iulian Moraru
a8bbd6fe08 Backed out 2 changesets (bug 1762038, bug 1762037) for causing py3 failures. CLOSED TREE
Backed out changeset 3aa4f53b5325 (bug 1762038)
Backed out changeset 275ed0b3da7b (bug 1762037)
2022-06-08 03:09:30 +03:00
Sylvestre Ledru
1f05a012cc Bug 1762038 - mozlint: Update to pylint v2.13.5 r=linter-reviewers,ahal
Depends on D142376

Differential Revision: https://phabricator.services.mozilla.com/D142171
2022-06-07 22:14:31 +00:00
Andrew Halberstadt
4e7c111145 Bug 1761502 - Make l10n linter error less scary when Mercurial doesn't exist, r=linter-reviewers,sylvestre
This case can happen for Git users.

Differential Revision: https://phabricator.services.mozilla.com/D143601
2022-04-14 13:02:50 +00:00
Mitchell Hentges
65ffc413f9 Bug 1761507: Bump typed-ast version r=ahal
This should resolve a `./mach lint` incompatibility with
Python 3.10.

Differential Revision: https://phabricator.services.mozilla.com/D142337
2022-03-29 19:14:08 +00:00
Mitchell Hentges
e913081903 Bug 1751795: Log more information if pip_install_requirements fails r=ahal
In addition to showing the `pip check` failure, also show:
* The `pip install --requirements ...` output
* The output of `pip list -v`
* The path to the `requirements.txt` file and the affected site.

To get sufficient detail of `pip install --requirements` to display
if the subsequent `pip check` call failed, I had to remove the
`--quiet` parameter. It was replicated by hiding _all_ output
if `quiet=True` and `pip install` succeeds - this is different to
the previous behaviour, where warnings would still poke through,
even if `quiet=True` and the install succeeded.
This was the only way to make it work such that all output would
be available without having to run `pip install` twice (which would
likely get different output the second time). Besides, there weren't
many warnings triggering this edge case, so the change in behaviour is
probably acceptable.

Additionally, in both places doing `pip check`
(post-install-requirements and when doing system-package compatibility
checking), move the `pip check` output to happen last, so that users
don't need to scroll to the top of the `pip list` wall of text to find
the reason for their command failure.

Differential Revision: https://phabricator.services.mozilla.com/D137206
2022-02-03 21:51:49 +00:00
Rob Lemley
87150cdcab Bug 1748288 - Update typed-ast dependency in pylint and black linters. r=linter-reviewers,ahal
Black and PyLint linters fail to install with Python 3.10 because of typed-ast.
typed-ast 1.4.3 added support for Python 3.10.

Differential Revision: https://phabricator.services.mozilla.com/D135538
2022-01-10 22:32:27 +00:00
Mitchell Hentges
6571032077 Bug 1739067: Scope Mach virtualenv to be checkout-specific r=perftest-reviewers,ahal,sparky
Build and run the Mach virtualenv from a `state_dir` that is
"specific-to-topsrcdir".

As part of this, move `get_state_dir()` to `mach` so that it's usable
before `sys.path` entries are fully set up.

Differential Revision: https://phabricator.services.mozilla.com/D130383
2021-11-29 22:33:54 +00:00
Sylvestre Ledru
d6ba1a7419 Bug 1707591 - ride along: update of the flake8 dep to match black's r=linter-reviewers,ahal
Depends on D131717

Differential Revision: https://phabricator.services.mozilla.com/D131718
2021-11-22 22:10:04 +00:00
Sylvestre Ledru
c9ed427926 Bug 1707591 - ride along: update of the pylint dep to match black's r=linter-reviewers,ahal
Depends on D130965

Differential Revision: https://phabricator.services.mozilla.com/D131717
2021-11-22 22:10:03 +00:00
Sylvestre Ledru
0bd2d56002 Bug 1707591 - Update to black 21.11b1 r=gerard-majax
Depends on D131716

Differential Revision: https://phabricator.services.mozilla.com/D130964
2021-11-22 22:10:03 +00:00
Sylvestre Ledru
0369d71fc0 Bug 1707591 - Parse the new output of black --version r=linter-reviewers,ahal
Depends on D126202

Differential Revision: https://phabricator.services.mozilla.com/D131716
2021-11-22 22:10:02 +00:00
Renovate Bot
d7e0dac10a Bug 1731749 - Update dependency pylint to v2.11.1 r=linter-reviewers,ahal
Differential Revision: https://phabricator.services.mozilla.com/D126202
2021-11-22 22:10:02 +00:00
Iulian Moraru
897bb9d353 Backed out 2 changesets (bug 1707591) for causing python mozlint failures on test_yaml.py. CLOSED TREE
Backed out changeset a730ab2d0dbe (bug 1707591)
Backed out changeset 0269849fd7ef (bug 1707591)
2021-11-12 18:44:36 +02:00
Sylvestre Ledru
372b8d509f Bug 1707591 - Update to black 21.10b0 r=gerard-majax
Differential Revision: https://phabricator.services.mozilla.com/D130964
2021-11-12 15:06:55 +00:00
Renovate Bot
8ec610cce9 no bug - Update dependency autopep8 to v1.6.0 r=linter-reviewers,marco DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D129355
2021-10-24 21:33:48 +00:00
Mathew Hodson
05af5b9c98 Bug 1735681 - Add colorama to pylint_requirements.in. r=ahal
This makes sure colorama stays in pylint_requirements.txt next
time someone regenerates it on a non-Windows machine. Since
colorama is only required by pylint on Windows.

Differential Revision: https://phabricator.services.mozilla.com/D128426
2021-10-14 13:14:02 +00:00
Mathew Hodson
3df2d4789a Bug 1734971 - Add pylint requirements for Windows. r=linter-reviewers,sylvestre
This adds colorama, which is required by pylint only on Windows.

Differential Revision: https://phabricator.services.mozilla.com/D128007
2021-10-13 17:05:42 +00:00
Renovate Bot
c9b15cac97 no bug - Update dependency flake8 to v4 r=linter-reviewers,ahal DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D128092
2021-10-13 14:16:38 +00:00
Sylvestre Ledru
9d070b0060 Bug 1729222 - Update dependency pylint to v2.10.2 r=linter-reviewers,marco DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D124577
2021-09-06 13:14:41 +00:00