Compare commits

...

13 Commits

Author SHA1 Message Date
w0rp
2d3883392e wip 2026-02-28 09:39:23 +00:00
Florian Best
fbaf6485d9 feat(python): add "ty" linter
Fixes: #4971
2025-12-19 21:41:36 +01: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
50 changed files with 779 additions and 52 deletions

2
AGENTS.md Normal file
View File

@@ -0,0 +1,2 @@
- For `doc/ale-*.txt` help docs, right-align Vim help tags (`*...*`) to the right margin so tag lines meet ALE's alignment check.
- Keep integration/tool headings in ALE docs sorted in the expected order (alphabetical within each section), and update the corresponding table of contents entries in `doc/ale.txt` when adding/removing headings.

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

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

81
ale_linters/python/ty.vim Normal file
View File

@@ -0,0 +1,81 @@
" Description: ty as linter for python files
call ale#Set('python_ty_executable', 'ty')
call ale#Set('python_ty_options', '')
call ale#Set('python_ty_use_global', get(g:, 'ale_use_global_executables', 1))
call ale#Set('python_ty_change_directory', 1)
call ale#Set('python_ty_auto_pipenv', 0)
call ale#Set('python_ty_auto_poetry', 0)
call ale#Set('python_ty_auto_uv', 0)
function! ale_linters#python#ty#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_ty_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_ty_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_ty_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_ty', ['ty'])
endfunction
function! ale_linters#python#ty#GetCwd(buffer) abort
if ale#Var(a:buffer, 'python_ty_change_directory')
" Run from project root if found, else from buffer dir.
let l:project_root = ale#python#FindProjectRoot(a:buffer)
return !empty(l:project_root) ? l:project_root : '%s:h'
endif
return ''
endfunction
function! ale_linters#python#ty#GetCommand(buffer) abort
let l:executable = ale_linters#python#ty#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$' ? ' run ty ' : ''
let l:exec_args = l:exec_args . ' check --output-format gitlab '
return ale#Escape(l:executable) . l:exec_args . ale#Pad(ale#Var(a:buffer, 'python_ty_options')) . ' %s'
endfunction
function! ale_linters#python#ty#Handle(buffer, lines) abort
let l:output = []
let l:items = json_decode(join(a:lines, ''))
if empty(l:items)
return l:output
endif
for l:item in l:items
call add(l:output, {
\ 'lnum': l:item.location.positions.begin.line,
\ 'col': l:item.location.positions.begin.column,
\ 'end_lnum': l:item.location.positions.end.line,
\ 'end_col': l:item.location.positions.end.column,
\ 'code': l:item.check_name,
\ 'text': l:item.description,
\ 'type': l:item.severity =~? 'major' ? 'E' : 'W',
\})
endfor
return l:output
endfunction
call ale#linter#Define('python', {
\ 'name': 'ty',
\ 'executable': function('ale_linters#python#ty#GetExecutable'),
\ 'cwd': function('ale_linters#python#ty#GetCwd'),
\ 'command': function('ale_linters#python#ty#GetCommand'),
\ 'callback': 'ale_linters#python#ty#Handle',
\ 'output_stream': 'stdout',
\})

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

@@ -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*
@@ -265,6 +283,12 @@ g:ale_html_tidy_use_global
See |ale-integrations-local-executables|
===============================================================================
ty *ale-html-ty*
`ty` is a Python type checker. See |ale-python-ty| for configuration options.
===============================================================================
vscodehtml *ale-html-vscode*

View File

@@ -2106,6 +2106,92 @@ g:ale_python_ruff_format_auto_uv
executable.
===============================================================================
ty *ale-python-ty*
`ty` will be run from a detected project root, per |ale-python-root|.
*ale-options.python_ty_change_directory*
*g:ale_python_ty_change_directory*
*b:ale_python_ty_change_directory*
python_ty_change_directory
g:ale_python_ty_change_directory
Type: |Number|
Default: `1`
If set to `1`, `ty` will be run from a detected project root, per
|ale-python-root|. If no project root is detected, `ty` will be run from the
buffer's directory.
*ale-options.python_ty_executable*
*g:ale_python_ty_executable*
*b:ale_python_ty_executable*
python_ty_executable
g:ale_python_ty_executable
Type: |String|
Default: `'ty'`
See |ale-integrations-local-executables|
Set this to `'pipenv'` to invoke `'pipenv` `run` `ty` `check'`.
Set this to `'poetry'` to invoke `'poetry` `run` `ty` `check'`.
Set this to `'uv'` to invoke `'uv` `run` `ty` `check'`.
*ale-options.python_ty_options*
*g:ale_python_ty_options*
*b:ale_python_ty_options*
python_ty_options
g:ale_python_ty_options
Type: |String|
Default: `''`
This variable can be changed to add command-line arguments to the ty
invocation.
*ale-options.python_ty_use_global*
*g:ale_python_ty_use_global*
*b:ale_python_ty_use_global*
python_ty_use_global
g:ale_python_ty_use_global
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 1)`
See |ale-integrations-local-executables|
*ale-options.python_ty_auto_pipenv*
*g:ale_python_ty_auto_pipenv*
*b:ale_python_ty_auto_pipenv*
python_ty_auto_pipenv
g:ale_python_ty_auto_pipenv
Type: |Number|
Default: `0`
Detect whether the file is inside a pipenv, and set the executable to `pipenv`
if true. This is overridden by a manually-set executable.
*ale-options.python_ty_auto_poetry*
*g:ale_python_ty_auto_poetry*
*b:ale_python_ty_auto_poetry*
python_ty_auto_poetry
g:ale_python_ty_auto_poetry
Type: |Number|
Default: `0`
Detect whether the file is inside a poetry, and set the executable to `poetry`
if true. This is overridden by a manually-set executable.
*ale-options.python_ty_auto_uv*
*g:ale_python_ty_auto_uv*
*b:ale_python_ty_auto_uv*
python_ty_auto_uv
g:ale_python_ty_auto_uv
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
unimport *ale-python-unimport*

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
@@ -555,6 +557,7 @@ Notes:
* `reorder-python-imports`
* ruff
* ruff-format
* `ty`
* `unimport`
* `vulture`!!
* `yapf`

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

@@ -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,7 +3587,9 @@ 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|
ty....................................|ale-html-ty|
vscodehtml............................|ale-html-vscode|
write-good............................|ale-html-write-good|
html angular template...................|ale-htmlangular-options|
@@ -3829,6 +3832,7 @@ documented in additional help files.
reorder-python-imports................|ale-python-reorder_python_imports|
ruff..................................|ale-python-ruff|
ruff-format...........................|ale-python-ruff-format|
ty....................................|ale-python-ty|
unimport..............................|ale-python-unimport|
vulture...............................|ale-python-vulture|
yapf..................................|ale-python-yapf|

28
opencode.json Normal file
View File

@@ -0,0 +1,28 @@
{
"$schema": "https://opencode.ai/config.json",
"keybinds": {
"app_exit": "<leader>q"
},
"permission": {
"bash": {
"*": "deny",
"ls *": "allow",
"grep *": "allow",
"rg *": "allow",
"git diff *": "allow",
"git show *": "allow",
"git status *": "allow",
"git log *": "allow",
"git blame *": "allow",
"git reflog show *": "allow",
"./run-tests *": "allow"
},
"read": {
"*": "allow"
},
"edit": {
"*": "allow",
"opencode.json": "deny"
}
}
}

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
@@ -565,6 +567,7 @@ formatting.
* [reorder-python-imports](https://github.com/asottile/reorder_python_imports)
* [ruff](https://github.com/charliermarsh/ruff)
* [ruff-format](https://docs.astral.sh/ruff/formatter/)
* [ty](https://github.com/astral-sh/ty) :warning:
* [unimport](https://github.com/hakancelik96/unimport)
* [vulture](https://github.com/jendrikseipp/vulture) :warning: :floppy_disk:
* [yapf](https://github.com/google/yapf)

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

@@ -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,37 @@
Before:
runtime! ale_linters/python/ty.vim
After:
call ale#linter#Reset()
Execute(We should handle basic output from ty correctly):
AssertEqual
\ [
\ {
\ 'lnum': 3,
\ 'col': 2,
\ 'end_lnum': 3,
\ 'end_col': 10,
\ 'code': 'TY001',
\ 'text': 'Type check failed',
\ 'type': 'E',
\ },
\ {
\ 'lnum': 6,
\ 'col': 4,
\ 'end_lnum': 6,
\ 'end_col': 7,
\ 'code': 'TY002',
\ 'text': 'Potential issue',
\ 'type': 'W',
\ },
\ ],
\ ale_linters#python#ty#Handle(bufnr(''), [
\ '[',
\ '{"check_name":"TY001","description":"Type check failed","severity":"major","location":{"positions":{"begin":{"line":3,"column":2},"end":{"line":3,"column":10}}}},',
\ '{"check_name":"TY002","description":"Potential issue","severity":"minor","location":{"positions":{"begin":{"line":6,"column":4},"end":{"line":6,"column":7}}}}',
\ ']',
\ ])
Execute(We should handle empty output from ty correctly):
AssertEqual [], ale_linters#python#ty#Handle(bufnr(''), ['[]'])

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

@@ -4,6 +4,12 @@ Before:
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'
@@ -36,6 +42,12 @@ Execute(Poetry is detected when jinja_j2lint_auto_poetry is set):
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')

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

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

72
test/linter/test_ty.vader Normal file
View File

@@ -0,0 +1,72 @@
Before:
call ale#assert#SetUpLinterTest('python', 'ty')
After:
call ale#assert#TearDownLinterTest()
Execute(The ty command callback should return the correct default values):
call ale#test#SetFilename('./foo.py')
AssertLinterCwd expand('%:p:h')
AssertLinter 'ty', ale#Escape('ty') . ' check --output-format gitlab %s'
Execute(The option for disabling changing directories should work):
let g:ale_python_ty_change_directory = 0
AssertLinterCwd ''
AssertLinter 'ty', ale#Escape('ty') . ' check --output-format gitlab %s'
Execute(The ty executable should be configurable, and escaped properly):
let g:ale_python_ty_executable = 'executable with spaces'
AssertLinter 'executable with spaces', ale#Escape('executable with spaces') . ' check --output-format gitlab %s'
Execute(The ty command callback should let you set options):
let g:ale_python_ty_options = '--some-option value'
AssertLinter 'ty', ale#Escape('ty') . ' check --output-format gitlab --some-option value %s'
Execute(The ty command callback should switch to project root when available):
call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py')
AssertLinterCwd ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir')
AssertLinter 'ty', ale#Escape('ty') . ' check --output-format gitlab %s'
Execute(The ty command callback should use the global executable by default):
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
AssertLinter 'ty', ale#Escape('ty') . ' check --output-format gitlab %s'
Execute(The ty command callback should fall back to global ty when no virtualenv executable is found):
let g:ale_python_ty_use_global = 0
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
AssertLinter 'ty', ale#Escape('ty') . ' check --output-format gitlab %s'
Execute(Setting executable to 'pipenv' should append 'run ty'):
let g:ale_python_ty_executable = 'path/to/pipenv'
AssertLinter 'path/to/pipenv', ale#Escape('path/to/pipenv') . ' run ty check --output-format gitlab %s'
Execute(Pipenv is detected when python_ty_auto_pipenv is set):
let g:ale_python_ty_auto_pipenv = 1
call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
AssertLinter 'pipenv', ale#Escape('pipenv') . ' run ty check --output-format gitlab %s'
Execute(Setting executable to 'poetry' should append 'run ty'):
let g:ale_python_ty_executable = 'path/to/poetry'
AssertLinter 'path/to/poetry', ale#Escape('path/to/poetry') . ' run ty check --output-format gitlab %s'
Execute(poetry is detected when python_ty_auto_poetry is set):
let g:ale_python_ty_auto_poetry = 1
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
AssertLinter 'poetry', ale#Escape('poetry') . ' run ty check --output-format gitlab %s'
Execute(uv is detected when python_ty_auto_uv is set):
let g:ale_python_ty_auto_uv = 1
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
AssertLinter 'uv', ale#Escape('uv') . ' run ty check --output-format gitlab %s'