Compare commits

...

16 Commits

Author SHA1 Message Date
yoan667
ca1da76d5e add markdownlint fixer for markdown (#5066)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
2025-11-22 21:16:50 +09:00
pmonson711
962a932ed4 add support for expert (#5036)
* add support for expert

* Refactor elixir expert linter from feedback

- Simplify configuration by removing executable lookup logic
- Update documentation to reflect current configuration options
- Rename test file and update assertions for the new configuration

* default to expert for the lsp

The install instructions included something I missed. It includes a
global install, where the default executable is just `expert`. I'll
default to that and review if I should should add a configuration for a
global config.

---------

Co-authored-by: Your Name <pmonson711@nfiindustries.com>
2025-11-22 21:15:52 +09:00
yoan667
395d9fa2aa Add SuperHTML linter for HTML (#5055) 2025-11-22 21:15:28 +09:00
FouMalade
5f286eb909 add unimport fixer (#5068) 2025-11-22 21:14:57 +09:00
FouMalade
1f0f9ef28d fix option pymarkdown linter (#5060) 2025-11-22 21:12:51 +09:00
FouMalade
e56b55b65d Fix j2lint linter (#5065)
* fix option pymarkdown linter

* fix-j2lint-linter
2025-11-22 21:12:18 +09:00
Albert Peschar
260c756a9b biome: use --stdin-file-path for fixer (#5051) 2025-11-22 21:03:14 +09:00
Ben Boeckel
86d8ada5cb tombi: support toml_tombi_online flag to control remote schema fetching (#5032) 2025-11-22 21:02:24 +09:00
Steve Matney
de2d3da738 Adding --no-color flag to stylelint args (#5050)
* Adding --no-color flag to sass stylelint

* Adding --no-color to all stylelint args

* Adding --no-color expectation to stylelint tests

* Properly handling SyntaxError for stylelint; adding corresponding test

* Fixing CSS stylelint parameters and adding regression test
2025-11-22 21:00:41 +09:00
rymdbar
b9d7f56471 Use FindNearestFileOrDirectory, perl languageserver (#5038)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
Update to use mentioned function to find both .git/ directories and .git
worktree files.

Co-authored-by: cos <cos>
2025-10-28 21:16:17 +09:00
rymdbar
6d8e4a641c Make documentation mirror custom_linting_rules (#5056)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
Co-authored-by: cos <cos>
2025-10-27 21:56:35 +09:00
Nicolas Derumigny
d2f4090c33 doc(slang): fix minor typo (#5047)
Some checks failed
CI / build_image (push) Has been cancelled
CI / test_ale (--linters-only) (push) Has been cancelled
CI / test_ale (--lua-only) (push) Has been cancelled
CI / test_ale (--neovim-07-only) (push) Has been cancelled
CI / test_ale (--neovim-08-only) (push) Has been cancelled
CI / test_ale (--vim-80-only) (push) Has been cancelled
CI / test_ale (--vim-90-only) (push) Has been cancelled
2025-10-26 16:16:04 +09:00
Bill Ruddock
59c6b4f7b0 phpstan: support config phpstan.dist.neon (#5052)
phpstan will load config from (in order) phpstan.neon, phpstan.neon.dist, or
phpstan.dist.neon.
2025-10-26 15:55:40 +09:00
Bill Ruddock
21d5de18b2 fix phpstan: use configured level 0 (#5053)
Use configured g:ale_php_phpstan_level if it is 0 (as a number rather
than string).

0 (number) is considered to be empty, but '0' (string) is not.
2025-10-26 15:51:03 +09:00
Max Jacobson
ed26d1f1d9 Add --editor-mode flag when invoking rubocop (#5049)
* Add --editor-mode flag when invoking rubocop

Since RuboCop 1.61.0 (released in February 2024), RuboCop accepts an
`--editor-mode` flag which improves editor integrations like ale.

Some of RuboCop's auto-corrections can be surprising or annoying to run
on save. When RuboCop is running via an LSP or when the `--editor-mode`
flag is passed, it will understand that it is running in an editor, and
it will hold off on making changes that might be surprising or annoying.

For example, if I write

```ruby
def call
  results = some_process
end
```

This has an unused variable, and RuboCop will remove the unused variable
when you run it. However, if you're in the middle of editing, you may
not want it to remove that unused variable, because you may be about to
add a usage of it.

More context:

- PR which introduced it: https://github.com/rubocop/rubocop/pull/12682
- Release notes for 1.61: https://github.com/rubocop/rubocop/releases/tag/v1.61.0
- Docs: https://docs.rubocop.org/rubocop/1.80/configuration.html#contextual

This will be a breaking change for anyone who is running an old version
of RuboCop, because the flag will not exist for them. If they would like
to opt out of this change, they can set an option to omit the flag. I
think this ought to be enabled by default so that people will get this
benefit out of the box.

In the meantime, I am opting into this behavior by setting this option:

```vim
let g:ale_ruby_rubocop_options = "--editor-mode"
```

So I appreciate that this seam was already introduced.

* Make this a non-breaking change

This will detect the current rubocop version and auto-enable
--editor-mode for newer version of rubocop without affecting users of
older versions of rubocop.
2025-10-26 15:14:30 +09:00
FouMalade
9811114948 Add j2lint linter for Jinja2 templates (#5048)
Co-authored-by: Nicolas SCHMAUCH <nic.schmauch@i-0330135t.ac-bordeaux.fr>
2025-10-26 14:54:22 +09:00
51 changed files with 638 additions and 83 deletions

View File

@@ -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', {

View 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'),
\})

View File

@@ -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', {

View 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',
\})

View 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',
\})

View File

@@ -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', {

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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',
\})

View File

@@ -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', {

View File

@@ -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', {

View File

@@ -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', {

View File

@@ -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'),
\})

View File

@@ -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.

View File

@@ -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

View 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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View 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

View File

@@ -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

View File

@@ -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

View File

@@ -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:

View File

@@ -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*

View File

@@ -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:

View File

@@ -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`

View File

@@ -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*

View File

@@ -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: `''`

View File

@@ -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|

View File

@@ -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/)

View File

@@ -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',
\ }

View 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',
\}

View File

@@ -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'
\ }

View File

@@ -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',
\ }

View File

@@ -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(''))

View File

@@ -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(''))

View 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'
\ }

View File

@@ -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[:])

View 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'

View 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')

View File

@@ -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(''))

View 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'

View File

@@ -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'

View File

@@ -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 = ''

View File

@@ -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')

View File

@@ -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'

View File

@@ -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'

View 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'

View File

@@ -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):