Skip to content

Commit

Permalink
Add pyproject-flake8 support (#444)
Browse files Browse the repository at this point in the history
  • Loading branch information
toirl authored Nov 9, 2023
1 parent 06e4bb4 commit bd9bcc0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |
Expand Down Expand Up @@ -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
18 changes: 18 additions & 0 deletions lua/lint/linters/pflake8.lua
Original file line number Diff line number Diff line change
@@ -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,
}),
}

0 comments on commit bd9bcc0

Please sign in to comment.