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
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
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
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
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
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
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
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
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
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
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
***
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