Enable py2 linter on python/mozlint

RESOLVED FIXED in Firefox 57

Status

RESOLVED FIXED
a year ago
a year ago

People

(Reporter: ahal, Assigned: stevea1, Mentored)

Tracking

unspecified
mozilla57
Points:
---

Firefox Tracking Flags

(firefox57 fixed)

Details

(Whiteboard: [good-first-bug])

Attachments

(1 attachment)

(Reporter)

Description

a year 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.
(Reporter)

Updated

a year ago
Blocks: 1397427
Comment hidden (mozreview-request)
(Assignee)

Comment 2

a year 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.
(Reporter)

Updated

a year ago
Assignee: nobody → stevea1
(Reporter)

Comment 3

a year ago
mozreview-review
Comment on attachment 8905334 [details]
Bug 1397423 - Enable py2 linter on python/mozlint.

https://reviewboard.mozilla.org/r/177118/#review182300

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+
(Reporter)

Comment 4

a year 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

a year ago
Pushed by ahalberstadt@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/47da53b3d3e7
Enable py2 linter on python/mozlint. r=ahal
https://hg.mozilla.org/mozilla-central/rev/47da53b3d3e7
Status: NEW → RESOLVED
Last Resolved: a year ago
status-firefox57: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla57

Comment 7

a year 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"?
(Assignee)

Comment 8

a year 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

a year 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?
(Reporter)

Comment 10

a year 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.