Compare commits

..

22 Commits

Author SHA1 Message Date
Adrian Vollmer
8eb4803da9 Add pymarkdown fixer (#5045)
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-12-21 18:34:05 +09:00
John Jackson
0360a73644 Add ReScript support (#5072)
This adds support for both rescript format and rescript-language-server.

Closes https://github.com/dense-analysis/ale/issues/3335
2025-12-21 18:25:42 +09:00
bretello
dd6e6f1b15 ALEFindReferences: add -fzf flag to show output in fzf (#5018)
* references: add ALEFindReferences -fzf option

Allows using -fzf to show previews using fzf.vim. Includes:

- add support for opening in bufers, splits, tabs and for adding matches quickfix
- add support for -relative
- add fzf preview `--highlight-line` option
- add fzf.vim autoload module

* tests: fix references tests for fzf support update
2025-12-21 13:06:34 +09:00
Eric T. Johnson
fa3d4f2f13 cppcheck: don't pass source file if --project is specified (#5075)
This is no longer supported as of version 2.13.0.

Fixes: #4854
2025-12-21 12:59:13 +09:00
yoan667
710e1aac9c fix linter cppcheck (#5071) 2025-12-21 12:56:23 +09:00
rymdbar
281eb4808c Finalize #5055, adding SuperHTML linter for HTML (#5069)
Remove bogus test of non-existing g:ale_html_superhtml_options.

Co-authored-by: cos <cos>
2025-12-21 12:51:45 +09:00
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
71 changed files with 1141 additions and 128 deletions

View File

@@ -10,13 +10,18 @@ function! ale_linters#c#cppcheck#GetCommand(buffer) abort
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
\ : ''
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
" Versions >=2.13 don't allow using --project in conjunction with an
" explicit source file.
let l:source_file = stridx(l:compile_commands_option, '--project=') < 0
\ ? ' %t'
\ : ''
return '%e -q --language=c'
\ . l:template
\ . ale#Pad(l:compile_commands_option)
\ . ale#Pad(ale#Var(a:buffer, 'c_cppcheck_options'))
\ . l:buffer_path_include
\ . ' %t'
\ . l:source_file
endfunction
call ale#linter#Define('c', {

View File

@@ -10,13 +10,18 @@ function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
\ : ''
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
" Versions >=2.13 don't allow using --project in conjunction with an
" explicit source file.
let l:source_file = stridx(l:compile_commands_option, '--project=') < 0
\ ? ' %t'
\ : ''
return '%e -q --language=c++'
\ . l:template
\ . ale#Pad(l:compile_commands_option)
\ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options'))
\ . l:buffer_path_include
\ . ' %t'
\ . l:source_file
endfunction
call ale#linter#Define('cpp', {

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

@@ -0,0 +1,24 @@
" Author: John Jackson <john@johnridesa.bike>
" Description: The official language server for ReScript.
call ale#Set('rescript_language_server_executable', 'rescript-language-server')
call ale#Set(
\ 'rescript_language_server_use_global',
\ get(g:, 'ale_use_global_executables', v:true),
\ )
function! s:GetProjectRoot(buffer) abort
let l:config_file = ale#path#FindNearestFile(a:buffer, 'rescript.json')
return !empty(l:config_file) ? fnamemodify(l:config_file, ':h') : ''
endfunction
call ale#linter#Define('rescript', {
\ 'name': 'rescript_language_server',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#path#FindExecutable(b, 'rescript_language_server', [
\ 'node_modules/.bin/rescript-language-server'
\ ])},
\ 'command': '%e --stdio',
\ 'project_root': function('s:GetProjectRoot'),
\})

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'],
@@ -452,6 +457,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['markdown'],
\ 'description': 'Fix markdown files with pandoc.',
\ },
\ 'pymarkdown': {
\ 'function': 'ale#fixers#pymarkdown#Fix',
\ 'suggested_filetypes': ['markdown'],
\ 'description': 'Fix markdown files with pymarkdown.',
\ },
\ 'shfmt': {
\ 'function': 'ale#fixers#shfmt#Fix',
\ 'suggested_filetypes': ['sh'],
@@ -667,6 +677,11 @@ let s:default_registry = {
\ 'suggested_filetypes': ['racket'],
\ 'description': 'Fix Racket files with raco fmt.',
\ },
\ 'rescript_format': {
\ 'function': 'ale#fixers#rescript_format#Fix',
\ 'suggested_filetypes': ['rescript'],
\ 'description': 'Official formatter for ReScript.',
\ },
\ 'ruff': {
\ 'function': 'ale#fixers#ruff#Fix',
\ 'suggested_filetypes': ['python'],
@@ -747,6 +762,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

@@ -0,0 +1,46 @@
scriptencoding utf-8
" Author: Adrian Vollmer <adrian.vollmer@syss.de>
" Description: Fix markdown files with pymarkdown.
call ale#Set('markdown_pymarkdown_executable', 'pymarkdown')
call ale#Set('markdown_pymarkdown_options', '')
call ale#Set('markdown_pymarkdown_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('markdown_pymarkdown_auto_pipenv', 0)
call ale#Set('markdown_pymarkdown_auto_poetry', 0)
call ale#Set('markdown_pymarkdown_auto_uv', 0)
function! ale#fixers#pymarkdown#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'markdown_pymarkdown_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'markdown_pymarkdown_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'markdown_pymarkdown_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'markdown_pymarkdown', ['pymarkdown'])
endfunction
function! ale#fixers#pymarkdown#Fix(buffer) abort
let l:executable = ale#fixers#pymarkdown#GetExecutable(a:buffer)
let l:options = ale#Var(a:buffer, 'markdown_pymarkdown_options')
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run pymarkdown'
\ : ''
return {
\ 'command': ale#Escape(l:executable) . l:exec_args
\ . ' fix'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' %t',
\ 'read_temporary_file': 1,
\}
endfunction

View File

@@ -0,0 +1,33 @@
" Author: John Jackson <john@johnridesa.bike>
" Description: Fix ReScript files with the ReScript formatter.
call ale#Set('rescript_format_executable', 'rescript')
call ale#Set(
\ 'rescript_format_use_global',
\ get(g:, 'ale_use_global_executables', v:false)
\ )
function! s:GetExecutable(buffer) abort
return ale#path#FindExecutable(a:buffer, 'rescript_format', [
\ 'node_modules/.bin/rescript',
\])
endfunction
function! s:FixWithVersion(buffer, version) abort
let l:exe = ale#Escape(s:GetExecutable(a:buffer))
let l:stdin = ale#semver#GTE(a:version, [12, 0, 0]) ? ' --stdin' : ' -stdin'
let l:ext = fnamemodify(bufname(a:buffer), ':e') is? 'resi'
\ ? ' .resi'
\ : ' .res'
return {'command': l:exe . ' format' . l:stdin . l:ext}
endfunction
function! ale#fixers#rescript_format#Fix(buffer) abort
return ale#semver#RunWithVersionCheck(
\ a:buffer,
\ s:GetExecutable(a:buffer),
\ '%e --version',
\ function('s:FixWithVersion'),
\)
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),
\ '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

85
autoload/ale/fzf.vim Normal file
View File

@@ -0,0 +1,85 @@
" Author: bretello https://github.com/bretello
" Description: Functions for integrating with fzf
" Handle references found with ALEFindReferences using fzf
function! ale#fzf#ShowReferences(item_list, options) abort
let l:name = 'LSP References'
let l:capname = 'References'
let l:items = copy(a:item_list)
let l:cwd = getcwd() " no-custom-checks
let l:sep = has('win32') ? '\' : '/'
function! s:relative_paths(line) closure abort
return substitute(a:line, '^' . l:cwd . l:sep, '', '')
endfunction
if get(a:options, 'use_relative_paths')
let l:items = map(filter(l:items, 'len(v:val)'), 's:relative_paths(v:val)')
endif
let l:start_query = ''
let l:fzf_options = {
\ 'source': items,
\ 'options': ['--prompt', l:name.'> ', '--query', l:start_query,
\ '--multi', '--bind', 'alt-a:select-all,alt-d:deselect-all',
\ '--delimiter', ':', '--preview-window', '+{2}/2']
\}
call add(l:fzf_options['options'], '--highlight-line') " this only works for more recent fzf versions (TODO: handle version check?)
" wrap with #with_preview and #fzfwrap before adding the sinklist,
" otherwise --expect options are not added
let l:opts_with_preview = fzf#vim#with_preview(l:fzf_options)
let l:bang = 0 " TODO: handle bang
let l:wrapped = fzf#wrap(l:name, l:opts_with_preview, l:bang)
call remove(l:wrapped, 'sink*') " remove the default sinklist to add in our custom sinklist
function! l:wrapped.sinklist(lines) closure abort
if len(a:lines) <2
return
endif
let l:cmd = a:lines[0]
function! s:references_to_qf(line) closure abort
" mimics ag_to_qf in junegunn/fzf.vim
let l:parts = matchlist(a:line, '\(.\{-}\)\s*:\s*\(\d\+\)\%(\s*:\s*\(\d\+\)\)\?\%(\s*:\(.*\)\)\?')
let l:filename = &autochdir ? fnamemodify(l:parts[1], ':p') : l:parts[1]
return {'filename': l:filename, 'lnum': l:parts[2], 'col': l:parts[3], 'text': l:parts[4]}
endfunction
let l:references = map(filter(a:lines[1:], 'len(v:val)'), 's:references_to_qf(v:val)')
if empty(l:references)
return
endif
if get(a:options, 'open_in') is# 'quickfix'
call setqflist([], 'r')
call setqflist(l:references, 'a')
call ale#util#Execute('cc 1')
endif
function! s:action(key, file) abort
" copied from fzf.vim
let l:default_action = {
\ 'ctrl-t': 'tab split',
\ 'ctrl-x': 'split',
\ 'ctrl-v': 'vsplit' }
let fzf_actions = get(g:, 'fzf_action', l:default_action)
let l:Cmd = get(fzf_actions, a:key, 'edit')
let l:cursor_cmd = escape('call cursor(' . a:file['lnum'] . ',' . a:file['col'] . ')', ' ')
let l:fullcmd = l:Cmd . ' +' . l:cursor_cmd . ' ' . fnameescape(a:file['filename'])
silent keepjumps keepalt execute fullcmd
endfunction
return map(l:references, 's:action(cmd, v:val)')
endfunction
call fzf#run(l:wrapped)
endfunction

View File

@@ -69,11 +69,12 @@ function! ale#handlers#cppcheck#HandleCppCheckFormat(buffer, lines) abort
"test.c:1:16: style: misra violation (use --rule-texts=<file> to get proper output) [misra-c2012-2.7]\'
"void test( int parm ) {}
" ^
let l:pattern = '\v(\f+):(\d+):(\d+|\{column\}): (\w+):(\{inconclusive:inconclusive\})? ?(.*) \[(%(\w[-.]?)+)\]\'
let l:pattern = '\v(\f+):(\d+):(\d+|\{column\}): (\w+):(\{inconclusive:inconclusive\})? ?(.*) \[(%(\w[-.]?)+)\]\\?'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
if ale#path#IsBufferPath(a:buffer, l:match[1])
let l:text = substitute(l:match[6], '\\$', '', '')
call add(l:output, {
\ 'lnum': str2nr(l:match[2]),
\ 'col': match(l:match[3],'{column}') >= 0 ? 1 : str2nr(l:match[3]),

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

@@ -1,5 +1,6 @@
let g:ale_default_navigation = get(g:, 'ale_default_navigation', 'buffer')
let g:ale_references_show_contents = get(g:, 'ale_references_show_contents', 1)
let g:ale_references_use_fzf = get(g:, 'ale_references_use_fzf', 0)
let s:references_map = {}
@@ -82,6 +83,16 @@ function! ale#references#FormatLSPResponseItem(response_item, options) abort
endtry
endif
if get(a:options, 'use_fzf') == 1
let l:filename = ale#util#ToResource(a:response_item.uri)
let l:nline = a:response_item.range.start.line + 1
let l:ncol = a:response_item.range.start.character + 1
" grep-style output (filename:line:col:text) so that fzf can properly
" show matches and previews using ':' as delimiter
return l:filename . ':' . l:nline . ':' . l:ncol . ':' . l:line_text
endif
if get(a:options, 'open_in') is# 'quickfix'
return {
\ 'filename': l:filename,
@@ -100,8 +111,10 @@ function! ale#references#FormatLSPResponseItem(response_item, options) abort
endfunction
function! ale#references#HandleLSPResponse(conn_id, response) abort
if has_key(a:response, 'id')
\&& has_key(s:references_map, a:response.id)
if ! (has_key(a:response, 'id') && has_key(s:references_map, a:response.id))
return
endif
let l:options = remove(s:references_map, a:response.id)
" The result can be a Dictionary item, a List of the same, or null.
@@ -119,7 +132,13 @@ function! ale#references#HandleLSPResponse(conn_id, response) abort
if empty(l:item_list)
call ale#util#Execute('echom ''No references found.''')
else
if get(l:options, 'open_in') is# 'quickfix'
if get(l:options, 'use_fzf') == 1
if !exists('*fzf#run')
throw 'fzf#run function not found. You also need Vim plugin from the main fzf repository (i.e. junegunn/fzf *and* junegunn/fzf.vim)'
endif
call ale#fzf#ShowReferences(l:item_list, l:options)
elseif get(l:options, 'open_in') is# 'quickfix'
call setqflist([], 'r')
call setqflist(l:item_list, 'a')
call ale#util#Execute('cc 1')
@@ -127,7 +146,6 @@ function! ale#references#HandleLSPResponse(conn_id, response) abort
call ale#preview#ShowSelection(l:item_list, l:options)
endif
endif
endif
endfunction
function! s:OnReady(line, column, options, linter, lsp_details) abort
@@ -165,6 +183,7 @@ function! s:OnReady(line, column, options, linter, lsp_details) abort
\ 'use_relative_paths': has_key(a:options, 'use_relative_paths') ? a:options.use_relative_paths : 0,
\ 'open_in': get(a:options, 'open_in', 'current-buffer'),
\ 'show_contents': a:options.show_contents,
\ 'use_fzf': get(a:options, 'use_fzf', g:ale_references_use_fzf),
\}
endfunction
@@ -185,6 +204,8 @@ function! ale#references#Find(...) abort
let l:options.open_in = 'quickfix'
elseif l:option is? '-contents'
let l:options.show_contents = 1
elseif l:option is? '-fzf'
let l:options.use_fzf = 1
endif
endfor
endif

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

@@ -111,6 +111,8 @@ See |ale-javascript-prettier| for information about the available options.
===============================================================================
pymarkdown *ale-markdown-pymarkdown*
pymarkdown can be used both as a linter and a fixer for Markdown files.
*ale-options.markdown_pymarkdown_executable*
*g:ale_markdown_pymarkdown_executable*
*b:ale_markdown_pymarkdown_executable*

54
doc/ale-rescript.txt Normal file
View File

@@ -0,0 +1,54 @@
===============================================================================
ALE ReScript Integration *ale-rescript-options*
===============================================================================
rescript-language-server *ale-rescript-language-server*
*ale-options.rescript_language_server_executable*
*g:ale_rescript_language_server_executable*
*b:ale_rescript_language_server_executable*
ale_rescript_language_server_executable
g:ale_rescript_language_server_executable
Type: |String|
Default: `'rescript-language-server'`
See |ale-integrations-local-executables|
*ale-options.rescript_language_server_use_global*
*g:ale_rescript_language_server_use_global*
*b:ale_rescript_language_server_use_global*
rescript_language_server_use_global
g:ale_rescript_language_server_use_global
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', v:true)`
See |ale-integrations-local-executables|
===============================================================================
rescript_format *ale-rescript-format*
*ale-options.rescript_format_executable*
*g:ale_rescript_format_executable*
*b:ale_rescript_format_executable*
rescript_format_executable
g:ale_rescript_format_executable
Type: |String|
Default: `'rescript'`
See |ale-integrations-local-executables|
*ale-options.rescript_format_use_global*
*g:ale_rescript_format_use_global*
*b:ale_rescript_format_use_global*
rescript_format_use_global
g:ale_rescript_format_use_global
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', v:false)`
See |ale-integrations-local-executables|
===============================================================================
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`
@@ -579,6 +582,9 @@ Notes:
* `cspell`
* `opacheck`
* `opafmt`
* ReScript
* `rescript-language-server`
* `rescript_format`
* REST
* kulala_fmt
* reStructuredText

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

@@ -2280,6 +2280,16 @@ g:ale_references_show_contents
If set to `true` or `1`, matches found by `:ALEFindReferences` will be
shown with a preview of the matching line.
*ale-options.references_use_fzf*
*g:ale_references_use_fzf*
references_use_fzf
g:ale_references_use_fzf
Type: |Boolean| or |Number|
Default: `false`
If set to `true` or `1`, matches found by `:ALEFindReferences` will be
always shown using |fzf-vim| (https://github.com/junegunn/fzf.vim).
*ale-options.rename_tsserver_find_in_comments*
*g:ale_rename_tsserver_find_in_comments*
rename_tsserver_find_in_comments
@@ -3490,6 +3500,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 +3597,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 +3646,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|
@@ -3849,6 +3862,9 @@ documented in additional help files.
cspell................................|ale-rego-cspell|
opacheck..............................|ale-rego-opa-check|
opafmt................................|ale-rego-opa-fmt-fixer|
rescript................................|ale-rescript-options|
rescript-language-server..............|ale-rescript-language-server|
rescript_format.......................|ale-rescript-format|
rest....................................|ale-rest-options|
kulala_fmt............................|ale-rest-kulala_fmt|
restructuredtext........................|ale-restructuredtext-options|
@@ -4082,6 +4098,7 @@ documented in additional help files.
`:ALEFindReferences -vsplit` - Open the location in a vertical split.
`:ALEFindReferences -quickfix` - Put the locations into quickfix list.
`:ALEFindReferences -contents` - Show line contents for matches.
`:ALEFindReferences -fzf` - Show matches/previews using |fzf-vim|.
The default method used for navigating to a new location can be changed
by modifying |g:ale_default_navigation|.
@@ -4089,6 +4106,11 @@ documented in additional help files.
The default behaviour on whether to show line content for matches can
be changed by modifying |g:ale_references_show_contents|.
The default behaviour on whether to use `fzf` to show matches/file previews
can be changed by modifying |g:ale_references_use_fzf|. `-fzf` can be combined
with `-tab`, `-split`, `-vsplit`, `-quickfix` and `-relative`, while line
contents/file previews are always shown.
You can add `-relative` to the command to view results with relatives paths,
instead of absolute paths. This option has no effect if `-quickfix` is used.

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/)
@@ -418,7 +421,7 @@ formatting.
* [pandoc](https://pandoc.org)
* [prettier](https://github.com/prettier/prettier)
* [proselint](http://proselint.com/)
* [pymarkdown](https://github.com/jackdewinter/pymarkdown)
* [pymarkdown](https://github.com/jackdewinter/pymarkdown) :floppy_disk:
* [redpen](http://redpen.cc/)
* [remark-lint](https://github.com/wooorm/remark-lint)
* [textlint](https://textlint.github.io/)
@@ -589,6 +592,9 @@ formatting.
* [cspell](https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell)
* [opacheck](https://www.openpolicyagent.org/docs/latest/cli/#opa-check)
* [opafmt](https://www.openpolicyagent.org/docs/latest/cli/#opa-fmt)
* ReScript
* [rescript-language-server](https://www.npmjs.com/package/@rescript/language-server) :speech_balloon:
* [rescript_format](https://rescript-lang.org/)
* REST
* [kulala_fmt](https://github.com/mistweaverco/kulala-fmt)
* reStructuredText

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

@@ -0,0 +1,81 @@
Before:
Save g:ale_markdown_pymarkdown_executable
Save g:ale_markdown_pymarkdown_options
Save g:ale_markdown_pymarkdown_auto_pipenv
Save g:ale_markdown_pymarkdown_auto_poetry
Save g:ale_markdown_pymarkdown_auto_uv
After:
Restore
Execute(The pymarkdown callback should return 'pymarkdown' as default command):
AssertEqual
\ {
\ 'command': ale#Escape('pymarkdown') . ' fix %t',
\ 'read_temporary_file': 1,
\ },
\ ale#fixers#pymarkdown#Fix(bufnr(''))
Execute(The pymarkdown executable and options should be configurable):
let g:ale_markdown_pymarkdown_executable = 'foobar'
let g:ale_markdown_pymarkdown_options = '--some-option'
AssertEqual
\ {
\ 'command': ale#Escape('foobar') . ' fix --some-option %t',
\ 'read_temporary_file': 1,
\ },
\ ale#fixers#pymarkdown#Fix(bufnr(''))
Execute(Setting executable to 'pipenv' appends 'run pymarkdown'):
let g:ale_markdown_pymarkdown_executable = 'path/to/pipenv'
AssertEqual
\ {
\ 'command': ale#Escape('path/to/pipenv') . ' run pymarkdown fix %t',
\ 'read_temporary_file': 1,
\ },
\ ale#fixers#pymarkdown#Fix(bufnr(''))
Execute(Pipenv is detected when markdown_pymarkdown_auto_pipenv is set):
let g:ale_markdown_pymarkdown_auto_pipenv = 1
call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
AssertEqual
\ {
\ 'command': ale#Escape('pipenv') . ' run pymarkdown fix %t',
\ 'read_temporary_file': 1,
\ },
\ ale#fixers#pymarkdown#Fix(bufnr(''))
Execute(Setting executable to 'poetry' appends 'run pymarkdown'):
let g:ale_markdown_pymarkdown_executable = 'path/to/poetry'
AssertEqual
\ {
\ 'command': ale#Escape('path/to/poetry') . ' run pymarkdown fix %t',
\ 'read_temporary_file': 1,
\ },
\ ale#fixers#pymarkdown#Fix(bufnr(''))
Execute(Poetry is detected when markdown_pymarkdown_auto_poetry is set):
let g:ale_markdown_pymarkdown_auto_poetry = 1
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
AssertEqual
\ {
\ 'command': ale#Escape('poetry') . ' run pymarkdown fix %t',
\ 'read_temporary_file': 1,
\ },
\ ale#fixers#pymarkdown#Fix(bufnr(''))
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')
AssertEqual
\ {
\ 'command': ale#Escape('uv') . ' run pymarkdown fix %t',
\ 'read_temporary_file': 1,
\ },
\ ale#fixers#pymarkdown#Fix(bufnr(''))

View File

@@ -0,0 +1,46 @@
Before:
call ale#assert#SetUpFixerTest('rescript', 'rescript_format')
After:
call ale#assert#TearDownFixerTest()
Execute(The rescript callback should return the correct default values):
call ale#test#SetFilename('../test-files/rescript/testfile-noextension')
set filetype=rescript
GivenCommandOutput ['12.0.0']
AssertFixer
\ {
\ 'command':
\ ale#Escape(g:ale_rescript_format_executable) . ' format --stdin .res'
\ }
Execute(The rescript callback should correctly detect res files):
call ale#test#SetFilename('../test-files/rescript/testfile.res')
GivenCommandOutput ['12.0.0']
AssertFixer
\ {
\ 'command':
\ ale#Escape(g:ale_rescript_format_executable) . ' format --stdin .res'
\ }
Execute(The rescript callback should correctly detect resi files):
call ale#test#SetFilename('../test-files/rescript/testfile.resi')
GivenCommandOutput ['12.0.0']
AssertFixer
\ {
\ 'command':
\ ale#Escape(g:ale_rescript_format_executable) . ' format --stdin .resi'
\ }
Execute(The version check should be correct):
call ale#test#SetFilename('../test-files/rescript/testfile.res')
GivenCommandOutput ['11.0.0']
AssertFixer
\ {
\ 'command':
\ ale#Escape(g:ale_rescript_format_executable) . ' format -stdin .res'
\ }

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

@@ -25,7 +25,7 @@ Execute(cppcheck for C should detect compile_commands.json files):
\ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
\ . ' --project=' . ale#Escape('compile_commands.json')
\ . ' --file-filter=' . ale#Escape(ale#test#GetFilename(b:rel_file_path))
\ . ' --enable=style %t'
\ . ' --enable=style'
Execute(cppcheck for C should detect compile_commands.json files in build directories):
let b:rel_file_path = '../test-files/cppcheck/with_build_dir/foo.c'
@@ -37,7 +37,7 @@ Execute(cppcheck for C should detect compile_commands.json files in build direct
\ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
\ . ' --project=' . ale#Escape(ale#path#Simplify('build/compile_commands.json'))
\ . ' --file-filter=' . ale#Escape(ale#test#GetFilename(b:rel_file_path))
\ . ' --enable=style %t'
\ . ' --enable=style'
Execute(cppcheck for C should include file dir if compile_commands.json file is not found):
call ale#test#SetFilename('../test-files/cppcheck/foo.c')

View File

@@ -31,7 +31,7 @@ Execute(cppcheck for C++ should detect compile_commands.json files):
\ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
\ . ' --project=' . ale#Escape('compile_commands.json')
\ . ' --file-filter=' . ale#Escape(ale#test#GetFilename(b:rel_file_path))
\ . ' --enable=style %t'
\ . ' --enable=style'
Execute(cppcheck for C++ should detect compile_commands.json files in build directories):
let b:rel_file_path = '../test-files/cppcheck/with_build_dir/foo.cpp'
@@ -43,7 +43,7 @@ Execute(cppcheck for C++ should detect compile_commands.json files in build dire
\ . ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
\ . ' --project=' . ale#Escape(ale#path#Simplify('build/compile_commands.json'))
\ . ' --file-filter=' . ale#Escape(ale#test#GetFilename(b:rel_file_path))
\ . ' --enable=style %t'
\ . ' --enable=style'
Execute(cppcheck for C++ should include file dir if compile_commands.json file is not found):
call ale#test#SetFilename('../test-files/cppcheck/foo.cpp')

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

@@ -0,0 +1,25 @@
Before:
call ale#assert#SetUpLinterTest('rescript', 'rescript_language_server')
Save &filetype
let &filetype = 'rescript'
After:
call ale#assert#TearDownLinterTest()
Execute(The language string should be correct):
AssertLSPLanguage 'rescript'
Execute(The project root should be detected correctly):
AssertLSPProject ''
call ale#test#SetFilename('../test-files/rescript/testfile.res')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/rescript')
Execute(The command should be correct):
call ale#test#SetFilename('../test-files/rescript/testfile.res')
AssertLinter
\ 'rescript-language-server',
\ ale#Escape('rescript-language-server') . ' --stdio'

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

View File

View File

View File

View File

@@ -121,6 +121,7 @@ Execute(Results should be shown for tsserver responses):
\ 'ignorethis': 'x',
\ 'open_in': 'tab',
\ 'use_relative_paths': 1,
\ 'use_fzf': 0,
\ }
\ }
\)
@@ -283,7 +284,7 @@ Execute(tsserver reference requests should be sent):
\ [0, 'ts@references', {'file': expand('%:p'), 'line': 2, 'offset': 5}]
\ ],
\ g:message_list
AssertEqual {'42': {'show_contents': 1, 'open_in': 'current-buffer', 'use_relative_paths': 0}}, ale#references#GetMap()
AssertEqual {'42': {'show_contents': 1, 'open_in': 'current-buffer', 'use_relative_paths': 0, 'use_fzf': 0, }}, ale#references#GetMap()
Execute('-relative' argument should enable 'use_relative_paths' in HandleTSServerResponse):
runtime ale_linters/typescript/tsserver.vim
@@ -293,7 +294,7 @@ Execute('-relative' argument should enable 'use_relative_paths' in HandleTSServe
call g:InitCallback()
AssertEqual {'42': {'show_contents': 1, 'open_in': 'current-buffer', 'use_relative_paths': 1}}, ale#references#GetMap()
AssertEqual {'42': {'show_contents': 1, 'open_in': 'current-buffer', 'use_relative_paths': 1, 'use_fzf': 0}}, ale#references#GetMap()
Execute(`-tab` should display results in tabs):
runtime ale_linters/typescript/tsserver.vim
@@ -303,7 +304,7 @@ Execute(`-tab` should display results in tabs):
call g:InitCallback()
AssertEqual {'42': {'show_contents': 1, 'open_in': 'tab', 'use_relative_paths': 0}}, ale#references#GetMap()
AssertEqual {'42': {'show_contents': 1, 'open_in': 'tab', 'use_relative_paths': 0, 'use_fzf': 0}}, ale#references#GetMap()
Execute(The default navigation type should be used):
runtime ale_linters/typescript/tsserver.vim
@@ -314,7 +315,7 @@ Execute(The default navigation type should be used):
call g:InitCallback()
AssertEqual {'42': {'show_contents': 1, 'open_in': 'tab', 'use_relative_paths': 0}}, ale#references#GetMap()
AssertEqual {'42': {'show_contents': 1, 'open_in': 'tab', 'use_relative_paths': 0, 'use_fzf': 0}}, ale#references#GetMap()
Execute(`-split` should display results in splits):
runtime ale_linters/typescript/tsserver.vim
@@ -324,7 +325,7 @@ Execute(`-split` should display results in splits):
call g:InitCallback()
AssertEqual {'42': {'show_contents': 1, 'open_in': 'split', 'use_relative_paths': 0}}, ale#references#GetMap()
AssertEqual {'42': {'show_contents': 1, 'open_in': 'split', 'use_relative_paths': 0, 'use_fzf': 0}}, ale#references#GetMap()
Execute(`-vsplit` should display results in vsplits):
runtime ale_linters/typescript/tsserver.vim
@@ -334,7 +335,7 @@ Execute(`-vsplit` should display results in vsplits):
call g:InitCallback()
AssertEqual {'42': {'show_contents': 1, 'open_in': 'vsplit', 'use_relative_paths': 0}}, ale#references#GetMap()
AssertEqual {'42': {'show_contents': 1, 'open_in': 'vsplit', 'use_relative_paths': 0, 'use_fzf': 0}}, ale#references#GetMap()
Execute(`-quickfix` should display results in quickfix):
runtime ale_linters/typescript/tsserver.vim
@@ -344,7 +345,7 @@ Execute(`-quickfix` should display results in quickfix):
call g:InitCallback()
AssertEqual {'42': {'show_contents': 1, 'open_in': 'quickfix', 'use_relative_paths': 0}}, ale#references#GetMap()
AssertEqual {'42': {'show_contents': 1, 'open_in': 'quickfix', 'use_relative_paths': 0, 'use_fzf': 0}}, ale#references#GetMap()
Given python(Some Python file):
foo
@@ -627,7 +628,7 @@ Execute(LSP reference requests should be sent):
\ ],
\ g:message_list
AssertEqual {'42': {'show_contents': 1, 'open_in': 'current-buffer', 'use_relative_paths': 0}}, ale#references#GetMap()
AssertEqual {'42': {'show_contents': 1, 'open_in': 'current-buffer', 'use_relative_paths': 0, 'use_fzf': 0}}, ale#references#GetMap()
Execute('-relative' argument should enable 'use_relative_paths' in HandleLSPResponse):
runtime ale_linters/python/pylsp.vim
@@ -638,4 +639,4 @@ Execute('-relative' argument should enable 'use_relative_paths' in HandleLSPResp
call g:InitCallback()
AssertEqual {'42': {'show_contents': 1, 'open_in': 'current-buffer', 'use_relative_paths': 1}}, ale#references#GetMap()
AssertEqual {'42': {'show_contents': 1, 'open_in': 'current-buffer', 'use_relative_paths': 1, 'use_fzf': 0}}, ale#references#GetMap()