Skip to content

Commit b93e44d

Browse files
aemongepre-commit-ci[bot]mochaaP
authored
builtins/diagnostics: add pydoclint (#181)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Zephyr Lykos <[email protected]>
1 parent 3291afd commit b93e44d

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

doc/BUILTINS.md

+17
Original file line numberDiff line numberDiff line change
@@ -1010,6 +1010,23 @@ local sources = { null_ls.builtins.diagnostics.mypy }
10101010
- Command: `mypy`
10111011
- Args: dynamically resolved (see [source](https://github.com/nvimtools/none-ls.nvim/blob/main/lua/null-ls/builtins/diagnostics/mypy.lua))
10121012

1013+
### [pydoclint](https://jsh9.github.io/pydoclint/)
1014+
1015+
Pydoclint is a Python docstring linter to check whether a docstring's sections (arguments, returns, raises, ...) match the function signature or function implementation.
1016+
Usage
1017+
1018+
```lua
1019+
local sources = { null_ls.builtins.diagnostics.pydoclint }
1020+
```
1021+
1022+
#### Defaults
1023+
1024+
- Filetypes: `{ "python" }`
1025+
- Method: `diagnostics`
1026+
- Command: `pydoclint`
1027+
- Args: dynamically resolved (see source)
1028+
1029+
10131030
### [npm_groovy_lint](https://github.com/nvuillam/npm-groovy-lint)
10141031

10151032
Lint, format and auto-fix Groovy, Jenkinsfile, and Gradle files.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
local h = require("null-ls.helpers")
2+
local methods = require("null-ls.methods")
3+
4+
local DIAGNOSTICS = methods.internal.DIAGNOSTICS
5+
6+
return h.make_builtin({
7+
name = "pydoclint",
8+
meta = {
9+
url = "https://github.com/jsh9/pydoclint",
10+
description = "Pydoclint is a Python docstring linter to check whether a docstring's sections (arguments, returns, raises, ...) match the function signature or function implementation. To see all violation codes go to [pydoclint](https://jsh9.github.io/pydoclint/violation_codes.html)",
11+
},
12+
method = DIAGNOSTICS,
13+
filetypes = { "python" },
14+
generator_opts = {
15+
command = "pydoclint",
16+
args = {
17+
"--show-filenames-in-every-violation-message=true",
18+
"-q",
19+
"$FILENAME",
20+
},
21+
to_temp_file = true,
22+
from_stderr = true,
23+
format = "line",
24+
check_exit_code = function(code)
25+
return code <= 2
26+
end,
27+
multiple_files = false,
28+
on_output = function(line, params)
29+
local path = params.temp_path
30+
-- rel/path/to/file.py:42: DOC000: Diagnostic message
31+
local pattern = path .. [[:(%d+): (DOC%d+: .*)]]
32+
return h.diagnostics.from_pattern(pattern, { "row", "message" })(line, params)
33+
end,
34+
},
35+
factory = h.generator_factory,
36+
})

0 commit comments

Comments
 (0)