Lint outgoing and working directory changes with |mach lint| in hg and git

Andrew Halberstadt ahalberstadt at mozilla.com
Fri Jul 7 17:33:26 UTC 2017


There are now pre-push and pre-commit version control hooks that use
--outgoing and --workdir respectively. These are available in both hg and
git. For installation instructions see:
http://gecko.readthedocs.io/en/latest/tools/lint/usage.html#using-a-vcs-hook

The old 'eslintvalidate' hooks are still around, but should be deprecated
by this new one. We'll leave them around for awhile but they may eventually
be removed, so please consider upgrading. Again, the benefit here is that
these new hooks will run all applicable linters (not just eslint).

Adding these hooks to |mach mercurial-setup| is tracked by bug 1295833.

Thanks,
Andrew

On Fri, Jun 23, 2017 at 10:01 AM, Andrew Halberstadt <
ahalberstadt at mozilla.com> wrote:

> tl;dr - |mach lint -wo| will lint what you want in 95% of cases
>
> I'm excited about two new features added to |mach lint| (make sure to
> update to latest central):
>
> 1) Lint outgoing changes with:
>
>     ./mach lint --outgoing
>
> This will lint all files touched by revisions *which would be pushed
> upstream*. With hg, make sure you have a default push defined. On git, the
> default remote repository should be automagically detected. In either case,
> you can also manually specify the remote target:
>
>     ./mach lint --outgoing https://hg.mozilla.org/releases/mozilla-beta
>
> 2) Lint working directory changes with:
>
>     ./mach lint --workdir
>
> This lints all files touched in the working directory. On git, this
> includes both staged and unstaged changes.
>
> You can run both of these at once with:
>
>     ./mach lint -wo
>
> For almost all use cases, the above command is all you need to remember.
> Mozlint (the library behind mach lint) will automatically determine what
> linters (eslint, flake8, wpt, etc) need to run against which files and do
> the right thing. So if you typically run |mach eslint|, I'd encourage you
> to start switching over to |mach lint| instead*.
>
> While these options call into the underlying vcs (and can therefore be a
> bit slower than specifying a path), they drastically reduce the number of
> files linted, so overall are much faster than linting an entire directory.
> The main caveat is that if you modify the lint configuration itself,
> mozlint is not smart enough to know that the entire tree should be linted. Bug
> 1373368 <https://bugzilla.mozilla.org/show_bug.cgi?id=1373368> is filed
> for this.
>
> Please let me know if you find any bugs or bad UX while using these!
> Cheers,
> Andrew
>
> * mach eslint is already an alias to mach lint --linter eslint
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/firefox-dev/attachments/20170707/4cc7edb0/attachment-0001.html>


More information about the firefox-dev mailing list