micropy-cli
micropy-cli copied to clipboard
Proposed convention: exclude files matching *_asm.py from linting in VS Code automatically
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.