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

RESOLVED FIXED in Firefox 50

Status

RESOLVED FIXED
2 years ago
8 months ago

People

(Reporter: ahal, Assigned: ahal)

Tracking

unspecified
mozilla50

Firefox Tracking Flags

(firefox50 fixed)

Details

Attachments

(2 attachments, 1 obsolete attachment)

Comment hidden (empty)
(Assignee)

Comment 1

2 years ago
Created attachment 8764709 [details]
Bug 1281899 - [mozlint] Add --rev option to lint files touched by changesets

Review commit: https://reviewboard.mozilla.org/r/60416/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/60416/
(Assignee)

Comment 2

2 years ago
Created attachment 8765007 [details]
Bug 1281899 - [mozlint] Create cli module and move logic from tools/lint/mach_commands.py there,

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)
(Assignee)

Comment 3

2 years ago
Created attachment 8765008 [details]
Bug 1281899 - [mozlint] Add ability to lint files touched by revisions and/or the working directory,

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/
(Assignee)

Updated

2 years ago
Attachment #8764709 - Attachment is obsolete: true
(Assignee)

Updated

2 years ago
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+
(Assignee)

Comment 6

2 years ago
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/
(Assignee)

Comment 7

2 years ago
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/
(Assignee)

Comment 8

2 years ago
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/
(Assignee)

Comment 9

2 years ago
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/

Comment 10

2 years ago
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

Comment 11

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/eaaff060e865
https://hg.mozilla.org/mozilla-central/rev/6984d7cf65bb
Status: ASSIGNED → RESOLVED
Last Resolved: 2 years ago
status-firefox50: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla50

Updated

8 months ago
Product: Testing → Firefox Build System
You need to log in before you can comment on or make changes to this bug.