Commit Graph
223 Commits
Author SHA1 Message Date
Jesse Schwartzentruber 301ec15a92 Bug 1903620 - Calculate jobs using CPU affinity in mach. r=firefox-build-system-reviewers,glandium
Differential Revision: https://phabricator.services.mozilla.com/D214289
2024-06-25 13:53:13 +00:00
ahochheiden d0a30e9392 Bug 1898817 - Replace distutils.spawn.find_executable with shutil.which within mozlint r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D211630
2024-06-21 17:30:03 +00:00
Noemi Erli 35f162af9c Backed out 8 changesets (bug 1899681, bug 1888570, bug 1898817) as requested by the dev CLOSED TREE
Backed out changeset 5be4d65a269f (bug 1899681)
Backed out changeset 4b2b91958615 (bug 1898817)
Backed out changeset 91cfbbe6cacd (bug 1898817)
Backed out changeset 689cadd510e1 (bug 1888570)
Backed out changeset dee593604635 (bug 1888570)
Backed out changeset 2fc073aab920 (bug 1898817)
Backed out changeset c68493490b5c (bug 1898817)
Backed out changeset eb50a220de69 (bug 1898817)
2024-06-12 21:19:10 +03:00
ahochheiden a7f90e7ba4 Bug 1898817 - Replace distutils.spawn.find_executable with shutil.which within mozlint r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D211630
2024-06-12 16:10:34 +00:00
Nick Alexander c1d63c5fb2 Bug 1896514 - Make mach lint accommodate Windows drive case differences. r=ahal
We hand-roll to avoid `os.path.realpath` invoking potentially
expensive filesystem APIs.

Differential Revision: https://phabricator.services.mozilla.com/D210230
2024-05-28 20:29:38 +00:00
Gijs Kruitbosch 2b6df36c8c Bug 1856535 - allow linters to work by excluding extensions instead of including them, r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D202635
2024-03-13 09:40:27 +00:00
Joel Maher 93a74ef1b8 Bug 1869430 - Batch 19.2 convert python unittest .ini -> .toml. r=gbrown,taskgraph-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D196124
2023-12-12 17:40:03 +00:00
Ray Kraesig 29050fe320 Bug 1866176 - normalize paths in FileFinder r=ahal,firefox-build-system-reviewers,glandium
On Windows, paths provided to FileFinder may contain backslashes, which
will cause uses of `mozpath.match` later on to fail when they try to
compare mixed-path values. To avoid this, normalize those paths on
receipt.

(Also, silence a lint by pulling the global `args` variable into a
function, so that it is no longer occluded by the various function
parameters named `args`.)

Differential Revision: https://phabricator.services.mozilla.com/D194448
2023-12-04 17:14:29 +00:00
Andrew Halberstadt 255518ea5c Bug 1867990 - Fix black formatting errors that snuck in due to regression, r=linter-reviewers,taskgraph-reviewers,releng-reviewers,bhearsum,sylvestre
These were not caught due to bug 1865672.

Depends on D195431

Differential Revision: https://phabricator.services.mozilla.com/D195432
2023-12-04 14:51:39 +00:00
Sandor Molnar afcfb9aad7 Backed out changeset fec3dc168176 (bug 1866176) for causing bug 1867494 CLOSED TREE 2023-11-30 14:38:22 +02:00
Ray Kraesig 0c19f4087a Bug 1866176 - normalize paths in FileFinder r=ahal,firefox-build-system-reviewers,glandium
On Windows, paths provided to FileFinder may contain backslashes, which
will cause uses of `mozpath.match` later on to fail when they try to
compare mixed-path values. To avoid this, normalize those paths on
receipt.

(Also, silence a lint by pulling the global `args` variable into a
function, so that it is no longer occluded by the various function
parameters named `args`.)

Differential Revision: https://phabricator.services.mozilla.com/D194448
2023-11-29 17:45:31 +00:00
serge-sans-paille 37e171f844 Bug 1865672 - Format mach with black r=ahochheiden
To do so we allow straight filenames in the include section and consider
them as automatically-included files.

Differential Revision: https://phabricator.services.mozilla.com/D194093
2023-11-21 08:10:29 +00:00
Geoff Brown 834d394cee Bug 1860671 - Use subprocess instead of mozprocess in mozlint r=hneiva
Reduce reliance on mozprocess ProcessHandler, which is poorly maintained.

Differential Revision: https://phabricator.services.mozilla.com/D191695
2023-10-26 16:09:13 +00:00
Sylvestre Ledru 3608dc8457 Bug 1860157 - Fix typos found by codespell 2.2.6 r=webdriver-reviewers,zeid,search-reviewers,perftest-reviewers,devtools-reviewers,releng-reviewers,gbrown,sparky,jteow
Differential Revision: https://phabricator.services.mozilla.com/D191480
2023-10-19 20:52:10 +00:00
Logan Rosen 45be05a920 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
Mark Banner cc8482c3ed Bug 1757373 - Enable linting to run in parallel when '.' is specified as the path. r=linter-reviewers,ahal
Differential Revision: https://phabricator.services.mozilla.com/D177260
2023-05-09 13:11:21 +00:00
Steve Fink 6892ec4233 Bug 1826209 - Display message when nonfatal warnings are present r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D174542
2023-04-07 18:29:51 +00:00
Steve Fink 7acbdeb4d7 Bug 1740598 - When linting, process only the given revision when --rev is present r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D174539
2023-04-04 18:25:13 +00:00
Paul Adenot f3638df0fd Bug 1825554 - Use monotonic clock to report durations in mach. r=firefox-build-system-reviewers,sergesanspaille
Differential Revision: https://phabricator.services.mozilla.com/D174118
2023-04-04 11:13:30 +00:00
Andrew Halberstadt 83bc2ca934 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
Cristian Tuns e0f5dfb939 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 f661e9875a 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
Andi-Bogdan Postelnicu 215b3acc3f Bug 1820494 - mozlint should output file no matter if there are issues for json formatter. r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D171790
2023-03-07 05:53:30 +00:00
ogiorgis d9ef1c2863 Bug 1749473 - fix docstring for autodoc r=firefox-source-docs-reviewers,sylvestre
Differential Revision: https://phabricator.services.mozilla.com/D171436
2023-03-03 09:37:42 +00:00
Marco Castelluccio f2004b2001 Bug 1801836 - Remove no longer necessary 'from __future__' imports under python/. r=linter-reviewers,glandium,ahal DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D165398
2022-12-23 01:26:15 +00:00
Marco Castelluccio 9905632fd2 Bug 1790816 - Reformat python/ with isort. r=#linter-reviewers CLOSED TREE
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D162656
2022-12-21 09:56:15 +00:00
Connor Sheehan a3b7423102 Bug 1805804: avoid linting the tree for support-files changes if --fix is passed r=marco
Changing a linter's `support-files` causes that linter to
run against the entire tree. This is to avoid introducing
a regression in files that weren't touched, which would
be confusing for developers who trusted `--outgoing` to
catch their regressions.

Turn this behaviour off when `--fix` is passed as a linter
argument so these regressions aren't also fixed tree-wide.
Move the logic for tree-wide linting into a function
`should_lint_entire_tree` and add tests for the behaviour
in `test_roller.py`.

Differential Revision: https://phabricator.services.mozilla.com/D164761
2022-12-15 16:40:09 +00:00
Valentin Rigal 1791a4abca Bug 1793948 - Softly report mozlint warnings on autoland. r=bastien,linter-reviewers,sylvestre,ahal
Differential Revision: https://phabricator.services.mozilla.com/D158769
2022-11-22 16:23:12 +00:00
Tom Ritter a7c11d47a0 Bug 1800927: Fix the Updatebot linter and offending moz.yaml files r=ahal,webdriver-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D162223
2022-11-21 19:35:16 +00:00
Valentin Rigal adbfac1819 Bug 1790000 - On Automation mozlint output file handler should be closed. r=marco
Differential Revision: https://phabricator.services.mozilla.com/D156664
2022-09-09 12:02:13 +00:00
Tom Ritter 8fcacd06b8 Bug 1772198 - Add a new filetype lint job r=linter-reviewers,ahal
Depends on D149309

Differential Revision: https://phabricator.services.mozilla.com/D149306
2022-06-24 20:07:07 +00:00
Ryan VanderMeulen 90fec6ac70 Bug 1738054 - Remove obsolete "skip-if = python == 2" keys from testing manifests and re-enable some skipped tests which now pass. r=ahochheiden
Differential Revision: https://phabricator.services.mozilla.com/D149573
2022-06-21 01:46:44 +00:00
Mitchell Hentges ea37a19f17 Bug 1756224: Update MozlintParser docs about default paths r=ahal
Updates parser documentation to clarify that, if no `paths` are
provided, then only those discovered by `--outgoing` and `--workdir`
are linted.

Differential Revision: https://phabricator.services.mozilla.com/D139158
2022-03-09 15:52:48 +00:00
Mitchell Hentges 4b59cbfdc0 Bug 1750632: ./mach lint should bootstrap clang-format r=ahal
Tie into `code_analysis`'s `get_clang_tools()` functionality to
intelligently bootstrap clang if it either doesn't exist or is
out-of-date.

This required exposing `command_context` to the linting logic, as it's
needed to call `artifact_toolchain(...)`.

Note that this means that the standalone `runcli.py` file won't be able
to support bootstrapping `clang-format`, or other linters that lean on
`command_context` in the future.

Finally, `substs.get("HOST_BIN_SUFFIX")` was replaced with a
windows-specific `binary += ".exe"`, because not all contexts where
the tests are run will have access to populated `substs` data.
Note that this worked before without the extension because it was
only used for starting a process, in which context Windows automatically
tries all `PATHEXT` options. Since we're now doing an `isfile()` check
(to enable more intelligent failure cases when `clang-format` doesn't
exist), we need the path to be fully correct.

Differential Revision: https://phabricator.services.mozilla.com/D137335
2022-03-04 19:39:32 +00:00
Mitchell Hentges e78b4d0e03 Bug 1754241: ./mach lint now raises exception on no-op in CI r=ahal
If there's no files to lint in CI, that's a smell that something is
misconfigured.

Resolve this by raising an exception accordingly if `MOZ_AUTOMATION` is
set (and we aren't running the tests for the linting code itself).
Automatically recommend specifying `*`, as (assuming the use of a
shell) that will resolve to "all files/dirs at $topsrcdir`", which
matches existing behaviour if `--outgoing` and `--workdir` aren't
provided.

Differential Revision: https://phabricator.services.mozilla.com/D138172
2022-02-10 16:22:06 +00:00
Mitchell Hentges b22b52b997 Bug 1753769: "runcli.py" in tests should use explicit paths r=ahal
The new `mozlint` behaviour will always lean on the VCS
to only lint changed files.

However, in tests, the VCS is going to be slow and also provide
inconsistent data between tests. Additionally, in some contexts,
the VCS won't be available.

Resolve this by hardcoding a file to lint for each case.

Differential Revision: https://phabricator.services.mozilla.com/D138033
2022-02-08 22:06:59 +00:00
Mitchell Hentges a931fca8e8 Bug 1753701: Always default to --outgoing/--workdir in ./mach lint r=ahal
Tweaks `./mach lint` behaviour to always fall back to only linting files
that have changed according to VCS - previously, this only happened if
no linter was provided.

Adjusts "am I at $topsrcdir" check to use `pathlib` to avoid mismatches
due to inconsistent capitalization or slash direction.

Updates CI references to explicitly provide `*` as the path to avoid
the only-lint-files-changed restriction.

Differential Revision: https://phabricator.services.mozilla.com/D137870
2022-02-04 21:48:59 +00:00
Gijs Kruitbosch a3eb3d42e8 Bug 1648114 - make clang-tidy easier to find, r=andi
Differential Revision: https://phabricator.services.mozilla.com/D133191
2022-01-13 16:20:03 +00:00
Sandor Molnar d64333870b Backed out changeset 9cef54c30d49 (bug 1648114) for causing python unit test failures in test_mach_commands. CLOSED TREE 2021-12-23 02:50:20 +02:00
Gijs Kruitbosch 160848c70b Bug 1648114 - make clang-tidy easier to find, r=andi
Differential Revision: https://phabricator.services.mozilla.com/D133191
2021-12-23 00:29:10 +00:00
Sylvestre Ledru a640fb80d7 Bug 1743088 - Mozlint: add an option to run the linter on third party code r=linter-reviewers,ahal DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D132234
2021-12-01 15:12:31 +00:00
Andrew Halberstadt 2b70901345 Bug 1740620 - Fix regression to 'mach lint --outgoing' on Git, r=gerard-majax
Differential Revision: https://phabricator.services.mozilla.com/D130948
2021-11-13 16:16:34 +00:00
Kagami Sascha Rosylight 6a970d8989 Bug 1723117 - Limit max_workers value of ProcessPoolExecutor to 61 r=firefox-build-system-reviewers,mhentges
Differential Revision: https://phabricator.services.mozilla.com/D121360
2021-09-03 22:27:05 +00:00
Nick Alexander 1c7cdc9b43 Bug 1714159 - Handle c:/... and C:/... when making relative paths in mozlint. r=ahal
Depends on D116151

Differential Revision: https://phabricator.services.mozilla.com/D116637
2021-06-02 21:27:40 +00:00
Nick Alexander a99f3fb47e Bug 1713178 - Make black linter setup avoid updating the virtualenv if it's installed. r=ahal
This could be easily generalized to avoid the updating the virtualenv
more generally, but I think this functionality should be in the
`virtualenv_manager` -- something like `install_pip_binary(...)` -- so
I've just done the most impactful example here.

Differential Revision: https://phabricator.services.mozilla.com/D116148
2021-05-31 21:44:05 +00:00
Nisarg 2c03fc0f86 Bug 1698838 - Create a format command as an alternative to lint --fix. r=ahal
***
Bug 1698838 - Restrict the list of linters to valid formatters r=ahal

***
Bug 1698838 - Abort formatting even if one of the linters passed is invalid r=ahal

***

***

Differential Revision: https://phabricator.services.mozilla.com/D109231
2021-04-12 18:01:14 +00:00
Cosmin Sabou f26791344a Bug 1703664 - Fix linting opt failure on mozlint/roller.py.
CLOSED TREE
2021-04-09 18:56:25 +03:00
Marco Castelluccio 5ba5f185ea Bug 1703664 - Enable showing all warnings from mozlint-based linters in reviewbot. r=ahal DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D111166
2021-04-09 15:08:57 +00:00
Nisarg 720a9ba234 Bug 1369784 - Improve the default behaviour of mozlint if no file paths or linters are specified r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D107394
2021-03-09 20:07:00 +00:00
nisarg 4d5b8dac4a Bug 1646161 - Add command to run linters for the exclude list r=ahal
Differential Revision: https://phabricator.services.mozilla.com/D105115
2021-03-09 20:07:00 +00:00