Closed Bug 1387830 Opened 3 years ago Closed 3 years ago

Allow ./mach lint to print its available linters

Categories

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

3 Branch
enhancement
Not set

Tracking

(firefox57 fixed)

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: Callek, Assigned: Callek)

Details

Attachments

(1 file)

When thinking about using ./mach lint -l ... I've wondered what linters are available a few times. This should help.
Comment on attachment 8894218 [details]
Bug 1387830 - Make ./mach lint able to output available linters.

https://reviewboard.mozilla.org/r/165300/#review171176

Thanks!

::: python/mozlint/mozlint/cli.py:30
(Diff revision 1)
>            'default': [],
>            'action': 'append',
>            'help': "Linters to run, e.g 'eslint'. By default all linters "
>                    "are run for all the appropriate files.",
>            }],
> +        [['--list-linters'],

I think we could just call this `--list`. There's not much else it could be listing, so should be obvious what it's for.

::: python/mozlint/mozlint/cli.py:124
(Diff revision 1)
> +    if list_linters:
> +        lint_paths = find_linters(linters)
> +        print("Available linters: {}".format(
> +            [os.path.splitext(os.path.basename(l))[0] for l in lint_paths]
> +        ))
> +        sys.exit(0)

nit: just use return 0 in case the thing calling this wants to keep going.
Attachment #8894218 - Flags: review?(ahalberstadt) → review+
Pushed by Callek@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/393b0727cba4
Make ./mach lint able to output available linters. r=ahal
Pushed by Callek@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/640c562833fc
Make ./mach lint able to output available linters. r=ahal
Flags: needinfo?(bugspam.Callek)
https://hg.mozilla.org/mozilla-central/rev/640c562833fc
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Product: Testing → Firefox Build System
Version: Version 3 → 3 Branch
You need to log in before you can comment on or make changes to this bug.