Closed Bug 1384273 Opened 7 years ago Closed 7 years ago

Get root of tree from mach when linting.

Categories

(Developer Infrastructure :: Lint and Formatting, defect)

3 Branch
defect
Not set
normal

Tracking

(firefox56 fixed)

RESOLVED FIXED
mozilla56
Tracking Status
firefox56 --- fixed

People

(Reporter: tomprince, Assigned: tomprince)

References

Details

Attachments

(1 file)

I'd like to run `mach lint` in a subdirectory but it default to expecting the current directory as the root of the source tree. `mach` already knows where the root of the tree is, so pass that into lint, rather then letting lint guess.
Comment on attachment 8890119 [details]
Bug 1384273 - Get lint root dir from mach;

https://reviewboard.mozilla.org/r/161104/#review166716

::: tools/lint/mach_commands.py:40
(Diff revision 1)
>          description='Run linters.',
>          parser=setup_argument_parser)
>      def lint(self, *runargs, **lintargs):
>          """Run linters."""
>          from mozlint import cli
> +        lintargs.setdefault('root', self.topsrcdir)

This should already be in lintargs:
https://dxr.mozilla.org/mozilla-central/source/python/mozlint/mozlint/roller.py#75

Specifically self.vcs.root should point to topsrcdir. In fact, the value here is being overwritten by the one above.

The lintargs are pretty opaque at the moment :(.. they should at least be documented somewhere.
Attachment #8890119 - Flags: review?(ahalberstadt) → review-
Comment on attachment 8890119 [details]
Bug 1384273 - Get lint root dir from mach;

https://reviewboard.mozilla.org/r/161104/#review166716

> This should already be in lintargs:
> https://dxr.mozilla.org/mozilla-central/source/python/mozlint/mozlint/roller.py#75
> 
> Specifically self.vcs.root should point to topsrcdir. In fact, the value here is being overwritten by the one above.
> 
> The lintargs are pretty opaque at the moment :(.. they should at least be documented somewhere.

My specific use case is running from a comm-central repository sitting inside of a mozillla-central repository. In that case, `self.vcs.root` points at the root of comm-central, which is wrong for at least https://dxr.mozilla.org/mozilla-central/source/tools/lint/eslint/setup_helper.py#351 which is what I was trying to fix.

Looking at the places that use `lintargs['root']`, I think all of them expect it to be the root of mozilla-central.
Comment on attachment 8890119 [details]
Bug 1384273 - Get lint root dir from mach;

https://reviewboard.mozilla.org/r/161104/#review166716

> My specific use case is running from a comm-central repository sitting inside of a mozillla-central repository. In that case, `self.vcs.root` points at the root of comm-central, which is wrong for at least https://dxr.mozilla.org/mozilla-central/source/tools/lint/eslint/setup_helper.py#351 which is what I was trying to fix.
> 
> Looking at the places that use `lintargs['root']`, I think all of them expect it to be the root of mozilla-central.

Ah, thanks for clarifying! In that case yes, this is fine.
Comment on attachment 8890119 [details]
Bug 1384273 - Get lint root dir from mach;

https://reviewboard.mozilla.org/r/161104/#review166928
Attachment #8890119 - Flags: review- → review+
Keywords: checkin-needed
Assignee: nobody → mozilla
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/8954e1ad4d82
Get lint root dir from mach; r=ahal
Keywords: checkin-needed
No longer blocks: comm-taskgraph
https://hg.mozilla.org/mozilla-central/rev/8954e1ad4d82
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
Product: Testing → Firefox Build System
Version: Version 3 → 3 Branch
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.