Closed Bug 1554657 Opened 6 months ago Closed 3 months ago

mozlint: add a verbose mode

Categories

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

task
Not set

Tracking

(firefox71 fixed)

RESOLVED FIXED
mozilla71
Tracking Status
firefox71 --- fixed

People

(Reporter: Sylvestre, Assigned: anmol.agarwal001, Mentored)

References

Details

(Keywords: good-first-bug, Whiteboard: [lang=python])

Attachments

(1 file, 2 obsolete files)

It would be great to have a verbose mode showing (at least):

  • the binary + args used
  • which files are touched/analyzed

It would help debugging the CI results.
Good news: should be easy
Bad news: should be done per check

Two examples of the code to update:

To run:

  • ./mach lint -l rustfmt --warnings --verbose

Yeah, this is a little trickier than one might expect since mozlint waits until the end before printing issues so that it can merge and sort them (so they appear in the correct file/line order).

But maybe verbose mode could print some sort of unformatted representation of the issue during logging, then again at the end for end-user consumption.

yeah, it could be displayed at the end of the output.
It is mostly for debugging and development.

For example, in:
https://taskcluster-artifacts.net/UYyp6ICmTVOaXDZx6XIblQ/0/public/logs/live_backing.log
[task 2019-05-26T11:25:44.492Z] No lint issues found.
could be

[task 2019-05-26T11:25:44.492Z] No lint issues found.
[task 2019-05-26T11:25:44.492Z] Command: /build/rustfmt --check
[task 2019-05-26T11:25:44.492Z] File(s)/dir(s): js/rust/src/ar.rs

hello, I can try to resolve this

sure, please try to submit a patch :)

Hello,
Is this issue still open please ?
I would want to try and check this.
As this is my first open source contribution any additional help will be massively appreciated.

Thanks in advance.

Yes, it is still open :)

Hello :sylvestre, I would like to pick up this issue. I was going through the code and tried to run the above command : "./mach lint -l rustfmt --warnings --verbose". But I got the following exception,

return func(files, config, **lintargs)
File "/home/anmol/Stuff/OpenSource/Mozilla/src/mozilla-unified/tools/lint/rust/init.py", line 153, in lint
results = run_rustfmt(config, files, fix=False)
File "/home/anmol/Stuff/OpenSource/Mozilla/src/mozilla-unified/tools/lint/rust/init.py", line 131, in run_rustfmt
if is_old_rustfmt(binary):
File "/home/anmol/Stuff/OpenSource/Mozilla/src/mozilla-unified/tools/lint/rust/init.py", line 117, in is_old_rustfmt
[binary, " --version"], stderr=subprocess.STDOUT
File "/usr/lib/python2.7/subprocess.py", line 216, in check_output
process = Popen(stdout=PIPE, *popenargs, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 394, in init
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
raise child_exception
AttributeError: 'NoneType' object has no attribute 'rfind'

Do I need to set some environment variables or something? Can you please help?

(In reply to Anmol Agarwal from comment #7)

Hello :sylvestre, I would like to pick up this issue. I was going through the code and tried to run the above command : "./mach lint -l rustfmt --warnings --verbose". But I got the following exception,

return func(files, config, **lintargs)
File "/home/anmol/Stuff/OpenSource/Mozilla/src/mozilla-unified/tools/lint/rust/init.py", line 153, in lint
results = run_rustfmt(config, files, fix=False)
File "/home/anmol/Stuff/OpenSource/Mozilla/src/mozilla-unified/tools/lint/rust/init.py", line 131, in run_rustfmt
if is_old_rustfmt(binary):
File "/home/anmol/Stuff/OpenSource/Mozilla/src/mozilla-unified/tools/lint/rust/init.py", line 117, in is_old_rustfmt
[binary, " --version"], stderr=subprocess.STDOUT
File "/usr/lib/python2.7/subprocess.py", line 216, in check_output
process = Popen(stdout=PIPE, *popenargs, **kwargs)
File "/usr/lib/python2.7/subprocess.py", line 394, in init
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1047, in _execute_child
raise child_exception
AttributeError: 'NoneType' object has no attribute 'rfind'

Do I need to set some environment variables or something? Can you please help?

I just needed to install rstfmt. It works fine now.

I just needed to install rstfmt. It works fine now.

Don't hesitate to file a bug and propose a patch to improve the error message :)

Hello :sylvestre,

I just added a review request for this bug. Please review it. Moreover, please change the assignee to this bug to me.

Depends on D43507

Depends on D43659

Attachment #9088520 - Attachment is obsolete: true
Attachment #9088519 - Attachment is obsolete: true
Assignee: nobody → anmol.agarwal001
Attachment #9088259 - Attachment description: Bug 1554657 - Modified mozlint and formatters to include a new verbose mode showing the file paths scanned and the command ran for linting as output → Bug 1554657 - Add a verbose mode to |mach lint| to display log output
Pushed by ahalberstadt@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/51e40b81f682
Add a verbose mode to |mach lint| to display log output r=ahal
Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla71

Thanks for your contribution Anmol and congrats on getting a change into mozilla-central!

Thanks ahal for guiding me through this. I guess this is deployed in Firefox Nightly build 71.0a1, but I can't see the release notes. Moreover, can you please recommend another bug upon which I can start working?

Oh, we don't make release notes for nightly builds, and even if we did infrastructure changes like this (that don't impact the Firefox binary) wouldn't be included.

Maybe bug 1494090 could be a good one? If that looks interesting, take a look and feel free to ask me over there if you have questions (use needinfo or I'll likely miss it).

Regressions: 1591977
You need to log in before you can comment on or make changes to this bug.