Add CMake linter cmake-lint (#4036)

* Add CMake linter cmake-lint

Add support for the CMake linter provided by
https://github.com/cheshirekow/cmake_format.

* Escape cmake-lint executable and add linter tests
This commit is contained in:
Carl Smedstad
2022-02-06 13:09:38 +01:00
committed by GitHub
parent 7cbb68da6c
commit c9938bc293
7 changed files with 108 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
Before:
runtime ale_linters/cmake/cmake_lint.vim
After:
Restore
call ale#linter#Reset()
Execute(The cmake_lint handler should handle basic warnings):
AssertEqual
\ [
\ {
\ 'lnum': 126,
\ 'col': 0,
\ 'type': 'W',
\ 'code': 'C0301',
\ 'text': 'Line too long (136/80)',
\ },
\ {
\ 'lnum': 139,
\ 'col': 4,
\ 'type': 'W',
\ 'code': 'C0113',
\ 'text': 'Missing COMMENT in statement which allows it',
\ },
\ ],
\ ale_linters#cmake#cmake_lint#Handle(1, [
\ 'CMakeLists.txt:126: [C0301] Line too long (136/80)',
\ 'CMakeLists.txt:139,04: [C0113] Missing COMMENT in statement which allows it',
\ ])

View File

@@ -0,0 +1,13 @@
Before:
call ale#assert#SetUpLinterTest('cmake', 'cmake_lint')
After:
call ale#assert#TearDownLinterTest()
Execute(The default command should be correct):
AssertLinter 'cmake-lint', ale#Escape('cmake-lint') . ' %t'
Execute(The executable should be configurable):
let g:ale_cmake_cmake_lint_executable = 'foobar'
AssertLinter 'foobar', ale#Escape('foobar') . ' %t'