This repository has been archived by the owner on Aug 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 787
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(diagnostics): add cmake_lint to go alongside cmake_format
- Loading branch information
1 parent
7cd491b
commit 7498653
Showing
3 changed files
with
42 additions
and
1 deletion.
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
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,38 @@ | ||
local h = require("null-ls.helpers") | ||
local methods = require("null-ls.methods") | ||
|
||
local DIAGNOSTICS = methods.internal.DIAGNOSTICS | ||
|
||
return h.make_builtin({ | ||
name = "cmake_lint", | ||
meta = { | ||
url = "https://github.com/cheshirekow/cmake_format", | ||
description = "Check cmake listfiles for style violations, common mistakes, and anti-patterns.", | ||
}, | ||
method = DIAGNOSTICS, | ||
filetypes = { "cmake" }, | ||
generator_opts = { | ||
command = "cmake-lint", | ||
args = { | ||
"$FILENAME", | ||
}, | ||
format = "line", | ||
to_stdin = false, | ||
from_stderr = true, | ||
on_output = h.diagnostics.from_pattern( | ||
[[(%d+),(%d+): %[((%w)[%d]+)%] (.+)]], | ||
{ "row", "col", "code", "severity", "message" }, | ||
{ | ||
severities = { | ||
E = h.diagnostics.severities["error"], | ||
W = h.diagnostics.severities["warning"], | ||
C = h.diagnostics.severities["information"], | ||
R = h.diagnostics.severities["information"], | ||
I = h.diagnostics.severities["information"], | ||
}, | ||
offsets = { col = 1 }, | ||
} | ||
), | ||
}, | ||
factory = h.generator_factory, | ||
}) |