puppet: Add puppet-languageserver linter
This commit is contained in:
parent
00a3859304
commit
42ae06a288
4 changed files with 49 additions and 2 deletions
|
@ -157,7 +157,7 @@ formatting.
|
||||||
| Pony | [ponyc](https://github.com/ponylang/ponyc) |
|
| Pony | [ponyc](https://github.com/ponylang/ponyc) |
|
||||||
| proto | [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint) |
|
| proto | [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint) |
|
||||||
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) |
|
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) |
|
||||||
| Puppet | [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) |
|
| Puppet | [languageserver](https://github.com/lingua-pupuli/puppet-editor-services), [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) |
|
||||||
| Python | [autopep8](https://github.com/hhatto/autopep8), [black](https://github.com/ambv/black), [flake8](http://flake8.pycqa.org/en/latest/), [isort](https://github.com/timothycrosley/isort), [mypy](http://mypy-lang.org/), [prospector](http://github.com/landscapeio/prospector), [pycodestyle](https://github.com/PyCQA/pycodestyle), [pyls](https://github.com/palantir/python-language-server), [pyre](https://github.com/facebook/pyre-check), [pylint](https://www.pylint.org/) !!, [yapf](https://github.com/google/yapf) |
|
| Python | [autopep8](https://github.com/hhatto/autopep8), [black](https://github.com/ambv/black), [flake8](http://flake8.pycqa.org/en/latest/), [isort](https://github.com/timothycrosley/isort), [mypy](http://mypy-lang.org/), [prospector](http://github.com/landscapeio/prospector), [pycodestyle](https://github.com/PyCQA/pycodestyle), [pyls](https://github.com/palantir/python-language-server), [pyre](https://github.com/facebook/pyre-check), [pylint](https://www.pylint.org/) !!, [yapf](https://github.com/google/yapf) |
|
||||||
| QML | [qmlfmt](https://github.com/jesperhh/qmlfmt), [qmllint](https://github.com/qt/qtdeclarative/tree/5.11/tools/qmllint) |
|
| QML | [qmlfmt](https://github.com/jesperhh/qmlfmt), [qmllint](https://github.com/qt/qtdeclarative/tree/5.11/tools/qmllint) |
|
||||||
| R | [lintr](https://github.com/jimhester/lintr) |
|
| R | [lintr](https://github.com/jimhester/lintr) |
|
||||||
|
|
35
ale_linters/puppet/languageserver.vim
Normal file
35
ale_linters/puppet/languageserver.vim
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
" Author: Alexander Olofsson <alexander.olofsson@liu.se>
|
||||||
|
" Description: Puppet Language Server integration for ALE
|
||||||
|
|
||||||
|
call ale#Set('puppet_languageserver_executable', 'puppet-languageserver')
|
||||||
|
|
||||||
|
function! ale_linters#puppet#languageserver#GetExecutable(buffer) abort
|
||||||
|
return ale#Var(a:buffer, 'puppet_languageserver_executable')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#puppet#languageserver#GetCommand(buffer) abort
|
||||||
|
let l:exe = ale#Escape(ale_linters#puppet#languageserver#GetExecutable(a:buffer))
|
||||||
|
|
||||||
|
return l:exe . ' --stdio'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#puppet#languageserver#GetProjectRoot(buffer) abort
|
||||||
|
" Note: while manifest.json is a strong recommendation, the only
|
||||||
|
" *required* path for a Puppet module is the manifests folder.
|
||||||
|
let l:root_path = ale#path#FindNearestFile(a:buffer, 'metadata.json')
|
||||||
|
|
||||||
|
if empty(l:root_path)
|
||||||
|
let l:root_path = ale#path#FindNearestDirectory(a:buffer, 'manifests')
|
||||||
|
endif
|
||||||
|
|
||||||
|
return !empty(l:root_path) ? fnamemodify(l:root_path, ':h') : ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
call ale#linter#Define('puppet', {
|
||||||
|
\ 'name': 'languageserver',
|
||||||
|
\ 'lsp': 'stdio',
|
||||||
|
\ 'executable_callback': 'ale_linters#puppet#languageserver#GetExecutable',
|
||||||
|
\ 'command_callback': 'ale_linters#puppet#languageserver#GetCommand',
|
||||||
|
\ 'language': 'puppet',
|
||||||
|
\ 'project_root_callback': 'ale_linters#puppet#languageserver#GetProjectRoot',
|
||||||
|
\})
|
|
@ -22,5 +22,16 @@ g:ale_puppet_puppetlint_options *g:ale_puppet_puppetlint_options*
|
||||||
puppet-lint invocation.
|
puppet-lint invocation.
|
||||||
|
|
||||||
|
|
||||||
|
===============================================================================
|
||||||
|
puppet-languageserver *ale-puppet-languageserver*
|
||||||
|
|
||||||
|
g:ale_puppet_languageserver_executable *g:ale_puppet_languageserver_executable*
|
||||||
|
*b:ale_puppet_languageserver_executable*
|
||||||
|
type: |String|
|
||||||
|
Default: `'puppet-languageserver'`
|
||||||
|
|
||||||
|
This variable can be used to specify the executable used for
|
||||||
|
puppet-languageserver.
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||||
|
|
|
@ -186,6 +186,7 @@ CONTENTS *ale-contents*
|
||||||
puglint.............................|ale-pug-puglint|
|
puglint.............................|ale-pug-puglint|
|
||||||
puppet................................|ale-puppet-options|
|
puppet................................|ale-puppet-options|
|
||||||
puppetlint..........................|ale-puppet-puppetlint|
|
puppetlint..........................|ale-puppet-puppetlint|
|
||||||
|
puppet-languageserver...............|ale-puppet-languageserver|
|
||||||
pyrex (cython)........................|ale-pyrex-options|
|
pyrex (cython)........................|ale-pyrex-options|
|
||||||
cython..............................|ale-pyrex-cython|
|
cython..............................|ale-pyrex-cython|
|
||||||
python................................|ale-python-options|
|
python................................|ale-python-options|
|
||||||
|
@ -390,7 +391,7 @@ Notes:
|
||||||
* Pony: `ponyc`
|
* Pony: `ponyc`
|
||||||
* proto: `protoc-gen-lint`
|
* proto: `protoc-gen-lint`
|
||||||
* Pug: `pug-lint`
|
* Pug: `pug-lint`
|
||||||
* Puppet: `puppet`, `puppet-lint`
|
* Puppet: `languageserver`, `puppet`, `puppet-lint`
|
||||||
* Python: `autopep8`, `black`, `flake8`, `isort`, `mypy`, `prospector`, `pycodestyle`, `pyls`, `pyre`, `pylint`!!, `yapf`
|
* Python: `autopep8`, `black`, `flake8`, `isort`, `mypy`, `prospector`, `pycodestyle`, `pyls`, `pyre`, `pylint`!!, `yapf`
|
||||||
* QML: `qmlfmt`, `qmllint`
|
* QML: `qmlfmt`, `qmllint`
|
||||||
* R: `lintr`
|
* R: `lintr`
|
||||||
|
|
Reference in a new issue