Compare commits

..

1 Commits

Author SHA1 Message Date
w0rp
b2702c6829 Bump the ALE version to v3.1.0 2021-02-11 19:47:40 +00:00
1414 changed files with 5099 additions and 19748 deletions

View File

@@ -1,6 +0,0 @@
---
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

View File

@@ -40,9 +40,7 @@ Are you having trouble configuring ALE? Try asking for help on [Stack Exchange](
2. Then this happened. 2. Then this happened.
### :ALEInfo ### :ALEInfo
<details>
<summary>Expand</summary> <!-- Paste the output of :ALEInfo here. Try :ALEInfoToClipboard -->
<!-- Paste the output of :ALEInfo here. Try :ALEInfoToClipboard --> <!-- Make sure to run :ALEInfo from the buffer where the bug occurred. -->
<!-- Make sure to run :ALEInfo from the buffer where the bug occurred. --> <!-- Read the output. You might figure out what went wrong yourself. -->
<!-- Read the output. You might figure out what went wrong yourself. -->
</details>

6
.github/stale.yml vendored
View File

@@ -1,9 +1,9 @@
--- ---
# This configuration closes stale PRs after 56 + 7 days. # This configuration closes stale PRs after 28 + 7 days.
# That's 8 weeks until stale bot complains, and a week until it closes a PR. # That's 4 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. # Issues in ALE are never, ever stale. They are either resolved or not.
only: pulls only: pulls
daysUntilStale: 56 daysUntilStale: 28
daysUntilClose: 7 daysUntilClose: 7
exemptLabels: [] exemptLabels: []
staleLabel: stale staleLabel: stale

View File

@@ -4,8 +4,7 @@ on: # yamllint disable-line rule:truthy
push: push:
branches: [ master ] # yamllint disable-line rule:brackets branches: [ master ] # yamllint disable-line rule:brackets
tags: tags:
- v[0-9]+.[0-9]+.x - /^v\d+\.\d+\.(x|\d+)$/
- v[0-9]+.[0-9]+.[0-9]+
pull_request: pull_request:
branches: [ master ] # yamllint disable-line rule:brackets branches: [ master ] # yamllint disable-line rule:brackets
@@ -27,9 +26,9 @@ jobs:
matrix: matrix:
vim-version: vim-version:
- '--vim-80-only' - '--vim-80-only'
- '--vim-90-only' - '--vim-82-only'
- '--neovim-02-only' - '--neovim-02-only'
- '--neovim-08-only' - '--neovim-04-only'
- '--linters-only' - '--linters-only'
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2

View File

@@ -1,5 +0,0 @@
policies:
# Disable a violation that is thrown randomly for reasons I still
# do not understand.
ProhibitMissingScriptEncoding:
enabled: false

View File

@@ -1,27 +1,26 @@
FROM testbed/vim:24 FROM tweekmonster/vim-testbed:latest
RUN install_vim -tag v8.0.0027 -build \ RUN install_vim -tag v8.0.0027 -build \
-tag v9.0.0133 -build \ -tag v8.2.2401 -build \
-tag neovim:v0.2.0 -build \ -tag neovim:v0.2.0 -build \
-tag neovim:v0.8.0 -build -tag neovim:v0.4.4 -build
ENV PACKAGES="\ ENV PACKAGES="\
bash \ bash \
git \ git \
python2 \ python \
python3 \ py-pip \
py3-pip \
grep \ grep \
sed \ sed \
" "
RUN apk --update add $PACKAGES && \ RUN apk --update add $PACKAGES && \
rm -rf /var/cache/apk/* /tmp/* /var/tmp/* rm -rf /var/cache/apk/* /tmp/* /var/tmp/*
RUN pip install vim-vint==0.3.21 RUN pip install vim-vint==0.3.15
RUN git clone https://github.com/junegunn/vader.vim vader && \ RUN git clone https://github.com/junegunn/vader.vim vader && \
cd vader && git checkout c6243dd81c98350df4dec608fa972df98fa2a3af cd vader && git checkout c6243dd81c98350df4dec608fa972df98fa2a3af
ARG GIT_VERSION ARG GIT_VERSION
LABEL Version=${GIT_VERSION} LABEL Version=${GIT_VERSION}
LABEL Name=denseanalysis/ale LABEL Name=w0rp/ale

View File

@@ -1,4 +1,4 @@
# Asynchronous Lint Engine [![GitHub Build Status](https://github.com/dense-analysis/ale/workflows/CI/badge.svg)](https://github.com/dense-analysis/ale/actions?query=event%3Apush+workflow%3ACI+branch%3Amaster++) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/r0ef1xu8xjmik58d/branch/master?svg=true)](https://ci.appveyor.com/project/dense-analysis/ale) [![Join the Dense Analysis Discord server](https://img.shields.io/badge/chat-Discord-5865F2)](https://discord.gg/5zFD6pQxDk) # Asynchronous Lint Engine [![GitHub Build Status](https://github.com/dense-analysis/ale/workflows/CI/badge.svg)](https://github.com/dense-analysis/ale/actions?query=event%3Apush+workflow%3ACI+branch%3Amaster++) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/r0ef1xu8xjmik58d/branch/master?svg=true)](https://ci.appveyor.com/project/dense-analysis/ale) [![Join the chat at https://gitter.im/vim-ale/Lobby](https://badges.gitter.im/vim-ale/Lobby.svg)](https://gitter.im/vim-ale/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
![ALE Logo by Mark Grealish - https://www.bhalash.com/](https://user-images.githubusercontent.com/3518142/59195920-2c339500-8b85-11e9-9c22-f6b7f69637b8.jpg) ![ALE Logo by Mark Grealish - https://www.bhalash.com/](https://user-images.githubusercontent.com/3518142/59195920-2c339500-8b85-11e9-9c22-f6b7f69637b8.jpg)
@@ -81,8 +81,6 @@ other content at [w0rp.com](https://w0rp.com).
18. [How can I configure ALE differently for different buffers?](#faq-buffer-configuration) 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) 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) 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> <a name="supported-languages"></a>
@@ -198,15 +196,14 @@ completion manually with `<C-x><C-o>`.
set omnifunc=ale#completion#OmniFunc set omnifunc=ale#completion#OmniFunc
``` ```
ALE supports automatic imports from external modules. This behavior is enabled ALE supports automatic imports from external modules. This behavior is disabled
by default and can be disabled by setting: by default and can be enabled by setting:
```vim ```vim
let g:ale_completion_autoimport = 0 let g:ale_completion_autoimport = 1
``` ```
Note that disabling auto import can result in missing completion items from some See `:help ale-completion` for more information.
LSP servers (e.g. eclipselsp). See `:help ale-completion` for more information.
<a name="usage-go-to-definition"></a> <a name="usage-go-to-definition"></a>
@@ -264,9 +261,6 @@ See `:help ale-symbol-search` for more information.
ALE supports renaming symbols in symbols in code such as variables or class ALE supports renaming symbols in symbols in code such as variables or class
names with the `ALERename` command. 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 `ALECodeAction` will execute actions on the cursor or applied to a visual
range selection, such as automatically fixing errors. range selection, such as automatically fixing errors.
@@ -359,7 +353,7 @@ See the Vundle documentation for more information.
<a name="installation-with-vim-plug"></a> <a name="installation-with-vim-plug"></a>
### 3.iv. Installation with Vim-Plug ### 3.iiii. Installation with Vim-Plug
You can install this plugin using [Vim-Plug](https://github.com/junegunn/vim-plug) You can install this plugin using [Vim-Plug](https://github.com/junegunn/vim-plug)
by adding the GitHub path for this repository to your `~/.vimrc`: by adding the GitHub path for this repository to your `~/.vimrc`:
@@ -386,8 +380,8 @@ If you are interested in the general direction of the project, check out the
[wiki home page](https://github.com/dense-analysis/ale/wiki). The wiki includes [wiki home page](https://github.com/dense-analysis/ale/wiki). The wiki includes
a Roadmap for the future, and more. a Roadmap for the future, and more.
If you'd liked to discuss ALE and more check out the Dense Analysis Discord If you'd liked to discuss the project more directly, check out the `#vim-ale` channel
server here: https://discord.gg/5zFD6pQxDk on Freenode. Web chat is available [here](https://webchat.freenode.net/?channels=vim-ale).
<a name="faq"></a> <a name="faq"></a>
@@ -913,51 +907,3 @@ 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 correct commands and map filename paths between different file systems. See
`:help ale-lint-other-machines` for the full documentation on how to configure `:help ale-lint-other-machines` for the full documentation on how to configure
ALE to support this. 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([''], 8)
```
<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.

View File

@@ -1,5 +0,0 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Ada files.
call ale#handlers#cspell#DefineLinter('ada')

View File

@@ -1,46 +0,0 @@
" Author: Horacio Sanson <https://github.com/hsanson>
" Description: Support ansible language server https://github.com/ansible/ansible-language-server/
call ale#Set('ansible_language_server_executable', 'ansible-language-server')
call ale#Set('ansible_language_server_config', {})
function! ale_linters#ansible#ansible_language_server#Executable(buffer) abort
return ale#Var(a:buffer, 'ansible_language_server_executable')
endfunction
function! ale_linters#ansible#ansible_language_server#GetCommand(buffer) abort
let l:executable = ale_linters#ansible#ansible_language_server#Executable(a:buffer)
return ale#Escape(l:executable) . ' --stdio'
endfunction
function! ale_linters#ansible#ansible_language_server#FindProjectRoot(buffer) abort
let l:dir = fnamemodify(
\ ale#path#FindNearestFile(a:buffer, 'ansible.cfg'),
\ ':h'
\)
if l:dir isnot# '.' && isdirectory(l:dir)
return l:dir
endif
let l:dir = fnamemodify(
\ ale#path#FindNearestDirectory(a:buffer, '.git'),
\ ':h:h'
\)
if l:dir isnot# '.' && isdirectory(l:dir)
return l:dir
endif
return ''
endfunction
call ale#linter#Define('ansible', {
\ 'name': 'ansible-language-server',
\ 'lsp': 'stdio',
\ 'executable': function('ale_linters#ansible#ansible_language_server#Executable'),
\ 'command': function('ale_linters#ansible#ansible_language_server#GetCommand'),
\ 'project_root': function('ale_linters#ansible#ansible_language_server#FindProjectRoot'),
\ 'lsp_config': {b -> ale#Var(b, 'ansible_language_server_config')}
\})

View File

@@ -1,4 +1,4 @@
" Authors: Bjorn Neergaard <bjorn@neersighted.com>, Vytautas Macionis <vytautas.macionis@manomail.de> " Author: Bjorn Neergaard <bjorn@neersighted.com>
" Description: ansible-lint for ansible-yaml files " Description: ansible-lint for ansible-yaml files
call ale#Set('ansible_ansible_lint_executable', 'ansible-lint') 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') return ale#Var(a:buffer, 'ansible_ansible_lint_executable')
endfunction endfunction
function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
for l:line in a:lines[:10] for l:line in a:lines[:10]
if match(l:line, '^Traceback') >= 0 if match(l:line, '^Traceback') >= 0
return [{ return [{
@@ -18,111 +18,39 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort
endif endif
endfor endfor
let l:version_group = ale#semver#GTE(a:version, [6, 0, 0]) ? '>=6.0.0' : " Matches patterns line the following:
\ ale#semver#GTE(a:version, [5, 0, 0]) ? '>=5.0.0' : "
\ '<5.0.0' " test.yml:35: [EANSIBLE0002] Trailing whitespace
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: \[?([[:alnum:]]+)\]? (.*)$'
let l:output = [] let l:output = []
if '>=6.0.0' is# l:version_group for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:error_codes = { 'blocker': 'E', 'critical': 'E', 'major': 'W', 'minor': 'W', 'info': 'I' } let l:code = l:match[4]
let l:linter_issues = ale#util#FuzzyJSONDecode(a:lines, [])
for l:issue in l:linter_issues if l:code is# 'EANSIBLE0002'
if ale#path#IsBufferPath(a:buffer, l:issue.location.path) \&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
call add(l:output, { " Skip warnings for trailing whitespace if the option is off.
\ 'lnum': exists('l:issue.location.lines.begin.column') ? l:issue.location.lines.begin.line : continue
\ l:issue.location.lines.begin, endif
\ 'col': exists('l:issue.location.lines.begin.column') ? l:issue.location.lines.begin.column : 0,
\ 'text': l:issue.check_name,
\ 'detail': l:issue.description,
\ 'code': l:issue.severity,
\ 'type': l:error_codes[l:issue.severity],
\})
endif
endfor
endif
if '>=5.0.0' is# l:version_group if ale#path#IsBufferPath(a:buffer, l:match[1])
" Matches patterns line the following: call add(l:output, {
" test.yml:3:148: syntax-check 'var' is not a valid attribute for a Play \ 'lnum': l:match[2] + 0,
" roles/test/tasks/test.yml:8: [package-latest] [VERY_LOW] Package installs should not use latest \ 'col': l:match[3] + 0,
" D:\test\tasks\test.yml:8: [package-latest] [VERY_LOW] package installs should not use latest \ 'text': l:match[5],
let l:pattern = '\v^(%([a-zA-Z]:)?[^:]+):(\d+):%((\d+):)? %(\[([-[:alnum:]]+)\]) %(\[([_[:alnum:]]+)\]) (.*)$' \ 'code': l:code,
let l:error_codes = { 'VERY_HIGH': 'E', 'HIGH': 'E', 'MEDIUM': 'W', 'LOW': 'W', 'VERY_LOW': 'W', 'INFO': 'I' } \ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
\})
for l:match in ale#util#GetMatches(a:lines, l:pattern) endif
if ale#path#IsBufferPath(a:buffer, l:match[1]) endfor
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 '<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 return l:output
endfunction endfunction
function! ale_linters#ansible#ansible_lint#GetCommand(buffer, version) abort
let l:commands = {
\ '>=6.0.0': '%e --nocolor -f json -x yaml %s',
\ '>=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, [6, 0]) ? l:commands['>=6.0.0'] :
\ 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', { call ale#linter#Define('ansible', {
\ 'name': 'ansible_lint', \ 'name': 'ansible_lint',
\ 'aliases': ['ansible', 'ansible-lint'], \ 'aliases': ['ansible', 'ansible-lint'],
\ 'executable': function('ale_linters#ansible#ansible_lint#GetExecutable'), \ 'executable': function('ale_linters#ansible#ansible_lint#GetExecutable'),
\ 'command': {buffer -> ale#semver#RunWithVersionCheck( \ 'command': '%e -p %t',
\ buffer, \ 'callback': 'ale_linters#ansible#ansible_lint#Handle',
\ 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)},
\ )},
\}) \})

View File

@@ -1,5 +0,0 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for ASCIIDoc files.
call ale#handlers#cspell#DefineLinter('asciidoc')

View File

@@ -1,36 +0,0 @@
" 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',
\})

View File

@@ -1,5 +1,5 @@
" Author: kmarc <korondi.mark@gmail.com> " Author: kmarc <korondi.mark@gmail.com>
" Description: This file adds support for using GNU awk with scripts. " Description: This file adds support for using GNU awk with sripts.
call ale#Set('awk_gawk_executable', 'gawk') call ale#Set('awk_gawk_executable', 'gawk')
call ale#Set('awk_gawk_options', '') call ale#Set('awk_gawk_options', '')
@@ -9,9 +9,8 @@ function! ale_linters#awk#gawk#GetCommand(buffer) abort
" gawk from attempting to execute the body of the script " gawk from attempting to execute the body of the script
" it is linting. " it is linting.
return '%e --source ' . ale#Escape('BEGIN { exit } END { exit 1 }') return '%e --source ' . ale#Escape('BEGIN { exit } END { exit 1 }')
\ . ' --lint'
\ . ale#Pad(ale#Var(a:buffer, 'awk_gawk_options')) \ . ale#Pad(ale#Var(a:buffer, 'awk_gawk_options'))
\ . ' -f %t /dev/null' \ . ' -f %t --lint /dev/null'
endfunction endfunction
call ale#linter#Define('awk', { call ale#linter#Define('awk', {

View File

@@ -1,64 +0,0 @@
" Author: Carl Smedstad <carl.smedstad at protonmail dot com>
" Description: bicep for bicep files
let g:ale_bicep_bicep_executable =
\ get(g:, 'ale_bicep_bicep_executable', 'bicep')
let g:ale_bicep_bicep_options =
\ get(g:, 'ale_bicep_bicep_options', '')
function! ale_linters#bicep#bicep#Executable(buffer) abort
return ale#Var(a:buffer, 'bicep_bicep_executable')
endfunction
function! ale_linters#bicep#bicep#Command(buffer) abort
let l:executable = ale_linters#bicep#bicep#Executable(a:buffer)
let l:options = ale#Var(a:buffer, 'bicep_bicep_options')
if has('win32')
let l:nullfile = 'NUL'
else
let l:nullfile = '/dev/null'
endif
return ale#Escape(l:executable)
\ . ' build --outfile '
\ . l:nullfile
\ . ' '
\ . l:options
\ . ' %s'
endfunction
function! ale_linters#bicep#bicep#Handle(buffer, lines) abort
let l:pattern = '\v^.*\((\d+),(\d+)\)\s:\s([a-zA-Z]*)\s([-a-zA-Z0-9]*):\s(.*)'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
if l:match[3] is# 'Error'
let l:type = 'E'
elseif l:match[3] is# 'Warning'
let l:type = 'W'
else
let l:type = 'I'
endif
call add(l:output, {
\ 'lnum': l:match[1] + 0,
\ 'col': l:match[2] + 0,
\ 'type': l:type,
\ 'code': l:match[4],
\ 'text': l:match[5],
\})
endfor
return l:output
endfunction
call ale#linter#Define('bicep', {
\ 'name': 'bicep',
\ 'executable': function('ale_linters#bicep#bicep#Executable'),
\ 'command': function('ale_linters#bicep#bicep#Command'),
\ 'callback': 'ale_linters#bicep#bicep#Handle',
\ 'output_stream': 'both',
\ 'lint_file': 1,
\})

View File

@@ -1,47 +0,0 @@
" 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',
\ })

View File

@@ -3,8 +3,6 @@
call ale#Set('c_cc_executable', '<auto>') call ale#Set('c_cc_executable', '<auto>')
call ale#Set('c_cc_options', '-std=c11 -Wall') call ale#Set('c_cc_options', '-std=c11 -Wall')
call ale#Set('c_cc_use_header_lang_flag', -1)
call ale#Set('c_cc_header_exts', ['h'])
function! ale_linters#c#cc#GetExecutable(buffer) abort function! ale_linters#c#cc#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'c_cc_executable') let l:executable = ale#Var(a:buffer, 'c_cc_executable')
@@ -33,24 +31,12 @@ function! ale_linters#c#cc#GetCommand(buffer, output) abort
\ 'g') \ 'g')
endif endif
" Select the correct language flag depending on the executable, options
" and file extension
let l:executable = ale_linters#c#cc#GetExecutable(a:buffer)
let l:use_header_lang_flag = ale#Var(a:buffer, 'c_cc_use_header_lang_flag')
let l:header_exts = ale#Var(a:buffer, 'c_cc_header_exts')
let l:lang_flag = ale#c#GetLanguageFlag(
\ a:buffer,
\ l:executable,
\ l:use_header_lang_flag,
\ l:header_exts,
\ 'c')
" -iquote with the directory the file is in makes #include work for " -iquote with the directory the file is in makes #include work for
" headers in the same directory. " headers in the same directory.
" "
" `-o /dev/null` or `-o null` is needed to catch all errors, " `-o /dev/null` or `-o null` is needed to catch all errors,
" -fsyntax-only doesn't catch everything. " -fsyntax-only doesn't catch everything.
return '%e -S -x ' . l:lang_flag return '%e -S -x c'
\ . ' -o ' . g:ale#util#nul_file \ . ' -o ' . g:ale#util#nul_file
\ . ' -iquote %s:h' \ . ' -iquote %s:h'
\ . ale#Pad(l:cflags) \ . ale#Pad(l:cflags)

View File

@@ -5,13 +5,15 @@ call ale#Set('c_cppcheck_executable', 'cppcheck')
call ale#Set('c_cppcheck_options', '--enable=style') call ale#Set('c_cppcheck_options', '--enable=style')
function! ale_linters#c#cppcheck#GetCommand(buffer) abort 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:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer)
let l:buffer_path_include = empty(l:compile_commands_option) let l:buffer_path_include = empty(l:compile_commands_option)
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer) \ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
\ : '' \ : ''
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
return '%e -q --language=c' return l:cd_command
\ . '%e -q --language=c'
\ . l:template \ . l:template
\ . ale#Pad(l:compile_commands_option) \ . ale#Pad(l:compile_commands_option)
\ . ale#Pad(ale#Var(a:buffer, 'c_cppcheck_options')) \ . ale#Pad(ale#Var(a:buffer, 'c_cppcheck_options'))
@@ -23,7 +25,6 @@ call ale#linter#Define('c', {
\ 'name': 'cppcheck', \ 'name': 'cppcheck',
\ 'output_stream': 'both', \ 'output_stream': 'both',
\ 'executable': {b -> ale#Var(b, 'c_cppcheck_executable')}, \ 'executable': {b -> ale#Var(b, 'c_cppcheck_executable')},
\ 'cwd': function('ale#handlers#cppcheck#GetCwd'),
\ 'command': function('ale_linters#c#cppcheck#GetCommand'), \ 'command': function('ale_linters#c#cppcheck#GetCommand'),
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat', \ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
\}) \})

View File

@@ -1,20 +0,0 @@
" 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,
\})

View File

@@ -1,5 +0,0 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for C files.
call ale#handlers#cspell#DefineLinter('c')

View File

@@ -1,37 +0,0 @@
" Author: 0xHyoga <0xHyoga@gmx.com>
" Description: Report starknet-compile errors in cairo code
call ale#Set('cairo_starknet_executable', 'starknet-compile')
call ale#Set('cairo_starknet_options', '')
function! ale_linters#cairo#starknet#Handle(buffer, lines) abort
" Error always on the first line
" e.g ex01.cairo:20:6: Could not find module 'contracts.utils.ex00_base'. Searched in the following paths:
let l:pattern = '\v\.cairo:(\d+):(\d+):+ (.*)'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'lnum': str2nr(l:match[1]),
\ 'col': str2nr(l:match[2]),
\ 'type': 'E',
\ 'text': l:match[3],
\})
endfor
return l:output
endfunction
function! ale_linters#cairo#starknet#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'cairo_starknet_executable')
return l:executable . ale#Pad(ale#Var(a:buffer, 'cairo_starknet_options')) . ' %s'
endfunction
call ale#linter#Define('cairo', {
\ 'name': 'starknet',
\ 'executable': {b -> ale#Var(b, 'cairo_starknet_executable')},
\ 'command': function('ale_linters#cairo#starknet#GetCommand'),
\ 'callback': 'ale_linters#cairo#starknet#Handle',
\ 'output_stream': 'stderr',
\})

View File

@@ -1,23 +1,10 @@
" Author: Masashi Iizuka <liquidz.uo@gmail.com> " Author: Masashi Iizuka <liquidz.uo@gmail.com>
" Description: linter for clojure using clj-kondo https://github.com/borkdude/clj-kondo " 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 -'
\ . ' --filename %s'
return l:command
endfunction
function! ale_linters#clojure#clj_kondo#HandleCljKondoFormat(buffer, lines) abort function! ale_linters#clojure#clj_kondo#HandleCljKondoFormat(buffer, lines) abort
" output format " output format
" <filename>:<line>:<column>: <issue type>: <message> " <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 = [] let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern) for l:match in ale#util#GetMatches(a:lines, l:pattern)
@@ -42,6 +29,6 @@ call ale#linter#Define('clojure', {
\ 'name': 'clj-kondo', \ 'name': 'clj-kondo',
\ 'output_stream': 'stdout', \ 'output_stream': 'stdout',
\ 'executable': 'clj-kondo', \ 'executable': 'clj-kondo',
\ 'command': function('ale_linters#clojure#clj_kondo#GetCommand'), \ 'command': 'clj-kondo --cache --lint %t',
\ 'callback': 'ale_linters#clojure#clj_kondo#HandleCljKondoFormat', \ 'callback': 'ale_linters#clojure#clj_kondo#HandleCljKondoFormat',
\}) \})

View File

@@ -1,43 +0,0 @@
" 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',
\})

View File

@@ -3,8 +3,6 @@
call ale#Set('cpp_cc_executable', '<auto>') call ale#Set('cpp_cc_executable', '<auto>')
call ale#Set('cpp_cc_options', '-std=c++14 -Wall') call ale#Set('cpp_cc_options', '-std=c++14 -Wall')
call ale#Set('cpp_cc_use_header_lang_flag', -1)
call ale#Set('cpp_cc_header_exts', ['h', 'hpp'])
function! ale_linters#cpp#cc#GetExecutable(buffer) abort function! ale_linters#cpp#cc#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'cpp_cc_executable') let l:executable = ale#Var(a:buffer, 'cpp_cc_executable')
@@ -33,24 +31,12 @@ function! ale_linters#cpp#cc#GetCommand(buffer, output) abort
\ 'g') \ 'g')
endif endif
" Select the correct language flag depending on the executable, options
" and file extension
let l:executable = ale_linters#cpp#cc#GetExecutable(a:buffer)
let l:use_header_lang_flag = ale#Var(a:buffer, 'cpp_cc_use_header_lang_flag')
let l:header_exts = ale#Var(a:buffer, 'cpp_cc_header_exts')
let l:lang_flag = ale#c#GetLanguageFlag(
\ a:buffer,
\ l:executable,
\ l:use_header_lang_flag,
\ l:header_exts,
\ 'c++')
" -iquote with the directory the file is in makes #include work for " -iquote with the directory the file is in makes #include work for
" headers in the same directory. " headers in the same directory.
" "
" `-o /dev/null` or `-o null` is needed to catch all errors, " `-o /dev/null` or `-o null` is needed to catch all errors,
" -fsyntax-only doesn't catch everything. " -fsyntax-only doesn't catch everything.
return '%e -S -x ' . l:lang_flag return '%e -S -x c++'
\ . ' -o ' . g:ale#util#nul_file \ . ' -o ' . g:ale#util#nul_file
\ . ' -iquote %s:h' \ . ' -iquote %s:h'
\ . ale#Pad(l:cflags) \ . ale#Pad(l:cflags)

View File

@@ -26,7 +26,7 @@ function! ale_linters#cpp#clangtidy#GetCommand(buffer, output) abort
" Tell clang-tidy a .h header with a C++ filetype in Vim is a C++ file " Tell clang-tidy a .h header with a C++ filetype in Vim is a C++ file
" only when compile-commands.json file is not there. Adding these " only when compile-commands.json file is not there. Adding these
" flags makes clang-tidy completely ignore compile commands. " flags makes clang-tidy completely ignore compile commmands.
if expand('#' . a:buffer) =~# '\.h$' if expand('#' . a:buffer) =~# '\.h$'
let l:options .= !empty(l:options) ? ' -x c++' : '-x c++' let l:options .= !empty(l:options) ? ' -x c++' : '-x c++'
endif endif

View File

@@ -5,13 +5,15 @@ call ale#Set('cpp_cppcheck_executable', 'cppcheck')
call ale#Set('cpp_cppcheck_options', '--enable=style') call ale#Set('cpp_cppcheck_options', '--enable=style')
function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort 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:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer)
let l:buffer_path_include = empty(l:compile_commands_option) let l:buffer_path_include = empty(l:compile_commands_option)
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer) \ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
\ : '' \ : ''
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}') let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
return '%e -q --language=c++' return l:cd_command
\ . '%e -q --language=c++'
\ . l:template \ . l:template
\ . ale#Pad(l:compile_commands_option) \ . ale#Pad(l:compile_commands_option)
\ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options')) \ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options'))
@@ -23,7 +25,6 @@ call ale#linter#Define('cpp', {
\ 'name': 'cppcheck', \ 'name': 'cppcheck',
\ 'output_stream': 'both', \ 'output_stream': 'both',
\ 'executable': {b -> ale#Var(b, 'cpp_cppcheck_executable')}, \ 'executable': {b -> ale#Var(b, 'cpp_cppcheck_executable')},
\ 'cwd': function('ale#handlers#cppcheck#GetCwd'),
\ 'command': function('ale_linters#cpp#cppcheck#GetCommand'), \ 'command': function('ale_linters#cpp#cppcheck#GetCommand'),
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat', \ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
\}) \})

View File

@@ -1,5 +0,0 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for C++ files.
call ale#handlers#cspell#DefineLinter('cpp')

View File

@@ -3,10 +3,14 @@ call ale#Set('cs_csc_source', '')
call ale#Set('cs_csc_assembly_path', []) call ale#Set('cs_csc_assembly_path', [])
call ale#Set('cs_csc_assemblies', []) call ale#Set('cs_csc_assemblies', [])
function! ale_linters#cs#csc#GetCwd(buffer) abort function! s:GetWorkingDirectory(buffer) abort
let l:cwd = ale#Var(a:buffer, 'cs_csc_source') let l:working_directory = ale#Var(a:buffer, 'cs_csc_source')
return !empty(l:cwd) ? l:cwd : expand('#' . a:buffer . ':p:h') if !empty(l:working_directory)
return l:working_directory
endif
return expand('#' . a:buffer . ':p:h')
endfunction endfunction
function! ale_linters#cs#csc#GetCommand(buffer) abort function! ale_linters#cs#csc#GetCommand(buffer) abort
@@ -30,7 +34,8 @@ function! ale_linters#cs#csc#GetCommand(buffer) abort
" The code is compiled as a module and the output is redirected to a " The code is compiled as a module and the output is redirected to a
" temporary file. " temporary file.
return 'csc /unsafe' return ale#path#CdString(s:GetWorkingDirectory(a:buffer))
\ . 'csc /unsafe'
\ . ale#Pad(ale#Var(a:buffer, 'cs_csc_options')) \ . ale#Pad(ale#Var(a:buffer, 'cs_csc_options'))
\ . ale#Pad(l:lib_option) \ . ale#Pad(l:lib_option)
\ . ale#Pad(l:r_option) \ . ale#Pad(l:r_option)
@@ -52,7 +57,8 @@ function! ale_linters#cs#csc#Handle(buffer, lines) abort
\ '^\v([^ ]+)\s+([Cc][sS][^ ]+):\s+(.+)$', \ '^\v([^ ]+)\s+([Cc][sS][^ ]+):\s+(.+)$',
\] \]
let l:output = [] let l:output = []
let l:dir = ale_linters#cs#csc#GetCwd(a:buffer)
let l:dir = s:GetWorkingDirectory(a:buffer)
for l:match in ale#util#GetMatches(a:lines, l:patterns) 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' if len(l:match) > 6 && strlen(l:match[5]) > 2 && l:match[5][:1] is? 'CS'
@@ -83,7 +89,6 @@ call ale#linter#Define('cs',{
\ 'name': 'csc', \ 'name': 'csc',
\ 'output_stream': 'stdout', \ 'output_stream': 'stdout',
\ 'executable': 'csc', \ 'executable': 'csc',
\ 'cwd': function('ale_linters#cs#csc#GetCwd'),
\ 'command': function('ale_linters#cs#csc#GetCommand'), \ 'command': function('ale_linters#cs#csc#GetCommand'),
\ 'callback': 'ale_linters#cs#csc#Handle', \ 'callback': 'ale_linters#cs#csc#Handle',
\ 'lint_file': 1 \ 'lint_file': 1

View File

@@ -1,5 +0,0 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for C# files.
call ale#handlers#cspell#DefineLinter('cs')

View File

@@ -3,10 +3,14 @@ call ale#Set('cs_mcsc_source', '')
call ale#Set('cs_mcsc_assembly_path', []) call ale#Set('cs_mcsc_assembly_path', [])
call ale#Set('cs_mcsc_assemblies', []) call ale#Set('cs_mcsc_assemblies', [])
function! ale_linters#cs#mcsc#GetCwd(buffer) abort function! s:GetWorkingDirectory(buffer) abort
let l:cwd = ale#Var(a:buffer, 'cs_mcsc_source') let l:working_directory = ale#Var(a:buffer, 'cs_mcsc_source')
return !empty(l:cwd) ? l:cwd : expand('#' . a:buffer . ':p:h') if !empty(l:working_directory)
return l:working_directory
endif
return expand('#' . a:buffer . ':p:h')
endfunction endfunction
function! ale_linters#cs#mcsc#GetCommand(buffer) abort function! ale_linters#cs#mcsc#GetCommand(buffer) abort
@@ -30,7 +34,8 @@ function! ale_linters#cs#mcsc#GetCommand(buffer) abort
" The code is compiled as a module and the output is redirected to a " The code is compiled as a module and the output is redirected to a
" temporary file. " temporary file.
return 'mcs -unsafe' return ale#path#CdString(s:GetWorkingDirectory(a:buffer))
\ . 'mcs -unsafe'
\ . ale#Pad(ale#Var(a:buffer, 'cs_mcsc_options')) \ . ale#Pad(ale#Var(a:buffer, 'cs_mcsc_options'))
\ . ale#Pad(l:lib_option) \ . ale#Pad(l:lib_option)
\ . ale#Pad(l:r_option) \ . ale#Pad(l:r_option)
@@ -53,7 +58,7 @@ function! ale_linters#cs#mcsc#Handle(buffer, lines) abort
\] \]
let l:output = [] let l:output = []
let l:dir = ale_linters#cs#mcsc#GetCwd(a:buffer) let l:dir = s:GetWorkingDirectory(a:buffer)
for l:match in ale#util#GetMatches(a:lines, l:patterns) 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' if len(l:match) > 6 && strlen(l:match[5]) > 2 && l:match[5][:1] is? 'CS'
@@ -84,7 +89,6 @@ call ale#linter#Define('cs',{
\ 'name': 'mcsc', \ 'name': 'mcsc',
\ 'output_stream': 'stderr', \ 'output_stream': 'stderr',
\ 'executable': 'mcs', \ 'executable': 'mcs',
\ 'cwd': function('ale_linters#cs#mcsc#GetCwd'),
\ 'command': function('ale_linters#cs#mcsc#GetCommand'), \ 'command': function('ale_linters#cs#mcsc#GetCommand'),
\ 'callback': 'ale_linters#cs#mcsc#Handle', \ 'callback': 'ale_linters#cs#mcsc#Handle',
\ 'lint_file': 1 \ 'lint_file': 1

View File

@@ -1,5 +0,0 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for CSS files.
call ale#handlers#cspell#DefineLinter('css')

View File

@@ -11,7 +11,7 @@ endfunction
call ale#linter#Define('css', { call ale#linter#Define('css', {
\ 'name': 'stylelint', \ 'name': 'stylelint',
\ 'executable': {b -> ale#path#FindExecutable(b, 'css_stylelint', [ \ 'executable': {b -> ale#node#FindExecutable(b, 'css_stylelint', [
\ 'node_modules/.bin/stylelint', \ 'node_modules/.bin/stylelint',
\ ])}, \ ])},
\ 'command': function('ale_linters#css#stylelint#GetCommand'), \ 'command': function('ale_linters#css#stylelint#GetCommand'),

View File

@@ -1,16 +0,0 @@
" Author: Dalius Dobravolskas <dalius.dobravolskas@gmail.com>
" Description: VSCode css language server
function! ale_linters#css#vscodecss#GetProjectRoot(buffer) abort
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''
endfunction
call ale#linter#Define('css', {
\ 'name': 'vscodecss',
\ 'lsp': 'stdio',
\ 'executable': 'vscode-css-language-server',
\ 'command': '%e --stdio',
\ 'project_root': function('ale_linters#css#vscodecss#GetProjectRoot'),
\})

View File

@@ -1,23 +0,0 @@
" 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'),
\})

View File

@@ -1,106 +1,64 @@
" Author: w0rp <devw0rp@gmail.com> " Author: w0rp <devw0rp@gmail.com>
" Description: "dmd for D files" " Description: "dmd for D files"
function! s:GetDUBCommand(buffer) abort function! ale_linters#d#dmd#GetDUBCommand(buffer) abort
" If we can't run dub, then skip this command. " 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. " Returning an empty string skips to the DMD command.
let l:config = ale#d#FindDUBConfig(a:buffer) return ''
" 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 endif
return ['', ''] 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'
endfunction endfunction
function! ale_linters#d#dmd#RunDUBCommand(buffer) abort function! ale_linters#d#dmd#RunDUBCommand(buffer) abort
let [l:cwd, l:command] = s:GetDUBCommand(a:buffer) let l:command = ale_linters#d#dmd#GetDUBCommand(a:buffer)
if empty(l:command) if empty(l:command)
" If we can't run DUB, just run DMD. " If we can't run DUB, just run DMD.
return ale_linters#d#dmd#DMDCommand(a:buffer, [], {}) return ale_linters#d#dmd#DMDCommand(a:buffer, [], {})
endif endif
return ale#command#Run( return ale#command#Run(a:buffer, l:command, function('ale_linters#d#dmd#DMDCommand'))
\ a:buffer,
\ l:command,
\ function('ale_linters#d#dmd#DMDCommand'),
\ {'cwd': l:cwd},
\)
endfunction endfunction
function! ale_linters#d#dmd#DMDCommand(buffer, dub_output, meta) abort function! ale_linters#d#dmd#DMDCommand(buffer, dub_output, meta) abort
let l:import_list = [] 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 options generated from DUB, if available. " Build a list of import paths 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 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) if !empty(l:line)
if l:list_ind == 1 " The arguments must be '-Ifilename', not '-I filename'
call add(l:import_list, '-I' . ale#Escape(l:line)) 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 endif
endfor endfor
return 'dmd ' . join(l:import_list) . ' ' . return 'dmd '. join(l:import_list) . ' -o- -wi -vcolumns -c %t'
\ join(l:str_import_list) . ' ' .
\ join(l:versions_list) . ' ' .
\ join(l:deb_versions_list) . ' -o- -wi -vcolumns -c %t'
endfunction endfunction
function! ale_linters#d#dmd#Handle(buffer, lines) abort function! ale_linters#d#dmd#Handle(buffer, lines) abort
" Matches patterns lines like the following: " 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.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 " /tmp/tmp.G1L5xIizvB.d(8,8): Error: module weak_reference is in file 'dstruct/weak_reference.d' which cannot be read
let l:pattern = '\v^(\f+)\((\d+)(,(\d+))?\): (\w+): (.+)$' let l:pattern = '^[^(]\+(\([0-9]\+\)\,\?\([0-9]*\)): \([^:]\+\): \(.\+\)'
let l:output = [] let l:output = []
let l:dir = expand('#' . a:buffer . ':p:h')
for l:match in ale#util#GetMatches(a:lines, l:pattern) 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, { call add(l:output, {
\ 'filename': l:fname, \ 'lnum': l:match[1],
\ 'lnum': l:match[2], \ 'col': l:match[2],
\ 'col': l:match[4], \ 'type': l:match[3] is# 'Warning' ? 'W' : 'E',
\ 'type': l:match[5] is# 'Warning' || l:match[5] is# 'Deprecation' ? 'W' : 'E', \ 'text': l:match[4],
\ 'text': l:match[6],
\}) \})
endfor endfor

View File

@@ -1,29 +0,0 @@
" 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)
let [l:type, l:filename, l:lnum, l:col, l:message, l:code] = l:match[1:6]
call add(l:output, {
\ 'type': l:type is# 'error' ? 'E' : l:type is# 'info' ? 'I' : 'W',
\ 'text': l:code . ': ' . l:message,
\ 'lnum': str2nr(l:lnum),
\ 'col': str2nr(l:col),
\})
endfor
return l:output
endfunction
call ale#linter#Define('dart', {
\ 'name': 'dart_analyze',
\ 'executable': {b -> ale#Var(b, 'dart_analyze_executable')},
\ 'command': '%e analyze --fatal-infos %s',
\ 'callback': 'ale_linters#dart#dart_analyze#Handle',
\ 'lint_file': 1,
\})

View File

@@ -0,0 +1,36 @@
" 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,
\})

View File

@@ -1,31 +0,0 @@
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',
\})

View File

@@ -3,14 +3,13 @@
" always, yes, never " always, yes, never
call ale#Set('dockerfile_hadolint_use_docker', 'never') call ale#Set('dockerfile_hadolint_use_docker', 'never')
call ale#Set('dockerfile_hadolint_docker_image', 'hadolint/hadolint') call ale#Set('dockerfile_hadolint_docker_image', 'hadolint/hadolint')
call ale#Set('dockerfile_hadolint_options', '')
function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
" Matches patterns line the following: " Matches patterns line the following:
" "
" -:19 DL3001 warning: Pipe chain should start with a raw value. " /dev/stdin:19 DL3001 Pipe chain should start with a raw value.
" /dev/stdin:19:3 unexpected thing " /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 = [] let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern) for l:match in ale#util#GetMatches(a:lines, l:pattern)
@@ -39,8 +38,6 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
let l:text = l:match[8] let l:text = l:match[8]
let l:detail = l:match[8] let l:detail = l:match[8]
let l:domain = 'https://github.com/hadolint/hadolint/wiki/' let l:domain = 'https://github.com/hadolint/hadolint/wiki/'
let l:code = ''
let l:link = ''
if l:match[4] is# 'SC' if l:match[4] is# 'SC'
let l:domain = 'https://github.com/koalaman/shellcheck/wiki/' let l:domain = 'https://github.com/koalaman/shellcheck/wiki/'
@@ -49,26 +46,18 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
if l:match[5] isnot# '' if l:match[5] isnot# ''
let l:code = l:match[4] . l:match[5] let l:code = l:match[4] . l:match[5]
let l:link = ' ( ' . l:domain . l:code . ' )' 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 let l:detail = l:code . l:link . "\n\n" . l:detail
else else
let l:type = 'E' let l:type = 'E'
let l:detail = 'hadolint could not parse the file because of a syntax error.'
endif endif
let l:line_output = { call add(l:output, {
\ 'lnum': l:lnum, \ 'lnum': l:lnum,
\ 'col': l:colnum, \ 'col': l:colnum,
\ 'type': l:type, \ 'type': l:type,
\ 'text': l:text, \ 'text': l:text,
\ 'detail': l:detail \ 'detail': l:detail
\} \})
if l:code isnot# ''
let l:line_output['code'] = l:code
endif
call add(l:output, l:line_output)
endfor endfor
return l:output return l:output
@@ -103,15 +92,12 @@ endfunction
function! ale_linters#dockerfile#hadolint#GetCommand(buffer) abort function! ale_linters#dockerfile#hadolint#GetCommand(buffer) abort
let l:command = ale_linters#dockerfile#hadolint#GetExecutable(a:buffer) let l:command = ale_linters#dockerfile#hadolint#GetExecutable(a:buffer)
let l:opts = ale#Var(a:buffer, 'dockerfile_hadolint_options') . ' --no-color -'
if l:command is# 'docker' if l:command is# 'docker'
return printf('docker run --rm -i %s hadolint %s', return 'docker run --rm -i ' . ale#Var(a:buffer, 'dockerfile_hadolint_docker_image')
\ ale#Var(a:buffer, 'dockerfile_hadolint_docker_image'),
\ l:opts)
endif endif
return 'hadolint ' . l:opts return 'hadolint -'
endfunction endfunction

View File

@@ -56,7 +56,11 @@ function! ale_linters#elixir#credo#GetConfigFile() abort
endfunction endfunction
function! ale_linters#elixir#credo#GetCommand(buffer) abort function! ale_linters#elixir#credo#GetCommand(buffer) abort
return 'mix help credo && ' 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 && '
\ . 'mix credo ' . ale_linters#elixir#credo#GetMode() \ . 'mix credo ' . ale_linters#elixir#credo#GetMode()
\ . ale_linters#elixir#credo#GetConfigFile() \ . ale_linters#elixir#credo#GetConfigFile()
\ . ' --format=flycheck --read-from-stdin %s' \ . ' --format=flycheck --read-from-stdin %s'
@@ -65,7 +69,6 @@ endfunction
call ale#linter#Define('elixir', { call ale#linter#Define('elixir', {
\ 'name': 'credo', \ 'name': 'credo',
\ 'executable': 'mix', \ 'executable': 'mix',
\ 'cwd': function('ale#handlers#elixir#FindMixUmbrellaRoot'),
\ 'command': function('ale_linters#elixir#credo#GetCommand'), \ 'command': function('ale_linters#elixir#credo#GetCommand'),
\ 'callback': 'ale_linters#elixir#credo#Handle', \ 'callback': 'ale_linters#elixir#credo#Handle',
\}) \})

View File

@@ -1,5 +0,0 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Elixir files.
call ale#handlers#cspell#DefineLinter('elixir')

View File

@@ -25,10 +25,17 @@ function! ale_linters#elixir#dialyxir#Handle(buffer, lines) abort
return l:output return l:output
endfunction 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', { call ale#linter#Define('elixir', {
\ 'name': 'dialyxir', \ 'name': 'dialyxir',
\ 'executable': 'mix', \ 'executable': 'mix',
\ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'), \ 'command': function('ale_linters#elixir#dialyxir#GetCommand'),
\ 'command': 'mix help dialyzer && mix dialyzer',
\ 'callback': 'ale_linters#elixir#dialyxir#Handle', \ 'callback': 'ale_linters#elixir#dialyxir#Handle',
\}) \})

View File

@@ -29,11 +29,17 @@ function! ale_linters#elixir#dogma#Handle(buffer, lines) abort
return l:output return l:output
endfunction 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', { call ale#linter#Define('elixir', {
\ 'name': 'dogma', \ 'name': 'dogma',
\ 'executable': 'mix', \ 'executable': 'mix',
\ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'), \ 'command': function('ale_linters#elixir#dogma#GetCommand'),
\ 'command': 'mix help dogma && mix dogma %s --format=flycheck',
\ 'lint_file': 1, \ 'lint_file': 1,
\ 'callback': 'ale_linters#elixir#dogma#Handle', \ 'callback': 'ale_linters#elixir#dogma#Handle',
\}) \})

View File

@@ -30,15 +30,22 @@ function! ale_linters#elixir#mix#Handle(buffer, lines) abort
endfunction endfunction
function! ale_linters#elixir#mix#GetCommand(buffer) abort 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:temp_dir = ale#command#CreateDirectory(a:buffer)
return ale#Env('MIX_BUILD_PATH', l:temp_dir) . 'mix compile %s' 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'
endfunction endfunction
call ale#linter#Define('elixir', { call ale#linter#Define('elixir', {
\ 'name': 'mix', \ 'name': 'mix',
\ 'executable': 'mix', \ 'executable': 'mix',
\ 'cwd': function('ale#handlers#elixir#FindMixProjectRoot'),
\ 'command': function('ale_linters#elixir#mix#GetCommand'), \ 'command': function('ale_linters#elixir#mix#GetCommand'),
\ 'callback': 'ale_linters#elixir#mix#Handle', \ 'callback': 'ale_linters#elixir#mix#Handle',
\ 'lint_file': 1, \ 'lint_file': 1,

View File

@@ -28,7 +28,7 @@ endfunction
call ale#linter#Define('elm', { call ale#linter#Define('elm', {
\ 'name': 'elm_ls', \ 'name': 'elm_ls',
\ 'lsp': 'stdio', \ 'lsp': 'stdio',
\ 'executable': {b -> ale#path#FindExecutable(b, 'elm_ls', [ \ 'executable': {b -> ale#node#FindExecutable(b, 'elm_ls', [
\ 'node_modules/.bin/elm-language-server', \ 'node_modules/.bin/elm-language-server',
\ 'node_modules/.bin/elm-lsp', \ 'node_modules/.bin/elm-lsp',
\ 'elm-lsp' \ 'elm-lsp'

View File

@@ -186,23 +186,24 @@ function! ale_linters#elm#make#IsTest(buffer) abort
endif endif
endfunction 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. " Return the command to execute the linter in the projects directory.
" If it doesn't, then this will fail when imports are needed. " If it doesn't, then this will fail when imports are needed.
function! ale_linters#elm#make#GetCommand(buffer) abort function! ale_linters#elm#make#GetCommand(buffer) abort
let l:executable = ale_linters#elm#make#GetExecutable(a:buffer) 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_v19 = ale_linters#elm#make#IsVersionGte19(a:buffer)
let l:is_using_elm_test = l:executable =~# 'elm-test$' 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. " 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 " https://github.com/rtfeldman/node-test-runner/blob/57728f10668f2d2ab3179e7e3208bcfa9a1f19aa/README.md#--compiler
if l:is_v19 && l:is_using_elm_test if l:is_v19 && l:is_using_elm_test
let l:elm_make_executable = ale#path#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm']) let l:elm_make_executable = ale#node#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm'])
let l:elm_test_compiler_flag = ' --compiler ' . l:elm_make_executable . ' ' let l:elm_test_compiler_flag = ' --compiler ' . l:elm_make_executable . ' '
else else
let l:elm_test_compiler_flag = ' ' let l:elm_test_compiler_flag = ' '
@@ -212,9 +213,7 @@ function! ale_linters#elm#make#GetCommand(buffer) abort
" a sort of flag to tell the compiler not to generate an output file, " a sort of flag to tell the compiler not to generate an output file,
" which is why this is hard coded here. " which is why this is hard coded here.
" Source: https://github.com/elm-lang/elm-compiler/blob/19d5a769b30ec0b2fc4475985abb4cd94cd1d6c3/builder/src/Generate/Output.hs#L253 " Source: https://github.com/elm-lang/elm-compiler/blob/19d5a769b30ec0b2fc4475985abb4cd94cd1d6c3/builder/src/Generate/Output.hs#L253
return '%e make --report=json --output=/dev/null' return l:dir_set_cmd . '%e make --report=json --output=/dev/null' . l:elm_test_compiler_flag . '%t'
\ . l:elm_test_compiler_flag
\ . '%t'
endfunction endfunction
function! ale_linters#elm#make#GetExecutable(buffer) abort function! ale_linters#elm#make#GetExecutable(buffer) abort
@@ -222,13 +221,13 @@ function! ale_linters#elm#make#GetExecutable(buffer) abort
let l:is_v19 = ale_linters#elm#make#IsVersionGte19(a:buffer) let l:is_v19 = ale_linters#elm#make#IsVersionGte19(a:buffer)
if l:is_test && l:is_v19 if l:is_test && l:is_v19
return ale#path#FindExecutable( return ale#node#FindExecutable(
\ a:buffer, \ a:buffer,
\ 'elm_make', \ 'elm_make',
\ ['node_modules/.bin/elm-test', 'node_modules/.bin/elm'] \ ['node_modules/.bin/elm-test', 'node_modules/.bin/elm']
\) \)
else else
return ale#path#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm']) return ale#node#FindExecutable(a:buffer, 'elm_make', ['node_modules/.bin/elm'])
endif endif
endfunction endfunction
@@ -236,7 +235,6 @@ call ale#linter#Define('elm', {
\ 'name': 'make', \ 'name': 'make',
\ 'executable': function('ale_linters#elm#make#GetExecutable'), \ 'executable': function('ale_linters#elm#make#GetExecutable'),
\ 'output_stream': 'both', \ 'output_stream': 'both',
\ 'cwd': function('ale_linters#elm#make#GetCwd'),
\ 'command': function('ale_linters#elm#make#GetCommand'), \ 'command': function('ale_linters#elm#make#GetCommand'),
\ 'callback': 'ale_linters#elm#make#Handle' \ 'callback': 'ale_linters#elm#make#Handle'
\}) \})

View File

@@ -12,7 +12,6 @@ function! ale_linters#erlang#elvis#Handle(buffer, lines) abort
\ 'lnum': str2nr(l:match[1]), \ 'lnum': str2nr(l:match[1]),
\ 'text': s:AbbreviateMessage(l:match[2]), \ 'text': s:AbbreviateMessage(l:match[2]),
\ 'type': 'W', \ 'type': 'W',
\ 'sub_type': 'style',
\}) \})
endfor endfor

View File

@@ -1,49 +0,0 @@
" Author: Dmitri Vereshchagin <dmitri.vereshchagin@gmail.com>
" Description: LSP linter for Erlang files
call ale#Set('erlang_erlang_ls_executable', 'erlang_ls')
call ale#Set('erlang_erlang_ls_log_dir', '')
call ale#Set('erlang_erlang_ls_log_level', 'info')
function! s:GetCommand(buffer) abort
let l:log_dir = ale#Var(a:buffer, 'erlang_erlang_ls_log_dir')
let l:log_level = ale#Var(a:buffer, 'erlang_erlang_ls_log_level')
let l:command = '%e'
if !empty(l:log_dir)
let l:command .= ' --log-dir=' . ale#Escape(l:log_dir)
endif
let l:command .= ' --log-level=' . ale#Escape(l:log_level)
return l:command
endfunction
function! s:FindProjectRoot(buffer) abort
let l:markers = ['_build/', 'erlang_ls.config', 'rebar.lock']
" This is a way to find Erlang/OTP root (the one that is managed
" by kerl or asdf). Useful if :ALEGoToDefinition takes us there.
let l:markers += ['.kerl_config']
for l:marker in l:markers
let l:path = l:marker[-1:] is# '/'
\ ? ale#path#FindNearestDirectory(a:buffer, l:marker)
\ : ale#path#FindNearestFile(a:buffer, l:marker)
if !empty(l:path)
return ale#path#Dirname(l:path)
endif
endfor
return ''
endfunction
call ale#linter#Define('erlang', {
\ 'name': 'erlang_ls',
\ 'executable': {b -> ale#Var(b, 'erlang_erlang_ls_executable')},
\ 'command': function('s:GetCommand'),
\ 'lsp': 'stdio',
\ 'project_root': function('s:FindProjectRoot'),
\})

View File

@@ -25,7 +25,7 @@ function! ale_linters#erlang#erlc#Handle(buffer, lines) abort
" error.erl:4: variable 'B' is unbound " error.erl:4: variable 'B' is unbound
" error.erl:3: Warning: function main/0 is unused " error.erl:3: Warning: function main/0 is unused
" error.erl:4: Warning: variable 'A' is unused " error.erl:4: Warning: variable 'A' is unused
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+:)? (Warning: )?(.+)$' let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+): (Warning: )?(.+)$'
" parse_transforms are a special case. The error message does not indicate a location: " parse_transforms are a special case. The error message does not indicate a location:
" error.erl: undefined parse transform 'some_parse_transform' " error.erl: undefined parse transform 'some_parse_transform'
@@ -65,8 +65,8 @@ function! ale_linters#erlang#erlc#Handle(buffer, lines) abort
endif endif
let l:line = l:match[2] let l:line = l:match[2]
let l:warning_or_text = l:match[4] let l:warning_or_text = l:match[3]
let l:text = l:match[5] let l:text = l:match[4]
" If this file is a header .hrl, ignore the following expected messages: " If this file is a header .hrl, ignore the following expected messages:
" - 'no module definition' " - 'no module definition'

View File

@@ -1,51 +0,0 @@
" 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',
\})

View File

@@ -1,5 +0,0 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Go files.
call ale#handlers#cspell#DefineLinter('go')

View File

@@ -10,7 +10,8 @@ function! ale_linters#go#gobuild#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'go_gobuild_options') let l:options = ale#Var(a:buffer, 'go_gobuild_options')
" Run go test in local directory with relative path " Run go test in local directory with relative path
return ale#go#EnvString(a:buffer) return ale#path#BufferCdString(a:buffer)
\ . ale#go#EnvString(a:buffer)
\ . ale#Var(a:buffer, 'go_go_executable') . ' test' \ . ale#Var(a:buffer, 'go_go_executable') . ' test'
\ . (!empty(l:options) ? ' ' . l:options : '') \ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' -c -o /dev/null ./' \ . ' -c -o /dev/null ./'
@@ -49,7 +50,6 @@ call ale#linter#Define('go', {
\ 'name': 'gobuild', \ 'name': 'gobuild',
\ 'aliases': ['go build'], \ 'aliases': ['go build'],
\ 'executable': {b -> ale#Var(b, 'go_go_executable')}, \ 'executable': {b -> ale#Var(b, 'go_go_executable')},
\ 'cwd': '%s:h',
\ 'command': function('ale_linters#go#gobuild#GetCommand'), \ 'command': function('ale_linters#go#gobuild#GetCommand'),
\ 'output_stream': 'stderr', \ 'output_stream': 'stderr',
\ 'callback': 'ale_linters#go#gobuild#Handler', \ 'callback': 'ale_linters#go#gobuild#Handler',

View File

@@ -12,19 +12,21 @@ function! ale_linters#go#golangci_lint#GetCommand(buffer) abort
if l:lint_package if l:lint_package
return ale#go#EnvString(a:buffer) return ale#path#BufferCdString(a:buffer)
\ . ale#go#EnvString(a:buffer)
\ . '%e run ' \ . '%e run '
\ . l:options \ . l:options
endif endif
return ale#go#EnvString(a:buffer) return ale#path#BufferCdString(a:buffer)
\ . ale#go#EnvString(a:buffer)
\ . '%e run ' \ . '%e run '
\ . ale#Escape(l:filename) \ . ale#Escape(l:filename)
\ . ' ' . l:options \ . ' ' . l:options
endfunction endfunction
function! ale_linters#go#golangci_lint#GetMatches(lines) abort function! ale_linters#go#golangci_lint#GetMatches(lines) abort
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:?:?:?\s\*?(.+)\s+\((.+)\)$' let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:?:?:?\s\*?(.+)$'
return ale#util#GetMatches(a:lines, l:pattern) return ale#util#GetMatches(a:lines, l:pattern)
endfunction endfunction
@@ -34,20 +36,14 @@ function! ale_linters#go#golangci_lint#Handler(buffer, lines) abort
let l:output = [] let l:output = []
for l:match in ale_linters#go#golangci_lint#GetMatches(a:lines) for l:match in ale_linters#go#golangci_lint#GetMatches(a:lines)
if l:match[5] is# 'typecheck'
let l:msg_type = 'E'
else
let l:msg_type = 'W'
endif
" l:match[1] will already be an absolute path, output from " l:match[1] will already be an absolute path, output from
" golangci_lint " golangci_lint
call add(l:output, { call add(l:output, {
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
\ 'lnum': l:match[2] + 0, \ 'lnum': l:match[2] + 0,
\ 'col': l:match[3] + 0, \ 'col': l:match[3] + 0,
\ 'type': l:msg_type, \ 'type': 'E',
\ 'text': l:match[4] . ' (' . l:match[5] . ')', \ 'text': l:match[4],
\}) \})
endfor endfor
@@ -57,7 +53,6 @@ endfunction
call ale#linter#Define('go', { call ale#linter#Define('go', {
\ 'name': 'golangci-lint', \ 'name': 'golangci-lint',
\ 'executable': {b -> ale#Var(b, 'go_golangci_lint_executable')}, \ 'executable': {b -> ale#Var(b, 'go_golangci_lint_executable')},
\ 'cwd': '%s:h',
\ 'command': function('ale_linters#go#golangci_lint#GetCommand'), \ 'command': function('ale_linters#go#golangci_lint#GetCommand'),
\ 'callback': 'ale_linters#go#golangci_lint#Handler', \ 'callback': 'ale_linters#go#golangci_lint#Handler',
\ 'lint_file': 1, \ 'lint_file': 1,

View File

@@ -13,12 +13,14 @@ function! ale_linters#go#gometalinter#GetCommand(buffer) abort
" BufferCdString is used so that we can be sure the paths output from gometalinter can " BufferCdString is used so that we can be sure the paths output from gometalinter can
" be calculated to absolute paths in the Handler " be calculated to absolute paths in the Handler
if l:lint_package if l:lint_package
return ale#go#EnvString(a:buffer) return ale#path#BufferCdString(a:buffer)
\ . ale#go#EnvString(a:buffer)
\ . '%e' \ . '%e'
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .' \ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
endif endif
return ale#go#EnvString(a:buffer) return ale#path#BufferCdString(a:buffer)
\ . ale#go#EnvString(a:buffer)
\ . '%e' \ . '%e'
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(l:filename)) \ . ' --include=' . ale#Escape(ale#util#EscapePCRE(l:filename))
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .' \ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
@@ -51,7 +53,6 @@ endfunction
call ale#linter#Define('go', { call ale#linter#Define('go', {
\ 'name': 'gometalinter', \ 'name': 'gometalinter',
\ 'executable': {b -> ale#Var(b, 'go_gometalinter_executable')}, \ 'executable': {b -> ale#Var(b, 'go_gometalinter_executable')},
\ 'cwd': '%s:h',
\ 'command': function('ale_linters#go#gometalinter#GetCommand'), \ 'command': function('ale_linters#go#gometalinter#GetCommand'),
\ 'callback': 'ale_linters#go#gometalinter#Handler', \ 'callback': 'ale_linters#go#gometalinter#Handler',
\ 'lint_file': 1, \ 'lint_file': 1,

View File

@@ -5,7 +5,6 @@
call ale#Set('go_gopls_executable', 'gopls') call ale#Set('go_gopls_executable', 'gopls')
call ale#Set('go_gopls_options', '--mode stdio') call ale#Set('go_gopls_options', '--mode stdio')
call ale#Set('go_gopls_init_options', {}) 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 function! ale_linters#go#gopls#GetCommand(buffer) abort
return ale#go#EnvString(a:buffer) return ale#go#EnvString(a:buffer)
@@ -30,9 +29,7 @@ endfunction
call ale#linter#Define('go', { call ale#linter#Define('go', {
\ 'name': 'gopls', \ 'name': 'gopls',
\ 'lsp': 'stdio', \ 'lsp': 'stdio',
\ 'executable': {b -> ale#path#FindExecutable(b, 'go_gopls', [ \ 'executable': {b -> ale#Var(b, 'go_gopls_executable')},
\ ale#go#GetGoPathExecutable('bin/gopls'),
\ ])},
\ 'command': function('ale_linters#go#gopls#GetCommand'), \ 'command': function('ale_linters#go#gopls#GetCommand'),
\ 'project_root': function('ale_linters#go#gopls#FindProjectRoot'), \ 'project_root': function('ale_linters#go#gopls#FindProjectRoot'),
\ 'initialization_options': {b -> ale#Var(b, 'go_gopls_init_options')}, \ 'initialization_options': {b -> ale#Var(b, 'go_gopls_init_options')},

View File

@@ -1,11 +1,15 @@
" Author: Ben Reedy <https://github.com/breed808> " Author: Ben Reedy <https://github.com/breed808>
" Description: gosimple for Go files " 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', { call ale#linter#Define('go', {
\ 'name': 'gosimple', \ 'name': 'gosimple',
\ 'executable': 'gosimple', \ 'executable': 'gosimple',
\ 'cwd': '%s:h', \ 'command': function('ale_linters#go#gosimple#GetCommand'),
\ 'command': {b -> ale#go#EnvString(b) . 'gosimple .'},
\ 'callback': 'ale#handlers#go#Handler', \ 'callback': 'ale#handlers#go#Handler',
\ 'output_stream': 'both', \ 'output_stream': 'both',
\ 'lint_file': 1, \ 'lint_file': 1,

View File

@@ -1,23 +1,19 @@
" Author: Jelte Fennema <github-public@jeltef.nl> " Author: Jelte Fennema <github-public@jeltef.nl>
" Description: gotype for Go files " Description: gotype for Go files
function! ale_linters#go#gotype#GetExecutable(buffer) abort function! ale_linters#go#gotype#GetCommand(buffer) abort
if expand('#' . a:buffer . ':p') =~# '_test\.go$' if expand('#' . a:buffer . ':p') =~# '_test\.go$'
return '' return ''
endif endif
return 'gotype' return ale#path#BufferCdString(a:buffer) . ' '
endfunction \ . ale#go#EnvString(a:buffer) . 'gotype -e .'
function! ale_linters#go#gotype#GetCommand(buffer) abort
return ale#go#EnvString(a:buffer) . 'gotype -e .'
endfunction endfunction
call ale#linter#Define('go', { call ale#linter#Define('go', {
\ 'name': 'gotype', \ 'name': 'gotype',
\ 'output_stream': 'stderr', \ 'output_stream': 'stderr',
\ 'executable': function('ale_linters#go#gotype#GetExecutable'), \ 'executable': 'gotype',
\ 'cwd': '%s:h',
\ 'command': function('ale_linters#go#gotype#GetCommand'), \ 'command': function('ale_linters#go#gotype#GetCommand'),
\ 'callback': 'ale#handlers#go#Handler', \ 'callback': 'ale#handlers#go#Handler',
\ 'lint_file': 1, \ 'lint_file': 1,

View File

@@ -10,7 +10,8 @@ call ale#Set('go_govet_options', '')
function! ale_linters#go#govet#GetCommand(buffer) abort function! ale_linters#go#govet#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'go_govet_options') let l:options = ale#Var(a:buffer, 'go_govet_options')
return ale#go#EnvString(a:buffer) return ale#path#BufferCdString(a:buffer) . ' '
\ . ale#go#EnvString(a:buffer)
\ . ale#Var(a:buffer, 'go_go_executable') . ' vet ' \ . ale#Var(a:buffer, 'go_go_executable') . ' vet '
\ . (!empty(l:options) ? ' ' . l:options : '') \ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' .' \ . ' .'
@@ -21,7 +22,6 @@ call ale#linter#Define('go', {
\ 'aliases': ['go vet'], \ 'aliases': ['go vet'],
\ 'output_stream': 'stderr', \ 'output_stream': 'stderr',
\ 'executable': {b -> ale#Var(b, 'go_go_executable')}, \ 'executable': {b -> ale#Var(b, 'go_go_executable')},
\ 'cwd': '%s:h',
\ 'command': function('ale_linters#go#govet#GetCommand'), \ 'command': function('ale_linters#go#govet#GetCommand'),
\ 'callback': 'ale#handlers#go#Handler', \ 'callback': 'ale#handlers#go#Handler',
\ 'lint_file': 1, \ 'lint_file': 1,

View File

@@ -1,32 +1,32 @@
" Author: Ben Reedy <https://github.com/breed808> " Author: Ben Reedy <https://github.com/breed808>
" Description: staticcheck for Go files " Description: staticcheck for Go files
call ale#Set('go_staticcheck_executable', 'staticcheck')
call ale#Set('go_staticcheck_options', '') call ale#Set('go_staticcheck_options', '')
call ale#Set('go_staticcheck_lint_package', 1) call ale#Set('go_staticcheck_lint_package', 0)
call ale#Set('go_staticcheck_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#go#staticcheck#GetCommand(buffer) abort 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:options = ale#Var(a:buffer, 'go_staticcheck_options')
let l:lint_package = ale#Var(a:buffer, 'go_staticcheck_lint_package') let l:lint_package = ale#Var(a:buffer, 'go_staticcheck_lint_package')
let l:env = ale#go#EnvString(a:buffer) 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 if l:lint_package
return l:env . '%e' return ale#path#BufferCdString(a:buffer)
\ . l:env . 'staticcheck'
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .' \ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
endif endif
return l:env . '%e' return ale#path#BufferCdString(a:buffer)
\ . l:env . 'staticcheck'
\ . (!empty(l:options) ? ' ' . l:options : '') \ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' %s:t' \ . ' ' . ale#Escape(l:filename)
endfunction endfunction
call ale#linter#Define('go', { call ale#linter#Define('go', {
\ 'name': 'staticcheck', \ 'name': 'staticcheck',
\ 'executable': {b -> ale#path#FindExecutable(b, 'go_staticcheck', [ \ 'executable': 'staticcheck',
\ ale#go#GetGoPathExecutable('bin/staticcheck'),
\ ])},
\ 'cwd': '%s:h',
\ 'command': function('ale_linters#go#staticcheck#GetCommand'), \ 'command': function('ale_linters#go#staticcheck#GetCommand'),
\ 'callback': 'ale#handlers#go#Handler', \ 'callback': 'ale#handlers#go#Handler',
\ 'output_stream': 'both', \ 'output_stream': 'both',

View File

@@ -4,7 +4,6 @@
call ale#linter#Define('graphql', { call ale#linter#Define('graphql', {
\ 'name': 'eslint', \ 'name': 'eslint',
\ 'executable': function('ale#handlers#eslint#GetExecutable'), \ 'executable': function('ale#handlers#eslint#GetExecutable'),
\ 'cwd': function('ale#handlers#eslint#GetCwd'),
\ 'command': function('ale#handlers#eslint#GetCommand'), \ 'command': function('ale#handlers#eslint#GetCommand'),
\ 'callback': 'ale#handlers#eslint#HandleJSON', \ 'callback': 'ale#handlers#eslint#HandleJSON',
\}) \})

View File

@@ -1,10 +1,15 @@
" Author: Michiel Westerbeek <happylinks@gmail.com> " Author: Michiel Westerbeek <happylinks@gmail.com>
" Description: Linter for GraphQL Schemas " 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', { call ale#linter#Define('graphql', {
\ 'name': 'gqlint', \ 'name': 'gqlint',
\ 'executable': 'gqlint', \ 'executable': 'gqlint',
\ 'cwd': '%s:h', \ 'command': function('ale_linters#graphql#gqlint#GetCommand'),
\ 'command': 'gqlint --reporter=simple %t',
\ 'callback': 'ale#handlers#unix#HandleAsWarning', \ 'callback': 'ale#handlers#unix#HandleAsWarning',
\}) \})

View File

@@ -5,23 +5,16 @@ call ale#Set('handlebars_embertemplatelint_executable', 'ember-template-lint')
call ale#Set('handlebars_embertemplatelint_use_global', get(g:, 'ale_use_global_executables', 0)) call ale#Set('handlebars_embertemplatelint_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort
return ale#path#FindExecutable(a:buffer, 'handlebars_embertemplatelint', [ return ale#node#FindExecutable(a:buffer, 'handlebars_embertemplatelint', [
\ 'node_modules/.bin/ember-template-lint', \ 'node_modules/.bin/ember-template-lint',
\]) \])
endfunction endfunction
function! ale_linters#handlebars#embertemplatelint#GetCommand(buffer, version) abort function! ale_linters#handlebars#embertemplatelint#GetCommand(buffer, version) abort
if ale#semver#GTE(a:version, [4, 0, 0]) " Reading from stdin was introduced in ember-template-lint@1.6.0
" --json was removed in favor of --format=json in ember-template-lint@4.0.0 return ale#semver#GTE(a:version, [1, 6, 0])
return '%e --format=json --filename %s' \ ? '%e --json --filename %s'
endif \ : '%e --json %t'
if ale#semver#GTE(a:version, [1, 6, 0])
" Reading from stdin was introduced in ember-template-lint@1.6.0
return '%e --json --filename %s'
endif
return '%e --json %t'
endfunction endfunction
function! ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck(buffer) abort function! ale_linters#handlebars#embertemplatelint#GetCommandWithVersionCheck(buffer) abort

View File

@@ -4,7 +4,8 @@
call ale#Set('haskell_cabal_ghc_options', '-fno-code -v0') call ale#Set('haskell_cabal_ghc_options', '-fno-code -v0')
function! ale_linters#haskell#cabal_ghc#GetCommand(buffer) abort function! ale_linters#haskell#cabal_ghc#GetCommand(buffer) abort
return 'cabal exec -- ghc ' return ale#path#BufferCdString(a:buffer)
\ . 'cabal exec -- ghc '
\ . ale#Var(a:buffer, 'haskell_cabal_ghc_options') \ . ale#Var(a:buffer, 'haskell_cabal_ghc_options')
\ . ' %t' \ . ' %t'
endfunction endfunction
@@ -14,7 +15,6 @@ call ale#linter#Define('haskell', {
\ 'aliases': ['cabal-ghc'], \ 'aliases': ['cabal-ghc'],
\ 'output_stream': 'stderr', \ 'output_stream': 'stderr',
\ 'executable': 'cabal', \ 'executable': 'cabal',
\ 'cwd': '%s:h',
\ 'command': function('ale_linters#haskell#cabal_ghc#GetCommand'), \ 'command': function('ale_linters#haskell#cabal_ghc#GetCommand'),
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat', \ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
\}) \})

View File

@@ -1,5 +0,0 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Haskell files.
call ale#handlers#cspell#DefineLinter('haskell')

View File

@@ -4,7 +4,6 @@
" <devildead13@gmail.com>). It search more project root files. " <devildead13@gmail.com>). It search more project root files.
" "
call ale#Set('haskell_hls_executable', 'haskell-language-server-wrapper') call ale#Set('haskell_hls_executable', 'haskell-language-server-wrapper')
call ale#Set('haskell_hls_config', {})
function! ale_linters#haskell#hls#FindRootFile(buffer) abort function! ale_linters#haskell#hls#FindRootFile(buffer) abort
let l:serach_root_files = [ let l:serach_root_files = [
@@ -61,5 +60,4 @@ call ale#linter#Define('haskell', {
\ 'command': function('ale_linters#haskell#hls#GetCommand'), \ 'command': function('ale_linters#haskell#hls#GetCommand'),
\ 'executable': {b -> ale#Var(b, 'haskell_hls_executable')}, \ 'executable': {b -> ale#Var(b, 'haskell_hls_executable')},
\ 'project_root': function('ale_linters#haskell#hls#GetProjectRoot'), \ 'project_root': function('ale_linters#haskell#hls#GetProjectRoot'),
\ 'lsp_config': {b -> ale#Var(b, 'haskell_hls_config')},
\}) \})

View File

@@ -4,7 +4,8 @@
call ale#Set('haskell_stack_ghc_options', '-fno-code -v0') call ale#Set('haskell_stack_ghc_options', '-fno-code -v0')
function! ale_linters#haskell#stack_ghc#GetCommand(buffer) abort function! ale_linters#haskell#stack_ghc#GetCommand(buffer) abort
return ale#handlers#haskell#GetStackExecutable(a:buffer) return ale#path#BufferCdString(a:buffer)
\ . ale#handlers#haskell#GetStackExecutable(a:buffer)
\ . ' ghc -- ' \ . ' ghc -- '
\ . ale#Var(a:buffer, 'haskell_stack_ghc_options') \ . ale#Var(a:buffer, 'haskell_stack_ghc_options')
\ . ' %t' \ . ' %t'
@@ -15,7 +16,6 @@ call ale#linter#Define('haskell', {
\ 'aliases': ['stack-ghc'], \ 'aliases': ['stack-ghc'],
\ 'output_stream': 'stderr', \ 'output_stream': 'stderr',
\ 'executable': function('ale#handlers#haskell#GetStackExecutable'), \ 'executable': function('ale#handlers#haskell#GetStackExecutable'),
\ 'cwd': '%s:h',
\ 'command': function('ale_linters#haskell#stack_ghc#GetCommand'), \ 'command': function('ale_linters#haskell#stack_ghc#GetCommand'),
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat', \ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
\}) \})

View File

@@ -1,5 +0,0 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for help files.
call ale#handlers#cspell#DefineLinter('help')

View File

@@ -1,56 +0,0 @@
" 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'),
\})

View File

@@ -1,5 +0,0 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for HTML files.
call ale#handlers#cspell#DefineLinter('html')

View File

@@ -24,7 +24,7 @@ endfunction
call ale#linter#Define('html', { call ale#linter#Define('html', {
\ 'name': 'htmlhint', \ 'name': 'htmlhint',
\ 'executable': {b -> ale#path#FindExecutable(b, 'html_htmlhint', [ \ 'executable': {b -> ale#node#FindExecutable(b, 'html_htmlhint', [
\ 'node_modules/.bin/htmlhint', \ 'node_modules/.bin/htmlhint',
\ ])}, \ ])},
\ 'command': function('ale_linters#html#htmlhint#GetCommand'), \ 'command': function('ale_linters#html#htmlhint#GetCommand'),

View File

@@ -5,7 +5,7 @@ call ale#Set('html_stylelint_options', '')
call ale#Set('html_stylelint_use_global', 0) call ale#Set('html_stylelint_use_global', 0)
function! ale_linters#html#stylelint#GetExecutable(buffer) abort function! ale_linters#html#stylelint#GetExecutable(buffer) abort
return ale#path#FindExecutable(a:buffer, 'html_stylelint', [ return ale#node#FindExecutable(a:buffer, 'html_stylelint', [
\ 'node_modules/.bin/stylelint', \ 'node_modules/.bin/stylelint',
\]) \])
endfunction endfunction

View File

@@ -1,16 +0,0 @@
" Author: Dalius Dobravolskas <dalius.dobravolskas@gmail.com>
" Description: VSCode html language server
function! ale_linters#html#vscodehtml#GetProjectRoot(buffer) abort
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''
endfunction
call ale#linter#Define('html', {
\ 'name': 'vscodehtml',
\ 'lsp': 'stdio',
\ 'executable': 'vscode-html-language-server',
\ 'command': '%e --stdio',
\ 'project_root': function('ale_linters#html#vscodehtml#GetProjectRoot'),
\})

View File

@@ -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', {}) call ale#Set('ink_ls_initialization_options', {})
function! ale_linters#ink#ls#GetExecutable(buffer) abort function! ale_linters#ink#ls#GetExecutable(buffer) abort
return ale#path#FindExecutable(a:buffer, 'ink_ls', [ return ale#node#FindExecutable(a:buffer, 'ink_ls', [
\ 'ink-language-server', \ 'ink-language-server',
\ 'node_modules/.bin/ink-language-server', \ 'node_modules/.bin/ink-language-server',
\]) \])

View File

@@ -14,7 +14,6 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
for l:match in ale#util#GetMatches(a:lines, l:pattern) for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, { call add(l:output, {
\ 'type': l:match[1] is? 'WARN' ? 'W' : 'E', \ 'type': l:match[1] is? 'WARN' ? 'W' : 'E',
\ 'sub_type': 'style',
\ 'lnum': l:match[2] + 0, \ 'lnum': l:match[2] + 0,
\ 'col': l:match[3] + 0, \ 'col': l:match[3] + 0,
\ 'text': l:match[4], \ 'text': l:match[4],
@@ -32,7 +31,6 @@ function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
for l:match in ale#util#GetMatches(a:lines, l:pattern) for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, { call add(l:output, {
\ 'type': l:match[3] is? 'warning' ? 'W' : 'E', \ 'type': l:match[3] is? 'warning' ? 'W' : 'E',
\ 'sub_type': 'style',
\ 'lnum': l:match[2] + 0, \ 'lnum': l:match[2] + 0,
\ 'text': l:match[4], \ 'text': l:match[4],
\}) \})

View File

@@ -1,5 +0,0 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Java files.
call ale#handlers#cspell#DefineLinter('java')

View File

@@ -192,9 +192,4 @@ call ale#linter#Define('java', {
\ 'command': function('ale_linters#java#eclipselsp#RunWithVersionCheck'), \ 'command': function('ale_linters#java#eclipselsp#RunWithVersionCheck'),
\ 'language': 'java', \ 'language': 'java',
\ 'project_root': function('ale#java#FindProjectRoot'), \ 'project_root': function('ale#java#FindProjectRoot'),
\ 'initialization_options': {
\ 'extendedClientCapabilities': {
\ 'classFileContentsSupport': v:true
\ }
\ }
\}) \})

View File

@@ -9,16 +9,16 @@ call ale#Set('java_javac_classpath', '')
call ale#Set('java_javac_sourcepath', '') call ale#Set('java_javac_sourcepath', '')
function! ale_linters#java#javac#RunWithImportPaths(buffer) abort function! ale_linters#java#javac#RunWithImportPaths(buffer) abort
let [l:cwd, l:command] = ale#maven#BuildClasspathCommand(a:buffer) let l:command = ale#maven#BuildClasspathCommand(a:buffer)
" Try to use Gradle if Maven isn't available. " Try to use Gradle if Maven isn't available.
if empty(l:command) if empty(l:command)
let [l:cwd, l:command] = ale#gradle#BuildClasspathCommand(a:buffer) let l:command = ale#gradle#BuildClasspathCommand(a:buffer)
endif endif
" Try to use Ant if Gradle and Maven aren't available " Try to use Ant if Gradle and Maven aren't available
if empty(l:command) if empty(l:command)
let [l:cwd, l:command] = ale#ant#BuildClasspathCommand(a:buffer) let l:command = ale#ant#BuildClasspathCommand(a:buffer)
endif endif
if empty(l:command) if empty(l:command)
@@ -28,8 +28,7 @@ function! ale_linters#java#javac#RunWithImportPaths(buffer) abort
return ale#command#Run( return ale#command#Run(
\ a:buffer, \ a:buffer,
\ l:command, \ l:command,
\ function('ale_linters#java#javac#GetCommand'), \ function('ale_linters#java#javac#GetCommand')
\ {'cwd': l:cwd},
\) \)
endfunction endfunction
@@ -111,7 +110,8 @@ 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 " Always run javac from the directory the file is in, so we can resolve
" relative paths correctly. " relative paths correctly.
return '%e -Xlint' return ale#path#BufferCdString(a:buffer)
\ . '%e -Xlint'
\ . ale#Pad(l:cp_option) \ . ale#Pad(l:cp_option)
\ . ale#Pad(l:sp_option) \ . ale#Pad(l:sp_option)
\ . ' -d ' . ale#Escape(l:class_file_directory) \ . ' -d ' . ale#Escape(l:class_file_directory)
@@ -132,9 +132,7 @@ 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]) 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]) if empty(l:match[2]) && empty(l:match[3])
if !empty(l:match[1]) && !empty(l:output) let l:output[-1].col = len(l:match[1])
let l:output[-1].col = len(l:match[1])
endif
elseif empty(l:match[3]) elseif empty(l:match[3])
" Add symbols to 'cannot find symbol' errors. " Add symbols to 'cannot find symbol' errors.
if l:output[-1].text is# 'error: cannot find symbol' if l:output[-1].text is# 'error: cannot find symbol'
@@ -156,7 +154,6 @@ endfunction
call ale#linter#Define('java', { call ale#linter#Define('java', {
\ 'name': 'javac', \ 'name': 'javac',
\ 'executable': {b -> ale#Var(b, 'java_javac_executable')}, \ 'executable': {b -> ale#Var(b, 'java_javac_executable')},
\ 'cwd': '%s:h',
\ 'command': function('ale_linters#java#javac#RunWithImportPaths'), \ 'command': function('ale_linters#java#javac#RunWithImportPaths'),
\ 'output_stream': 'stderr', \ 'output_stream': 'stderr',
\ 'callback': 'ale_linters#java#javac#Handle', \ 'callback': 'ale_linters#java#javac#Handle',

View File

@@ -1,5 +0,0 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for JavaScript files.
call ale#handlers#cspell#DefineLinter('javascript')

View File

@@ -1,11 +0,0 @@
" 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'),
\})

View File

@@ -5,7 +5,6 @@ call ale#linter#Define('javascript', {
\ 'name': 'eslint', \ 'name': 'eslint',
\ 'output_stream': 'both', \ 'output_stream': 'both',
\ 'executable': function('ale#handlers#eslint#GetExecutable'), \ 'executable': function('ale#handlers#eslint#GetExecutable'),
\ 'cwd': function('ale#handlers#eslint#GetCwd'),
\ 'command': function('ale#handlers#eslint#GetCommand'), \ 'command': function('ale#handlers#eslint#GetCommand'),
\ 'callback': 'ale#handlers#eslint#HandleJSON', \ 'callback': 'ale#handlers#eslint#HandleJSON',
\}) \})

View File

@@ -22,7 +22,7 @@ function! ale_linters#javascript#flow#GetExecutable(buffer) abort
return '' return ''
endif endif
return ale#path#FindExecutable(a:buffer, 'javascript_flow', [ return ale#node#FindExecutable(a:buffer, 'javascript_flow', [
\ 'node_modules/.bin/flow', \ 'node_modules/.bin/flow',
\]) \])
endfunction endfunction

View File

@@ -19,7 +19,7 @@ endfunction
call ale#linter#Define('javascript', { call ale#linter#Define('javascript', {
\ 'name': 'flow-language-server', \ 'name': 'flow-language-server',
\ 'lsp': 'stdio', \ 'lsp': 'stdio',
\ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_flow_ls', [ \ 'executable': {b -> ale#node#FindExecutable(b, 'javascript_flow_ls', [
\ 'node_modules/.bin/flow', \ 'node_modules/.bin/flow',
\ ])}, \ ])},
\ 'command': '%e lsp --from ale-lsp', \ 'command': '%e lsp --from ale-lsp',

View File

@@ -53,7 +53,7 @@ endfunction
call ale#linter#Define('javascript', { call ale#linter#Define('javascript', {
\ 'name': 'jscs', \ 'name': 'jscs',
\ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_jscs', [ \ 'executable': {b -> ale#node#FindExecutable(b, 'javascript_jscs', [
\ 'node_modules/.bin/jscs', \ 'node_modules/.bin/jscs',
\ ])}, \ ])},
\ 'command': function('ale_linters#javascript#jscs#GetCommand'), \ 'command': function('ale_linters#javascript#jscs#GetCommand'),

View File

@@ -25,7 +25,7 @@ endfunction
call ale#linter#Define('javascript', { call ale#linter#Define('javascript', {
\ 'name': 'jshint', \ 'name': 'jshint',
\ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_jshint', [ \ 'executable': {b -> ale#node#FindExecutable(b, 'javascript_jshint', [
\ 'node_modules/.bin/jshint', \ 'node_modules/.bin/jshint',
\ ])}, \ ])},
\ 'command': function('ale_linters#javascript#jshint#GetCommand'), \ 'command': function('ale_linters#javascript#jshint#GetCommand'),

View File

@@ -6,7 +6,7 @@ call ale#Set('javascript_standard_use_global', get(g:, 'ale_use_global_executabl
call ale#Set('javascript_standard_options', '') call ale#Set('javascript_standard_options', '')
function! ale_linters#javascript#standard#GetExecutable(buffer) abort function! ale_linters#javascript#standard#GetExecutable(buffer) abort
return ale#path#FindExecutable(a:buffer, 'javascript_standard', [ return ale#node#FindExecutable(a:buffer, 'javascript_standard', [
\ 'node_modules/standardx/bin/cmd.js', \ 'node_modules/standardx/bin/cmd.js',
\ 'node_modules/standard/bin/cmd.js', \ 'node_modules/standard/bin/cmd.js',
\ 'node_modules/semistandard/bin/cmd.js', \ 'node_modules/semistandard/bin/cmd.js',

View File

@@ -8,7 +8,7 @@ call ale#Set('javascript_tsserver_use_global', get(g:, 'ale_use_global_executabl
call ale#linter#Define('javascript', { call ale#linter#Define('javascript', {
\ 'name': 'tsserver', \ 'name': 'tsserver',
\ 'lsp': 'tsserver', \ 'lsp': 'tsserver',
\ 'executable': {b -> ale#path#FindExecutable(b, 'javascript_tsserver', [ \ 'executable': {b -> ale#node#FindExecutable(b, 'javascript_tsserver', [
\ 'node_modules/.bin/tsserver', \ 'node_modules/.bin/tsserver',
\ ])}, \ ])},
\ 'command': '%e', \ 'command': '%e',

View File

@@ -1,5 +0,0 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for JSON files.
call ale#handlers#cspell#DefineLinter('json')

View File

@@ -1,16 +0,0 @@
" 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',
\})

View File

@@ -1,24 +1,32 @@
" Author: jD91mZM2 <me@krake.one> " Author: jD91mZM2 <me@krake.one>
call ale#Set('json_jq_executable', 'jq')
call ale#Set('json_jq_options', '')
call ale#Set('json_jq_filters', '.')
" Matches patterns like the following: function! ale_linters#json#jq#GetCommand(buffer) abort
" parse error: Expected another key-value pair at line 4, column 3 let l:executable = ale#fixers#jq#GetExecutable(a:buffer)
let s:pattern = '^parse error: \(.\+\) at line \(\d\+\), column \(\d\+\)$'
return ale#Escape(l:executable)
endfunction
function! ale_linters#json#jq#Handle(buffer, lines) abort function! ale_linters#json#jq#Handle(buffer, lines) abort
return ale#util#MapMatches(a:lines, s:pattern, {match -> { " Matches patterns like the following:
\ 'text': match[1], " parse error: Expected another key-value pair at line 4, column 3
\ 'lnum': match[2] + 0, let l:pattern = '^parse error: \(.\+\) at line \(\d\+\), column \(\d\+\)$'
\ 'col': match[3] + 0, 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
endfunction endfunction
call ale#linter#Define('json', { call ale#linter#Define('json', {
\ 'name': 'jq', \ 'name': 'jq',
\ 'executable': {b -> ale#Var(b, 'json_jq_executable')}, \ 'executable': function('ale#fixers#jq#GetExecutable'),
\ 'output_stream': 'stderr', \ 'output_stream': 'stderr',
\ 'command': '%e', \ 'command': function('ale_linters#json#jq#GetCommand'),
\ 'callback': 'ale_linters#json#jq#Handle', \ 'callback': 'ale_linters#json#jq#Handle',
\}) \})

View File

@@ -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)) call ale#Set('json_jsonlint_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#json#jsonlint#GetExecutable(buffer) abort function! ale_linters#json#jsonlint#GetExecutable(buffer) abort
return ale#path#FindExecutable(a:buffer, 'json_jsonlint', [ return ale#node#FindExecutable(a:buffer, 'json_jsonlint', [
\ 'node_modules/.bin/jsonlint', \ 'node_modules/.bin/jsonlint',
\ 'node_modules/jsonlint/lib/cli.js', \ 'node_modules/jsonlint/lib/cli.js',
\]) \])

View File

@@ -6,7 +6,7 @@ call ale#Set('json_spectral_use_global', get(g:, 'ale_use_global_executables', 0
call ale#linter#Define('json', { call ale#linter#Define('json', {
\ 'name': 'spectral', \ 'name': 'spectral',
\ 'executable': {b -> ale#path#FindExecutable(b, 'json_spectral', [ \ 'executable': {b -> ale#node#FindExecutable(b, 'json_spectral', [
\ 'node_modules/.bin/spectral', \ 'node_modules/.bin/spectral',
\ ])}, \ ])},
\ 'command': '%e lint --ignore-unknown-format -q -f text %t', \ 'command': '%e lint --ignore-unknown-format -q -f text %t',

View File

@@ -1,16 +0,0 @@
" Author: Dalius Dobravolskas <dalius.dobravolskas@gmail.com>
" Description: VSCode json language server
function! ale_linters#json#vscodejson#GetProjectRoot(buffer) abort
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''
endfunction
call ale#linter#Define('json', {
\ 'name': 'vscodejson',
\ 'lsp': 'stdio',
\ 'executable': 'vscode-json-language-server',
\ 'command': '%e --stdio',
\ 'project_root': function('ale_linters#json#vscodejson#GetProjectRoot'),
\})

View File

@@ -1,16 +0,0 @@
" 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',
\})

View File

@@ -1,16 +0,0 @@
" 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',
\})

View File

@@ -1,59 +0,0 @@
" 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',
\})

View File

@@ -1,52 +0,0 @@
" 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',
\})

View File

@@ -15,15 +15,20 @@ function! ale_linters#kotlin#kotlinc#RunWithImportPaths(buffer) abort
let l:command = '' let l:command = ''
" exec maven/gradle only if classpath is not set " exec maven/gradle only if classpath is not set
if !empty(ale#Var(a:buffer, 'kotlin_kotlinc_classpath')) if ale#Var(a:buffer, 'kotlin_kotlinc_classpath') isnot# ''
return ale_linters#kotlin#kotlinc#GetCommand(a:buffer, [], {}) return ale_linters#kotlin#kotlinc#GetCommand(a:buffer, [], {})
endif endif
let [l:cwd, l:command] = ale#maven#BuildClasspathCommand(a:buffer) 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
" Try to use Gradle if Maven isn't available. " Try to use Gradle if Maven isn't available.
if empty(l:command) if empty(l:command)
let [l:cwd, l:command] = ale#gradle#BuildClasspathCommand(a:buffer) let l:command = ale#gradle#BuildClasspathCommand(a:buffer)
endif endif
if empty(l:command) if empty(l:command)
@@ -33,8 +38,7 @@ function! ale_linters#kotlin#kotlinc#RunWithImportPaths(buffer) abort
return ale#command#Run( return ale#command#Run(
\ a:buffer, \ a:buffer,
\ l:command, \ l:command,
\ function('ale_linters#kotlin#kotlinc#GetCommand'), \ function('ale_linters#kotlin#kotlinc#GetCommand')
\ {'cwd': l:cwd},
\) \)
endfunction endfunction

View File

@@ -38,7 +38,7 @@ endfunction
call ale#linter#Define('less', { call ale#linter#Define('less', {
\ 'name': 'lessc', \ 'name': 'lessc',
\ 'executable': {b -> ale#path#FindExecutable(b, 'less_lessc', [ \ 'executable': {b -> ale#node#FindExecutable(b, 'less_lessc', [
\ 'node_modules/.bin/lessc', \ 'node_modules/.bin/lessc',
\ ])}, \ ])},
\ 'command': function('ale_linters#less#lessc#GetCommand'), \ 'command': function('ale_linters#less#lessc#GetCommand'),

View File

@@ -12,7 +12,7 @@ endfunction
call ale#linter#Define('less', { call ale#linter#Define('less', {
\ 'name': 'stylelint', \ 'name': 'stylelint',
\ 'executable': {b -> ale#path#FindExecutable(b, 'less_stylelint', [ \ 'executable': {b -> ale#node#FindExecutable(b, 'less_stylelint', [
\ 'node_modules/.bin/stylelint', \ 'node_modules/.bin/stylelint',
\ ])}, \ ])},
\ 'command': function('ale_linters#less#stylelint#GetCommand'), \ 'command': function('ale_linters#less#stylelint#GetCommand'),

View File

@@ -1,5 +0,0 @@
scriptencoding utf-8
" Author: David Houston <houstdav000>
" Description: cspell support for Lua files.
call ale#handlers#cspell#DefineLinter('lua')

View File

@@ -1,46 +0,0 @@
call ale#Set('lua_selene_executable', 'selene')
call ale#Set('lua_selene_options', '')
function! ale_linters#lua#selene#GetCommand(buffer) abort
return '%e' . ale#Pad(ale#Var(a:buffer, 'lua_selene_options'))
\ . ' --display-style=json -'
endfunction
function! ale_linters#lua#selene#Handle(buffer, lines) abort
let l:output = []
for l:line in a:lines
" as of version 0.17.0, selene has no way to suppress summary
" information when outputting json, so stop processing when we hit it
" (PR for this here: https://github.com/Kampfkarren/selene/pull/356)
if l:line is# 'Results:'
break
endif
let l:json = json_decode(l:line)
let l:lint = {
\ 'lnum': l:json.primary_label.span.start_line + 1,
\ 'end_lnum': l:json.primary_label.span.end_line + 1,
\ 'col': l:json.primary_label.span.start_column + 1,
\ 'end_col': l:json.primary_label.span.end_column,
\ 'text': l:json.message,
\ 'code': l:json.code,
\ 'type': l:json.severity is# 'Warning' ? 'W' : 'E',
\}
if has_key(l:json, 'notes') && len(l:json.notes) > 0
let l:lint.detail = l:lint.text . "\n\n" . join(l:json.notes, "\n")
endif
call add(l:output, l:lint)
endfor
return l:output
endfunction
call ale#linter#Define('lua', {
\ 'name': 'selene',
\ 'executable': {b -> ale#Var(b, 'lua_selene_executable')},
\ 'command': function('ale_linters#lua#selene#GetCommand'),
\ 'callback': 'ale_linters#lua#selene#Handle',
\})

Some files were not shown because too many files have changed in this diff Show More