mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
Compare commits
16 Commits
4217461c48
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca1da76d5e | ||
|
|
962a932ed4 | ||
|
|
395d9fa2aa | ||
|
|
5f286eb909 | ||
|
|
1f0f9ef28d | ||
|
|
e56b55b65d | ||
|
|
260c756a9b | ||
|
|
86d8ada5cb | ||
|
|
de2d3da738 | ||
|
|
b9d7f56471 | ||
|
|
6d8e4a641c | ||
|
|
d2f4090c33 | ||
|
|
59c6b4f7b0 | ||
|
|
21d5de18b2 | ||
|
|
ed26d1f1d9 | ||
|
|
9811114948 |
@@ -6,7 +6,7 @@ call ale#Set('css_stylelint_use_global', get(g:, 'ale_use_global_executables', 0
|
||||
|
||||
function! ale_linters#css#stylelint#GetCommand(buffer) abort
|
||||
return '%e ' . ale#Pad(ale#Var(a:buffer, 'css_stylelint_options'))
|
||||
\ . ' --stdin-filename %s'
|
||||
\ . ' --no-color --stdin-filename %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('css', {
|
||||
|
||||
12
ale_linters/elixir/expert.vim
Normal file
12
ale_linters/elixir/expert.vim
Normal file
@@ -0,0 +1,12 @@
|
||||
" Author: Paul Monson <pmonson711@pm.me>
|
||||
" Description: Expert integration (https://github.com/elixir-lang/expert)
|
||||
|
||||
call ale#Set('elixir_expert_executable', 'expert')
|
||||
|
||||
call ale#linter#Define('elixir', {
|
||||
\ 'name': 'expert',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'elixir_expert_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale#handlers#elixir#FindMixUmbrellaRoot'),
|
||||
\})
|
||||
@@ -16,7 +16,7 @@ function! ale_linters#html#stylelint#GetCommand(buffer) abort
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' --stdin-filename %s'
|
||||
\ . ' --no-color --stdin-filename %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('html', {
|
||||
|
||||
34
ale_linters/html/superhtml.vim
Normal file
34
ale_linters/html/superhtml.vim
Normal file
@@ -0,0 +1,34 @@
|
||||
call ale#Set('html_superhtml_executable', 'superhtml')
|
||||
call ale#Set('html_superhtml_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
|
||||
function! ale_linters#html#superhtml#GetCommand(buffer) abort
|
||||
return '%e check --stdin'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#html#superhtml#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
let l:pattern = '^\(.*\):\(\d\+\):\(\d\+\): \(.*\)$'
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if !empty(l:match)
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'col': str2nr(l:match[3]),
|
||||
\ 'text': l:match[4],
|
||||
\ 'type': 'E'
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('html', {
|
||||
\ 'name': 'superhtml',
|
||||
\ 'executable': {b -> ale#Var(b, 'html_superhtml_executable')},
|
||||
\ 'command': function('ale_linters#html#superhtml#GetCommand'),
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale_linters#html#superhtml#Handle',
|
||||
\})
|
||||
46
ale_linters/jinja/j2lint.vim
Normal file
46
ale_linters/jinja/j2lint.vim
Normal file
@@ -0,0 +1,46 @@
|
||||
" Description: linter for jinja using j2lint
|
||||
|
||||
call ale#Set('jinja_j2lint_executable', 'j2lint')
|
||||
call ale#Set('jinja_j2lint_options', '')
|
||||
call ale#Set('jinja_j2lint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('jinja_j2lint_auto_pipenv', 0)
|
||||
call ale#Set('jinja_j2lint_auto_poetry', 0)
|
||||
call ale#Set('jinja_j2lint_auto_uv', 0)
|
||||
|
||||
function! ale_linters#jinja#j2lint#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'jinja_j2lint_auto_pipenv'))
|
||||
\ && ale#python#PipenvPresent(a:buffer)
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'jinja_j2lint_auto_poetry'))
|
||||
\ && ale#python#PoetryPresent(a:buffer)
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'jinja_j2lint_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'jinja_j2lint', ['j2lint'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#jinja#j2lint#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#jinja#j2lint#GetExecutable(a:buffer)
|
||||
|
||||
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
|
||||
\ ? ' run j2lint'
|
||||
\ : ''
|
||||
|
||||
return ale#Escape(l:executable) . l:exec_args
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'jinja_j2lint_options'))
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('jinja', {
|
||||
\ 'name': 'j2lint',
|
||||
\ 'executable': function('ale_linters#jinja#j2lint#GetExecutable'),
|
||||
\ 'command': function('ale_linters#jinja#j2lint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsError',
|
||||
\})
|
||||
@@ -7,7 +7,7 @@ call ale#Set('less_stylelint_use_global', get(g:, 'ale_use_global_executables',
|
||||
function! ale_linters#less#stylelint#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'less_stylelint_options')
|
||||
|
||||
return '%e' . ale#Pad(l:options) . ' --stdin-filename %s'
|
||||
return '%e' . ale#Pad(l:options) . ' --no-color --stdin-filename %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('less', {
|
||||
|
||||
@@ -33,9 +33,8 @@ function! ale_linters#markdown#pymarkdown#GetCommand(buffer) abort
|
||||
\ : ''
|
||||
|
||||
return ale#Escape(l:executable) . l:exec_args
|
||||
\ . ' '
|
||||
\ . ale#Var(a:buffer, 'markdown_pymarkdown_options')
|
||||
\ . 'scan-stdin'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'markdown_pymarkdown_options'))
|
||||
\ . ' scan-stdin'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#markdown#pymarkdown#Handle(buffer, lines) abort
|
||||
|
||||
@@ -9,7 +9,7 @@ function! ale_linters#perl#languageserver#GetProjectRoot(buffer) abort
|
||||
" Makefile.PL, https://perldoc.perl.org/ExtUtils::MakeMaker
|
||||
" Build.PL, https://metacpan.org/pod/Module::Build
|
||||
" dist.ini, https://metacpan.org/pod/Dist::Zilla
|
||||
let l:potential_roots = [ 'Makefile.PL', 'Build.PL', 'dist.ini', '.git' ]
|
||||
let l:potential_roots = [ 'Makefile.PL', 'Build.PL', 'dist.ini' ]
|
||||
|
||||
for l:root in l:potential_roots
|
||||
let l:project_root = ale#path#FindNearestFile(a:buffer, l:root)
|
||||
@@ -19,6 +19,12 @@ function! ale_linters#perl#languageserver#GetProjectRoot(buffer) abort
|
||||
endif
|
||||
endfor
|
||||
|
||||
let l:project_root = ale#path#FindNearestFileOrDirectory(a:buffer, '.git')
|
||||
|
||||
if !empty(l:project_root)
|
||||
return fnamemodify(l:project_root . '/', ':p:h:h')
|
||||
endif
|
||||
|
||||
return fnamemodify(expand('#' . a:buffer . ':p:h'), ':p:h')
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -27,6 +27,10 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort
|
||||
|
||||
let l:level = ale#Var(a:buffer, 'php_phpstan_level')
|
||||
|
||||
if type(l:level) is v:t_number
|
||||
let l:level = string(l:level)
|
||||
endif
|
||||
|
||||
if empty(l:level) && empty(ale_linters#php#phpstan#FindConfigFile(a:buffer))
|
||||
" if no configuration file is found, then use 4 as a default level
|
||||
let l:level = '4'
|
||||
@@ -83,6 +87,10 @@ function! ale_linters#php#phpstan#FindConfigFile(buffer) abort
|
||||
let l:result = ale#path#FindNearestFile(a:buffer, 'phpstan.neon.dist')
|
||||
endif
|
||||
|
||||
if empty(l:result)
|
||||
let l:result = ale#path#FindNearestFile(a:buffer, 'phpstan.dist.neon')
|
||||
endif
|
||||
|
||||
return l:result
|
||||
endfunction
|
||||
|
||||
|
||||
@@ -9,6 +9,6 @@ call ale#linter#Define('sass', {
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'sass_stylelint', [
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\ ])},
|
||||
\ 'command': '%e --stdin-filename %s',
|
||||
\ 'command': '%e --no-color --stdin-filename %s',
|
||||
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
|
||||
\})
|
||||
|
||||
@@ -6,7 +6,7 @@ call ale#Set('scss_stylelint_use_global', get(g:, 'ale_use_global_executables',
|
||||
|
||||
function! ale_linters#scss#stylelint#GetCommand(buffer) abort
|
||||
return '%e ' . ale#Pad(ale#Var(a:buffer, 'scss_stylelint_options'))
|
||||
\ . ' --stdin-filename %s'
|
||||
\ . ' --no-color --stdin-filename %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('scss', {
|
||||
|
||||
@@ -7,7 +7,7 @@ call ale#Set('stylus_stylelint_use_global', get(g:, 'ale_use_global_executables'
|
||||
function! ale_linters#stylus#stylelint#GetCommand(buffer) abort
|
||||
return '%e'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'stylus_stylelint_options'))
|
||||
\ . ' --stdin-filename %s'
|
||||
\ . ' --no-color --stdin-filename %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('stylus', {
|
||||
|
||||
@@ -8,7 +8,7 @@ call ale#Set('sugarss_stylelint_use_global', get(g:, 'ale_use_global_executables
|
||||
function! ale_linters#sugarss#stylelint#GetCommand(buffer) abort
|
||||
return '%e ' . ale#Pad(ale#Var(a:buffer, 'sugarss_stylelint_options'))
|
||||
\ . ' --syntax=sugarss'
|
||||
\ . ' --stdin-filename %s'
|
||||
\ . ' --no-color --stdin-filename %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('sugarss', {
|
||||
|
||||
@@ -3,6 +3,19 @@
|
||||
|
||||
call ale#Set('toml_tombi_executable', 'tombi')
|
||||
call ale#Set('toml_tombi_lsp_options', '')
|
||||
call ale#Set('toml_tombi_online', 0)
|
||||
|
||||
function! ale_linters#toml#tombi#GetCommand(buffer) abort
|
||||
let l:offline = ''
|
||||
|
||||
if !ale#Var(a:buffer, 'toml_tombi_online')
|
||||
let l:offline = '--offline'
|
||||
endif
|
||||
|
||||
return '%e lsp'
|
||||
\ . ale#Pad(l:offline)
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'toml_tombi_lsp_options'))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#toml#tombi#GetProjectRoot(buffer) abort
|
||||
" Try to find nearest tombi.toml
|
||||
@@ -33,6 +46,6 @@ call ale#linter#Define('toml', {
|
||||
\ 'name': 'tombi',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'toml_tombi_executable')},
|
||||
\ 'command': {b -> '%e lsp' . ale#Pad(ale#Var(b, 'toml_tombi_lsp_options'))},
|
||||
\ 'command': function('ale_linters#toml#tombi#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#toml#tombi#GetProjectRoot'),
|
||||
\})
|
||||
|
||||
@@ -192,6 +192,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['python'],
|
||||
\ 'description': 'Tidy Python imports with pyflyby.',
|
||||
\ },
|
||||
\ 'unimport': {
|
||||
\ 'function': 'ale#fixers#unimport#Fix',
|
||||
\ 'suggested_filetypes': ['python'],
|
||||
\ 'description': 'unimport fixer',
|
||||
\ },
|
||||
\ 'importjs': {
|
||||
\ 'function': 'ale#fixers#importjs#Fix',
|
||||
\ 'suggested_filetypes': ['javascript'],
|
||||
@@ -747,6 +752,11 @@ let s:default_registry = {
|
||||
\ 'suggested_filetypes': ['verilog'],
|
||||
\ 'description': 'Formats verilog files using verible.',
|
||||
\ },
|
||||
\ 'markdownlint': {
|
||||
\ 'function': 'ale#fixers#markdownlint#Fix',
|
||||
\ 'suggested_filetypes': ['markdown'],
|
||||
\ 'description': 'Fix markdown files with markdownlint.',
|
||||
\ },
|
||||
\}
|
||||
|
||||
" Reset the function registry to the default entries.
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
function! ale#fixers#biome#Fix(buffer) abort
|
||||
let l:executable = ale#handlers#biome#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'biome_options')
|
||||
let l:apply = ale#Var(a:buffer, 'biome_fixer_apply_unsafe') ? '--write --unsafe' : '--write'
|
||||
let l:unsafe = ale#Var(a:buffer, 'biome_fixer_apply_unsafe') ? ' --unsafe' : ''
|
||||
|
||||
return {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': ale#Escape(l:executable) . ' check ' . l:apply
|
||||
\ 'command': ale#Escape(l:executable) . ' check '
|
||||
\ . '--write --stdin-file-path %s' . l:unsafe
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' %t'
|
||||
\}
|
||||
endfunction
|
||||
|
||||
15
autoload/ale/fixers/markdownlint.vim
Normal file
15
autoload/ale/fixers/markdownlint.vim
Normal file
@@ -0,0 +1,15 @@
|
||||
:scriptencoding utf-8
|
||||
|
||||
call ale#Set('markdownlint_executable', 'markdownlint')
|
||||
call ale#Set('markdownlint_options', '--fix')
|
||||
|
||||
function! ale#fixers#markdownlint#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'markdownlint_executable')
|
||||
let l:options = ale#Var(a:buffer, 'markdownlint_options')
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' ' . l:options,
|
||||
\}
|
||||
endfunction
|
||||
|
||||
@@ -19,20 +19,34 @@ function! ale#fixers#rubocop#PostProcess(buffer, output) abort
|
||||
return a:output[l:line :]
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#rubocop#GetCommand(buffer) abort
|
||||
function! ale#fixers#rubocop#GetCommand(buffer, version) abort
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable')
|
||||
let l:options = ale#Var(a:buffer, 'ruby_rubocop_options')
|
||||
let l:auto_correct_all = ale#Var(a:buffer, 'ruby_rubocop_auto_correct_all')
|
||||
let l:editor_mode = ale#semver#GTE(a:version, [1, 61, 0])
|
||||
|
||||
return ale#ruby#EscapeExecutable(l:executable, 'rubocop')
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . (l:auto_correct_all ? ' --auto-correct-all' : ' --auto-correct')
|
||||
\ . (l:editor_mode ? ' --editor-mode' : '')
|
||||
\ . ' --force-exclusion --stdin %s'
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#rubocop#Fix(buffer) abort
|
||||
function! ale#fixers#rubocop#GetCommandForVersion(buffer, version) abort
|
||||
return {
|
||||
\ 'command': ale#fixers#rubocop#GetCommand(a:buffer),
|
||||
\ 'process_with': 'ale#fixers#rubocop#PostProcess'
|
||||
\ 'command': ale#fixers#rubocop#GetCommand(a:buffer, a:version),
|
||||
\ 'process_with': 'ale#fixers#rubocop#PostProcess'
|
||||
\}
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#rubocop#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'ruby_rubocop_executable')
|
||||
let l:command = l:executable . ale#Pad('--version')
|
||||
|
||||
return ale#semver#RunWithVersionCheck(
|
||||
\ a:buffer,
|
||||
\ l:executable,
|
||||
\ l:command,
|
||||
\ function('ale#fixers#rubocop#GetCommandForVersion'),
|
||||
\)
|
||||
endfunction
|
||||
|
||||
@@ -20,7 +20,7 @@ function! ale#fixers#stylelint#Fix(buffer) abort
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': ale#node#Executable(a:buffer, l:executable)
|
||||
\ . ale#Pad(l:options)
|
||||
\ . ' --fix --stdin --stdin-filename %s',
|
||||
\ . ' --fix --stdin --no-color --stdin-filename %s',
|
||||
\ 'read_temporary_file': 0,
|
||||
\}
|
||||
endfunction
|
||||
|
||||
@@ -3,13 +3,20 @@
|
||||
|
||||
call ale#Set('toml_tombi_executable', 'tombi')
|
||||
call ale#Set('toml_tombi_format_options', '')
|
||||
call ale#Set('toml_tombi_online', 0)
|
||||
|
||||
function! ale#fixers#tombi_format#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'toml_tombi_executable')
|
||||
let l:offline = ''
|
||||
|
||||
if !ale#Var(a:buffer, 'toml_tombi_online')
|
||||
let l:offline = '--offline'
|
||||
endif
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' format'
|
||||
\ . ale#Pad(l:offline)
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'toml_tombi_format_options')),
|
||||
\}
|
||||
endfunction
|
||||
|
||||
@@ -3,13 +3,20 @@
|
||||
|
||||
call ale#Set('toml_tombi_executable', 'tombi')
|
||||
call ale#Set('toml_tombi_lint_options', '')
|
||||
call ale#Set('toml_tombi_online', 0)
|
||||
|
||||
function! ale#fixers#tombi_lint#Fix(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'toml_tombi_executable')
|
||||
let l:offline = ''
|
||||
|
||||
if !ale#Var(a:buffer, 'toml_tombi_online')
|
||||
let l:offline = '--offline'
|
||||
endif
|
||||
|
||||
return {
|
||||
\ 'command': ale#Escape(l:executable)
|
||||
\ . ' lint'
|
||||
\ . ale#Pad(l:offline)
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'toml_tombi_lint_options')),
|
||||
\}
|
||||
endfunction
|
||||
|
||||
42
autoload/ale/fixers/unimport.vim
Normal file
42
autoload/ale/fixers/unimport.vim
Normal file
@@ -0,0 +1,42 @@
|
||||
call ale#Set('python_unimport_executable', 'unimport')
|
||||
call ale#Set('python_unimport_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
call ale#Set('python_unimport_options', '')
|
||||
call ale#Set('python_unimport_auto_pipenv', 0)
|
||||
call ale#Set('python_unimport_auto_poetry', 0)
|
||||
call ale#Set('python_unimport_auto_uv', 0)
|
||||
|
||||
function! ale#fixers#unimport#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_unimport_auto_pipenv'))
|
||||
\ && ale#python#PipenvPresent(a:buffer)
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_unimport_auto_poetry'))
|
||||
\ && ale#python#PoetryPresent(a:buffer)
|
||||
return 'poetry'
|
||||
endif
|
||||
|
||||
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_unimport_auto_uv'))
|
||||
\ && ale#python#UvPresent(a:buffer)
|
||||
return 'uv'
|
||||
endif
|
||||
|
||||
return ale#python#FindExecutable(a:buffer, 'python_unimport', ['unimport'])
|
||||
endfunction
|
||||
|
||||
function! ale#fixers#unimport#Fix(buffer) abort
|
||||
let l:executable = ale#fixers#unimport#GetExecutable(a:buffer)
|
||||
let l:cmd = [ale#Escape(l:executable)]
|
||||
|
||||
if l:executable =~? '\(pipenv\|poetry\|uv\)$'
|
||||
call extend(l:cmd, ['run', 'unimport'])
|
||||
endif
|
||||
|
||||
let l:options = ale#Var(a:buffer, 'python_unimport_options')
|
||||
|
||||
if !empty(l:options)
|
||||
call add(l:cmd, l:options)
|
||||
endif
|
||||
|
||||
return {'command': join(l:cmd, ' ')}
|
||||
endfunction
|
||||
@@ -36,7 +36,7 @@ function! ale#handlers#css#HandleCSSLintFormat(buffer, lines) abort
|
||||
endfunction
|
||||
|
||||
function! ale#handlers#css#HandleStyleLintFormat(buffer, lines) abort
|
||||
let l:exception_pattern = '\v^Error:'
|
||||
let l:exception_pattern = '\v^(Syntax)?Error:'
|
||||
|
||||
for l:line in a:lines[:10]
|
||||
if len(matchlist(l:line, l:exception_pattern)) > 0
|
||||
|
||||
@@ -85,9 +85,11 @@ The following general coding standards should be adhered to for Vim code.
|
||||
* Try to keep lines no longer than 80 characters, but this isn't an absolute
|
||||
requirement.
|
||||
* Use 4 spaces for every level of indentation in Vim code.
|
||||
* Add a blank line before every `function`, `if`, `for`, `while`, or `return`,
|
||||
which doesn't start a new level of indentation. This makes the logic in
|
||||
your code easier to follow.
|
||||
* Add a blank line before every `function`, `if`, `for`, `while`, `try`, or `return`,
|
||||
which doesn't start a new level of indentation. When adding more code on the
|
||||
same indentation level, also add blank lines after every corresponding end
|
||||
for those mentioned keywords. This makes the logic in your code easier to
|
||||
follow.
|
||||
* End every file with a trailing newline character, but not with extra blank
|
||||
lines. Remove trailing whitespace from the ends of lines.
|
||||
* Write the full names of commands instead of abbreviations. For example, write
|
||||
|
||||
@@ -139,8 +139,28 @@ g:ale_elixir_lexical_release
|
||||
|
||||
For example, set release to: `/home/projects/lexical/_build/dev/rel/lexical`
|
||||
|
||||
There are currnetly no configuration options for lexical.
|
||||
There are currently no configuration options for lexical.
|
||||
|
||||
|
||||
===============================================================================
|
||||
expert *ale-elixir-expert*
|
||||
|
||||
Expert (https://github.com/elixir-lang/expert)
|
||||
|
||||
*ale-options.elixir_expert_executable*
|
||||
*g:ale_elixir_expert_executable*
|
||||
*b:ale_elixir_expert_executable*
|
||||
elixir_expert_executable
|
||||
g:ale_elixir_expert_executable
|
||||
Type: |String|
|
||||
Default: `/usr/bin/elixir-expert`
|
||||
|
||||
Location of the expert executable.
|
||||
|
||||
For example, set release to:
|
||||
`/home/projects/expert/apps/expert/burrito_out/expert_linux_amd64`
|
||||
|
||||
There are currently no configuration options for expert.
|
||||
|
||||
===============================================================================
|
||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||
|
||||
@@ -206,6 +206,24 @@ g:ale_html_stylelint_use_global
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
|
||||
===============================================================================
|
||||
superhtml *ale-html-superhtml*
|
||||
|
||||
g:ale_html_superhtml_executable *g:ale_html_superhtml_executable*
|
||||
*b:ale_html_superhtml_executable*
|
||||
Type: |String|
|
||||
Default: `'superhtml'`
|
||||
|
||||
This variable can be changed to use a different executable for superhtml.
|
||||
|
||||
g:ale_html_superhtml_use_global *g:ale_html_superhtml_use_global*
|
||||
*b:ale_html_superhtml_use_global*
|
||||
Type: |Number|
|
||||
Default: `get(g:, 'ale_use_global_executables', 0)`
|
||||
|
||||
See |ale-integrations-local-executables|
|
||||
|
||||
|
||||
===============================================================================
|
||||
tidy *ale-html-tidy*
|
||||
|
||||
|
||||
@@ -8,5 +8,9 @@ djlint *ale-jinja-djlint*
|
||||
|
||||
See |ale-html-djlint|
|
||||
|
||||
===============================================================================
|
||||
j2lint *ale-jinja-j2lint*
|
||||
|
||||
|
||||
===============================================================================
|
||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||
|
||||
@@ -180,6 +180,7 @@ Notes:
|
||||
* `dialyxir`
|
||||
* `dogma`!!
|
||||
* `elixir-ls`
|
||||
* `expert`
|
||||
* `lexical`
|
||||
* `mix`!!
|
||||
* Elm
|
||||
@@ -289,6 +290,7 @@ Notes:
|
||||
* `prettier`
|
||||
* `proselint`
|
||||
* `rustywind`
|
||||
* `superhtml`
|
||||
* `tidy`
|
||||
* `write-good`
|
||||
* HTML Angular
|
||||
@@ -336,6 +338,7 @@ Notes:
|
||||
* `xo`
|
||||
* Jinja
|
||||
* djlint
|
||||
* j2lint
|
||||
* JSON
|
||||
* `VSCode JSON language server`
|
||||
* `biome`
|
||||
|
||||
@@ -25,6 +25,18 @@ g:ale_toml_tombi_executable
|
||||
`tombi`.
|
||||
|
||||
|
||||
*ale-options.toml_tombi_online*
|
||||
*g:ale_toml_tombi_online*
|
||||
*b:ale_toml_tombi_online*
|
||||
toml_tombi_online
|
||||
g:ale_toml_tombi_online
|
||||
Type: |Boolean|
|
||||
Default: `1`
|
||||
|
||||
This variable can be modified allow fetching remote schemas when using
|
||||
`tombi`.
|
||||
|
||||
|
||||
*ale-options.toml_tombi_lsp_options*
|
||||
*g:ale_toml_tombi_lsp_options*
|
||||
*b:ale_toml_tombi_lsp_options*
|
||||
|
||||
@@ -79,11 +79,11 @@ iverilog *ale-verilog-iverilog*
|
||||
===============================================================================
|
||||
slang *ale-verilog-slang*
|
||||
|
||||
*ale-options.verilog_slang_option*
|
||||
*g:ale_verilog_slang_option*
|
||||
*ale-options.verilog_slang_options*
|
||||
*g:ale_verilog_slang_options*
|
||||
*b:ale_verilog_slang_options*
|
||||
verilog_slang_option
|
||||
g:ale_verilog_slang_option
|
||||
verilog_slang_options
|
||||
g:ale_verilog_slang_options
|
||||
Type: |String|
|
||||
Default: `''`
|
||||
|
||||
|
||||
@@ -3490,6 +3490,7 @@ documented in additional help files.
|
||||
credo.................................|ale-elixir-credo|
|
||||
cspell................................|ale-elixir-cspell|
|
||||
lexical...............................|ale-elixir-lexical|
|
||||
expert................................|ale-elixir-expert|
|
||||
elm.....................................|ale-elm-options|
|
||||
elm-format............................|ale-elm-elm-format|
|
||||
elm-ls................................|ale-elm-elm-ls|
|
||||
@@ -3586,6 +3587,7 @@ documented in additional help files.
|
||||
prettier..............................|ale-html-prettier|
|
||||
rustywind.............................|ale-html-rustywind|
|
||||
stylelint.............................|ale-html-stylelint|
|
||||
superhtml.............................|ale-html-superhtml|
|
||||
tidy..................................|ale-html-tidy|
|
||||
vscodehtml............................|ale-html-vscode|
|
||||
write-good............................|ale-html-write-good|
|
||||
@@ -3634,6 +3636,7 @@ documented in additional help files.
|
||||
xo....................................|ale-javascript-xo|
|
||||
jinja...................................|ale-jinja-options|
|
||||
djlint................................|ale-jinja-djlint|
|
||||
j2lint................................|ale-jinja-j2lint|
|
||||
json....................................|ale-json-options|
|
||||
biome.................................|ale-json-biome|
|
||||
clang-format..........................|ale-json-clangformat|
|
||||
|
||||
@@ -190,6 +190,7 @@ formatting.
|
||||
* [dialyxir](https://github.com/jeremyjh/dialyxir)
|
||||
* [dogma](https://github.com/lpil/dogma) :floppy_disk:
|
||||
* [elixir-ls](https://github.com/elixir-lsp/elixir-ls) :warning: :speech_balloon:
|
||||
* [expert](https://github.com/elixir-lang/expert) :warning: :speech_balloon:
|
||||
* [lexical](https://github.com/lexical-lsp/lexical) :warning: :speech_balloon:
|
||||
* [mix](https://hexdocs.pm/mix/Mix.html) :warning: :floppy_disk:
|
||||
* Elm
|
||||
@@ -299,6 +300,7 @@ formatting.
|
||||
* [prettier](https://github.com/prettier/prettier)
|
||||
* [proselint](http://proselint.com/)
|
||||
* [rustywind](https://github.com/avencera/rustywind)
|
||||
* [superhtml](https://github.com/kristoff-it/superhtml)
|
||||
* [tidy](http://www.html-tidy.org/)
|
||||
* [write-good](https://github.com/btford/write-good)
|
||||
* HTML Angular
|
||||
@@ -346,6 +348,7 @@ formatting.
|
||||
* [xo](https://github.com/sindresorhus/xo)
|
||||
* Jinja
|
||||
* [djlint](https://djlint.com/)
|
||||
* [j2lint](https://github.com/aristanetworks/j2lint/)
|
||||
* JSON
|
||||
* [VSCode JSON language server](https://github.com/hrsh7th/vscode-langservers-extracted)
|
||||
* [biome](https://biomejs.dev/)
|
||||
|
||||
@@ -15,9 +15,8 @@ Execute(The default biome command should be correct):
|
||||
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': ale#Escape('biome')
|
||||
\ . ' check --write %t'
|
||||
\ . ' check --write --stdin-file-path %s'
|
||||
\ }
|
||||
|
||||
Execute(Unsafe fixes can be applied via an option):
|
||||
@@ -26,9 +25,8 @@ Execute(Unsafe fixes can be applied via an option):
|
||||
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': ale#Escape('biome')
|
||||
\ . ' check --write --unsafe %t'
|
||||
\ . ' check --write --stdin-file-path %s --unsafe'
|
||||
\ }
|
||||
|
||||
Execute(The fixer should accept options):
|
||||
@@ -37,7 +35,6 @@ Execute(The fixer should accept options):
|
||||
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': ale#Escape('biome')
|
||||
\ . ' check --write --foobar %t',
|
||||
\ . ' check --write --stdin-file-path %s --foobar',
|
||||
\ }
|
||||
|
||||
17
test/fixers/test_markdownlint_fixer_callback.vader
Normal file
17
test/fixers/test_markdownlint_fixer_callback.vader
Normal file
@@ -0,0 +1,17 @@
|
||||
Before:
|
||||
call ale#assert#SetUpFixerTest('markdown', 'markdownlint')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownFixerTest()
|
||||
|
||||
Execute:
|
||||
AssertFixer {
|
||||
\ 'command': ale#Escape('markdownlint') . ' --fix',
|
||||
\}
|
||||
|
||||
Execute:
|
||||
let g:ale_markdownlint_executable = 'custom_markdownlint'
|
||||
|
||||
AssertFixer {
|
||||
\ 'command': ale#Escape('custom_markdownlint') . ' --fix',
|
||||
\}
|
||||
@@ -1,53 +1,47 @@
|
||||
Before:
|
||||
Save g:ale_ruby_rubocop_executable
|
||||
Save g:ale_ruby_rubocop_options
|
||||
|
||||
" Use an invalid global executable, so we don't match it.
|
||||
let g:ale_ruby_rubocop_executable = 'xxxinvalid'
|
||||
let g:ale_ruby_rubocop_options = ''
|
||||
|
||||
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||
call ale#assert#SetUpFixerTest('ruby', 'rubocop')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
call ale#assert#TearDownFixerTest()
|
||||
|
||||
Execute(The rubocop callback should return the correct default values):
|
||||
call ale#test#SetFilename('../test-files/ruby/dummy.rb')
|
||||
|
||||
AssertEqual
|
||||
GivenCommandOutput ['1.61.0']
|
||||
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'process_with': 'ale#fixers#rubocop#PostProcess',
|
||||
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
||||
\ . ' --auto-correct --force-exclusion --stdin %s',
|
||||
\ },
|
||||
\ ale#fixers#rubocop#Fix(bufnr(''))
|
||||
\ . ' --auto-correct --editor-mode --force-exclusion --stdin %s',
|
||||
\ }
|
||||
|
||||
Execute(The rubocop callback should include custom rubocop options):
|
||||
let g:ale_ruby_rubocop_options = '--except Lint/Debugger'
|
||||
call ale#test#SetFilename('../test-files/ruby/with_config/dummy.rb')
|
||||
|
||||
AssertEqual
|
||||
GivenCommandOutput ['1.61.0']
|
||||
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'process_with': 'ale#fixers#rubocop#PostProcess',
|
||||
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
||||
\ . ' --except Lint/Debugger'
|
||||
\ . ' --auto-correct --force-exclusion --stdin %s',
|
||||
\ },
|
||||
\ ale#fixers#rubocop#Fix(bufnr(''))
|
||||
\ . ' --auto-correct --editor-mode --force-exclusion --stdin %s',
|
||||
\ }
|
||||
|
||||
Execute(The rubocop callback should use auto-correct-all option when set):
|
||||
let g:ale_ruby_rubocop_auto_correct_all = 1
|
||||
call ale#test#SetFilename('../test-files/ruby/with_config/dummy.rb')
|
||||
|
||||
AssertEqual
|
||||
GivenCommandOutput ['1.61.0']
|
||||
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'process_with': 'ale#fixers#rubocop#PostProcess',
|
||||
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
||||
\ . ' --auto-correct-all --force-exclusion --stdin %s'
|
||||
\ },
|
||||
\ ale#fixers#rubocop#Fix(bufnr(''))
|
||||
\ . ' --auto-correct-all --editor-mode --force-exclusion --stdin %s'
|
||||
\ }
|
||||
|
||||
Execute(The rubocop post-processor should remove diagnostics content):
|
||||
AssertEqual
|
||||
@@ -87,3 +81,16 @@ Execute(The rubocop post-processor should remove diagnostics content):
|
||||
\ ' ''forrest'',',
|
||||
\ ' ''run'']',
|
||||
\ ])
|
||||
|
||||
Execute(The rubocop callback should not use editor-mode option with older versions):
|
||||
call ale#test#SetFilename('../test-files/ruby/with_config/dummy.rb')
|
||||
|
||||
GivenCommandOutput ['1.59.0']
|
||||
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'process_with': 'ale#fixers#rubocop#PostProcess',
|
||||
\ 'command': ale#Escape(g:ale_ruby_rubocop_executable)
|
||||
\ . ' --auto-correct --force-exclusion --stdin %s'
|
||||
\ }
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ Execute(The stylelint callback should return the correct default values):
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/stylelint/bin/stylelint.js'))
|
||||
\ . ' --fix --stdin --stdin-filename %s',
|
||||
\ . ' --fix --stdin --no-color --stdin-filename %s',
|
||||
\ }
|
||||
|
||||
Execute(The stylelint callback should include custom stylelint options):
|
||||
@@ -30,5 +30,5 @@ Execute(The stylelint callback should include custom stylelint options):
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': (has('win32') ? 'node.exe ' : '')
|
||||
\ . ale#Escape(ale#path#Simplify(g:dir . '/../test-files/eslint/react-app/node_modules/stylelint/bin/stylelint.js'))
|
||||
\ . ' --cache --fix --stdin --stdin-filename %s',
|
||||
\ . ' --cache --fix --stdin --no-color --stdin-filename %s',
|
||||
\ }
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
Before:
|
||||
Save g:ale_toml_tombi_executable
|
||||
Save g:ale_toml_tombi_format_options
|
||||
Save g:ale_toml_tombi_online
|
||||
|
||||
" Use an invalid global executable, so we don't match it.
|
||||
let g:ale_toml_tombi_executable = 'xxxinvalid'
|
||||
@@ -14,13 +15,20 @@ After:
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Execute(The tombi format callback should return the correct default values):
|
||||
AssertEqual
|
||||
\ {'command': ale#Escape('xxxinvalid') . ' format'},
|
||||
\ ale#fixers#tombi_format#Fix(bufnr(''))
|
||||
|
||||
Execute(The tombi format callback should include custom options):
|
||||
let g:ale_toml_tombi_format_options = "--offline"
|
||||
|
||||
AssertEqual
|
||||
\ {'command': ale#Escape('xxxinvalid') . ' format --offline'},
|
||||
\ ale#fixers#tombi_format#Fix(bufnr(''))
|
||||
|
||||
Execute(The tombi format callback should obey `toml_tombi_online`):
|
||||
let g:ale_toml_tombi_online = 1
|
||||
|
||||
AssertEqual
|
||||
\ {'command': ale#Escape('xxxinvalid') . ' lint'},
|
||||
\ ale#fixers#tombi_lint#Fix(bufnr(''))
|
||||
|
||||
Execute(The tombi format callback should include custom options):
|
||||
let g:ale_toml_tombi_format_options = "--no-cache"
|
||||
|
||||
AssertEqual
|
||||
\ {'command': ale#Escape('xxxinvalid') . ' format --offline --no-cache'},
|
||||
\ ale#fixers#tombi_format#Fix(bufnr(''))
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
Before:
|
||||
Save g:ale_toml_tombi_executable
|
||||
Save g:ale_toml_tombi_lint_options
|
||||
Save g:ale_toml_tombi_online
|
||||
|
||||
" Use an invalid global executable, so we don't match it.
|
||||
let g:ale_toml_tombi_executable = 'xxxinvalid'
|
||||
@@ -14,13 +15,20 @@ After:
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Execute(The tombi lint callback should return the correct default values):
|
||||
AssertEqual
|
||||
\ {'command': ale#Escape('xxxinvalid') . ' lint --offline'},
|
||||
\ ale#fixers#tombi_lint#Fix(bufnr(''))
|
||||
|
||||
Execute(The tombi lint callback should obey `toml_tombi_online`):
|
||||
let g:ale_toml_tombi_online = 1
|
||||
|
||||
AssertEqual
|
||||
\ {'command': ale#Escape('xxxinvalid') . ' lint'},
|
||||
\ ale#fixers#tombi_lint#Fix(bufnr(''))
|
||||
|
||||
Execute(The tombi lint callback should include custom options):
|
||||
let g:ale_toml_tombi_lint_options = "--offline"
|
||||
let g:ale_toml_tombi_lint_options = "--no-cache"
|
||||
|
||||
AssertEqual
|
||||
\ {'command': ale#Escape('xxxinvalid') . ' lint --offline'},
|
||||
\ {'command': ale#Escape('xxxinvalid') . ' lint --offline --no-cache'},
|
||||
\ ale#fixers#tombi_lint#Fix(bufnr(''))
|
||||
|
||||
47
test/fixers/test_unimport_fixer_callback.vader
Normal file
47
test/fixers/test_unimport_fixer_callback.vader
Normal file
@@ -0,0 +1,47 @@
|
||||
Before:
|
||||
call ale#assert#SetUpFixerTest('python', 'unimport')
|
||||
|
||||
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownFixerTest()
|
||||
|
||||
unlet! b:bin_dir
|
||||
|
||||
Execute(The unimport callback should return the correct default values):
|
||||
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
|
||||
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#Escape(ale#path#Simplify(g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/unimport')),
|
||||
\ }
|
||||
|
||||
Execute(Pipenv is detected when python_unimport_auto_pipenv is set):
|
||||
let g:ale_python_unimport_auto_pipenv = 1
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
|
||||
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#Escape('pipenv') . ' run unimport'
|
||||
\ }
|
||||
|
||||
Execute(Poetry is detected when python_unimport_auto_poetry is set):
|
||||
let g:ale_python_unimport_auto_poetry = 1
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
|
||||
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#Escape('poetry') . ' run unimport'
|
||||
\ }
|
||||
|
||||
Execute(uv is detected when python_unimport_auto_uv is set):
|
||||
let g:ale_python_unimport_auto_uv = 1
|
||||
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertFixer
|
||||
\ {
|
||||
\ 'command': ale#Escape('uv') . ' run unimport'
|
||||
\ }
|
||||
@@ -41,3 +41,26 @@ Execute (stylelint should complain when no configuration file is used):
|
||||
\ 'detail': join(g:error_lines, "\n"),
|
||||
\ }],
|
||||
\ ale#handlers#css#HandleStyleLintFormat(347, g:error_lines[:])
|
||||
|
||||
Execute (stylelint should complain but not blow up when SyntaxError is encountered):
|
||||
let g:error_lines = [
|
||||
\ 'SyntaxError: Unexpected token, expected "," (136:4)',
|
||||
\ ' at constructor (/home/ts-project/node_modules/@babel/parser/lib/index.js:367:19)',
|
||||
\ ' at TypeScriptParserMixin.raise (/home/ts-project/node_modules/@babel/parser/lib/index.js:6630:19)',
|
||||
\ ' at TypeScriptParserMixin.unexpected (/home/ts-project/node_modules/@babel/parser/lib/index.js:6650:16)',
|
||||
\ ' at TypeScriptParserMixin.expect (/home/ts-project/node_modules/@babel/parser/lib/index.js:6930:12)',
|
||||
\ ' at TypeScriptParserMixin.tsParseDelimitedListWorker (/home/ts-project/node_modules/@babel/parser/lib/index.js:7932:14)',
|
||||
\ ' at TypeScriptParserMixin.tsParseDelimitedList (/home/ts-project/node_modules/@babel/parser/lib/index.js:7909:25)',
|
||||
\ ' at /home/ts-project/node_modules/@babel/parser/lib/index.js:9170:19',
|
||||
\ ' at TypeScriptParserMixin.tsInTopLevelContext (/home/ts-project/node_modules/@babel/parser/lib/index.js:8834:14)',
|
||||
\ ' at /home/ts-project/node_modules/@babel/parser/lib/index.js:9168:44',
|
||||
\ ' at TypeScriptParserMixin.tsInType (/home/ts-project/node_modules/@babel/parser/lib/index.js:8841:14)',
|
||||
\]
|
||||
|
||||
AssertEqual
|
||||
\ [{
|
||||
\ 'lnum': 1,
|
||||
\ 'text': 'stylelint exception thrown (type :ALEDetail for more information)',
|
||||
\ 'detail': join(g:error_lines, "\n"),
|
||||
\ }],
|
||||
\ ale#handlers#css#HandleStyleLintFormat(347, g:error_lines[:])
|
||||
|
||||
33
test/linter/test_css_stylelint.vader
Normal file
33
test/linter/test_css_stylelint.vader
Normal file
@@ -0,0 +1,33 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('css', 'stylelint')
|
||||
unlet! b:executable
|
||||
|
||||
After:
|
||||
unlet! b:executable
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(node_modules directories should be discovered):
|
||||
call ale#test#SetFilename('../test-files/stylelint/nested/testfile.css')
|
||||
|
||||
let b:executable = ale#path#Simplify(
|
||||
\ g:dir
|
||||
\ . '/../test-files/stylelint/node_modules/.bin/stylelint'
|
||||
\)
|
||||
|
||||
AssertLinter b:executable, ale#Escape(b:executable) . ' --no-color --stdin-filename %s'
|
||||
|
||||
Execute(The global override should work):
|
||||
let b:ale_css_stylelint_executable = 'foobar'
|
||||
let b:ale_css_stylelint_use_global = 1
|
||||
|
||||
call ale#test#SetFilename('../test-files/stylelint/nested/testfile.css')
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' --no-color --stdin-filename %s'
|
||||
|
||||
Execute(Extra options should be configurable):
|
||||
call ale#test#SetFilename('../test-files/dummy')
|
||||
|
||||
let b:ale_css_stylelint_options = '--configFile ''/absolute/path/to/file'''
|
||||
|
||||
AssertLinter 'stylelint',
|
||||
\ ale#Escape('stylelint') . ' --configFile ''/absolute/path/to/file'' --no-color --stdin-filename %s'
|
||||
20
test/linter/test_elixir_expert.vader
Normal file
20
test/linter/test_elixir_expert.vader
Normal file
@@ -0,0 +1,20 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('elixir', 'expert')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(should set correct defaults):
|
||||
AssertLinter 'expert', ale#Escape('expert')
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let b:ale_elixir_expert_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar')
|
||||
|
||||
Execute(should set correct LSP values):
|
||||
call ale#test#SetFilename('../test-files/elixir/umbrella_project/apps/app1/lib/app.ex')
|
||||
|
||||
AssertLSPLanguage 'elixir'
|
||||
AssertLSPOptions {}
|
||||
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/elixir/umbrella_project')
|
||||
@@ -37,7 +37,7 @@ Execute(node_modules directories should be discovered):
|
||||
|
||||
AssertEqual b:executable, ale_linters#html#stylelint#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
\ ale#Escape(b:executable) . ' --stdin-filename %s',
|
||||
\ ale#Escape(b:executable) . ' --no-color --stdin-filename %s',
|
||||
\ ale_linters#html#stylelint#GetCommand(bufnr(''))
|
||||
|
||||
Execute(The global override should work):
|
||||
@@ -48,7 +48,7 @@ Execute(The global override should work):
|
||||
|
||||
AssertEqual 'foobar', ale_linters#html#stylelint#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
\ ale#Escape('foobar') . ' --stdin-filename %s',
|
||||
\ ale#Escape('foobar') . ' --no-color --stdin-filename %s',
|
||||
\ ale_linters#html#stylelint#GetCommand(bufnr(''))
|
||||
|
||||
Execute(Extra options should be configurable):
|
||||
@@ -56,5 +56,5 @@ Execute(Extra options should be configurable):
|
||||
|
||||
AssertEqual 'stylelint', ale_linters#html#stylelint#GetExecutable(bufnr(''))
|
||||
AssertEqual
|
||||
\ ale#Escape('stylelint') . ' --whatever --stdin-filename %s',
|
||||
\ ale#Escape('stylelint') . ' --whatever --no-color --stdin-filename %s',
|
||||
\ ale_linters#html#stylelint#GetCommand(bufnr(''))
|
||||
|
||||
56
test/linter/test_j2lint.vader
Normal file
56
test/linter/test_j2lint.vader
Normal file
@@ -0,0 +1,56 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('jinja', 'j2lint')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The pycodestyle command callback should allow options):
|
||||
let g:ale_jinja_j2lint_options = '--exclude=test*.j2'
|
||||
|
||||
AssertLinter 'j2lint',
|
||||
\ ale#Escape('j2lint') . ' --exclude=test*.j2 %t'
|
||||
|
||||
Execute(The j2lint executable should be configurable):
|
||||
let g:ale_jinja_j2lint_executable = '~/.local/bin/j2lint'
|
||||
|
||||
AssertLinter '~/.local/bin/j2lint',
|
||||
\ ale#Escape('~/.local/bin/j2lint'). ' %t'
|
||||
|
||||
Execute(Setting executable to 'pipenv' appends 'run j2lint'):
|
||||
let g:ale_jinja_j2lint_executable = 'path/to/pipenv'
|
||||
|
||||
AssertLinter 'path/to/pipenv',
|
||||
\ ale#Escape('path/to/pipenv') . ' run j2lint %t'
|
||||
|
||||
Execute(Pipenv is detected when jinja_j2lint_auto_pipenv is set):
|
||||
let g:ale_jinja_j2lint_auto_pipenv = 1
|
||||
call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
|
||||
|
||||
AssertLinter 'pipenv',
|
||||
\ ale#Escape('pipenv') . ' run j2lint %t'
|
||||
|
||||
Execute(Setting executable to 'poetry' appends 'run j2lint'):
|
||||
let g:ale_jinja_j2lint_executable = 'path/to/poetry'
|
||||
|
||||
AssertLinter 'path/to/poetry',
|
||||
\ ale#Escape('path/to/poetry') . ' run j2lint %t'
|
||||
|
||||
Execute(Poetry is detected when jinja_j2lint_auto_poetry is set):
|
||||
let g:ale_jinja_j2lint_auto_poetry = 1
|
||||
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
|
||||
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run j2lint %t'
|
||||
|
||||
Execute(Setting executable to 'uv' appends 'run j2lint'):
|
||||
let g:ale_jinja_j2lint_executable = 'path/to/uv'
|
||||
|
||||
AssertLinter 'path/to/uv',
|
||||
\ ale#Escape('path/to/uv') . ' run j2lint %t'
|
||||
|
||||
Execute(uv is detected when jinja_j2lint_auto_uv is set):
|
||||
let g:ale_jinja_j2lint_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
AssertLinter 'uv',
|
||||
\ ale#Escape('uv') . ' run j2lint %t'
|
||||
@@ -14,7 +14,7 @@ Execute(node_modules directories should be discovered):
|
||||
\ . '/../test-files/stylelint/node_modules/.bin/stylelint'
|
||||
\)
|
||||
|
||||
AssertLinter b:executable, ale#Escape(b:executable) . ' --stdin-filename %s'
|
||||
AssertLinter b:executable, ale#Escape(b:executable) . ' --no-color --stdin-filename %s'
|
||||
|
||||
Execute(The global override should work):
|
||||
let b:ale_less_stylelint_executable = 'foobar'
|
||||
@@ -22,11 +22,11 @@ Execute(The global override should work):
|
||||
|
||||
call ale#test#SetFilename('../test-files/stylelint/nested/testfile.less')
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' --stdin-filename %s'
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' --no-color --stdin-filename %s'
|
||||
|
||||
Execute(Extra options should be configurable):
|
||||
let b:ale_less_stylelint_options = '--whatever'
|
||||
call ale#test#SetFilename('../test-files/dummy')
|
||||
|
||||
AssertLinter 'stylelint',
|
||||
\ ale#Escape('stylelint') . ' --whatever --stdin-filename %s'
|
||||
\ ale#Escape('stylelint') . ' --whatever --no-color --stdin-filename %s'
|
||||
|
||||
@@ -59,6 +59,13 @@ Execute(project with level set to 3):
|
||||
AssertLinter 'phpstan',
|
||||
\ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat json -l ' . ale#Escape('3') . ' %s'
|
||||
|
||||
Execute(project with level set to 0):
|
||||
call ale#test#SetFilename('phpstan-test-files/foo/test.php')
|
||||
let g:ale_php_phpstan_level = 0
|
||||
|
||||
AssertLinter 'phpstan',
|
||||
\ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat json -l ' . ale#Escape('0') . ' %s'
|
||||
|
||||
Execute(Custom phpstan configuration file):
|
||||
let g:ale_php_phpstan_configuration = 'phpstan_config'
|
||||
|
||||
@@ -95,6 +102,17 @@ Execute(Configuration dist file exists in current directory):
|
||||
\ ]
|
||||
AssertLinterCwd g:dir
|
||||
|
||||
Execute(Configuration alternative dist file exists in current directory):
|
||||
call writefile(['parameters:', ' level: 7'], './phpstan.dist.neon')
|
||||
let g:ale_php_phpstan_level = ''
|
||||
let g:ale_php_phpstan_configuration = ''
|
||||
|
||||
AssertLinter 'phpstan', [
|
||||
\ ale#Escape('phpstan') . ' --version',
|
||||
\ ale#Escape('phpstan') . ' analyze --no-progress --errorFormat json %s'
|
||||
\ ]
|
||||
AssertLinterCwd g:dir
|
||||
|
||||
Execute(Configuration file exists in current directory, but force phpstan level):
|
||||
call writefile(['parameters:', ' level: 7'], './phpstan.neon')
|
||||
let g:ale_php_phpstan_configuration = ''
|
||||
|
||||
@@ -8,7 +8,10 @@ Execute(The pymarkdown command callback should return default string):
|
||||
AssertLinter 'pymarkdown', ale#Escape('pymarkdown') . ' scan-stdin'
|
||||
|
||||
Execute(The pycodestyle command callback should allow options):
|
||||
let g:markdown_pymarkdown_options = '--exclude=test*.py'
|
||||
let g:ale_markdown_pymarkdown_options = '--exclude=test*.py'
|
||||
|
||||
AssertLinter 'pymarkdown',
|
||||
\ ale#Escape('pymarkdown') . ' --exclude=test*.py scan-stdin'
|
||||
|
||||
Execute(The pymarkdown executable should be configurable):
|
||||
let g:ale_markdown_pymarkdown_executable = '~/.local/bin/pymarkdown'
|
||||
@@ -42,6 +45,12 @@ Execute(Poetry is detected when markdown_pymarkdown_auto_poetry is set):
|
||||
AssertLinter 'poetry',
|
||||
\ ale#Escape('poetry') . ' run pymarkdown scan-stdin'
|
||||
|
||||
Execute(Setting executable to 'uv' appends 'run pymarkdown'):
|
||||
let g:ale_markdown_pymarkdown_executable = 'path/to/uv'
|
||||
|
||||
AssertLinter 'path/to/uv',
|
||||
\ ale#Escape('path/to/uv') . ' run pymarkdown scan-stdin'
|
||||
|
||||
Execute(uv is detected when markdown_pymarkdown_auto_uv is set):
|
||||
let g:ale_markdown_pymarkdown_auto_uv = 1
|
||||
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
|
||||
|
||||
@@ -14,7 +14,7 @@ Execute(node_modules directories should be discovered):
|
||||
\ . '/../test-files/stylelint/node_modules/.bin/stylelint'
|
||||
\)
|
||||
|
||||
AssertLinter b:executable, ale#Escape(b:executable) . ' --stdin-filename %s'
|
||||
AssertLinter b:executable, ale#Escape(b:executable) . ' --no-color --stdin-filename %s'
|
||||
|
||||
Execute(The global override should work):
|
||||
let b:ale_scss_stylelint_executable = 'foobar'
|
||||
@@ -22,7 +22,7 @@ Execute(The global override should work):
|
||||
|
||||
call ale#test#SetFilename('../test-files/stylelint/nested/testfile.scss')
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' --stdin-filename %s'
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' --no-color --stdin-filename %s'
|
||||
|
||||
Execute(Extra options should be configurable):
|
||||
call ale#test#SetFilename('../test-files/dummy')
|
||||
@@ -30,4 +30,4 @@ Execute(Extra options should be configurable):
|
||||
let b:ale_scss_stylelint_options = '--configFile ''/absolute/path/to/file'''
|
||||
|
||||
AssertLinter 'stylelint',
|
||||
\ ale#Escape('stylelint') . ' --configFile ''/absolute/path/to/file'' --stdin-filename %s'
|
||||
\ ale#Escape('stylelint') . ' --configFile ''/absolute/path/to/file'' --no-color --stdin-filename %s'
|
||||
|
||||
@@ -14,7 +14,7 @@ Execute(node_modules directories should be discovered):
|
||||
\ . '/../test-files/stylelint/node_modules/.bin/stylelint'
|
||||
\)
|
||||
|
||||
AssertLinter b:executable, ale#Escape(b:executable) . ' --syntax=sugarss --stdin-filename %s'
|
||||
AssertLinter b:executable, ale#Escape(b:executable) . ' --syntax=sugarss --no-color --stdin-filename %s'
|
||||
|
||||
Execute(The global override should work):
|
||||
let b:ale_sugarss_stylelint_executable = 'foobar'
|
||||
@@ -22,7 +22,7 @@ Execute(The global override should work):
|
||||
|
||||
call ale#test#SetFilename('../test-files/stylelint/nested/testfile.sss')
|
||||
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' --syntax=sugarss --stdin-filename %s'
|
||||
AssertLinter 'foobar', ale#Escape('foobar') . ' --syntax=sugarss --no-color --stdin-filename %s'
|
||||
|
||||
Execute(Extra options should be configurable):
|
||||
call ale#test#SetFilename('../test-files/dummy')
|
||||
@@ -30,4 +30,4 @@ Execute(Extra options should be configurable):
|
||||
let b:ale_sugarss_stylelint_options = '--configFile ''/absolute/path/to/file'''
|
||||
|
||||
AssertLinter 'stylelint',
|
||||
\ ale#Escape('stylelint') . ' --configFile ''/absolute/path/to/file'' --syntax=sugarss --stdin-filename %s'
|
||||
\ ale#Escape('stylelint') . ' --configFile ''/absolute/path/to/file'' --syntax=sugarss --no-color --stdin-filename %s'
|
||||
|
||||
29
test/linter/test_superhtml.vader
Normal file
29
test/linter/test_superhtml.vader
Normal file
@@ -0,0 +1,29 @@
|
||||
Before:
|
||||
call ale#assert#SetUpLinterTest('html', 'superhtml')
|
||||
call ale#test#SetFilename('test.html')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'superhtml',
|
||||
\ ale#Escape('superhtml') . ' check --stdin'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let g:ale_html_superhtml_executable = '/usr/local/bin/superhtml'
|
||||
|
||||
AssertLinter '/usr/local/bin/superhtml',
|
||||
\ ale#Escape('/usr/local/bin/superhtml') . ' check --stdin'
|
||||
|
||||
Execute(The options should be configurable):
|
||||
let g:ale_html_superhtml_options = '--some-option'
|
||||
|
||||
AssertLinter 'superhtml',
|
||||
\ ale#Escape('superhtml') . ' check --stdin'
|
||||
|
||||
Execute(The use_global option should be respected):
|
||||
let g:ale_html_superhtml_executable = 'custom_superhtml'
|
||||
let g:ale_html_superhtml_use_global = 1
|
||||
|
||||
AssertLinter 'custom_superhtml',
|
||||
\ ale#Escape('custom_superhtml') . ' check --stdin'
|
||||
@@ -1,10 +1,16 @@
|
||||
Before:
|
||||
Save g:ale_toml_tombi_online
|
||||
call ale#assert#SetUpLinterTest('toml', 'tombi')
|
||||
|
||||
After:
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default executable path should be correct):
|
||||
AssertLinter 'tombi', ale#Escape('tombi') . ' lsp --offline'
|
||||
|
||||
Execute(The default executable path should obey `toml_tombi_online`):
|
||||
let g:ale_toml_tombi_online = 1
|
||||
|
||||
AssertLinter 'tombi', ale#Escape('tombi') . ' lsp'
|
||||
|
||||
Execute(The project root should be detected correctly with a configuration file):
|
||||
|
||||
Reference in New Issue
Block a user