Closed Bug 1568484 Opened 5 years ago Closed 5 years ago

Add an option to mozlint to output paths relative to repository

Categories

(Developer Infrastructure :: Lint and Formatting, enhancement)

enhancement
Not set
normal

Tracking

(firefox70 fixed)

RESOLVED FIXED
mozilla70
Tracking Status
firefox70 --- fixed

People

(Reporter: bastien, Assigned: bastien)

References

Details

Attachments

(1 file)

I suggest adding a new CLI option to mozlint, in order to output issues paths relative to the repository.
It's needed for the code-review bot, to avoid cleaning the analyzers outputs, and maintaining a list of checkout folders...

The option --relative will be inactive by default to preserve the current behaviour.

What if we do this by default? Is there any other service which is relying on the absolute path?

Yeah, I don't think we need a flag for this, let's just do it by default. It should be fine as long as we're consistent. We use abspath because I needed to be sure that every linter returned the paths in the same format (so mozlint could collapse them accurately). But making sure every path is relative should accomplish the same thing.

Note another way of solving this would be to store lint.root in the Issue container. Then each record emitted by the json formatter would have both the repo root and the abspath, so the reviewbot could calculate the relpath. Actually, we should probably put root in there regardless (in case something does need an abspath).

Or rather than storing root in every Issue, we can put it on the ResultSummary class (which is what gets passed into the formatters):
https://searchfox.org/mozilla-central/source/python/mozlint/mozlint/roller.py#109

Depends on: 1568535
No longer depends on: 1568535
Attachment #9080284 - Attachment description: Bug 1568484 - Add relative paths option to mozlint, r=ahal → Bug 1568484 - Output issues relative paths in mozlint, r=ahal

Thanks for the feedback Andrew, i updated the new version by storing root in ResultSummary.
I initially implemented the relative path output without an option, but was worried about breaking other user's setups...

Pushed by babadie@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/639f502ded6b
Output issues relative paths in mozlint, r=ahal
See Also: → 1569882
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70
Regressions: 1569882
See Also: 1569882
Product: Firefox Build System → Developer Infrastructure
See Also: → 1821374
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: