Closed Bug 1281899 Opened 4 years ago Closed 4 years ago

[mozlint] Ability to lint only files touched by a given commit series

Categories

(Firefox Build System :: Lint and Formatting, defect)

defect
Not set
normal

Tracking

(firefox50 fixed)

RESOLVED FIXED
mozilla50
Tracking Status
firefox50 --- fixed

People

(Reporter: ahal, Assigned: ahal)

Details

Attachments

(2 files, 1 obsolete file)

No description provided.
There is currently no built-in user interface to mozlint. The only existing interface is the
external cli provided by |mach lint|. However, in the future mozlint may need to be used in a
context where mach isn't readily available (i.e version-control-tools). This patch basically
just moves the cli logic out of mach_commands.py, and into mozlint core. That way it can be
re-used in other places without needing to be re-implemented.

The |mach lint setup| subcommand was removed because apparently subcommands don't work with
the parser attribute. Nothing was using it yet anyway, so I removed it for now. It may get
re-added in some form in the future.

Review commit: https://reviewboard.mozilla.org/r/60560/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/60560/
Attachment #8765007 - Flags: review?(smacleod)
Attachment #8765008 - Flags: review?(smacleod)
This adds two parameters, --rev and --workdir. Each works both with mercurial and git (though the syntax for
specifying revisions is different between them). The value is simply forwarded to either |hg log| or |git diff|
so syntax like |mach lint -r .~4::.| or |mach lint -r "HEAD~4 HEAD"| will work as expected.

Review commit: https://reviewboard.mozilla.org/r/60562/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/60562/
Attachment #8764709 - Attachment is obsolete: true
Component: General → Lint
Comment on attachment 8765007 [details]
Bug 1281899 - [mozlint] Create cli module and move logic from tools/lint/mach_commands.py there,

https://reviewboard.mozilla.org/r/60560/#review59188

::: python/mozlint/mozlint/cli.py:83
(Diff revision 1)
> +    status = 0
> +    if results:
> +        status = 1

might as well nuke this and just `return 1 if results else 0`
Attachment #8765007 - Flags: review?(smacleod) → review+
Comment on attachment 8765008 [details]
Bug 1281899 - [mozlint] Add ability to lint files touched by revisions and/or the working directory,

https://reviewboard.mozilla.org/r/60562/#review59198
Attachment #8765008 - Flags: review?(smacleod) → review+
Comment on attachment 8765007 [details]
Bug 1281899 - [mozlint] Create cli module and move logic from tools/lint/mach_commands.py there,

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60560/diff/1-2/
Comment on attachment 8765008 [details]
Bug 1281899 - [mozlint] Add ability to lint files touched by revisions and/or the working directory,

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60562/diff/1-2/
Comment on attachment 8765007 [details]
Bug 1281899 - [mozlint] Create cli module and move logic from tools/lint/mach_commands.py there,

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60560/diff/2-3/
Comment on attachment 8765008 [details]
Bug 1281899 - [mozlint] Add ability to lint files touched by revisions and/or the working directory,

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/60562/diff/2-3/
Pushed by ahalberstadt@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/eaaff060e865
[mozlint] Create cli module and move logic from tools/lint/mach_commands.py there, r=smacleod
https://hg.mozilla.org/integration/autoland/rev/6984d7cf65bb
[mozlint] Add ability to lint files touched by revisions and/or the working directory, r=smacleod
https://hg.mozilla.org/mozilla-central/rev/eaaff060e865
https://hg.mozilla.org/mozilla-central/rev/6984d7cf65bb
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
Product: Testing → Firefox Build System
You need to log in before you can comment on or make changes to this bug.