diff --git a/README.md b/README.md index cab562b5..00c3baf8 100644 --- a/README.md +++ b/README.md @@ -147,6 +147,7 @@ Other dedicated linters that are built-in are: | [puppet-lint][puppet-lint] | `puppet-lint` | | [pycodestyle][pcs-docs] | `pycodestyle` | | [pydocstyle][pydocstyle] | `pydocstyle` | +| [pyroject-flake8][pflake8] | `pflake8` | | [Pylint][15] | `pylint` | | [Revive][14] | `revive` | | [rflint][rflint] | `rflint` | @@ -429,3 +430,4 @@ busted tests/ [puppet-lint]: https://github.com/puppetlabs/puppet-lint [snyk]: https://github.com/snyk/cli [gitlint]: https://github.com/jorisroovers/gitlint +[pflake8]: https://github.com/csachs/pyproject-flake8 diff --git a/lua/lint/linters/pflake8.lua b/lua/lint/linters/pflake8.lua new file mode 100644 index 00000000..009e6586 --- /dev/null +++ b/lua/lint/linters/pflake8.lua @@ -0,0 +1,18 @@ +-- path/to/file:line:col: code message +local pattern = "[^:]+:(%d+):(%d+):(%w+):(.+)" +local groups = { "lnum", "col", "code", "message" } + +return { + cmd = "pflake8", + stdin = true, + args = { + "--format=%(path)s:%(row)d:%(col)d:%(code)s:%(text)s", + "--no-show-source", + "-", + }, + ignore_exitcode = true, + parser = require("lint.parser").from_pattern(pattern, groups, nil, { + ["source"] = "flake8", + ["severity"] = vim.diagnostic.severity.WARN, + }), +}