Closed Bug 1573182 Opened 7 years ago Closed 7 years ago

flake8 linter fails to parse PEP484 annotations in Python 3 files

Categories

(Developer Infrastructure :: Lint and Formatting, task)

task
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1567642

People

(Reporter: beth, Unassigned)

Details

While adding a new Python 3 only file, I ran into the issue that our flake8 linter only supports python 2 files. Adding a python 3 file with PEP 484 type annotations, e.g.

def main(args: List[str]) -> int:
    pass

will result in the linter failing to parse the file with the error: SyntaxError: invalid syntax (E999)

Here is a try push with a failing flake8 job.

This is a known issue. Until that's fixed, your only options are to not use type annotations or add your file to the flake8 exclude list:
https://searchfox.org/mozilla-central/source/.flake8#3

If you go the latter route, please add a new section of exclusions via a comment. Something like # These files have Python 3-only syntax (see bug 1567642).

Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.