mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 20:54:26 +08:00
Compare commits
204 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
560e6340ce | ||
|
|
e5492e124d | ||
|
|
87ade74b4d | ||
|
|
c173b6243d | ||
|
|
e490e87a60 | ||
|
|
b42153eb17 | ||
|
|
66b2d994a1 | ||
|
|
3e1a98ff67 | ||
|
|
7ac0f633cc | ||
|
|
5b1044e2ad | ||
|
|
47470eddc2 | ||
|
|
82a3e444b2 | ||
|
|
4a4516e3bf | ||
|
|
8b1ea33cc0 | ||
|
|
2428d4d81d | ||
|
|
6d9399d863 | ||
|
|
c9938bc293 | ||
|
|
7cbb68da6c | ||
|
|
0c276aac90 | ||
|
|
a58b7b5efb | ||
|
|
5856c06775 | ||
|
|
6d20b6c162 | ||
|
|
0d529d9b94 | ||
|
|
d1e2aaf85d | ||
|
|
a81512cfd2 | ||
|
|
da1e4dcd1e | ||
|
|
5087246c82 | ||
|
|
76bd059371 | ||
|
|
5a5029b73d | ||
|
|
7b8e711877 | ||
|
|
11a90ad0ff | ||
|
|
ac0495df6e | ||
|
|
48f68598cb | ||
|
|
dcec4b3c37 | ||
|
|
5b792c7641 | ||
|
|
e4ec2e4dc7 | ||
|
|
091592bfb0 | ||
|
|
b9744076a1 | ||
|
|
9a01836015 | ||
|
|
9860dadbc9 | ||
|
|
de67f4743d | ||
|
|
072750137f | ||
|
|
ea643b97ab | ||
|
|
aee0cc45be | ||
|
|
3ca66e44bd | ||
|
|
2cfeabd1b5 | ||
|
|
3b8ff6536e | ||
|
|
31dc6a61a0 | ||
|
|
01fdd8d66b | ||
|
|
d72a9d64ff | ||
|
|
1e0e76bf96 | ||
|
|
76c2293e68 | ||
|
|
ff26ed7231 | ||
|
|
a9d7f45924 | ||
|
|
8b3b16d71c | ||
|
|
f37cd1fd4f | ||
|
|
92f08b5af2 | ||
|
|
da331acc9e | ||
|
|
95ba7898b4 | ||
|
|
9b5a3581eb | ||
|
|
cb0f0e1d0b | ||
|
|
16898417e6 | ||
|
|
c7e3f1a0dd | ||
|
|
7413dfd3fc | ||
|
|
1ee7580557 | ||
|
|
42a6e039cb | ||
|
|
34a972f85d | ||
|
|
efa563826d | ||
|
|
f9deee0e41 | ||
|
|
19b0f72c23 | ||
|
|
708e810414 | ||
|
|
c9c89a1853 | ||
|
|
f8a4c78b5b | ||
|
|
2f72a3ed19 | ||
|
|
dca56dd772 | ||
|
|
31349f208b | ||
|
|
f769f64c07 | ||
|
|
19437e25d0 | ||
|
|
bf29f6ea92 | ||
|
|
b504eeb094 | ||
|
|
c5c58f5bf8 | ||
|
|
42aadf6a26 | ||
|
|
35d0bd1519 | ||
|
|
8fd23f4b71 | ||
|
|
b9fdb91e92 | ||
|
|
d53a085096 | ||
|
|
f896744fee | ||
|
|
a099fe24b2 | ||
|
|
9264ffda23 | ||
|
|
836125391a | ||
|
|
d6f5fb69ad | ||
|
|
775d121d46 | ||
|
|
a793db7399 | ||
|
|
cc34310a99 | ||
|
|
10f984673c | ||
|
|
9eb39348e9 | ||
|
|
3ba40b4316 | ||
|
|
2dd9790281 | ||
|
|
fa032b1b7f | ||
|
|
8ecf32f3fe | ||
|
|
056fbd08f6 | ||
|
|
dce088a4f0 | ||
|
|
73d32335fe | ||
|
|
8c591996a8 | ||
|
|
7d8fb2ba17 | ||
|
|
530b38de34 | ||
|
|
5ad4fdd583 | ||
|
|
c1c3873c89 | ||
|
|
651038b601 | ||
|
|
a6719c2d4f | ||
|
|
f83a1f70d5 | ||
|
|
a6a8131306 | ||
|
|
1893abdb19 | ||
|
|
d6dbb5398e | ||
|
|
d8f4e8b708 | ||
|
|
82a7e9f588 | ||
|
|
d098124e59 | ||
|
|
c8f669249a | ||
|
|
9a9fd24b17 | ||
|
|
2a5a7baffc | ||
|
|
774ab4b4f0 | ||
|
|
1e9f40ff8d | ||
|
|
8b73d98baf | ||
|
|
e230f07465 | ||
|
|
958f30c163 | ||
|
|
af13c350d2 | ||
|
|
87e079a9b2 | ||
|
|
36fcb01e05 | ||
|
|
e4ddd32c84 | ||
|
|
afcbd1620e | ||
|
|
9efa96eb94 | ||
|
|
f9332bae1f | ||
|
|
d6302d1858 | ||
|
|
12d8803015 | ||
|
|
52563f9181 | ||
|
|
45430eb07e | ||
|
|
0d90cb64c6 | ||
|
|
b749ec702a | ||
|
|
49bdbc3ba5 | ||
|
|
7862633d9d | ||
|
|
a4ba421803 | ||
|
|
397d56f40c | ||
|
|
a566a5d01b | ||
|
|
ad27e921d7 | ||
|
|
88817b3780 | ||
|
|
2c8a857262 | ||
|
|
e78519683e | ||
|
|
84a4a76aaf | ||
|
|
1b08791228 | ||
|
|
a02a4f2811 | ||
|
|
f53431331e | ||
|
|
3f386ae5e9 | ||
|
|
bf1c30f585 | ||
|
|
6ef5bf308c | ||
|
|
93f80ea767 | ||
|
|
bee8eccb42 | ||
|
|
d81986a106 | ||
|
|
737c1bf1ac | ||
|
|
1c90d8c018 | ||
|
|
1cd0c0c33b | ||
|
|
686c8c5e0a | ||
|
|
cec9954d01 | ||
|
|
f0887d3e61 | ||
|
|
06f57ca973 | ||
|
|
655f0070cd | ||
|
|
b1f95dc4fb | ||
|
|
eb0ebe6221 | ||
|
|
cdac7a830e | ||
|
|
c6b61950f8 | ||
|
|
f7852dbd0a | ||
|
|
35caaecc9f | ||
|
|
3728d9f76c | ||
|
|
4411b4d751 | ||
|
|
b1d833417b | ||
|
|
3838ae118d | ||
|
|
8319e0f8c7 | ||
|
|
ed7f4dee53 | ||
|
|
dc40ece3c3 | ||
|
|
bd808dca30 | ||
|
|
c00852e809 | ||
|
|
f43e4abc88 | ||
|
|
b45ee8ec6c | ||
|
|
80a48d01be | ||
|
|
c21d6afd2f | ||
|
|
8c5081f631 | ||
|
|
826878c41e | ||
|
|
1d76fd55a1 | ||
|
|
680ba68d81 | ||
|
|
9fe7b1fe6a | ||
|
|
48fab99a0a | ||
|
|
038e4a8c31 | ||
|
|
7696561555 | ||
|
|
90b9597d50 | ||
|
|
2550f5d952 | ||
|
|
d340710fcf | ||
|
|
3ea887d2f4 | ||
|
|
1ee7f6c97b | ||
|
|
0b35c3a5b9 | ||
|
|
88d052b5a9 | ||
|
|
b30c5c9b51 | ||
|
|
8cb9f5ef51 | ||
|
|
3b184f88d3 | ||
|
|
ea72d66b6d | ||
|
|
1773a496ad |
6
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
6
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Ask for Help
|
||||
url: https://github.com/dense-analysis/ale/discussions/new?category=q-a-ask-for-help-with-problems
|
||||
about: Ask for Help in ALE Discussions
|
||||
6
.github/stale.yml
vendored
6
.github/stale.yml
vendored
@@ -1,9 +1,9 @@
|
||||
---
|
||||
# This configuration closes stale PRs after 28 + 7 days.
|
||||
# That's 4 weeks until stale bot complains, and a week until it closes a PR.
|
||||
# This configuration closes stale PRs after 56 + 7 days.
|
||||
# That's 8 weeks until stale bot complains, and a week until it closes a PR.
|
||||
# Issues in ALE are never, ever stale. They are either resolved or not.
|
||||
only: pulls
|
||||
daysUntilStale: 28
|
||||
daysUntilStale: 56
|
||||
daysUntilClose: 7
|
||||
exemptLabels: []
|
||||
staleLabel: stale
|
||||
|
||||
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
@@ -4,7 +4,8 @@ on: # yamllint disable-line rule:truthy
|
||||
push:
|
||||
branches: [ master ] # yamllint disable-line rule:brackets
|
||||
tags:
|
||||
- /^v\d+\.\d+\.(x|\d+)$/
|
||||
- v[0-9]+.[0-9]+.x
|
||||
- v[0-9]+.[0-9]+.[0-9]+
|
||||
pull_request:
|
||||
branches: [ master ] # yamllint disable-line rule:brackets
|
||||
|
||||
@@ -29,6 +30,7 @@ jobs:
|
||||
- '--vim-82-only'
|
||||
- '--neovim-02-only'
|
||||
- '--neovim-04-only'
|
||||
- '--neovim-05-only'
|
||||
- '--linters-only'
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
5
.vintrc.yaml
Normal file
5
.vintrc.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
policies:
|
||||
# Disable a violation that is thrown randomly for reasons I still
|
||||
# do not understand.
|
||||
ProhibitMissingScriptEncoding:
|
||||
enabled: false
|
||||
12
Dockerfile
12
Dockerfile
@@ -1,22 +1,24 @@
|
||||
FROM tweekmonster/vim-testbed:latest
|
||||
FROM testbed/vim:20
|
||||
|
||||
RUN install_vim -tag v8.0.0027 -build \
|
||||
-tag v8.2.2401 -build \
|
||||
-tag neovim:v0.2.0 -build \
|
||||
-tag neovim:v0.4.4 -build
|
||||
-tag neovim:v0.4.4 -build \
|
||||
-tag neovim:v0.5.0 -build
|
||||
|
||||
ENV PACKAGES="\
|
||||
bash \
|
||||
git \
|
||||
python \
|
||||
py-pip \
|
||||
python2 \
|
||||
python3 \
|
||||
py3-pip \
|
||||
grep \
|
||||
sed \
|
||||
"
|
||||
RUN apk --update add $PACKAGES && \
|
||||
rm -rf /var/cache/apk/* /tmp/* /var/tmp/*
|
||||
|
||||
RUN pip install vim-vint==0.3.15
|
||||
RUN pip install vim-vint==0.3.21
|
||||
|
||||
RUN git clone https://github.com/junegunn/vader.vim vader && \
|
||||
cd vader && git checkout c6243dd81c98350df4dec608fa972df98fa2a3af
|
||||
|
||||
64
README.md
64
README.md
@@ -81,6 +81,8 @@ other content at [w0rp.com](https://w0rp.com).
|
||||
18. [How can I configure ALE differently for different buffers?](#faq-buffer-configuration)
|
||||
19. [How can I configure the height of the list in which ALE displays errors?](#faq-list-window-height)
|
||||
20. [How can I run linters or fixers via Docker or a VM?](#faq-vm)
|
||||
21. [How can I change the borders for floating preview windows?](#faq-window-borders)
|
||||
22. [How can I use ALE and vim-lsp together?](#faq-vim-lsp)
|
||||
|
||||
<a name="supported-languages"></a>
|
||||
|
||||
@@ -196,14 +198,15 @@ completion manually with `<C-x><C-o>`.
|
||||
set omnifunc=ale#completion#OmniFunc
|
||||
```
|
||||
|
||||
ALE supports automatic imports from external modules. This behavior is disabled
|
||||
by default and can be enabled by setting:
|
||||
ALE supports automatic imports from external modules. This behavior is enabled
|
||||
by default and can be disabled by setting:
|
||||
|
||||
```vim
|
||||
let g:ale_completion_autoimport = 1
|
||||
let g:ale_completion_autoimport = 0
|
||||
```
|
||||
|
||||
See `:help ale-completion` for more information.
|
||||
Note that disabling auto import can result in missing completion items from some
|
||||
LSP servers (e.g. eclipselsp). See `:help ale-completion` for more information.
|
||||
|
||||
<a name="usage-go-to-definition"></a>
|
||||
|
||||
@@ -261,6 +264,9 @@ See `:help ale-symbol-search` for more information.
|
||||
ALE supports renaming symbols in symbols in code such as variables or class
|
||||
names with the `ALERename` command.
|
||||
|
||||
`ALEFileRename` will rename file and fix import paths (tsserver
|
||||
only).
|
||||
|
||||
`ALECodeAction` will execute actions on the cursor or applied to a visual
|
||||
range selection, such as automatically fixing errors.
|
||||
|
||||
@@ -381,7 +387,7 @@ If you are interested in the general direction of the project, check out the
|
||||
a Roadmap for the future, and more.
|
||||
|
||||
If you'd liked to discuss the project more directly, check out the `#vim-ale` channel
|
||||
on Freenode. Web chat is available [here](https://webchat.freenode.net/?channels=vim-ale).
|
||||
on Libera Chat. Web chat is available [here](https://web.libera.chat/#vim-ale).
|
||||
|
||||
<a name="faq"></a>
|
||||
|
||||
@@ -907,3 +913,51 @@ tools are well-integrated with ALE, and ALE is properly configured to run the
|
||||
correct commands and map filename paths between different file systems. See
|
||||
`:help ale-lint-other-machines` for the full documentation on how to configure
|
||||
ALE to support this.
|
||||
|
||||
<a name="faq-window-borders"></a>
|
||||
|
||||
### 5.xxi. How can I change the borders for floating preview windows?
|
||||
|
||||
Borders for floating preview windows are enabled by default. You can use the
|
||||
`g:ale_floating_window_border` setting to configure them.
|
||||
|
||||
You could disable the border with an empty list.
|
||||
|
||||
```vim
|
||||
let g:ale_floating_window_border = []
|
||||
```
|
||||
|
||||
If the terminal supports Unicode, you might try setting the value like below, to
|
||||
make it look nicer.
|
||||
|
||||
```vim
|
||||
let g:ale_floating_window_border = ['│', '─', '╭', '╮', '╯', '╰']
|
||||
```
|
||||
|
||||
Since vim's default uses nice unicode characters when possible, you can trick
|
||||
ale into using that default with
|
||||
|
||||
```vim
|
||||
let g:ale_floating_window_border = repeat([''], 6)
|
||||
```
|
||||
|
||||
<a name="faq-vim-lsp"></a>
|
||||
|
||||
### 5.xxii. How can I use ALE and vim-lsp together?
|
||||
|
||||
[vim-lsp](https://github.com/prabirshrestha/vim-lsp) is a popular plugin as
|
||||
implementation of Language Server Protocol (LSP) client for Vim. It provides
|
||||
all the LSP features including auto completion, diagnostics, go to definitions,
|
||||
etc.
|
||||
|
||||
ALE also provides LSP support for diagnostics. When you use both ALE and
|
||||
vim-lsp, one option is disabling ALE's LSP support by
|
||||
`let g:ale_disable_lsp = 1`. However ALE provides integration of external
|
||||
programs. Showing errors from language servers by vim-lsp and showing errors
|
||||
from other external programs by ALE are confusing and problematic.
|
||||
|
||||
[vim-lsp-ale](https://github.com/rhysd/vim-lsp-ale) is a bridge plugin to solve
|
||||
the problem when using both ALE and vim-lsp. With the plugin, diagnostics are
|
||||
provided by vim-lsp and ALE can handle all the errors. Please read
|
||||
[vim-lsp-ale's documentation](https://github.com/rhysd/vim-lsp-ale/blob/master/doc/vim-lsp-ale.txt)
|
||||
for more details.
|
||||
|
||||
5
ale_linters/ada/cspell.vim
Normal file
5
ale_linters/ada/cspell.vim
Normal file
@@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Ada files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('ada')
|
||||
@@ -1,4 +1,4 @@
|
||||
" Author: Bjorn Neergaard <bjorn@neersighted.com>
|
||||
" Authors: Bjorn Neergaard <bjorn@neersighted.com>, Vytautas Macionis <vytautas.macionis@manomail.de>
|
||||
" Description: ansible-lint for ansible-yaml files
|
||||
|
||||
call ale#Set('ansible_ansible_lint_executable', 'ansible-lint')
|
||||
@@ -7,7 +7,7 @@ function! ale_linters#ansible#ansible_lint#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'ansible_ansible_lint_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
|
||||
function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort
|
||||
for l:line in a:lines[:10]
|
||||
if match(l:line, '^Traceback') >= 0
|
||||
return [{
|
||||
@@ -18,39 +18,87 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
|
||||
endif
|
||||
endfor
|
||||
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" test.yml:35: [EANSIBLE0002] Trailing whitespace
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: \[?([[:alnum:]]+)\]? (.*)$'
|
||||
let l:version_group = ale#semver#GTE(a:version, [5, 0, 0]) ? '>=5.0.0' : '<5.0.0'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:code = l:match[4]
|
||||
if '>=5.0.0' is# l:version_group
|
||||
" Matches patterns line the following:
|
||||
" test.yml:3:148: syntax-check 'var' is not a valid attribute for a Play
|
||||
" roles/test/tasks/test.yml:8: [package-latest] [VERY_LOW] Package installs should not use latest
|
||||
" D:\test\tasks\test.yml:8: [package-latest] [VERY_LOW] package installs should not use latest
|
||||
let l:pattern = '\v^(%([a-zA-Z]:)?[^:]+):(\d+):%((\d+):)? %(\[([-[:alnum:]]+)\]) %(\[([_[:alnum:]]+)\]) (.*)$'
|
||||
let l:error_codes = { 'VERY_HIGH': 'E', 'HIGH': 'E', 'MEDIUM': 'W', 'LOW': 'W', 'VERY_LOW': 'W', 'INFO': 'I' }
|
||||
|
||||
if l:code is# 'EANSIBLE0002'
|
||||
\&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
||||
" Skip warnings for trailing whitespace if the option is off.
|
||||
continue
|
||||
endif
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
if ale#path#IsBufferPath(a:buffer, l:match[1])
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[6],
|
||||
\ 'code': l:match[4],
|
||||
\ 'type': l:error_codes[l:match[5]],
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if ale#path#IsBufferPath(a:buffer, l:match[1])
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[5],
|
||||
\ 'code': l:code,
|
||||
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
if '<5.0.0' is# l:version_group
|
||||
" Matches patterns line the following:
|
||||
" test.yml:35: [EANSIBLE0002] Trailing whitespace
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: \[?([[:alnum:]]+)\]? (.*)$'
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:code = l:match[4]
|
||||
|
||||
if l:code is# 'EANSIBLE0002'
|
||||
\&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
||||
" Skip warnings for trailing whitespace if the option is off.
|
||||
continue
|
||||
endif
|
||||
|
||||
if ale#path#IsBufferPath(a:buffer, l:match[1])
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[5],
|
||||
\ 'code': l:code,
|
||||
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ansible#ansible_lint#GetCommand(buffer, version) abort
|
||||
let l:commands = {
|
||||
\ '>=5.0.0': '%e --nocolor --parseable-severity -x yaml %s',
|
||||
\ '<5.0.0': '%e --nocolor -p %t'
|
||||
\}
|
||||
let l:command = ale#semver#GTE(a:version, [5, 0]) ? l:commands['>=5.0.0'] : l:commands['<5.0.0']
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ansible', {
|
||||
\ 'name': 'ansible_lint',
|
||||
\ 'aliases': ['ansible', 'ansible-lint'],
|
||||
\ 'executable': function('ale_linters#ansible#ansible_lint#GetExecutable'),
|
||||
\ 'command': '%e -p %t',
|
||||
\ 'callback': 'ale_linters#ansible#ansible_lint#Handle',
|
||||
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale_linters#ansible#ansible_lint#GetExecutable(buffer),
|
||||
\ '%e --version',
|
||||
\ function('ale_linters#ansible#ansible_lint#GetCommand'),
|
||||
\ )},
|
||||
\ 'lint_file': 1,
|
||||
\ 'callback': {buffer, lines -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale_linters#ansible#ansible_lint#GetExecutable(buffer),
|
||||
\ '%e --version',
|
||||
\ {buffer, version -> ale_linters#ansible#ansible_lint#Handle(
|
||||
\ buffer,
|
||||
\ l:version,
|
||||
\ lines)},
|
||||
\ )},
|
||||
\})
|
||||
|
||||
5
ale_linters/asciidoc/cspell.vim
Normal file
5
ale_linters/asciidoc/cspell.vim
Normal file
@@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for ASCIIDoc files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('asciidoc')
|
||||
36
ale_linters/avra/avra.vim
Normal file
36
ale_linters/avra/avra.vim
Normal file
@@ -0,0 +1,36 @@
|
||||
" Author: Utkarsh Verma <utkarshverma@protonmail.com>
|
||||
" Description: AVRA linter for avra syntax.
|
||||
|
||||
call ale#Set('avra_avra_executable', 'avra')
|
||||
call ale#Set('avra_avra_options', '')
|
||||
|
||||
function! ale_linters#avra#avra#GetCommand(buffer) abort
|
||||
return '%e'
|
||||
\ . ' %t'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'avra_avra_options'))
|
||||
\ . ' -o ' . g:ale#util#nul_file
|
||||
endfunction
|
||||
|
||||
function! ale_linters#avra#avra#Handle(buffer, lines) abort
|
||||
" Note that we treat 'fatal' as errors.
|
||||
let l:pattern = '^\S\+(\(\d\+\))\s\+:\s\+\(\S\+\)\s\+:\s\+\(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'type': l:match[2] =~? 'Error' ? 'E' : 'W',
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('avra', {
|
||||
\ 'name': 'avra',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'avra_avra_executable')},
|
||||
\ 'command': function('ale_linters#avra#avra#GetCommand'),
|
||||
\ 'callback': 'ale_linters#avra#avra#Handle',
|
||||
\})
|
||||
47
ale_linters/bitbake/oelint_adv.vim
Normal file
47
ale_linters/bitbake/oelint_adv.vim
Normal file
@@ -0,0 +1,47 @@
|
||||
" Author: offa
|
||||
" Description: oelint-adv for BitBake files
|
||||
|
||||
call ale#Set('bitbake_oelint_adv_executable', 'oelint-adv')
|
||||
call ale#Set('bitbake_oelint_adv_options', '')
|
||||
call ale#Set('bitbake_oelint_adv_config', '.oelint.cfg')
|
||||
|
||||
function! ale_linters#bitbake#oelint_adv#Command(buffer) abort
|
||||
let l:config_file = ale#path#FindNearestFile(a:buffer,
|
||||
\ ale#Var(a:buffer, 'bitbake_oelint_adv_config'))
|
||||
|
||||
return ((!empty(l:config_file))
|
||||
\ ? 'OELINT_CONFIG=' . ale#Escape(l:config_file) . ' '
|
||||
\ : '')
|
||||
\ . '%e --quiet '
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'bitbake_oelint_adv_options')) . '%s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bitbake#oelint_adv#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^(.+):(.+):(.+):(.+):(.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'type': l:match[3] is# 'error'
|
||||
\ ? 'E' : (l:match[3] is# 'warning' ? 'W' : 'I'),
|
||||
\ 'text': StripAnsiCodes(l:match[5]),
|
||||
\ 'code': l:match[4]
|
||||
\ })
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! StripAnsiCodes(line) abort
|
||||
return substitute(a:line, '\e\[[0-9;]\+[mK]', '', 'g')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('bitbake', {
|
||||
\ 'name': 'oelint_adv',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#Var(b, 'bitbake_oelint_adv_executable')},
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#bitbake#oelint_adv#Command'),
|
||||
\ 'callback': 'ale_linters#bitbake#oelint_adv#Handle',
|
||||
\ })
|
||||
@@ -5,15 +5,13 @@ call ale#Set('c_cppcheck_executable', 'cppcheck')
|
||||
call ale#Set('c_cppcheck_options', '--enable=style')
|
||||
|
||||
function! ale_linters#c#cppcheck#GetCommand(buffer) abort
|
||||
let l:cd_command = ale#handlers#cppcheck#GetCdCommand(a:buffer)
|
||||
let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer)
|
||||
let l:buffer_path_include = empty(l:compile_commands_option)
|
||||
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
|
||||
\ : ''
|
||||
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
||||
|
||||
return l:cd_command
|
||||
\ . '%e -q --language=c'
|
||||
return '%e -q --language=c'
|
||||
\ . l:template
|
||||
\ . ale#Pad(l:compile_commands_option)
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'c_cppcheck_options'))
|
||||
@@ -25,6 +23,7 @@ call ale#linter#Define('c', {
|
||||
\ 'name': 'cppcheck',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#Var(b, 'c_cppcheck_executable')},
|
||||
\ 'cwd': function('ale#handlers#cppcheck#GetCwd'),
|
||||
\ 'command': function('ale_linters#c#cppcheck#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
|
||||
\})
|
||||
|
||||
20
ale_linters/c/cpplint.vim
Normal file
20
ale_linters/c/cpplint.vim
Normal file
@@ -0,0 +1,20 @@
|
||||
" Author: Justin Huang <justin.y.huang@live.com>
|
||||
" Description: cpplint for c files
|
||||
|
||||
call ale#Set('c_cpplint_executable', 'cpplint')
|
||||
call ale#Set('c_cpplint_options', '')
|
||||
|
||||
function! ale_linters#c#cpplint#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'c_cpplint_options')
|
||||
|
||||
return '%e' . ale#Pad(l:options) . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'cpplint',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'c_cpplint_executable')},
|
||||
\ 'command': function('ale_linters#c#cpplint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#cpplint#HandleCppLintFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
5
ale_linters/c/cspell.vim
Normal file
5
ale_linters/c/cspell.vim
Normal file
@@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for C files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('c')
|
||||
@@ -1,10 +1,22 @@
|
||||
" Author: Masashi Iizuka <liquidz.uo@gmail.com>
|
||||
" Description: linter for clojure using clj-kondo https://github.com/borkdude/clj-kondo
|
||||
|
||||
call ale#Set('clojure_clj_kondo_options', '--cache')
|
||||
|
||||
function! ale_linters#clojure#clj_kondo#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'clojure_clj_kondo_options')
|
||||
|
||||
let l:command = 'clj-kondo'
|
||||
\ . ale#Pad(l:options)
|
||||
\ . ' --lint %t'
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
||||
function! ale_linters#clojure#clj_kondo#HandleCljKondoFormat(buffer, lines) abort
|
||||
" output format
|
||||
" <filename>:<line>:<column>: <issue type>: <message>
|
||||
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+):? ((Exception|error|warning): ?(.+))$'
|
||||
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+)?:(\d+)?:? ((Exception|error|warning): ?(.+))$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
@@ -29,6 +41,6 @@ call ale#linter#Define('clojure', {
|
||||
\ 'name': 'clj-kondo',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': 'clj-kondo',
|
||||
\ 'command': 'clj-kondo --cache --lint %t',
|
||||
\ 'command': function('ale_linters#clojure#clj_kondo#GetCommand'),
|
||||
\ 'callback': 'ale_linters#clojure#clj_kondo#HandleCljKondoFormat',
|
||||
\})
|
||||
|
||||
43
ale_linters/cmake/cmake_lint.vim
Normal file
43
ale_linters/cmake/cmake_lint.vim
Normal file
@@ -0,0 +1,43 @@
|
||||
" Author: Carl Smedstad <carl.smedstad at protonmail dot com>
|
||||
" Description: cmake-lint for cmake files
|
||||
|
||||
let g:ale_cmake_cmake_lint_executable =
|
||||
\ get(g:, 'ale_cmake_cmake_lint_executable', 'cmake-lint')
|
||||
|
||||
let g:ale_cmake_cmake_lint_options =
|
||||
\ get(g:, 'ale_cmake_cmake_lint_options', '')
|
||||
|
||||
function! ale_linters#cmake#cmake_lint#Executable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cmake_cmake_lint_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cmake#cmake_lint#Command(buffer) abort
|
||||
let l:executable = ale_linters#cmake#cmake_lint#Executable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'cmake_cmake_lint_options')
|
||||
|
||||
return ale#Escape(l:executable) . ' ' . l:options . ' %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cmake#cmake_lint#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^[^:]+:(\d+),?(\d+)?:\s\[([A-Z]\d+)\]\s(.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'type': 'W',
|
||||
\ 'code': l:match[3],
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cmake', {
|
||||
\ 'name': 'cmake_lint',
|
||||
\ 'executable': function('ale_linters#cmake#cmake_lint#Executable'),
|
||||
\ 'command': function('ale_linters#cmake#cmake_lint#Command'),
|
||||
\ 'callback': 'ale_linters#cmake#cmake_lint#Handle',
|
||||
\})
|
||||
@@ -5,15 +5,13 @@ call ale#Set('cpp_cppcheck_executable', 'cppcheck')
|
||||
call ale#Set('cpp_cppcheck_options', '--enable=style')
|
||||
|
||||
function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
|
||||
let l:cd_command = ale#handlers#cppcheck#GetCdCommand(a:buffer)
|
||||
let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer)
|
||||
let l:buffer_path_include = empty(l:compile_commands_option)
|
||||
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
|
||||
\ : ''
|
||||
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
||||
|
||||
return l:cd_command
|
||||
\ . '%e -q --language=c++'
|
||||
return '%e -q --language=c++'
|
||||
\ . l:template
|
||||
\ . ale#Pad(l:compile_commands_option)
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options'))
|
||||
@@ -25,6 +23,7 @@ call ale#linter#Define('cpp', {
|
||||
\ 'name': 'cppcheck',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#Var(b, 'cpp_cppcheck_executable')},
|
||||
\ 'cwd': function('ale#handlers#cppcheck#GetCwd'),
|
||||
\ 'command': function('ale_linters#cpp#cppcheck#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
|
||||
\})
|
||||
|
||||
5
ale_linters/cpp/cspell.vim
Normal file
5
ale_linters/cpp/cspell.vim
Normal file
@@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for C++ files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('cpp')
|
||||
@@ -3,14 +3,10 @@ call ale#Set('cs_csc_source', '')
|
||||
call ale#Set('cs_csc_assembly_path', [])
|
||||
call ale#Set('cs_csc_assemblies', [])
|
||||
|
||||
function! s:GetWorkingDirectory(buffer) abort
|
||||
let l:working_directory = ale#Var(a:buffer, 'cs_csc_source')
|
||||
function! ale_linters#cs#csc#GetCwd(buffer) abort
|
||||
let l:cwd = ale#Var(a:buffer, 'cs_csc_source')
|
||||
|
||||
if !empty(l:working_directory)
|
||||
return l:working_directory
|
||||
endif
|
||||
|
||||
return expand('#' . a:buffer . ':p:h')
|
||||
return !empty(l:cwd) ? l:cwd : expand('#' . a:buffer . ':p:h')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cs#csc#GetCommand(buffer) abort
|
||||
@@ -34,8 +30,7 @@ function! ale_linters#cs#csc#GetCommand(buffer) abort
|
||||
|
||||
" The code is compiled as a module and the output is redirected to a
|
||||
" temporary file.
|
||||
return ale#path#CdString(s:GetWorkingDirectory(a:buffer))
|
||||
\ . 'csc /unsafe'
|
||||
return 'csc /unsafe'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cs_csc_options'))
|
||||
\ . ale#Pad(l:lib_option)
|
||||
\ . ale#Pad(l:r_option)
|
||||
@@ -57,8 +52,7 @@ function! ale_linters#cs#csc#Handle(buffer, lines) abort
|
||||
\ '^\v([^ ]+)\s+([Cc][sS][^ ]+):\s+(.+)$',
|
||||
\]
|
||||
let l:output = []
|
||||
|
||||
let l:dir = s:GetWorkingDirectory(a:buffer)
|
||||
let l:dir = ale_linters#cs#csc#GetCwd(a:buffer)
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:patterns)
|
||||
if len(l:match) > 6 && strlen(l:match[5]) > 2 && l:match[5][:1] is? 'CS'
|
||||
@@ -89,6 +83,7 @@ call ale#linter#Define('cs',{
|
||||
\ 'name': 'csc',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': 'csc',
|
||||
\ 'cwd': function('ale_linters#cs#csc#GetCwd'),
|
||||
\ 'command': function('ale_linters#cs#csc#GetCommand'),
|
||||
\ 'callback': 'ale_linters#cs#csc#Handle',
|
||||
\ 'lint_file': 1
|
||||
|
||||
5
ale_linters/cs/cspell.vim
Normal file
5
ale_linters/cs/cspell.vim
Normal file
@@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for C# files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('cs')
|
||||
@@ -3,14 +3,10 @@ call ale#Set('cs_mcsc_source', '')
|
||||
call ale#Set('cs_mcsc_assembly_path', [])
|
||||
call ale#Set('cs_mcsc_assemblies', [])
|
||||
|
||||
function! s:GetWorkingDirectory(buffer) abort
|
||||
let l:working_directory = ale#Var(a:buffer, 'cs_mcsc_source')
|
||||
function! ale_linters#cs#mcsc#GetCwd(buffer) abort
|
||||
let l:cwd = ale#Var(a:buffer, 'cs_mcsc_source')
|
||||
|
||||
if !empty(l:working_directory)
|
||||
return l:working_directory
|
||||
endif
|
||||
|
||||
return expand('#' . a:buffer . ':p:h')
|
||||
return !empty(l:cwd) ? l:cwd : expand('#' . a:buffer . ':p:h')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cs#mcsc#GetCommand(buffer) abort
|
||||
@@ -34,8 +30,7 @@ function! ale_linters#cs#mcsc#GetCommand(buffer) abort
|
||||
|
||||
" The code is compiled as a module and the output is redirected to a
|
||||
" temporary file.
|
||||
return ale#path#CdString(s:GetWorkingDirectory(a:buffer))
|
||||
\ . 'mcs -unsafe'
|
||||
return 'mcs -unsafe'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cs_mcsc_options'))
|
||||
\ . ale#Pad(l:lib_option)
|
||||
\ . ale#Pad(l:r_option)
|
||||
@@ -58,7 +53,7 @@ function! ale_linters#cs#mcsc#Handle(buffer, lines) abort
|
||||
\]
|
||||
let l:output = []
|
||||
|
||||
let l:dir = s:GetWorkingDirectory(a:buffer)
|
||||
let l:dir = ale_linters#cs#mcsc#GetCwd(a:buffer)
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:patterns)
|
||||
if len(l:match) > 6 && strlen(l:match[5]) > 2 && l:match[5][:1] is? 'CS'
|
||||
@@ -89,6 +84,7 @@ call ale#linter#Define('cs',{
|
||||
\ 'name': 'mcsc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'mcs',
|
||||
\ 'cwd': function('ale_linters#cs#mcsc#GetCwd'),
|
||||
\ 'command': function('ale_linters#cs#mcsc#GetCommand'),
|
||||
\ 'callback': 'ale_linters#cs#mcsc#Handle',
|
||||
\ 'lint_file': 1
|
||||
|
||||
5
ale_linters/css/cspell.vim
Normal file
5
ale_linters/css/cspell.vim
Normal file
@@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for CSS files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('css')
|
||||
@@ -11,7 +11,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('css', {
|
||||
\ 'name': 'stylelint',
|
||||
\ 'executable': {b -> ale#node#FindExecutable(b, 'css_stylelint', [
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'css_stylelint', [
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\ ])},
|
||||
\ 'command': function('ale_linters#css#stylelint#GetCommand'),
|
||||
|
||||
23
ale_linters/cuda/clangd.vim
Normal file
23
ale_linters/cuda/clangd.vim
Normal file
@@ -0,0 +1,23 @@
|
||||
" Author: Tommy Chiang <ty1208chiang@gmail.com>
|
||||
" Description: Clangd language server for CUDA (modified from Andrey
|
||||
" Melentyev's implementation for C++)
|
||||
|
||||
call ale#Set('cuda_clangd_executable', 'clangd')
|
||||
call ale#Set('cuda_clangd_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#cuda#clangd#GetCommand(buffer) abort
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
|
||||
return '%e'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cuda_clangd_options'))
|
||||
\ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cuda', {
|
||||
\ 'name': 'clangd',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'cuda_clangd_executable')},
|
||||
\ 'command': function('ale_linters#cuda#clangd#GetCommand'),
|
||||
\ 'project_root': function('ale#c#FindProjectRoot'),
|
||||
\})
|
||||
@@ -1,64 +1,106 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: "dmd for D files"
|
||||
|
||||
function! ale_linters#d#dmd#GetDUBCommand(buffer) abort
|
||||
function! s:GetDUBCommand(buffer) abort
|
||||
" If we can't run dub, then skip this command.
|
||||
if !executable('dub')
|
||||
if executable('dub')
|
||||
" Returning an empty string skips to the DMD command.
|
||||
return ''
|
||||
let l:config = ale#d#FindDUBConfig(a:buffer)
|
||||
|
||||
" To support older dub versions, we just change the directory to the
|
||||
" directory where we found the dub config, and then run `dub describe`
|
||||
" from that directory.
|
||||
if !empty(l:config)
|
||||
return [fnamemodify(l:config, ':h'), 'dub describe --data-list
|
||||
\ --data=import-paths
|
||||
\ --data=string-import-paths
|
||||
\ --data=versions
|
||||
\ --data=debug-versions
|
||||
\']
|
||||
endif
|
||||
endif
|
||||
|
||||
let l:dub_file = ale#d#FindDUBConfig(a:buffer)
|
||||
|
||||
if empty(l:dub_file)
|
||||
return ''
|
||||
endif
|
||||
|
||||
" To support older dub versions, we just change the directory to
|
||||
" the directory where we found the dub config, and then run `dub describe`
|
||||
" from that directory.
|
||||
return 'cd ' . ale#Escape(fnamemodify(l:dub_file, ':h'))
|
||||
\ . ' && dub describe --import-paths'
|
||||
return ['', '']
|
||||
endfunction
|
||||
|
||||
function! ale_linters#d#dmd#RunDUBCommand(buffer) abort
|
||||
let l:command = ale_linters#d#dmd#GetDUBCommand(a:buffer)
|
||||
let [l:cwd, l:command] = s:GetDUBCommand(a:buffer)
|
||||
|
||||
if empty(l:command)
|
||||
" If we can't run DUB, just run DMD.
|
||||
return ale_linters#d#dmd#DMDCommand(a:buffer, [], {})
|
||||
endif
|
||||
|
||||
return ale#command#Run(a:buffer, l:command, function('ale_linters#d#dmd#DMDCommand'))
|
||||
return ale#command#Run(
|
||||
\ a:buffer,
|
||||
\ l:command,
|
||||
\ function('ale_linters#d#dmd#DMDCommand'),
|
||||
\ {'cwd': l:cwd},
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#d#dmd#DMDCommand(buffer, dub_output, meta) abort
|
||||
let l:import_list = []
|
||||
let l:str_import_list = []
|
||||
let l:versions_list = []
|
||||
let l:deb_versions_list = []
|
||||
let l:list_ind = 1
|
||||
let l:seen_line = 0
|
||||
|
||||
" Build a list of import paths generated from DUB, if available.
|
||||
" Build a list of options generated from DUB, if available.
|
||||
" DUB output each path or version on a single line.
|
||||
" Each list is separated by a blank line.
|
||||
" Empty list are represented by a blank line (followed and/or
|
||||
" preceded by a separation blank line)
|
||||
for l:line in a:dub_output
|
||||
" line still has end of line char on windows
|
||||
let l:line = substitute(l:line, '[\r\n]*$', '', '')
|
||||
|
||||
if !empty(l:line)
|
||||
" The arguments must be '-Ifilename', not '-I filename'
|
||||
call add(l:import_list, '-I' . ale#Escape(l:line))
|
||||
if l:list_ind == 1
|
||||
call add(l:import_list, '-I' . ale#Escape(l:line))
|
||||
elseif l:list_ind == 2
|
||||
call add(l:str_import_list, '-J' . ale#Escape(l:line))
|
||||
elseif l:list_ind == 3
|
||||
call add(l:versions_list, '-version=' . ale#Escape(l:line))
|
||||
elseif l:list_ind == 4
|
||||
call add(l:deb_versions_list, '-debug=' . ale#Escape(l:line))
|
||||
endif
|
||||
|
||||
let l:seen_line = 1
|
||||
elseif !l:seen_line
|
||||
" if list is empty must skip one empty line
|
||||
let l:seen_line = 1
|
||||
else
|
||||
let l:seen_line = 0
|
||||
let l:list_ind += 1
|
||||
endif
|
||||
endfor
|
||||
|
||||
return 'dmd '. join(l:import_list) . ' -o- -wi -vcolumns -c %t'
|
||||
return 'dmd ' . join(l:import_list) . ' ' .
|
||||
\ join(l:str_import_list) . ' ' .
|
||||
\ join(l:versions_list) . ' ' .
|
||||
\ join(l:deb_versions_list) . ' -o- -wi -vcolumns -c %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#d#dmd#Handle(buffer, lines) abort
|
||||
" Matches patterns lines like the following:
|
||||
" /tmp/tmp.qclsa7qLP7/file.d(1): Error: function declaration without return type. (Note that constructors are always named 'this')
|
||||
" /tmp/tmp.G1L5xIizvB.d(8,8): Error: module weak_reference is in file 'dstruct/weak_reference.d' which cannot be read
|
||||
let l:pattern = '^[^(]\+(\([0-9]\+\)\,\?\([0-9]*\)): \([^:]\+\): \(.\+\)'
|
||||
let l:pattern = '\v^(\f+)\((\d+)(,(\d+))?\): (\w+): (.+)$'
|
||||
let l:output = []
|
||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
" If dmd was invoked with relative path, match[1] is relative, otherwise it is absolute.
|
||||
" As we invoke dmd with the buffer path (in /tmp), this will generally be absolute already
|
||||
let l:fname = ale#path#GetAbsPath(l:dir, l:match[1])
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1],
|
||||
\ 'col': l:match[2],
|
||||
\ 'type': l:match[3] is# 'Warning' ? 'W' : 'E',
|
||||
\ 'text': l:match[4],
|
||||
\ 'filename': l:fname,
|
||||
\ 'lnum': l:match[2],
|
||||
\ 'col': l:match[4],
|
||||
\ 'type': l:match[5] is# 'Warning' || l:match[5] is# 'Deprecation' ? 'W' : 'E',
|
||||
\ 'text': l:match[6],
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
||||
28
ale_linters/dart/dart_analyze.vim
Normal file
28
ale_linters/dart/dart_analyze.vim
Normal file
@@ -0,0 +1,28 @@
|
||||
" Author: ghsang <gwonhyuksang@gmail.com>
|
||||
" Description: Check Dart files with dart analyze
|
||||
|
||||
call ale#Set('dart_analyze_executable', 'dart')
|
||||
|
||||
function! ale_linters#dart#dart_analyze#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^ ([a-z]+) - (.+):(\d+):(\d+) - (.+) - (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'type': l:match[1] is# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[6] . ': ' . l:match[5],
|
||||
\ 'lnum': str2nr(l:match[3]),
|
||||
\ 'col': str2nr(l:match[4]),
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('dart', {
|
||||
\ 'name': 'dart_analyze',
|
||||
\ 'executable': {b -> ale#Var(b, 'dart_analyze_executable')},
|
||||
\ 'command': '%e analyze %s',
|
||||
\ 'callback': 'ale_linters#dart#dart_analyze#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
@@ -1,36 +0,0 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Check Dart files with dartanalyzer
|
||||
|
||||
call ale#Set('dart_dartanalyzer_executable', 'dartanalyzer')
|
||||
|
||||
function! ale_linters#dart#dartanalyzer#GetCommand(buffer) abort
|
||||
let l:path = ale#path#FindNearestFile(a:buffer, '.packages')
|
||||
|
||||
return '%e'
|
||||
\ . (!empty(l:path) ? ' --packages ' . ale#Escape(l:path) : '')
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dart#dartanalyzer#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^ ([a-z]+) . (.+) at (.+):(\d+):(\d+) . (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'type': l:match[1] is# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[6] . ': ' . l:match[2],
|
||||
\ 'lnum': str2nr(l:match[4]),
|
||||
\ 'col': str2nr(l:match[5]),
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('dart', {
|
||||
\ 'name': 'dartanalyzer',
|
||||
\ 'executable': {b -> ale#Var(b, 'dart_dartanalyzer_executable')},
|
||||
\ 'command': function('ale_linters#dart#dartanalyzer#GetCommand'),
|
||||
\ 'callback': 'ale_linters#dart#dartanalyzer#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
31
ale_linters/desktop/desktop_file_validate.vim
Normal file
31
ale_linters/desktop/desktop_file_validate.vim
Normal file
@@ -0,0 +1,31 @@
|
||||
call ale#Set('desktop_desktop_file_validate_options', '')
|
||||
|
||||
" Example matches for pattern:
|
||||
"
|
||||
" foo.desktop: warning: key "TerminalOptions" in group ...
|
||||
" foo.desktop: error: action "new-private-window" is defined, ...
|
||||
let s:pattern = '\v^(.+): ([a-z]+): (.+)$'
|
||||
|
||||
function! ale_linters#desktop#desktop_file_validate#Handle(buffer, lines) abort
|
||||
" The error format doesn't specify lines, so we can just put all of the
|
||||
" errors on line 1.
|
||||
return ale#util#MapMatches(a:lines, s:pattern, {match -> {
|
||||
\ 'lnum': 1,
|
||||
\ 'col': 1,
|
||||
\ 'type': match[2] is? 'error' ? 'E' : 'W',
|
||||
\ 'text': match[3],
|
||||
\}})
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('desktop', {
|
||||
\ 'name': 'desktop_file_validate',
|
||||
\ 'aliases': ['desktop-file-validate'],
|
||||
\ 'executable': 'desktop-file-validate',
|
||||
\ 'command': {b ->
|
||||
\ '%e'
|
||||
\ . ale#Pad(ale#Var(b, 'desktop_desktop_file_validate_options'))
|
||||
\ . ' %t'
|
||||
\ },
|
||||
\ 'callback': 'ale_linters#desktop#desktop_file_validate#Handle',
|
||||
\ 'output_stream': 'both',
|
||||
\})
|
||||
@@ -7,9 +7,9 @@ call ale#Set('dockerfile_hadolint_docker_image', 'hadolint/hadolint')
|
||||
function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" /dev/stdin:19 DL3001 Pipe chain should start with a raw value.
|
||||
" -:19 DL3001 warning: Pipe chain should start with a raw value.
|
||||
" /dev/stdin:19:3 unexpected thing
|
||||
let l:pattern = '\v^/dev/stdin:(\d+):?(\d+)? ((DL|SC)(\d+) )?((.+)?: )?(.+)$'
|
||||
let l:pattern = '\v^%(/dev/stdin|-):(\d+):?(\d+)? ((DL|SC)(\d+) )?((.+)?: )?(.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
@@ -38,6 +38,8 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
|
||||
let l:text = l:match[8]
|
||||
let l:detail = l:match[8]
|
||||
let l:domain = 'https://github.com/hadolint/hadolint/wiki/'
|
||||
let l:code = ''
|
||||
let l:link = ''
|
||||
|
||||
if l:match[4] is# 'SC'
|
||||
let l:domain = 'https://github.com/koalaman/shellcheck/wiki/'
|
||||
@@ -46,18 +48,26 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
|
||||
if l:match[5] isnot# ''
|
||||
let l:code = l:match[4] . l:match[5]
|
||||
let l:link = ' ( ' . l:domain . l:code . ' )'
|
||||
let l:text = l:code . ': ' . l:detail
|
||||
let l:detail = l:code . l:link . "\n\n" . l:detail
|
||||
else
|
||||
let l:type = 'E'
|
||||
let l:detail = 'hadolint could not parse the file because of a syntax error.'
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
let l:line_output = {
|
||||
\ 'lnum': l:lnum,
|
||||
\ 'col': l:colnum,
|
||||
\ 'type': l:type,
|
||||
\ 'text': l:text,
|
||||
\ 'detail': l:detail
|
||||
\})
|
||||
\}
|
||||
|
||||
if l:code isnot# ''
|
||||
let l:line_output['code'] = l:code
|
||||
endif
|
||||
|
||||
call add(l:output, l:line_output)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
@@ -92,12 +102,15 @@ endfunction
|
||||
|
||||
function! ale_linters#dockerfile#hadolint#GetCommand(buffer) abort
|
||||
let l:command = ale_linters#dockerfile#hadolint#GetExecutable(a:buffer)
|
||||
let l:opts = '--no-color -'
|
||||
|
||||
if l:command is# 'docker'
|
||||
return 'docker run --rm -i ' . ale#Var(a:buffer, 'dockerfile_hadolint_docker_image')
|
||||
return printf('docker run --rm -i %s hadolint %s',
|
||||
\ ale#Var(a:buffer, 'dockerfile_hadolint_docker_image'),
|
||||
\ l:opts)
|
||||
endif
|
||||
|
||||
return 'hadolint -'
|
||||
return 'hadolint ' . l:opts
|
||||
endfunction
|
||||
|
||||
|
||||
|
||||
@@ -56,11 +56,7 @@ function! ale_linters#elixir#credo#GetConfigFile() abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elixir#credo#GetCommand(buffer) abort
|
||||
let l:project_root = ale#handlers#elixir#FindMixUmbrellaRoot(a:buffer)
|
||||
let l:mode = ale_linters#elixir#credo#GetMode()
|
||||
|
||||
return ale#path#CdString(l:project_root)
|
||||
\ . 'mix help credo && '
|
||||
return 'mix help credo && '
|
||||
\ . 'mix credo ' . ale_linters#elixir#credo#GetMode()
|
||||
\ . ale_linters#elixir#credo#GetConfigFile()
|
||||
\ . ' --format=flycheck --read-from-stdin %s'
|
||||
@@ -69,6 +65,7 @@ endfunction
|
||||
call ale#linter#Define('elixir', {
|
||||
\ 'name': 'credo',
|
||||
\ 'executable': 'mix',
|
||||
\ 'cwd': function('ale#handlers#elixir#FindMixUmbrellaRoot'),
|
||||
\ 'command': function('ale_linters#elixir#credo#GetCommand'),
|
||||
\ 'callback': 'ale_linters#elixir#credo#Handle',
|
||||
\})
|
||||
|
||||
5
ale_linters/elixir/cspell.vim
Normal file
5
ale_linters/elixir/cspell.vim
Normal file
@@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Elixir files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('elixir')
|
||||
@@ -25,17 +25,10 @@ function! ale_linters#elixir#dialyxir#Handle(buffer, lines) abort
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elixir#dialyxir#GetCommand(buffer) abort
|
||||
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
|
||||
|
||||
return ale#path#CdString(l:project_root)
|
||||
\ . ' mix help dialyzer && mix dialyzer'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elixir', {
|
||||
\ 'name': 'dialyxir',
|
||||
\ 'executable': 'mix',
|
||||
\ 'command': function('ale_linters#elixir#dialyxir#GetCommand'),
|
||||
\ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'),
|
||||
\ 'command': 'mix help dialyzer && mix dialyzer',
|
||||
\ 'callback': 'ale_linters#elixir#dialyxir#Handle',
|
||||
\})
|
||||
|
||||
|
||||
@@ -29,17 +29,11 @@ function! ale_linters#elixir#dogma#Handle(buffer, lines) abort
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elixir#dogma#GetCommand(buffer) abort
|
||||
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
|
||||
|
||||
return ale#path#CdString(l:project_root)
|
||||
\ . ' mix help dogma && mix dogma %s --format=flycheck'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elixir', {
|
||||
\ 'name': 'dogma',
|
||||
\ 'executable': 'mix',
|
||||
\ 'command': function('ale_linters#elixir#dogma#GetCommand'),
|
||||
\ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'),
|
||||
\ 'command': 'mix help dogma && mix dogma %s --format=flycheck',
|
||||
\ 'lint_file': 1,
|
||||
\ 'callback': 'ale_linters#elixir#dogma#Handle',
|
||||
\})
|
||||
|
||||
@@ -30,22 +30,15 @@ function! ale_linters#elixir#mix#Handle(buffer, lines) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elixir#mix#GetCommand(buffer) abort
|
||||
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
|
||||
|
||||
let l:temp_dir = ale#command#CreateDirectory(a:buffer)
|
||||
|
||||
let l:mix_build_path = has('win32')
|
||||
\ ? 'set MIX_BUILD_PATH=' . ale#Escape(l:temp_dir) . ' &&'
|
||||
\ : 'MIX_BUILD_PATH=' . ale#Escape(l:temp_dir)
|
||||
|
||||
return ale#path#CdString(l:project_root)
|
||||
\ . l:mix_build_path
|
||||
\ . ' mix compile %s'
|
||||
return ale#Env('MIX_BUILD_PATH', l:temp_dir) . 'mix compile %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elixir', {
|
||||
\ 'name': 'mix',
|
||||
\ 'executable': 'mix',
|
||||
\ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'),
|
||||
\ 'command': function('ale_linters#elixir#mix#GetCommand'),
|
||||
\ 'callback': 'ale_linters#elixir#mix#Handle',
|
||||
\ 'lint_file': 1,
|
||||
|
||||
@@ -28,7 +28,7 @@ endfunction
|
||||
call ale#linter#Define('elm', {
|
||||
\ 'name': 'elm_ls',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#node#FindExecutable(b, 'elm_ls', [
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'elm_ls', [
|
||||
\ 'node_modules/.bin/elm-language-server',
|
||||
\ 'node_modules/.bin/elm-lsp',
|
||||
\ 'elm-lsp'
|
||||
|
||||
@@ -186,24 +186,23 @@ function! ale_linters#elm#make#IsTest(buffer) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#GetCwd(buffer) abort
|
||||
let l:root_dir = ale_linters#elm#make#GetRootDir(a:buffer)
|
||||
|
||||
return !empty(l:root_dir) ? l:root_dir : ''
|
||||
endfunction
|
||||
|
||||
" Return the command to execute the linter in the projects directory.
|
||||
" If it doesn't, then this will fail when imports are needed.
|
||||
function! ale_linters#elm#make#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#elm#make#GetExecutable(a:buffer)
|
||||
let l:root_dir = ale_linters#elm#make#GetRootDir(a:buffer)
|
||||
let l:is_v19 = ale_linters#elm#make#IsVersionGte19(a:buffer)
|
||||
let l:is_using_elm_test = l:executable =~# 'elm-test$'
|
||||
|
||||
if empty(l:root_dir)
|
||||
let l:dir_set_cmd = ''
|
||||
else
|
||||
let l:dir_set_cmd = 'cd ' . ale#Escape(l:root_dir) . ' && '
|
||||
endif
|
||||
|
||||
" elm-test needs to know the path of elm-make if elm isn't installed globally.
|
||||
" https://github.com/rtfeldman/node-test-runner/blob/57728f10668f2d2ab3179e7e3208bcfa9a1f19aa/README.md#--compiler
|
||||
if l:is_v19 && l:is_using_elm_test
|
||||
let l:elm_make_executable = ale#node#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm'])
|
||||
let l:elm_make_executable = ale#path#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm'])
|
||||
let l:elm_test_compiler_flag = ' --compiler ' . l:elm_make_executable . ' '
|
||||
else
|
||||
let l:elm_test_compiler_flag = ' '
|
||||
@@ -213,7 +212,9 @@ function! ale_linters#elm#make#GetCommand(buffer) abort
|
||||
" a sort of flag to tell the compiler not to generate an output file,
|
||||
" which is why this is hard coded here.
|
||||
" Source: https://github.com/elm-lang/elm-compiler/blob/19d5a769b30ec0b2fc4475985abb4cd94cd1d6c3/builder/src/Generate/Output.hs#L253
|
||||
return l:dir_set_cmd . '%e make --report=json --output=/dev/null' . l:elm_test_compiler_flag . '%t'
|
||||
return '%e make --report=json --output=/dev/null'
|
||||
\ . l:elm_test_compiler_flag
|
||||
\ . '%t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#GetExecutable(buffer) abort
|
||||
@@ -221,13 +222,13 @@ function! ale_linters#elm#make#GetExecutable(buffer) abort
|
||||
let l:is_v19 = ale_linters#elm#make#IsVersionGte19(a:buffer)
|
||||
|
||||
if l:is_test && l:is_v19
|
||||
return ale#node#FindExecutable(
|
||||
return ale#path#FindExecutable(
|
||||
\ a:buffer,
|
||||
\ 'elm_make',
|
||||
\ ['node_modules/.bin/elm-test', 'node_modules/.bin/elm']
|
||||
\)
|
||||
else
|
||||
return ale#node#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm'])
|
||||
return ale#path#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm'])
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -235,6 +236,7 @@ call ale#linter#Define('elm', {
|
||||
\ 'name': 'make',
|
||||
\ 'executable': function('ale_linters#elm#make#GetExecutable'),
|
||||
\ 'output_stream': 'both',
|
||||
\ 'cwd': function('ale_linters#elm#make#GetCwd'),
|
||||
\ 'command': function('ale_linters#elm#make#GetCommand'),
|
||||
\ 'callback': 'ale_linters#elm#make#Handle'
|
||||
\})
|
||||
|
||||
@@ -12,6 +12,7 @@ function! ale_linters#erlang#elvis#Handle(buffer, lines) abort
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'text': s:AbbreviateMessage(l:match[2]),
|
||||
\ 'type': 'W',
|
||||
\ 'sub_type': 'style',
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ function! ale_linters#erlang#erlc#Handle(buffer, lines) abort
|
||||
" error.erl:4: variable 'B' is unbound
|
||||
" error.erl:3: Warning: function main/0 is unused
|
||||
" error.erl:4: Warning: variable 'A' is unused
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+): (Warning: )?(.+)$'
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+:)? (Warning: )?(.+)$'
|
||||
|
||||
" parse_transforms are a special case. The error message does not indicate a location:
|
||||
" error.erl: undefined parse transform 'some_parse_transform'
|
||||
@@ -65,8 +65,8 @@ function! ale_linters#erlang#erlc#Handle(buffer, lines) abort
|
||||
endif
|
||||
|
||||
let l:line = l:match[2]
|
||||
let l:warning_or_text = l:match[3]
|
||||
let l:text = l:match[4]
|
||||
let l:warning_or_text = l:match[4]
|
||||
let l:text = l:match[5]
|
||||
|
||||
" If this file is a header .hrl, ignore the following expected messages:
|
||||
" - 'no module definition'
|
||||
|
||||
51
ale_linters/eruby/erblint.vim
Normal file
51
ale_linters/eruby/erblint.vim
Normal file
@@ -0,0 +1,51 @@
|
||||
" Author: Roeland Moors - https://github.com/roelandmoors
|
||||
" based on the ale ruumba and robocop linters
|
||||
" Description: ERB Lint, support for https://github.com/Shopify/erb-lint
|
||||
|
||||
call ale#Set('eruby_erblint_executable', 'erblint')
|
||||
call ale#Set('eruby_erblint_options', '')
|
||||
|
||||
function! ale_linters#eruby#erblint#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'eruby_erblint_executable')
|
||||
|
||||
return ale#ruby#EscapeExecutable(l:executable, 'erblint')
|
||||
\ . ' --format json '
|
||||
\ . ale#Var(a:buffer, 'eruby_erblint_options')
|
||||
\ . ' --stdin %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#eruby#erblint#Handle(buffer, lines) abort
|
||||
if empty(a:lines)
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:errors = ale#util#FuzzyJSONDecode(a:lines[0], [])
|
||||
|
||||
if !has_key(l:errors, 'summary')
|
||||
\|| l:errors['summary']['offenses'] == 0
|
||||
\|| empty(l:errors['files'])
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:output = []
|
||||
|
||||
for l:error in l:errors['files'][0]['offenses']
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:error['location']['start_line'] + 0,
|
||||
\ 'col': l:error['location']['start_column'] + 0,
|
||||
\ 'end_col': l:error['location']['last_column'] + 0,
|
||||
\ 'code': l:error['linter'],
|
||||
\ 'text': l:error['message'],
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('eruby', {
|
||||
\ 'name': 'erblint',
|
||||
\ 'executable': {b -> ale#Var(b, 'eruby_erblint_executable')},
|
||||
\ 'command': function('ale_linters#eruby#erblint#GetCommand'),
|
||||
\ 'callback': 'ale_linters#eruby#erblint#Handle',
|
||||
\})
|
||||
5
ale_linters/go/cspell.vim
Normal file
5
ale_linters/go/cspell.vim
Normal file
@@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Go files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('go')
|
||||
@@ -10,8 +10,7 @@ function! ale_linters#go#gobuild#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'go_gobuild_options')
|
||||
|
||||
" Run go test in local directory with relative path
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
return ale#go#EnvString(a:buffer)
|
||||
\ . ale#Var(a:buffer, 'go_go_executable') . ' test'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' -c -o /dev/null ./'
|
||||
@@ -50,6 +49,7 @@ call ale#linter#Define('go', {
|
||||
\ 'name': 'gobuild',
|
||||
\ 'aliases': ['go build'],
|
||||
\ 'executable': {b -> ale#Var(b, 'go_go_executable')},
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#go#gobuild#GetCommand'),
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale_linters#go#gobuild#Handler',
|
||||
|
||||
@@ -12,14 +12,12 @@ function! ale_linters#go#golangci_lint#GetCommand(buffer) abort
|
||||
|
||||
|
||||
if l:lint_package
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
return ale#go#EnvString(a:buffer)
|
||||
\ . '%e run '
|
||||
\ . l:options
|
||||
endif
|
||||
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
return ale#go#EnvString(a:buffer)
|
||||
\ . '%e run '
|
||||
\ . ale#Escape(l:filename)
|
||||
\ . ' ' . l:options
|
||||
@@ -53,6 +51,7 @@ endfunction
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'golangci-lint',
|
||||
\ 'executable': {b -> ale#Var(b, 'go_golangci_lint_executable')},
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#go#golangci_lint#GetCommand'),
|
||||
\ 'callback': 'ale_linters#go#golangci_lint#Handler',
|
||||
\ 'lint_file': 1,
|
||||
|
||||
@@ -13,14 +13,12 @@ function! ale_linters#go#gometalinter#GetCommand(buffer) abort
|
||||
" BufferCdString is used so that we can be sure the paths output from gometalinter can
|
||||
" be calculated to absolute paths in the Handler
|
||||
if l:lint_package
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
return ale#go#EnvString(a:buffer)
|
||||
\ . '%e'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||
endif
|
||||
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
return ale#go#EnvString(a:buffer)
|
||||
\ . '%e'
|
||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(l:filename))
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||
@@ -53,6 +51,7 @@ endfunction
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'gometalinter',
|
||||
\ 'executable': {b -> ale#Var(b, 'go_gometalinter_executable')},
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#go#gometalinter#GetCommand'),
|
||||
\ 'callback': 'ale_linters#go#gometalinter#Handler',
|
||||
\ 'lint_file': 1,
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
call ale#Set('go_gopls_executable', 'gopls')
|
||||
call ale#Set('go_gopls_options', '--mode stdio')
|
||||
call ale#Set('go_gopls_init_options', {})
|
||||
call ale#Set('go_gopls_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#go#gopls#GetCommand(buffer) abort
|
||||
return ale#go#EnvString(a:buffer)
|
||||
@@ -29,7 +30,9 @@ endfunction
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'gopls',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'go_gopls_executable')},
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'go_gopls', [
|
||||
\ ale#go#GetGoPathExecutable('bin/gopls'),
|
||||
\ ])},
|
||||
\ 'command': function('ale_linters#go#gopls#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#go#gopls#FindProjectRoot'),
|
||||
\ 'initialization_options': {b -> ale#Var(b, 'go_gopls_init_options')},
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
" Author: Ben Reedy <https://github.com/breed808>
|
||||
" Description: gosimple for Go files
|
||||
|
||||
function! ale_linters#go#gosimple#GetCommand(buffer) abort
|
||||
return ale#path#BufferCdString(a:buffer) . ' '
|
||||
\ . ale#go#EnvString(a:buffer) . 'gosimple .'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'gosimple',
|
||||
\ 'executable': 'gosimple',
|
||||
\ 'command': function('ale_linters#go#gosimple#GetCommand'),
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': {b -> ale#go#EnvString(b) . 'gosimple .'},
|
||||
\ 'callback': 'ale#handlers#go#Handler',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'lint_file': 1,
|
||||
|
||||
@@ -1,19 +1,23 @@
|
||||
" Author: Jelte Fennema <github-public@jeltef.nl>
|
||||
" Description: gotype for Go files
|
||||
|
||||
function! ale_linters#go#gotype#GetCommand(buffer) abort
|
||||
function! ale_linters#go#gotype#GetExecutable(buffer) abort
|
||||
if expand('#' . a:buffer . ':p') =~# '_test\.go$'
|
||||
return ''
|
||||
endif
|
||||
|
||||
return ale#path#BufferCdString(a:buffer) . ' '
|
||||
\ . ale#go#EnvString(a:buffer) . 'gotype -e .'
|
||||
return 'gotype'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gotype#GetCommand(buffer) abort
|
||||
return ale#go#EnvString(a:buffer) . 'gotype -e .'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'gotype',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'gotype',
|
||||
\ 'executable': function('ale_linters#go#gotype#GetExecutable'),
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#go#gotype#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#go#Handler',
|
||||
\ 'lint_file': 1,
|
||||
|
||||
@@ -10,8 +10,7 @@ call ale#Set('go_govet_options', '')
|
||||
function! ale_linters#go#govet#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'go_govet_options')
|
||||
|
||||
return ale#path#BufferCdString(a:buffer) . ' '
|
||||
\ . ale#go#EnvString(a:buffer)
|
||||
return ale#go#EnvString(a:buffer)
|
||||
\ . ale#Var(a:buffer, 'go_go_executable') . ' vet '
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' .'
|
||||
@@ -22,6 +21,7 @@ call ale#linter#Define('go', {
|
||||
\ 'aliases': ['go vet'],
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'go_go_executable')},
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#go#govet#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#go#Handler',
|
||||
\ 'lint_file': 1,
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
" Author: Ben Reedy <https://github.com/breed808>
|
||||
" Description: staticcheck for Go files
|
||||
|
||||
call ale#Set('go_staticcheck_executable', 'staticcheck')
|
||||
call ale#Set('go_staticcheck_options', '')
|
||||
call ale#Set('go_staticcheck_lint_package', 0)
|
||||
call ale#Set('go_staticcheck_lint_package', 1)
|
||||
call ale#Set('go_staticcheck_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#go#staticcheck#GetCommand(buffer) abort
|
||||
let l:filename = expand('#' . a:buffer . ':t')
|
||||
let l:options = ale#Var(a:buffer, 'go_staticcheck_options')
|
||||
let l:lint_package = ale#Var(a:buffer, 'go_staticcheck_lint_package')
|
||||
let l:env = ale#go#EnvString(a:buffer)
|
||||
|
||||
" BufferCdString is used so that we can be sure the paths output from
|
||||
" staticcheck can be calculated to absolute paths in the Handler
|
||||
if l:lint_package
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . l:env . 'staticcheck'
|
||||
return l:env . '%e'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||
endif
|
||||
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . l:env . 'staticcheck'
|
||||
return l:env . '%e'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' ' . ale#Escape(l:filename)
|
||||
\ . ' %s:t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'staticcheck',
|
||||
\ 'executable': 'staticcheck',
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'go_staticcheck', [
|
||||
\ ale#go#GetGoPathExecutable('bin/staticcheck'),
|
||||
\ ])},
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#go#staticcheck#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#go#Handler',
|
||||
\ 'output_stream': 'both',
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
call ale#linter#Define('graphql', {
|
||||
\ 'name': 'eslint',
|
||||
\ 'executable': function('ale#handlers#eslint#GetExecutable'),
|
||||
\ 'cwd': function('ale#handlers#eslint#GetCwd'),
|
||||
\ 'command': function('ale#handlers#eslint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#eslint#HandleJSON',
|
||||
\})
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
" Author: Michiel Westerbeek <happylinks@gmail.com>
|
||||
" Description: Linter for GraphQL Schemas
|
||||
|
||||
function! ale_linters#graphql#gqlint#GetCommand(buffer) abort
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . 'gqlint'
|
||||
\ . ' --reporter=simple %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('graphql', {
|
||||
\ 'name': 'gqlint',
|
||||
\ 'executable': 'gqlint',
|
||||
\ 'command': function('ale_linters#graphql#gqlint#GetCommand'),
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': 'gqlint --reporter=simple %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
||||
|
||||
@@ -5,7 +5,7 @@ call ale#Set('handlebars_embertemplatelint_executable', 'ember-template-lint')
|
||||
call ale#Set('handlebars_embertemplatelint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'handlebars_embertemplatelint', [
|
||||
return ale#path#FindExecutable(a:buffer, 'handlebars_embertemplatelint', [
|
||||
\ 'node_modules/.bin/ember-template-lint',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
call ale#Set('haskell_cabal_ghc_options', '-fno-code -v0')
|
||||
|
||||
function! ale_linters#haskell#cabal_ghc#GetCommand(buffer) abort
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . 'cabal exec -- ghc '
|
||||
return 'cabal exec -- ghc '
|
||||
\ . ale#Var(a:buffer, 'haskell_cabal_ghc_options')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
@@ -15,6 +14,7 @@ call ale#linter#Define('haskell', {
|
||||
\ 'aliases': ['cabal-ghc'],
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'cabal',
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#haskell#cabal_ghc#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
||||
|
||||
5
ale_linters/haskell/cspell.vim
Normal file
5
ale_linters/haskell/cspell.vim
Normal file
@@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Haskell files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('haskell')
|
||||
@@ -4,6 +4,7 @@
|
||||
" <devildead13@gmail.com>). It search more project root files.
|
||||
"
|
||||
call ale#Set('haskell_hls_executable', 'haskell-language-server-wrapper')
|
||||
call ale#Set('haskell_hls_config', {})
|
||||
|
||||
function! ale_linters#haskell#hls#FindRootFile(buffer) abort
|
||||
let l:serach_root_files = [
|
||||
@@ -60,4 +61,5 @@ call ale#linter#Define('haskell', {
|
||||
\ 'command': function('ale_linters#haskell#hls#GetCommand'),
|
||||
\ 'executable': {b -> ale#Var(b, 'haskell_hls_executable')},
|
||||
\ 'project_root': function('ale_linters#haskell#hls#GetProjectRoot'),
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'haskell_hls_config')},
|
||||
\})
|
||||
|
||||
@@ -4,8 +4,7 @@
|
||||
call ale#Set('haskell_stack_ghc_options', '-fno-code -v0')
|
||||
|
||||
function! ale_linters#haskell#stack_ghc#GetCommand(buffer) abort
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#handlers#haskell#GetStackExecutable(a:buffer)
|
||||
return ale#handlers#haskell#GetStackExecutable(a:buffer)
|
||||
\ . ' ghc -- '
|
||||
\ . ale#Var(a:buffer, 'haskell_stack_ghc_options')
|
||||
\ . ' %t'
|
||||
@@ -16,6 +15,7 @@ call ale#linter#Define('haskell', {
|
||||
\ 'aliases': ['stack-ghc'],
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': function('ale#handlers#haskell#GetStackExecutable'),
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#haskell#stack_ghc#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
||||
|
||||
5
ale_linters/help/cspell.vim
Normal file
5
ale_linters/help/cspell.vim
Normal file
@@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for help files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('help')
|
||||
56
ale_linters/html/angular.vim
Normal file
56
ale_linters/html/angular.vim
Normal file
@@ -0,0 +1,56 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: tsserver integration for ALE
|
||||
|
||||
call ale#Set('html_angular_executable', 'ngserver')
|
||||
call ale#Set('html_angular_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#html#angular#GetProjectRoot(buffer) abort
|
||||
return ale#path#Dirname(
|
||||
\ ale#path#FindNearestDirectory(a:buffer, 'node_modules')
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#html#angular#GetExecutable(buffer) abort
|
||||
return 'node'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#html#angular#GetCommand(buffer) abort
|
||||
let l:language_service_dir = ale#path#Simplify(
|
||||
\ ale#path#FindNearestDirectory(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/@angular/language-service'
|
||||
\ )
|
||||
\)
|
||||
|
||||
if empty(l:language_service_dir)
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:language_service_dir = fnamemodify(l:language_service_dir, ':h')
|
||||
let l:typescript_dir = ale#path#Simplify(
|
||||
\ fnamemodify(l:language_service_dir, ':h:h')
|
||||
\ . '/typescript'
|
||||
\)
|
||||
let l:script = ale#path#FindExecutable(a:buffer, 'html_angular', [
|
||||
\ 'node_modules/@angular/language-server/bin/ngserver',
|
||||
\ 'node_modules/@angular/language-server/index.js',
|
||||
\])
|
||||
|
||||
if !filereadable(l:script)
|
||||
return ''
|
||||
endif
|
||||
|
||||
return ale#Escape('node') . ' ' . ale#Escape(l:script)
|
||||
\ . ' --ngProbeLocations ' . ale#Escape(l:language_service_dir)
|
||||
\ . ' --tsProbeLocations ' . ale#Escape(l:typescript_dir)
|
||||
\ . ' --stdio'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('html', {
|
||||
\ 'name': 'angular',
|
||||
\ 'aliases': ['angular-language-server'],
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': function('ale_linters#html#angular#GetExecutable'),
|
||||
\ 'command': function('ale_linters#html#angular#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#html#angular#GetProjectRoot'),
|
||||
\})
|
||||
5
ale_linters/html/cspell.vim
Normal file
5
ale_linters/html/cspell.vim
Normal file
@@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for HTML files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('html')
|
||||
@@ -24,7 +24,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('html', {
|
||||
\ 'name': 'htmlhint',
|
||||
\ 'executable': {b -> ale#node#FindExecutable(b, 'html_htmlhint', [
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'html_htmlhint', [
|
||||
\ 'node_modules/.bin/htmlhint',
|
||||
\ ])},
|
||||
\ 'command': function('ale_linters#html#htmlhint#GetCommand'),
|
||||
|
||||
@@ -5,7 +5,7 @@ call ale#Set('html_stylelint_options', '')
|
||||
call ale#Set('html_stylelint_use_global', 0)
|
||||
|
||||
function! ale_linters#html#stylelint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'html_stylelint', [
|
||||
return ale#path#FindExecutable(a:buffer, 'html_stylelint', [
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
@@ -6,7 +6,7 @@ call ale#Set('ink_ls_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('ink_ls_initialization_options', {})
|
||||
|
||||
function! ale_linters#ink#ls#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'ink_ls', [
|
||||
return ale#path#FindExecutable(a:buffer, 'ink_ls', [
|
||||
\ 'ink-language-server',
|
||||
\ 'node_modules/.bin/ink-language-server',
|
||||
\])
|
||||
|
||||
@@ -14,6 +14,7 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'type': l:match[1] is? 'WARN' ? 'W' : 'E',
|
||||
\ 'sub_type': 'style',
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[4],
|
||||
@@ -31,6 +32,7 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'type': l:match[3] is? 'warning' ? 'W' : 'E',
|
||||
\ 'sub_type': 'style',
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
|
||||
5
ale_linters/java/cspell.vim
Normal file
5
ale_linters/java/cspell.vim
Normal file
@@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Java files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('java')
|
||||
@@ -192,4 +192,9 @@ call ale#linter#Define('java', {
|
||||
\ 'command': function('ale_linters#java#eclipselsp#RunWithVersionCheck'),
|
||||
\ 'language': 'java',
|
||||
\ 'project_root': function('ale#java#FindProjectRoot'),
|
||||
\ 'initialization_options': {
|
||||
\ 'extendedClientCapabilities': {
|
||||
\ 'classFileContentsSupport': v:true
|
||||
\ }
|
||||
\ }
|
||||
\})
|
||||
|
||||
@@ -9,16 +9,16 @@ call ale#Set('java_javac_classpath', '')
|
||||
call ale#Set('java_javac_sourcepath', '')
|
||||
|
||||
function! ale_linters#java#javac#RunWithImportPaths(buffer) abort
|
||||
let l:command = ale#maven#BuildClasspathCommand(a:buffer)
|
||||
let [l:cwd, l:command] = ale#maven#BuildClasspathCommand(a:buffer)
|
||||
|
||||
" Try to use Gradle if Maven isn't available.
|
||||
if empty(l:command)
|
||||
let l:command = ale#gradle#BuildClasspathCommand(a:buffer)
|
||||
let [l:cwd, l:command] = ale#gradle#BuildClasspathCommand(a:buffer)
|
||||
endif
|
||||
|
||||
" Try to use Ant if Gradle and Maven aren't available
|
||||
if empty(l:command)
|
||||
let l:command = ale#ant#BuildClasspathCommand(a:buffer)
|
||||
let [l:cwd, l:command] = ale#ant#BuildClasspathCommand(a:buffer)
|
||||
endif
|
||||
|
||||
if empty(l:command)
|
||||
@@ -28,7 +28,8 @@ function! ale_linters#java#javac#RunWithImportPaths(buffer) abort
|
||||
return ale#command#Run(
|
||||
\ a:buffer,
|
||||
\ l:command,
|
||||
\ function('ale_linters#java#javac#GetCommand')
|
||||
\ function('ale_linters#java#javac#GetCommand'),
|
||||
\ {'cwd': l:cwd},
|
||||
\)
|
||||
endfunction
|
||||
|
||||
@@ -110,8 +111,7 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths, meta) abort
|
||||
|
||||
" Always run javac from the directory the file is in, so we can resolve
|
||||
" relative paths correctly.
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . '%e -Xlint'
|
||||
return '%e -Xlint'
|
||||
\ . ale#Pad(l:cp_option)
|
||||
\ . ale#Pad(l:sp_option)
|
||||
\ . ' -d ' . ale#Escape(l:class_file_directory)
|
||||
@@ -132,7 +132,9 @@ function! ale_linters#java#javac#Handle(buffer, lines) abort
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, [l:pattern, l:col_pattern, l:symbol_pattern])
|
||||
if empty(l:match[2]) && empty(l:match[3])
|
||||
let l:output[-1].col = len(l:match[1])
|
||||
if !empty(l:match[1]) && !empty(l:output)
|
||||
let l:output[-1].col = len(l:match[1])
|
||||
endif
|
||||
elseif empty(l:match[3])
|
||||
" Add symbols to 'cannot find symbol' errors.
|
||||
if l:output[-1].text is# 'error: cannot find symbol'
|
||||
@@ -154,6 +156,7 @@ endfunction
|
||||
call ale#linter#Define('java', {
|
||||
\ 'name': 'javac',
|
||||
\ 'executable': {b -> ale#Var(b, 'java_javac_executable')},
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#java#javac#RunWithImportPaths'),
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale_linters#java#javac#Handle',
|
||||
|
||||
5
ale_linters/javascript/cspell.vim
Normal file
5
ale_linters/javascript/cspell.vim
Normal file
@@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for JavaScript files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('javascript')
|
||||
11
ale_linters/javascript/deno.vim
Normal file
11
ale_linters/javascript/deno.vim
Normal file
@@ -0,0 +1,11 @@
|
||||
" Author: Arnold Chand <creativenull@outlook.com>
|
||||
" Description: Deno lsp linter for JavaScript files.
|
||||
|
||||
call ale#linter#Define('javascript', {
|
||||
\ 'name': 'deno',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': function('ale#handlers#deno#GetExecutable'),
|
||||
\ 'command': '%e lsp',
|
||||
\ 'project_root': function('ale#handlers#deno#GetProjectRoot'),
|
||||
\ 'initialization_options': function('ale#handlers#deno#GetInitializationOptions'),
|
||||
\})
|
||||
@@ -5,6 +5,7 @@ call ale#linter#Define('javascript', {
|
||||
\ 'name': 'eslint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': function('ale#handlers#eslint#GetExecutable'),
|
||||
\ 'cwd': function('ale#handlers#eslint#GetCwd'),
|
||||
\ 'command': function('ale#handlers#eslint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#eslint#HandleJSON',
|
||||
\})
|
||||
|
||||
@@ -22,7 +22,7 @@ function! ale_linters#javascript#flow#GetExecutable(buffer) abort
|
||||
return ''
|
||||
endif
|
||||
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_flow', [
|
||||
return ale#path#FindExecutable(a:buffer, 'javascript_flow', [
|
||||
\ 'node_modules/.bin/flow',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
@@ -19,7 +19,7 @@ endfunction
|
||||
call ale#linter#Define('javascript', {
|
||||
\ 'name': 'flow-language-server',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#node#FindExecutable(b, 'javascript_flow_ls', [
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_flow_ls', [
|
||||
\ 'node_modules/.bin/flow',
|
||||
\ ])},
|
||||
\ 'command': '%e lsp --from ale-lsp',
|
||||
|
||||
@@ -53,7 +53,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('javascript', {
|
||||
\ 'name': 'jscs',
|
||||
\ 'executable': {b -> ale#node#FindExecutable(b, 'javascript_jscs', [
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_jscs', [
|
||||
\ 'node_modules/.bin/jscs',
|
||||
\ ])},
|
||||
\ 'command': function('ale_linters#javascript#jscs#GetCommand'),
|
||||
|
||||
@@ -25,7 +25,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('javascript', {
|
||||
\ 'name': 'jshint',
|
||||
\ 'executable': {b -> ale#node#FindExecutable(b, 'javascript_jshint', [
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_jshint', [
|
||||
\ 'node_modules/.bin/jshint',
|
||||
\ ])},
|
||||
\ 'command': function('ale_linters#javascript#jshint#GetCommand'),
|
||||
|
||||
@@ -6,7 +6,7 @@ call ale#Set('javascript_standard_use_global', get(g:, 'ale_use_global_executabl
|
||||
call ale#Set('javascript_standard_options', '')
|
||||
|
||||
function! ale_linters#javascript#standard#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_standard', [
|
||||
return ale#path#FindExecutable(a:buffer, 'javascript_standard', [
|
||||
\ 'node_modules/standardx/bin/cmd.js',
|
||||
\ 'node_modules/standard/bin/cmd.js',
|
||||
\ 'node_modules/semistandard/bin/cmd.js',
|
||||
|
||||
@@ -8,7 +8,7 @@ call ale#Set('javascript_tsserver_use_global', get(g:, 'ale_use_global_executabl
|
||||
call ale#linter#Define('javascript', {
|
||||
\ 'name': 'tsserver',
|
||||
\ 'lsp': 'tsserver',
|
||||
\ 'executable': {b -> ale#node#FindExecutable(b, 'javascript_tsserver', [
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_tsserver', [
|
||||
\ 'node_modules/.bin/tsserver',
|
||||
\ ])},
|
||||
\ 'command': '%e',
|
||||
|
||||
5
ale_linters/json/cspell.vim
Normal file
5
ale_linters/json/cspell.vim
Normal file
@@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for JSON files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('json')
|
||||
16
ale_linters/json/eslint.vim
Normal file
16
ale_linters/json/eslint.vim
Normal file
@@ -0,0 +1,16 @@
|
||||
" Author: João Pesce <joao@pesce.cc>
|
||||
" Description: eslint for JSON files.
|
||||
"
|
||||
" Requires eslint-plugin-jsonc or a similar plugin to work
|
||||
"
|
||||
" Uses the same funtcions as ale_linters/javascript/eslint.vim by w0rp
|
||||
" <devw0rp@gmail.com>
|
||||
|
||||
call ale#linter#Define('json', {
|
||||
\ 'name': 'eslint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': function('ale#handlers#eslint#GetExecutable'),
|
||||
\ 'cwd': function('ale#handlers#eslint#GetCwd'),
|
||||
\ 'command': function('ale#handlers#eslint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#eslint#HandleJSON',
|
||||
\})
|
||||
@@ -1,32 +1,24 @@
|
||||
" Author: jD91mZM2 <me@krake.one>
|
||||
call ale#Set('json_jq_executable', 'jq')
|
||||
call ale#Set('json_jq_options', '')
|
||||
call ale#Set('json_jq_filters', '.')
|
||||
|
||||
function! ale_linters#json#jq#GetCommand(buffer) abort
|
||||
let l:executable = ale#fixers#jq#GetExecutable(a:buffer)
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
endfunction
|
||||
" Matches patterns like the following:
|
||||
" parse error: Expected another key-value pair at line 4, column 3
|
||||
let s:pattern = '^parse error: \(.\+\) at line \(\d\+\), column \(\d\+\)$'
|
||||
|
||||
function! ale_linters#json#jq#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
" parse error: Expected another key-value pair at line 4, column 3
|
||||
let l:pattern = '^parse error: \(.\+\) at line \(\d\+\), column \(\d\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'text': l:match[1],
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
return ale#util#MapMatches(a:lines, s:pattern, {match -> {
|
||||
\ 'text': match[1],
|
||||
\ 'lnum': match[2] + 0,
|
||||
\ 'col': match[3] + 0,
|
||||
\}})
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('json', {
|
||||
\ 'name': 'jq',
|
||||
\ 'executable': function('ale#fixers#jq#GetExecutable'),
|
||||
\ 'executable': {b -> ale#Var(b, 'json_jq_executable')},
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command': function('ale_linters#json#jq#GetCommand'),
|
||||
\ 'command': '%e',
|
||||
\ 'callback': 'ale_linters#json#jq#Handle',
|
||||
\})
|
||||
|
||||
@@ -4,7 +4,7 @@ call ale#Set('json_jsonlint_executable', 'jsonlint')
|
||||
call ale#Set('json_jsonlint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#json#jsonlint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'json_jsonlint', [
|
||||
return ale#path#FindExecutable(a:buffer, 'json_jsonlint', [
|
||||
\ 'node_modules/.bin/jsonlint',
|
||||
\ 'node_modules/jsonlint/lib/cli.js',
|
||||
\])
|
||||
|
||||
@@ -6,7 +6,7 @@ call ale#Set('json_spectral_use_global', get(g:, 'ale_use_global_executables', 0
|
||||
|
||||
call ale#linter#Define('json', {
|
||||
\ 'name': 'spectral',
|
||||
\ 'executable': {b -> ale#node#FindExecutable(b, 'json_spectral', [
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'json_spectral', [
|
||||
\ 'node_modules/.bin/spectral',
|
||||
\ ])},
|
||||
\ 'command': '%e lint --ignore-unknown-format -q -f text %t',
|
||||
|
||||
16
ale_linters/json5/eslint.vim
Normal file
16
ale_linters/json5/eslint.vim
Normal file
@@ -0,0 +1,16 @@
|
||||
" Author: João Pesce <joao@pesce.cc>
|
||||
" Description: eslint for JSON5 files.
|
||||
"
|
||||
" Requires eslint-plugin-jsonc or a similar plugin to work
|
||||
"
|
||||
" Uses the same funtcions as ale_linters/javascript/eslint.vim by w0rp
|
||||
" <devw0rp@gmail.com>
|
||||
|
||||
call ale#linter#Define('json5', {
|
||||
\ 'name': 'eslint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': function('ale#handlers#eslint#GetExecutable'),
|
||||
\ 'cwd': function('ale#handlers#eslint#GetCwd'),
|
||||
\ 'command': function('ale#handlers#eslint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#eslint#HandleJSON',
|
||||
\})
|
||||
16
ale_linters/jsonc/eslint.vim
Normal file
16
ale_linters/jsonc/eslint.vim
Normal file
@@ -0,0 +1,16 @@
|
||||
" Author: João Pesce <joao@pesce.cc>
|
||||
" Description: eslint for JSONC files.
|
||||
"
|
||||
" Requires eslint-plugin-jsonc or a similar plugin to work
|
||||
"
|
||||
" Uses the same funtcions as ale_linters/javascript/eslint.vim by w0rp
|
||||
" <devw0rp@gmail.com>
|
||||
|
||||
call ale#linter#Define('jsonc', {
|
||||
\ 'name': 'eslint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': function('ale#handlers#eslint#GetExecutable'),
|
||||
\ 'cwd': function('ale#handlers#eslint#GetCwd'),
|
||||
\ 'command': function('ale#handlers#eslint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#eslint#HandleJSON',
|
||||
\})
|
||||
59
ale_linters/jsonnet/jsonnet_lint.vim
Normal file
59
ale_linters/jsonnet/jsonnet_lint.vim
Normal file
@@ -0,0 +1,59 @@
|
||||
" Author: Trevor Whitney <trevorjwhitney@gmail.com>
|
||||
" Description: jsonnet-lint for jsonnet files
|
||||
|
||||
call ale#Set('jsonnet_jsonnet_lint_executable', 'jsonnet-lint')
|
||||
call ale#Set('jsonnet_jsonnet_lint_options', '')
|
||||
|
||||
function! ale_linters#jsonnet#jsonnet_lint#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'jsonnet_jsonnet_lint_options')
|
||||
|
||||
return '%e'
|
||||
\ . ale#Pad(l:options)
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
|
||||
function! ale_linters#jsonnet#jsonnet_lint#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" ERROR: foo.jsonnet:22:3-12 expected token OPERATOR but got (IDENTIFIER, "bar")
|
||||
" ERROR: hoge.jsonnet:20:3 unexpected: "}" while parsing terminal
|
||||
" ERROR: main.jsonnet:212:1-14 Expected , or ; but got (IDENTIFIER, "older_cluster")
|
||||
let l:pattern = '^ERROR: [^:]*:\(\d\+\):\(\d\+\)\(-\d\+\)* \(.*\)'
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
continue
|
||||
endif
|
||||
|
||||
let line_number = l:match[1] + 0
|
||||
let column = l:match[2] + 0
|
||||
" l:match[3] has optional -14, when linter is showing a range
|
||||
let text = l:match[4]
|
||||
|
||||
|
||||
" vcol is Needed to indicate that the column is a character.
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': line_number,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': column,
|
||||
\ 'text': text,
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('jsonnet', {
|
||||
\ 'name': 'jsonnet_lint',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'jsonnet_jsonnet_lint_executable')},
|
||||
\ 'command': function('ale_linters#jsonnet#jsonnet_lint#GetCommand'),
|
||||
\ 'callback': 'ale_linters#jsonnet#jsonnet_lint#Handle',
|
||||
\})
|
||||
52
ale_linters/jsonnet/jsonnetfmt.vim
Normal file
52
ale_linters/jsonnet/jsonnetfmt.vim
Normal file
@@ -0,0 +1,52 @@
|
||||
" Authors: Trevor Whitney <trevorjwhitney@gmail.com> and Takuya Kosugiyama <re@itkq.jp>
|
||||
" Description: jsonnetfmt for jsonnet files
|
||||
|
||||
call ale#Set('jsonnet_jsonnetfmt_executable', 'jsonnetfmt')
|
||||
call ale#Set('jsonnet_jsonnetfmt_options', '')
|
||||
|
||||
function! ale_linters#jsonnet#jsonnetfmt#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'jsonnet_jsonnetfmt_options')
|
||||
|
||||
return '%e'
|
||||
\ . ale#Pad(l:options)
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
|
||||
function! ale_linters#jsonnet#jsonnetfmt#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" STATIC ERROR: foo.jsonnet:22:3-12: expected token OPERATOR but got (IDENTIFIER, "bar")
|
||||
" STATIC ERROR: hoge.jsonnet:20:3: unexpected: "}" while parsing terminal
|
||||
let l:pattern = '^STATIC ERROR:[^:]*:\(\d\+\):\(\d\+\):*\(-\d\+\)* \(.*\)'
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
continue
|
||||
endif
|
||||
|
||||
" vcol is Needed to indicate that the column is a character.
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[4],
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('jsonnet', {
|
||||
\ 'name': 'jsonnetfmt',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'jsonnet_jsonnetfmt_executable')},
|
||||
\ 'command': function('ale_linters#jsonnet#jsonnetfmt#GetCommand'),
|
||||
\ 'callback': 'ale_linters#jsonnet#jsonnetfmt#Handle',
|
||||
\})
|
||||
@@ -15,20 +15,15 @@ function! ale_linters#kotlin#kotlinc#RunWithImportPaths(buffer) abort
|
||||
let l:command = ''
|
||||
|
||||
" exec maven/gradle only if classpath is not set
|
||||
if ale#Var(a:buffer, 'kotlin_kotlinc_classpath') isnot# ''
|
||||
if !empty(ale#Var(a:buffer, 'kotlin_kotlinc_classpath'))
|
||||
return ale_linters#kotlin#kotlinc#GetCommand(a:buffer, [], {})
|
||||
endif
|
||||
|
||||
let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml')
|
||||
|
||||
if !empty(l:pom_path) && executable('mvn')
|
||||
let l:command = ale#path#CdString(fnamemodify(l:pom_path, ':h'))
|
||||
\ . 'mvn dependency:build-classpath'
|
||||
endif
|
||||
let [l:cwd, l:command] = ale#maven#BuildClasspathCommand(a:buffer)
|
||||
|
||||
" Try to use Gradle if Maven isn't available.
|
||||
if empty(l:command)
|
||||
let l:command = ale#gradle#BuildClasspathCommand(a:buffer)
|
||||
let [l:cwd, l:command] = ale#gradle#BuildClasspathCommand(a:buffer)
|
||||
endif
|
||||
|
||||
if empty(l:command)
|
||||
@@ -38,7 +33,8 @@ function! ale_linters#kotlin#kotlinc#RunWithImportPaths(buffer) abort
|
||||
return ale#command#Run(
|
||||
\ a:buffer,
|
||||
\ l:command,
|
||||
\ function('ale_linters#kotlin#kotlinc#GetCommand')
|
||||
\ function('ale_linters#kotlin#kotlinc#GetCommand'),
|
||||
\ {'cwd': l:cwd},
|
||||
\)
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('less', {
|
||||
\ 'name': 'lessc',
|
||||
\ 'executable': {b -> ale#node#FindExecutable(b, 'less_lessc', [
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'less_lessc', [
|
||||
\ 'node_modules/.bin/lessc',
|
||||
\ ])},
|
||||
\ 'command': function('ale_linters#less#lessc#GetCommand'),
|
||||
|
||||
@@ -12,7 +12,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('less', {
|
||||
\ 'name': 'stylelint',
|
||||
\ 'executable': {b -> ale#node#FindExecutable(b, 'less_stylelint', [
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'less_stylelint', [
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\ ])},
|
||||
\ 'command': function('ale_linters#less#stylelint#GetCommand'),
|
||||
|
||||
5
ale_linters/lua/cspell.vim
Normal file
5
ale_linters/lua/cspell.vim
Normal file
@@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Lua files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('lua')
|
||||
@@ -1,4 +1,4 @@
|
||||
" Author: Vincent (wahrwolf [ät] wolfpit.net)
|
||||
" Author: Vincent (wahrwolf [at] wolfpit.net)
|
||||
" Description: languagetool for mails
|
||||
|
||||
|
||||
|
||||
@@ -20,6 +20,6 @@ endfunction
|
||||
call ale#linter#Define('make', {
|
||||
\ 'name': 'checkmake',
|
||||
\ 'executable': 'checkmake',
|
||||
\ 'command': 'checkmake %s --format="{{.LineNumber}}:{{.Rule}}:{{.Violation}}"',
|
||||
\ 'command': 'checkmake %s --format="{{.LineNumber}}:{{.Rule}}:{{.Violation}}{{\"\r\n\"}}"',
|
||||
\ 'callback': 'ale_linters#make#checkmake#Handle',
|
||||
\})
|
||||
|
||||
5
ale_linters/markdown/cspell.vim
Normal file
5
ale_linters/markdown/cspell.vim
Normal file
@@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Markdown files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('markdown')
|
||||
@@ -1,4 +1,4 @@
|
||||
" Author: Vincent (wahrwolf [ät] wolfpit.net)
|
||||
" Author: Vincent (wahrwolf [at] wolfpit.net)
|
||||
" Description: languagetool for markdown files
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ endfunction
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'remark_lint',
|
||||
\ 'aliases': ['remark-lint'],
|
||||
\ 'executable': {b -> ale#node#FindExecutable(b, 'markdown_remark_lint', [
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'markdown_remark_lint', [
|
||||
\ 'node_modules/.bin/remark',
|
||||
\ ])},
|
||||
\ 'command': function('ale_linters#markdown#remark_lint#GetCommand'),
|
||||
|
||||
@@ -1,9 +1,24 @@
|
||||
" Author: chew-z https://github.com/chew-z
|
||||
" Description: vale for Markdown files
|
||||
|
||||
call ale#Set('markdown_vale_executable', 'vale')
|
||||
call ale#Set('markdown_vale_input_file', '%t')
|
||||
call ale#Set('markdown_vale_options', '')
|
||||
|
||||
function! ale_linters#markdown#vale#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'markdown_vale_executable')
|
||||
let l:input_file = ale#Var(a:buffer, 'markdown_vale_input_file')
|
||||
|
||||
" Defaults to `vale --output=JSON %t`
|
||||
return ale#Escape(l:executable)
|
||||
\ . ' --output=JSON '
|
||||
\ . ale#Var(a:buffer, 'markdown_vale_options')
|
||||
\ . ' ' . l:input_file
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'vale',
|
||||
\ 'executable': 'vale',
|
||||
\ 'command': 'vale --output=JSON %t',
|
||||
\ 'executable': {b -> ale#Var(b, 'markdown_vale_executable')},
|
||||
\ 'command': function('ale_linters#markdown#vale#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#vale#Handle',
|
||||
\})
|
||||
|
||||
@@ -5,12 +5,9 @@ call ale#Set('mercury_mmc_executable', 'mmc')
|
||||
call ale#Set('mercury_mmc_options', '--make --output-compile-error-lines 100')
|
||||
|
||||
function! ale_linters#mercury#mmc#GetCommand(buffer) abort
|
||||
let l:module_name = expand('#' . a:buffer . ':t:r')
|
||||
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . '%e --errorcheck-only '
|
||||
return '%e --errorcheck-only '
|
||||
\ . ale#Var(a:buffer, 'mercury_mmc_options')
|
||||
\ . ' ' . l:module_name
|
||||
\ . ' %s:t:r'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#mercury#mmc#Handle(buffer, lines) abort
|
||||
@@ -34,6 +31,7 @@ call ale#linter#Define('mercury', {
|
||||
\ 'name': 'mmc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'mercury_mmc_executable')},
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#mercury#mmc#GetCommand'),
|
||||
\ 'callback': 'ale_linters#mercury#mmc#Handle',
|
||||
\ 'lint_file': 1,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
function! ale_linters#nix#nix#Command(buffer, output, meta) abort
|
||||
let l:version = a:output[0][22:]
|
||||
|
||||
if l:version =~# '^\(2.4\|3\).*'
|
||||
if l:version =~# '^\(2.[4-9]\|3\).*'
|
||||
return 'nix-instantiate --log-format internal-json --parse -'
|
||||
else
|
||||
return 'nix-instantiate --parse -'
|
||||
|
||||
18
ale_linters/nix/statix.vim
Normal file
18
ale_linters/nix/statix.vim
Normal file
@@ -0,0 +1,18 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: statix analysis and suggestions for Nix files
|
||||
|
||||
call ale#Set('nix_statix_check_executable', 'statix')
|
||||
call ale#Set('nix_statix_check_options', '')
|
||||
|
||||
function! ale_linters#nix#statix#GetCommand(buffer) abort
|
||||
return '%e check -o errfmt --stdin'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'nix_statix_check_options'))
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('nix', {
|
||||
\ 'name': 'statix',
|
||||
\ 'executable': {b -> ale#Var(b, 'nix_statix_check_executable')},
|
||||
\ 'command': function('ale_linters#nix#statix#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#statix#Handle',
|
||||
\})
|
||||
13
ale_linters/ocaml/ocamllsp.vim
Normal file
13
ale_linters/ocaml/ocamllsp.vim
Normal file
@@ -0,0 +1,13 @@
|
||||
" Author: Risto Stevcev <me@risto.codes>
|
||||
" Description: The official language server for OCaml
|
||||
|
||||
call ale#Set('ocaml_ocamllsp_use_opam', 1)
|
||||
|
||||
call ale#linter#Define('ocaml', {
|
||||
\ 'name': 'ocamllsp',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': function('ale#handlers#ocamllsp#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#ocamllsp#GetCommand'),
|
||||
\ 'language': function('ale#handlers#ocamllsp#GetLanguage'),
|
||||
\ 'project_root': function('ale#handlers#ocamllsp#GetProjectRoot'),
|
||||
\})
|
||||
17
ale_linters/ocamlinterface/merlin.vim
Normal file
17
ale_linters/ocamlinterface/merlin.vim
Normal file
@@ -0,0 +1,17 @@
|
||||
" Author: Andrey Popp -- @andreypopp
|
||||
" Description: Report errors in OCaml code with Merlin
|
||||
|
||||
if !exists('g:merlin')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! ale_linters#ocamlinterface#merlin#Handle(buffer, lines) abort
|
||||
return merlin#ErrorLocList()
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ocamlinterface', {
|
||||
\ 'name': 'merlin',
|
||||
\ 'executable': 'ocamlmerlin',
|
||||
\ 'command': 'true',
|
||||
\ 'callback': 'ale_linters#ocamlinterface#merlin#Handle',
|
||||
\})
|
||||
13
ale_linters/ocamlinterface/ocamllsp.vim
Normal file
13
ale_linters/ocamlinterface/ocamllsp.vim
Normal file
@@ -0,0 +1,13 @@
|
||||
" Author: Risto Stevcev <me@risto.codes>
|
||||
" Description: The official language server for OCaml
|
||||
|
||||
call ale#Set('ocaml_ocamllsp_use_opam', 1)
|
||||
|
||||
call ale#linter#Define('ocamlinterface', {
|
||||
\ 'name': 'ocamllsp',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': function('ale#handlers#ocamllsp#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#ocamllsp#GetCommand'),
|
||||
\ 'language': function('ale#handlers#ocamllsp#GetLanguage'),
|
||||
\ 'project_root': function('ale#handlers#ocamllsp#GetProjectRoot'),
|
||||
\})
|
||||
5
ale_linters/php/cspell.vim
Normal file
5
ale_linters/php/cspell.vim
Normal file
@@ -0,0 +1,5 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for PHP files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('php')
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user