BradenM/micropy-cli

Proposed convention: exclude files matching *_asm.py from linting in VS Code automatically

开放

#221 创建于 2021年2月4日

 (0 条评论) (0 个反应) (0 位负责人)Python (29 个派生)auto 404
enhancementhelp wanted

仓库指标

星标
 (335 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Is your feature request related to a problem? Please describe. When writing code in assembler such as the following:

@rp2.asm_pio()
def irq_test():
    wrap_target()
    nop()          [31]
    nop()          [31]
    nop()          [31]
    nop()          [31]
    irq(0)
    nop()          [31]
    nop()          [31]
    nop()          [31]
    nop()          [31]
    irq(1)
    wrap()

this makes linting go crazy as it's obviously not "normal" Python code, despite being accepted happily by MicroPython.

Describe the solution you'd like I have moved such functions into their own file (e.g. foo_asm.py) and have then added the following to settings.json in VS Code:

    "python.linting.ignorePatterns": [
        ".vscode/*.py",
        "**/*_asm.py"
    ]

This makes pylint a lot quieter!

I'm proposing that this approach is adopted as a convention and that the above JSON is included in the settings.json file created by micropy-cli when initialising a new project.

Describe alternatives you've considered It's also possible to exclude files using a comment:

# pylint: skip-file

and it's possible to just disable linting for an assembly method:

# pylint: disable=E,W,C,R

however, both approaches require you to add the comments in explicitly, remember the syntax (or find somewhere to copy and paste it from) and requires knowledge of pylint's workings. A standardised file-naming convention supported by micropy-cli would remove those obstacles.

贡献者指南