Closed Bug 1397423 Opened 7 years ago Closed 7 years ago

Enable py2 linter on python/mozlint


(Testing :: Mozbase, enhancement)

Not set


(firefox57 fixed)

Tracking Status
firefox57 --- fixed


(Reporter: ahal, Assigned: stevea1, Mentored)



(Whiteboard: [good-first-bug])


(1 file)

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.
Blocks: 1397427
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.
Assignee: nobody → stevea1
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+
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.
Pushed by
Enable py2 linter on python/mozlint. r=ahal
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
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"?
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.
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?
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.