Enable py2 linter on python/mozlint

RESOLVED FIXED in Firefox 57


2 years ago
2 years ago


(Reporter: ahal, Assigned: stevea1, Mentored)



Firefox Tracking Flags

(firefox57 fixed)


(Whiteboard: [good-first-bug])


(1 attachment)



2 years ago
The linter can be enabled by removing 'python/mozlint' from the exclude section in tools/lint/py2.yml.

You can then see all the errors by running:
./mach lint -l py2 python/mozlint

Each of the errors will need to be fixed before this can land.

To test changes, please be sure to run both:
./mach lint --outgoing
./mach python-test python/mozlint

to be sure nothing else broke.


2 years ago
Blocks: 1397427
Comment hidden (mozreview-request)

Comment 2

2 years ago
Hi, I've posted the patch for this. I believe I've resolved all the errors that cropped up. One thing to note, before submitting, when I ran:
./mach lint --outgoing 

it came back with 
error: python3 not detected, aborting py-compat check 

I have Python 2.7 installed if that helps...

Running the './mach python-test python/mozlint' command was successful though, with everything passing.


2 years ago
Assignee: nobody → stevea1

Comment 3

2 years ago
Comment on attachment 8905334 [details]
Bug 1397423 - Enable py2 linter on python/mozlint.


This looks great, thanks!

As long as the return code from the lint command was 0 you can ignore that error (installing python3 alongside your current python would make that error go away). I'll push a quick try run for you just in case before landing.
Attachment #8905334 - Flags: review?(ahalberstadt) → review+

Comment 4

2 years ago
Hey Steve, thanks for your contribution!

I'll land this for you if everything looks good once the results come back from try. In the meantime, let me know if you'd like to work on anything else. There is a ton more linting work like this to do (including flake8), or if you'd like to try something more challenging let me know roughly your python experience and what kind of things you'd be interested in.

Comment 5

2 years ago
Pushed by ahalberstadt@mozilla.com:
Enable py2 linter on python/mozlint. r=ahal
Last Resolved: 2 years ago
status-firefox57: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla57

Comment 7

2 years ago
Hi, I just wanted to ask that, when you removed python/mozlint from py2.yml what error did you get , was it "ImportError: No module named python.compat"?

Comment 8

2 years ago
The only error I got was the one I mentioned in Comment #2. That occurred because I didn't have Python 3 installed on my system. I installed python3 and that corrected the error.

Comment 9

2 years ago
Hi Steve , thanks for replying. You have mentioned in your Comment #1  "I believe I've resolved all the errors that cropped up".
So can you tell me some of the errors you got. Was this- "ImportError: No module named python.compat" one of them?

Comment 10

2 years ago
Hey akriti, that's odd. Would you mind posting the command you're running over in bug 1397427? I'd be happy to help you investigate!
You need to log in before you can comment on or make changes to this bug.