Previous Post | Top | Next Post |
TOC
Pointers to linting tools.
See Re-learning Vim (2) to understand how linters are used from Vim frontend.
Shell
shellcheck
- deb package: shellcheck
- site: https://github.com/koalaman/shellcheck
- use in vim via ALE
- ignore warning:
- line: “
# shellcheck disable=SC2059
” just above code line - file: “
# shellcheck disable=SC2059
” just below#!/bin/sh
- user: “
disable=SC2059
” in~/.shellcheckrc
- line: “
- list of warnings
vim as formtter
- NORMAL MODE:
gg=G
Python
In case of doubt, chose one lint in ~/.vim/vimrc
for ALE by UN-commenting
out (instead of running 3 linters, use fast flake8-only):
let g:ale_linters = {'python': ['flake8']}
"let g:ale_linters = {'python': ['pylint']}
"let g:ale_linters = {'python': ['mypy']}
See https://github.com/osamuaoki/dot-vim
pylint
- deb package: pylint
- src: https://github.com/PyCQA/pylint
- doc: https://pylint.readthedocs.io/en/latest/index.html
- use in vim via ALE
- ignore warning:
- line: “
# pylint: disable=no-member
” just above code line - file: “
# pylint: disable=missing-docstring
” top of file - user:
~/.config/pylintrc
- line: “
- error code
The template for ~/.config/pylintrc
is created by :pylint --generate-rcfile >~/.config/pylintrc
~/.config/pylintrc
mod:
disable=print-statement,
parameter-unpacking,
...
# extras
invalid-name,
line-too-long,
missing-function-docstring,
useless-return,
duplicate-code
flake8 – wrapper around pycodestyle and pyflakes and mccabe
- deb package: python3-flake8
- src: https://github.com/PyCQA/flake8
- doc: https://flake8.readthedocs.io/en/latest/
- config: https://flake8.pycqa.org/en/latest/user/configuration.html
- line: “
# noqa
” at the end of line - project: https://flake8.pycqa.org/en/latest/user/configuration.html
- user:
~/.config/flake8
- line: “
- error code
~/.config/flake8
:
[flake8]
ignore = E226,E302,E41
max-line-length = 160
Here, E41
means E41*
.
Black – formatter
- deb package: black
- src: https://github.com/psf/black
- doc: https://black.readthedocs.io/en/stable/
- config: https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html
- project:
pyproject.toml
- user:
~/.config/black
- project:
isort – formatter
- deb: python3-isort
- doc: https://pycqa.github.io/isort/
- src: https://github.com/PyCQA/isort
Previous Post | Top | Next Post |