-
-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds support for sphinx-lint, the linter provided by Sphinx here: https://github.com/sphinx-contrib/sphinx-lint Signed-off-by: Antonin Godard <[email protected]>
- Loading branch information
1 parent
36da8dd
commit 8e9562d
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
local efm = '%f:%l: %m' | ||
|
||
return { | ||
cmd = 'sphinx-lint', | ||
|
||
stream = 'stderr', | ||
ignore_exitcode = true, | ||
parser = require('lint.parser').from_errorformat(efm, { | ||
source = 'sphinx-lint', | ||
severity = vim.diagnostic.severity.WARN, | ||
}), | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
describe('linter.sphinx-lint', function() | ||
it('can parse the output', function() | ||
local parser = require('lint.linters.sphinx-lint').parser | ||
local bufnr = vim.uri_to_bufnr('file:///foo.rst') | ||
local result = parser([[ | ||
/foo.rst:42: trailing whitespace (trailing-whitespace) | ||
/foo.rst:420: missing space before default role: beep boop (missing-space-before-default-role) | ||
]], bufnr) | ||
|
||
assert.are.same(2, #result) | ||
|
||
local expected_error = { | ||
source = 'sphinx-lint', | ||
message = 'trailing whitespace (trailing-whitespace)', | ||
lnum = 41, | ||
col = 0, | ||
end_lnum = 41, | ||
end_col = 0, | ||
severity = vim.diagnostic.severity.WARN, | ||
} | ||
assert.are.same(expected_error, result[1]) | ||
|
||
expected_error = { | ||
source = 'sphinx-lint', | ||
message = 'missing space before default role: beep boop (missing-space-before-default-role)', | ||
lnum = 419, | ||
col = 0, | ||
end_lnum = 419, | ||
end_col = 0, | ||
severity = vim.diagnostic.severity.WARN, | ||
} | ||
assert.are.same(expected_error, result[2]) | ||
|
||
end) | ||
end) |