Closed Bug 1622686 Opened 4 years ago Closed 4 years ago

testing/web-platform: Make it flake8 compliant

Categories

(Developer Infrastructure :: Lint and Formatting, task)

task
Not set
normal

Tracking

(firefox83 fixed)

RESOLVED FIXED
83 Branch
Tracking Status
firefox83 --- fixed

People

(Reporter: Sylvestre, Assigned: mail, Mentored)

References

Details

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

Attachments

(1 file, 1 obsolete file)

Filling as a good first bug to learn workflows.

As the change is easy, it is mostly to learn how to contribute to Firefox.

To work on this, remove this line:
https://searchfox.org/mozilla-central/source/.flake8#52

To run the linter:
$ ./mach lint -l flake8 testing/web-platform/

To run the autofix:
$ ./mach lint -l flake8 --fix testing/web-platform/

Then, the remaining thing should be fixed by hand.

Tutorial to contribute:
https://firefox-source-docs.mozilla.org/tools/docs/contribute/how_to_contribute_firefox.html

Please don't ask for the bug to be assigned. It will be automatically assigned to the first patch.

I tried to work on this ticket in Ubuntu but after running ./mach lint -l flake8 testing/web-platform/ i see the following:
...
mozilla/src/src/obj-x86_64-pc-linux-gnu/_virtualenvs/init_py3/lib/python3.6/site-packages/pip/_internal/cli/req_command.py", line 17, in <module>
from pip._internal.index import PackageFinder
ImportError: cannot import name 'PackageFinder'

Unable to install correct version of flake8
Try to install it manually with:
$ pip install -U --require-hashes -r /mozilla/src/src/tools/lint/python/flake8_requirements.txt
error: problem with lint setup, skipping flake8
Error running mach:

['lint', '-l', 'flake8', 'testing/web-platform/']

...
The details of the failure are as follows:

mozlint.errors.LintersNotConfigured: No linters registered! Use LintRoller.read to register a linter.

File "mozilla/src/src/tools/lint/mach_commands.py", line 85, in lint
return cli.run(*runargs, **lintargs)
File "mozilla/src/src/python/mozlint/mozlint/cli.py", line 228, in run
num_procs=num_procs
File "/home/theo/Desktop/mozilla/src/src/python/mozlint/mozlint/roller.py", line 248, in roll
raise LintersNotConfigured

How do i fix it?
Should i follow any specific process to register a linters?

Flags: needinfo?(sledru)

Running ./mach clobber python fixed the issue so i will provide a fix soon.

Flags: needinfo?(sledru)

Change is complete now. I only face problems to push the revisions to phabricator.
Running moz-phab submit 534249::534612 returns

warning: Watchman unavailable: watchman exited with code 1
FileNotFoundError: [WinError 206] The filename or extension is too long
Run moz-phab again with '--trace' to show debugging output
Sentry is attempting to send 0 pending error messages
Waiting up to 2 seconds
Press Ctrl-Break to quit

I also tried moz-phab self-update and it returned the following message
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\mozilla-build\python3\Scripts\moz-phab.exe\moz-phab.exe' -> 'C:\mozilla-build\python3\Scripts\moz-phab.exe\moz-phab-temp.exe'
Run moz-phab again with '--trace' to show debugging output
Sentry is attempting to send 0 pending error messages
Waiting up to 2 seconds
Press Ctrl-Break to quit

Is this a configuration issue? Could somebody help me solve it?

Flags: needinfo?(sledru)

Bugzilla isn't the place to ask for help. Please ask your questions here:
https://chat.mozilla.org/#/room/#introduction:mozilla.org
good luck!

Flags: needinfo?(sledru)
Assignee: nobody → nikolaoutheod
Status: NEW → ASSIGNED
Attachment #9156386 - Attachment is obsolete: true
Assignee: nikolaoutheod → nobody
Status: ASSIGNED → NEW

This also enables py3 linting for testing/web-platform. The external testing/web-platform/tests is excluded from linting.

Assignee: nobody → pfischbeck
Status: NEW → ASSIGNED
Pushed by sledru@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/01429e0b0702
Make testing/web-platform flake8 compliant. r=sylvestre,jgraham
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 83 Branch
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: