From b5e603bbc5127ad6a78913054f48de733724c435 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Sat, 25 Feb 2017 17:27:03 +0000 Subject: [PATCH] Add cmakelint support for cmake filetype --- README.md | 1 + ale_linters/cmake/cmakelint.vim | 24 ++++++++++++++++++++++++ doc/ale.txt | 19 +++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 ale_linters/cmake/cmakelint.vim diff --git a/README.md b/README.md index 677a7ca..9f4e6ab 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ name. That seems to be the fairest way to arrange this table. | C++ (filetype cpp) | [clang](http://clang.llvm.org/), [clangtidy](http://clang.llvm.org/extra/clang-tidy/), [cppcheck] (http://cppcheck.sourceforge.net), [gcc](https://gcc.gnu.org/)| | C# | [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) | | Chef | [foodcritic](http://www.foodcritic.io/) | +| CMake | [cmakelint](https://github.com/richq/cmake-lint) | | CoffeeScript | [coffee](http://coffeescript.org/), [coffeelint](https://www.npmjs.com/package/coffeelint) | | CSS | [csslint](http://csslint.net/), [stylelint](https://github.com/stylelint/stylelint) | | Cython (pyrex filetype) | [cython](http://cython.org/) | diff --git a/ale_linters/cmake/cmakelint.vim b/ale_linters/cmake/cmakelint.vim new file mode 100644 index 0000000..fb876c6 --- /dev/null +++ b/ale_linters/cmake/cmakelint.vim @@ -0,0 +1,24 @@ +" Author: Kenneth Benzie +" Description: cmakelint for cmake files + +let g:ale_cmake_cmakelint_executable = +\ get(g:, 'ale_cmake_cmakelint_executable', 'cmakelint') + +let g:ale_cmake_cmakelint_options = +\ get(g:, 'ale_cmake_cmakelint_options', '') + +function! ale_linters#cmake#cmakelint#Executable(buffer) abort + return g:ale_cmake_cmakelint_executable +endfunction + +function! ale_linters#cmake#cmakelint#Command(buffer) abort + return ale_linters#cmake#cmakelint#Executable(a:buffer) + \ . ' ' . g:ale_cmake_cmakelint_options . ' %t' +endfunction + +call ale#linter#Define('cmake', { +\ 'name': 'cmakelint', +\ 'executable_callback': 'ale_linters#cmake#cmakelint#Executable', +\ 'command_callback': 'ale_linters#cmake#cmakelint#Command', +\ 'callback': 'ale#handlers#HandleUnixFormatAsWarning', +\}) diff --git a/doc/ale.txt b/doc/ale.txt index 5f9cdea..c62ebbd 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -79,6 +79,7 @@ The following languages and tools are supported. * C++ (filetype cpp): 'clang', 'clangtidy', 'cppcheck', 'gcc' * C#: 'mcs' * Chef: 'foodcritic' +* CMake: 'cmakelint' * CoffeeScript: 'coffee', 'coffelint' * CSS: 'csslint', 'stylelint' * Cython (pyrex filetype): 'cython' @@ -1061,6 +1062,24 @@ g:ale_yaml_yamllint_options *g:ale_yaml_yamllint_options* This variable can be set to pass additional options to yamllint. +------------------------------------------------------------------------------ +4.32. cmakelint *ale-linter-options-cmakelint* + +g:ale_cmake_cmakelint_exectuable *g:ale_cmake_cmakelint_executable* + + Type: |String| + Default: `''` + + This variable can be set to change the path the cmakelint. + +g:ale_cmake_cmakelint_options *g:ale_cmake_cmakelint_options* + + Type: |String| + Default: `''` + + This variable can be set to pass additional options to cmakelint. + + =============================================================================== 5. Linter Integration Notes *ale-linter-integration*