Closed Bug 1790890 Opened 3 years ago Closed 3 years ago

Port bug 1492495: Enable 'flake8-isort' plugin in flake8 mozlinter

Categories

(Thunderbird :: Build Config, task)

task

Tracking

(thunderbird_esr102 unaffected)

RESOLVED FIXED
108 Branch
Tracking Status
thunderbird_esr102 --- unaffected

People

(Reporter: rjl, Assigned: rjl)

References

Details

Attachments

(2 files)

Bug 1492495 adds the 'flake8-isort' plugin to the flake8 Python linter.

The short version is that it will enforce a standard order for imported libraries and modules.

Initially, it will only produce warnings which will not fail mozlint tests in CI.

A new config file will need to be added: comm/tools/lint/flake8.yml. This will enable comm-central file exclusions and not run flake8 on *.configure files. Not sure why m-c is including configure files in its mozlint config, they're all excluded in the .flake8 file.

---
flake8:
    description: Python linter
    # Excludes should be added to topsrcdir/.flake8.
    exclude: []
    # The configure option is used by the build system
    extensions: ['py']
    support-files:
        - '**/.flake8'
        - 'tools/lint/python/flake8*'
    # Rules that should result in warnings rather than errors.
    warning-rules: ['I001', 'I003', 'I004', 'I005']
    type: external
    payload: commlint:lint_wrapper
    wraps: python.flake8:lint
    setup: python.flake8:setup

Then with bug 1492495 in m-c, this works:

./mach commlint -l flake8 --warnings comm

Should be able to pass --fix to mach commlint and take care of most of the isort problems.

isort is an "import" statement ordering check. For now, only issue warnings for
those checks.

Assignee: daniel → rob
Status: NEW → ASSIGNED
Target Milestone: --- → 108 Branch
Blocks: 1799140

Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/050b94a49569
port Bug 1492495: Make flake8-isort failures a warning instead of hard fail. r=dandarnell
https://hg.mozilla.org/comm-central/rev/ec849410c436
Fix flake8-isort error messages. r=dandarnell

Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: