Compare commits

...

23 Commits

Author SHA1 Message Date
Andrew Wray
0b0f8d91bc Prefer ale_root setting for project roots 2025-06-25 20:50:15 +01:00
Andrey Starodubtsev
9e49019a26 Some absolute paths are not recognized for Windows (#4987)
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
* Some abs paths are not recognized for win32

Paths like "c:/abc/def.cpp" were not recognized as absolute on Windows.

* Fix test for mypy_handler

mypy handler not just simplifies path, but tries to convert path to
absolute.
2025-06-24 11:05:11 +01:00
w0rp
a0572359ae Remove pytest.ini from project detection files
This breaks detecting the project root when editing tests with a nested
pytest.ini file where other project files are available. The other files
are so common we can just removes this entirely and test that we
ignore it in one case.
2025-06-24 07:47:15 +01:00
w0rp
80ff84db84 Skip whitespace warnings from ruff, if so configured
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-05-20 16:59:42 +01:00
w0rp
c8c33e7217 Add bash-language-server as an alias for it 2025-05-20 15:55:26 +01:00
Horacio Sanson
5098dfd27e Fix golangci-lint fixer with version 2 (#4960)
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-05-17 20:28:17 +09:00
Oliver Albertini
7cdaaa645d [python/pyre.vim] use pyrefly executable (#4972)
https://github.com/facebook/pyrefly

The pyre project has evolved to pyrefly. This replaces the pyre linter
with a pyrefly one and removes the test files that were added for
finding the project root in the old pyre world.

Co-authored-by: Oliver Ruben Albertini <oliverruben@gmail.com>
2025-05-17 20:08:52 +09:00
Nikita Korolev
2f4a866591 Add initial support for named-checkzone linter (#4961)
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: ds <ds@local>
2025-05-05 15:05:51 +09:00
Benjamin Block
f9de268816 Adding Roc language linters and fixers. (#4966)
* `roc_language_server`

* `roc format`

* `roc format annotate`
2025-05-05 15:01:45 +09:00
w0rp
1aaeb2cdae Add other issue types
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-04-26 04:32:53 +01:00
w0rp
05e22db9a2 Add Bug as a bug issue template type 2025-04-26 04:31:16 +01:00
Benjamin Block
d0cdde7516 Add support for the Lean 4 LSP, served by lake. (#4952) 2025-04-26 10:48:39 +09:00
Mikhail Velikikh
baaca9a5d7 Use ale#Escape in c_clangformat_style_option (#4949)
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
* Use ale#Escape in c_clangformat_style_option
* Update Vader test
2025-04-16 02:29:57 +00:00
Jean-Philippe Guérard
aac34cd45a Add bash to the linter aliases (#4948) 2025-04-16 02:28:32 +00:00
w0rp
366de225fd Mention, but do not scream when a file changes before it is fixed
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-04-10 15:17:35 +01:00
PizZaKatZe
22185c4c5c Remove ANSI color codes from nix linter messages (#4944)
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
* Remove ANSI color codes from nix linter messages

* Add test for color-coded nix linter findings

* Fix test: Escape backslashes

---------

Co-authored-by: Sebastian Neuser <sebastian.neuser@fnordkollektiv.de>
Co-authored-by: Sebastian Neuser <haggl@sineband.de>
2025-04-07 20:23:13 +09:00
Josh Pencheon
2883260ade Correctly identify tempfiles once symlinks are resolved (#3726)
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
Some linters will expand the paths of symlinked tempfiles when
reporting them back to ALE. This ensures that if they do, the filename
is still flagged appropriately as being temporary.
2025-04-02 21:48:32 +09:00
Dmitri Vereshchagin
090d31b79a Always use safe file local variables for erlang-mode fixer (#4942)
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
File local variables in Emacs are used in a way similar to Vim
modelines.  For example, at the end of the file you might find something
like the following:

    %% Local Variables:
    %% erlang-indent-level: 2
    %% something-weird: t
    %% End:

The `erlang-indent-level' variable in this list instructs the Erlang
mode to use two columns per indentation level.  But since the
`something-weird' variable is likely unknown, both may be ignored.

By default, Emacs in batch mode ignores all variable/value pairs if it
encounters at least one that is not known to be safe.  Setting
`enable-local-variables' to `:safe' tells Emacs to use only safe values
and ignore the rest.
2025-04-01 20:44:57 +09:00
Horacio Sanson
067e74fee8 Add support for glnagci-lint v2 (#4936)
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
Version 2 of golangci-lint introduces several breaking changes to the
command line arguments and the configuration file.

Thi PR updates ale integration to support both version 1.6x.x and 2.x.x
of golangci-lint.
2025-03-31 11:46:42 +01:00
Dmitri Vereshchagin
ff8fe94494 Remove hadolint rule code from location list entry text (#4939)
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
The code is already passed with the code key of location list entry.
Before this change, when using the default message format, it appeared
twice in the description of each location list entry and twice in each
echo message.
2025-03-30 13:58:04 +09:00
w0rp
6433d31f47 Update ale_disable_lsp documentation to clarify options
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-03-29 13:34:22 +00:00
w0rp
f3f0b05240 Fix #4935 - Send tsserver messsages to tsserver in Neovim 2025-03-29 13:25:49 +00:00
w0rp
add538213f Set up Lua development for Macs with Homebrew
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-03-28 16:20:18 +00:00
66 changed files with 1063 additions and 185 deletions

View File

@@ -1,6 +1,7 @@
---
name: Report a bug
labels: bug
type: Bug
about: Report a bug with ALE.
---

View File

@@ -1,6 +1,7 @@
---
name: Suggest a new linter or fixer
labels: new tool
type: Task
about: Suggest a new tool ALE can officially integrate with.
---

View File

@@ -1,6 +1,7 @@
---
name: Suggest an improvement
labels: enhancement
type: Feature
about: Suggest some way to improve ALE, or add a new feature.
---

View File

@@ -7,7 +7,8 @@
"test"
],
"workspace.library": [
"/usr/share/nvim/runtime/lua"
"/usr/share/nvim/runtime/lua",
"/opt/homebrew/share/nvim/runtime/lua"
],
"runtime.pathStrict": true,
"runtime.path": [

View File

@@ -0,0 +1,43 @@
" Description: named-checkzone for bindzone
call ale#Set('bindzone_checkzone_executable', 'named-checkzone')
call ale#Set('bindzone_checkzone_options', '-c IN')
function! ale_linters#bindzone#checkzone#GetCommand(buffer) abort
return '%e' . ale#Pad(ale#Var(a:buffer, 'bindzone_checkzone_options'))
\ . ' example.com %t'
endfunction
function! ale_linters#bindzone#checkzone#Handle(buffer, lines) abort
let l:warning_pattern = '\vzone example.com/IN: (.+)$'
let l:error_pattern = '\v:(\d+): (.+)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:error_pattern)
let l:lnum = l:match[1]
let l:text = l:match[2]
call add(l:output, {'text': l:text, 'lnum': l:lnum + 0, 'type': 'E'})
endfor
for l:match in ale#util#GetMatches(a:lines, l:warning_pattern)
let l:text = l:match[1]
" Ignore information messages
let l:scrub_match = matchlist(l:text, '\v(loaded serial|not loaded due to) ')
if empty(l:scrub_match)
call add(l:output, {'text': l:text, 'lnum': 0, 'type': 'W'})
endif
endfor
return l:output
endfunction
call ale#linter#Define('bindzone', {
\ 'name': 'checkzone',
\ 'executable': {b -> ale#Var(b, 'bindzone_checkzone_executable')},
\ 'command': function('ale_linters#bindzone#checkzone#GetCommand'),
\ 'callback': 'ale_linters#bindzone#checkzone#Handle',
\ 'read_buffer': 0,
\})

View File

@@ -49,7 +49,6 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
if l:match[5] isnot# ''
let l:code = l:match[4] . l:match[5]
let l:link = ' ( ' . l:domain . l:code . ' )'
let l:text = l:code . ': ' . l:detail
let l:detail = l:code . l:link . "\n\n" . l:detail
else
let l:type = 'E'

View File

@@ -5,26 +5,38 @@ call ale#Set('go_golangci_lint_options', '')
call ale#Set('go_golangci_lint_executable', 'golangci-lint')
call ale#Set('go_golangci_lint_package', 1)
function! ale_linters#go#golangci_lint#GetCommand(buffer) abort
function! ale_linters#go#golangci_lint#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'go_golangci_lint_executable')
return l:executable
endfunction
function! ale_linters#go#golangci_lint#GetCommand(buffer, version) abort
let l:filename = expand('#' . a:buffer . ':t')
let l:options = ale#Var(a:buffer, 'go_golangci_lint_options')
let l:lint_package = ale#Var(a:buffer, 'go_golangci_lint_package')
if ale#semver#GTE(a:version, [2, 0, 0])
let l:options = l:options
\ . ' --output.json.path stdout'
\ . ' --output.text.path stderr'
\ . ' --show-stats=0'
else
let l:options = l:options
\ . ' --out-format=json'
\ . ' --show-stats=0'
endif
if l:lint_package
return ale#go#EnvString(a:buffer)
\ . '%e run '
\ . l:options
\ . ' --out-format=json'
\ . ' --show-stats=0'
endif
return ale#go#EnvString(a:buffer)
\ . '%e run '
\ . ale#Escape(l:filename)
\ . ' ' . l:options
\ . ' --out-format=json'
\ . ' --show-stats=0'
endfunction
function! ale_linters#go#golangci_lint#Handler(buffer, lines) abort
@@ -58,9 +70,14 @@ endfunction
call ale#linter#Define('go', {
\ 'name': 'golangci-lint',
\ 'executable': {b -> ale#Var(b, 'go_golangci_lint_executable')},
\ 'executable': function('ale_linters#go#golangci_lint#GetExecutable'),
\ 'cwd': '%s:h',
\ 'command': function('ale_linters#go#golangci_lint#GetCommand'),
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
\ buffer,
\ ale_linters#go#golangci_lint#GetExecutable(buffer),
\ '%e --version',
\ function('ale_linters#go#golangci_lint#GetCommand'),
\ )},
\ 'callback': 'ale_linters#go#golangci_lint#Handler',
\ 'lint_file': 1,
\})

28
ale_linters/lean/lake.vim Normal file
View File

@@ -0,0 +1,28 @@
" Author: Benjamin Block <https://github.com/benjamindblock>
" Description: A language server for Lean 4.
function! ale_linters#lean#lake#GetProjectRoot(buffer) abort
let l:lakefile_toml = ale#path#FindNearestFile(a:buffer, 'lakefile.toml')
let l:lakefile_lean = ale#path#FindNearestFile(a:buffer, 'lakefile.lean')
if !empty(l:lakefile_toml)
return fnamemodify(l:lakefile_toml, ':p:h')
elseif !empty(l:lakefile_lean)
return fnamemodify(l:lakefile_lean, ':p:h')
else
return fnamemodify('', ':h')
endif
endfunction
call ale#Set('lean_lake_executable', 'lake')
call ale#Set('lean_lake_config', {})
call ale#linter#Define('lean', {
\ 'name': 'lake',
\ 'lsp': 'stdio',
\ 'language': 'lean',
\ 'lsp_config': {b -> ale#Var(b, 'lean_lake_config')},
\ 'executable': {b -> ale#Var(b, 'lean_lake_executable')},
\ 'command': '%e serve',
\ 'project_root': function('ale_linters#lean#lake#GetProjectRoot'),
\})

View File

@@ -29,7 +29,7 @@ function! ale_linters#nix#nix#Handle(buffer, lines) abort
\ 'type': 'E',
\ 'lnum': l:result.line,
\ 'col': l:result.column,
\ 'text': l:result.raw_msg
\ 'text': substitute(l:result.raw_msg, '\e\[[0-9;]*m', '', 'g'),
\})
endif
endif

View File

@@ -36,7 +36,7 @@ function! ale_linters#python#pylsp#GetCwd(buffer) abort
\ 'name': 'pylsp',
\ 'project_root': function('ale#python#FindProjectRoot'),
\}
let l:root = ale#lsp_linter#FindProjectRoot(a:buffer, l:fake_linter)
let l:root = ale#linter#GetRoot(a:buffer, l:fake_linter)
return !empty(l:root) ? l:root : v:null
endfunction

View File

@@ -0,0 +1,57 @@
" Author: oliverralbertini <oliver.albertini@gmail.com>
" Description: A performant type-checker supporting LSP for Python 3 created by Facebook
call ale#Set('python_pyrefly_executable', 'pyrefly')
call ale#Set('python_pyrefly_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_pyrefly_auto_pipenv', 0)
call ale#Set('python_pyrefly_auto_poetry', 0)
call ale#Set('python_pyrefly_auto_uv', 0)
function! ale_linters#python#pyrefly#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_pyrefly_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'python_pyrefly_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'python_pyrefly_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'python_pyrefly', ['pyrefly'])
endfunction
function! ale_linters#python#pyrefly#GetCommand(buffer) abort
let l:executable = ale_linters#python#pyrefly#GetExecutable(a:buffer)
let l:exec_args = [
\ ale#Escape(l:executable)
\ ]
\ + (l:executable =~? '\(pipenv\|poetry\|uv\)$' ? ['run', 'pyrefly'] : [])
\ + [
\ 'lsp',
\ ]
return join(l:exec_args, ' ')
endfunction
function! ale_linters#python#pyrefly#GetCwd(buffer) abort
" 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'
endfunction
call ale#linter#Define('python', {
\ 'name': 'pyrefly',
\ 'lsp': 'stdio',
\ 'executable': function('ale_linters#python#pyrefly#GetExecutable'),
\ 'command': function('ale_linters#python#pyrefly#GetCommand'),
\ 'project_root': function('ale#python#FindProjectRoot'),
\ 'completion_filter': 'ale#completion#python#CompletionItemFilter',
\ 'cwd': function('ale_linters#python#pyrefly#GetCwd'),
\})

View File

@@ -13,7 +13,7 @@ function! ale_linters#python#pyright#GetCwd(buffer) abort
\ 'name': 'pyright',
\ 'project_root': function('ale#python#FindProjectRoot'),
\}
let l:root = ale#lsp_linter#FindProjectRoot(a:buffer, l:fake_linter)
let l:root = ale#linter#GetRoot(a:buffer, l:fake_linter)
return !empty(l:root) ? l:root : v:null
endfunction

View File

@@ -72,20 +72,31 @@ function! ale_linters#python#ruff#Handle(buffer, lines) abort
try
let l:item = json_decode(l:line)
catch
let l:item = v:null
" If we can't decode a line, skip it.
continue
endtry
if !empty(l:item)
call add(l:output, {
\ 'lnum': l:item.location.row,
\ 'col': l:item.location.column,
\ 'end_lnum': l:item.end_location.row,
\ 'end_col': l:item.end_location.column - 1,
\ 'code': l:item.code,
\ 'text': l:item.message,
\ 'type': l:item.code =~? '\vE\d+' ? 'E' : 'W',
\})
if (l:item.code is# 'W291' || l:item.code is# 'W293')
\&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
" Skip warnings for trailing whitespace if the option is off.
continue
endif
if l:item.code is# 'W391'
\&& !ale#Var(a:buffer, 'warn_about_trailing_blank_lines')
" Skip warnings for trailing blank lines if the option is off
continue
endif
call add(l:output, {
\ 'lnum': l:item.location.row,
\ 'col': l:item.location.column,
\ 'end_lnum': l:item.end_location.row,
\ 'end_col': l:item.end_location.column - 1,
\ 'code': l:item.code,
\ 'text': l:item.message,
\ 'type': l:item.code =~? '\vE\d+' ? 'E' : 'W',
\})
endfor
return l:output

View File

@@ -0,0 +1,25 @@
" Author: Benjamin Block <https://github.com/benjamindblock>
" Description: A language server for Roc.
function! ale_linters#roc#roc_language_server#GetProjectRoot(buffer) abort
let l:roc_main_file = ale#path#FindNearestFile(a:buffer, 'main.roc')
if !empty(l:roc_main_file)
return fnamemodify(l:roc_main_file, ':p:h')
else
return fnamemodify('', ':h')
endif
endfunction
call ale#Set('roc_roc_language_server_executable', 'roc_language_server')
call ale#Set('roc_roc_language_server_config', {})
call ale#linter#Define('roc', {
\ 'name': 'roc_language_server',
\ 'lsp': 'stdio',
\ 'language': 'roc',
\ 'lsp_config': {b -> ale#Var(b, 'roc_roc_language_server_config')},
\ 'executable': {b -> ale#Var(b, 'roc_roc_language_server_executable')},
\ 'command': '%e',
\ 'project_root': function('ale_linters#roc#roc_language_server#GetProjectRoot'),
\})

View File

@@ -25,6 +25,7 @@ endfunction
call ale#linter#Define('sh', {
\ 'name': 'language_server',
\ 'aliases': ['bash-language-server'],
\ 'lsp': 'stdio',
\ 'executable': function('ale_linters#sh#language_server#GetExecutable'),
\ 'command': function('ale_linters#sh#language_server#GetCommand'),

View File

@@ -216,7 +216,7 @@ endfunction
function! ale#assert#LSPProject(expected_root) abort
let l:buffer = bufnr('')
let l:linter = s:GetLinter()
let l:root = ale#lsp_linter#FindProjectRoot(l:buffer, l:linter)
let l:root = ale#linter#GetRoot(l:buffer, l:linter)
AssertEqual a:expected_root, l:root
endfunction

View File

@@ -78,7 +78,7 @@ function! ale#fix#ApplyFixes(buffer, output) abort
if !l:data.ignore_file_changed_errors
" no-custom-checks
echoerr 'The file was changed before fixing finished'
echom 'The file was changed before fixing finished'
endif
return

View File

@@ -722,6 +722,16 @@ let s:default_registry = {
\ 'suggested_filetypes': ['typst'],
\ 'description': 'A formatter for Typst files',
\ },
\ 'roc_format': {
\ 'function': 'ale#fixers#roc_format#Fix',
\ 'suggested_filetypes': ['roc'],
\ 'description': 'Formats Roc files.',
\ },
\ 'roc_annotate': {
\ 'function': 'ale#fixers#roc_annotate#Fix',
\ 'suggested_filetypes': ['roc'],
\ 'description': 'Annotates all top-level definitions in Roc files.',
\ },
\}
" Reset the function registry to the default entries.

View File

@@ -22,7 +22,7 @@ function! ale#fixers#clangformat#Fix(buffer) abort
let l:use_local_file = ale#Var(a:buffer, 'c_clangformat_use_local_file')
if l:style_option isnot# ''
let l:style_option = '-style=' . "'" . l:style_option . "'"
let l:style_option = '-style=' . ale#Escape(l:style_option)
endif
if l:use_local_file

View File

@@ -17,10 +17,11 @@ let s:variables = {
\}
function! ale#fixers#erlang_mode#Fix(buffer) abort
let emacs_executable =
let l:emacs_executable =
\ ale#Var(a:buffer, 'erlang_erlang_mode_emacs_executable')
let l:exprs = [
\ '(setq enable-local-variables :safe)',
\ s:SetqDefault(a:buffer, s:variables),
\ '(erlang-mode)',
\ '(font-lock-fontify-region (point-min) (point-max))',

View File

@@ -1,32 +1,48 @@
" Author: Ian Stapleton Cordasco <graffatcolmingov@gmail.com>
" Description: Run golangci-lint with the --fix flag to autofix some issues
call ale#Set('go_golangci_lint_options', '')
call ale#Set('go_golangci_lint_executable', 'golangci-lint')
call ale#Set('go_golangci_lint_package', 1)
call ale#Set('go_golangci_formatter_options', '')
call ale#Set('go_golangci_formatter_executable', 'golangci-lint')
function! ale#fixers#golangci_lint#GetCommand(buffer) abort
function! ale#fixers#golangci_lint#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'go_golangci_formatter_executable')
return l:executable
endfunction
function! ale#fixers#golangci_lint#GetCommand(buffer, version) abort
let l:filename = expand('#' . a:buffer . ':t')
let l:executable = ale#Var(a:buffer, 'go_golangci_lint_executable')
let l:options = ale#Var(a:buffer, 'go_golangci_lint_options') . ' --fix'
let l:package_mode = ale#Var(a:buffer, 'go_golangci_lint_package')
let l:executable = ale#fixers#golangci_lint#GetExecutable(a:buffer)
let l:options = ale#Var(a:buffer, 'go_golangci_formatter_options')
let l:env = ale#go#EnvString(a:buffer)
if l:package_mode
if ale#semver#GTE(a:version, [2, 0, 0])
return l:env . ale#Escape(l:executable)
\ . ' run '
\ . l:options
\ . ' fmt --stdin '
\ . l:options
else
return l:env . ale#Escape(l:executable)
\ . ' run --fix '
\ . l:options
\ . ' '
\ . ale#Escape(l:filename)
endif
endfunction
return l:env . ale#Escape(l:executable)
\ . ' run '
\ . l:options
\ . ' ' . ale#Escape(l:filename)
function! ale#fixers#golangci_lint#GetCommandForVersion(buffer, version) abort
return {
\ 'command': ale#fixers#golangci_lint#GetCommand(a:buffer, a:version)
\}
endfunction
function! ale#fixers#golangci_lint#Fix(buffer) abort
return {
\ 'command': ale#fixers#golangci_lint#GetCommand(a:buffer),
\}
let l:executable = ale#fixers#golangci_lint#GetExecutable(a:buffer)
let l:command = ale#fixers#golangci_lint#GetExecutable(a:buffer) . ale#Pad('--version')
return ale#semver#RunWithVersionCheck(
\ a:buffer,
\ l:executable,
\ l:command,
\ function('ale#fixers#golangci_lint#GetCommandForVersion'),
\)
endfunction

View File

@@ -0,0 +1,21 @@
" Author: Benjamin Block <https://github.com/benjamindblock>
" Description: Official type annotation tool for Roc.
call ale#Set('roc_roc_annotate_executable', 'roc')
call ale#Set('roc_roc_annotate_options', '')
function! ale#fixers#roc_annotate#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'roc_roc_annotate_executable')
let l:command = l:executable . ' format annotate'
let l:options = ale#Var(a:buffer, 'roc_roc_annotate_options')
if l:options isnot# ''
let l:command .= ' ' . l:options
endif
return {
\ 'command': l:command . ' %t',
\ 'read_temporary_file': 1,
\}
endfunction

View File

@@ -0,0 +1,20 @@
" Author: Benjamin Block <https://github.com/benjamindblock>
" Description: Official formatter for Roc.
call ale#Set('roc_roc_format_executable', 'roc')
call ale#Set('roc_roc_format_options', '')
function! ale#fixers#roc_format#Fix(buffer) abort
let l:executable = ale#Var(a:buffer, 'roc_roc_format_executable')
let l:command = l:executable . ' format'
let l:options = ale#Var(a:buffer, 'roc_roc_format_options')
if l:options isnot# ''
let l:command .= ' ' . l:options
endif
return {
\ 'command': l:command . ' %t',
\ 'read_temporary_file': 1,
\}
endfunction

View File

@@ -11,6 +11,7 @@ let s:linters = {}
" NOTE: Update the g:ale_linter_aliases documentation when modifying this.
let s:default_ale_linter_aliases = {
\ 'Dockerfile': 'dockerfile',
\ 'bash': 'sh',
\ 'csh': 'sh',
\ 'javascriptreact': ['javascript', 'jsx'],
\ 'plaintex': 'tex',
@@ -446,3 +447,32 @@ function! ale#linter#GetAddress(buffer, linter) abort
return type(l:Address) is v:t_func ? l:Address(a:buffer) : l:Address
endfunction
" Get the project root for a linter.
" If |b:ale_root| or |g:ale_root| is set to either a String or a Dict mapping
" linter names to roots or callbacks, return that value immediately. When no
" value is available, fall back to the linter-specific configuration.
function! ale#linter#GetRoot(buffer, linter) abort
let l:buffer_ale_root = getbufvar(a:buffer, 'ale_root', {})
if type(l:buffer_ale_root) is v:t_string
return l:buffer_ale_root
endif
if has_key(l:buffer_ale_root, a:linter.name)
let l:Root = l:buffer_ale_root[a:linter.name]
return type(l:Root) is v:t_func ? l:Root(a:buffer) : l:Root
endif
if has_key(g:ale_root, a:linter.name)
let l:Root = g:ale_root[a:linter.name]
return type(l:Root) is v:t_func ? l:Root(a:buffer) : l:Root
endif
if has_key(a:linter, 'project_root')
let l:Root = a:linter.project_root
return type(l:Root) is v:t_func ? l:Root(a:buffer) : l:Root
endif
return ''
endfunction

View File

@@ -706,7 +706,7 @@ function! ale#lsp#Send(conn_id, message) abort
throw 'LSP server not initialized yet!'
endif
if g:ale_use_neovim_lsp_api
if g:ale_use_neovim_lsp_api && !l:conn.is_tsserver
return luaeval('require("ale.lsp").send_message(_A)', {
\ 'client_id': l:conn.client_id,
\ 'is_notification': a:message[0] == 1 ? v:true : v:false,

View File

@@ -296,44 +296,6 @@ function! ale#lsp_linter#GetConfig(buffer, linter) abort
return {}
endfunction
function! ale#lsp_linter#FindProjectRoot(buffer, linter) abort
let l:buffer_ale_root = getbufvar(a:buffer, 'ale_root', {})
if type(l:buffer_ale_root) is v:t_string
return l:buffer_ale_root
endif
" Try to get a buffer-local setting for the root
if has_key(l:buffer_ale_root, a:linter.name)
let l:Root = l:buffer_ale_root[a:linter.name]
if type(l:Root) is v:t_func
return l:Root(a:buffer)
else
return l:Root
endif
endif
" Try to get a global setting for the root
if has_key(g:ale_root, a:linter.name)
let l:Root = g:ale_root[a:linter.name]
if type(l:Root) is v:t_func
return l:Root(a:buffer)
else
return l:Root
endif
endif
" Fall back to the linter-specific configuration
if has_key(a:linter, 'project_root')
let l:Root = a:linter.project_root
return type(l:Root) is v:t_func ? l:Root(a:buffer) : l:Root
endif
return ale#util#GetFunction(a:linter.project_root_callback)(a:buffer)
endfunction
" This function is accessible so tests can call it.
function! ale#lsp_linter#OnInit(linter, details, Callback) abort
@@ -504,7 +466,7 @@ endfunction
function! ale#lsp_linter#StartLSP(buffer, linter, Callback) abort
let l:command = ''
let l:address = ''
let l:root = ale#lsp_linter#FindProjectRoot(a:buffer, a:linter)
let l:root = ale#linter#GetRoot(a:buffer, a:linter)
if empty(l:root) && a:linter.lsp isnot# 'tsserver'
" If there's no project root, then we can't check files with LSP,

View File

@@ -115,20 +115,24 @@ endfunction
" Return 1 if a path is an absolute path.
function! ale#path#IsAbsolute(filename) abort
if has('win32') && a:filename[:0] is# '\'
return 1
if has('win32')
return a:filename[:0] =~# '[\\/]' || a:filename[0:2] =~? '[A-Z]:[/\\]'
else
return a:filename[:0] is# '/'
endif
" Check for /foo and C:\foo, etc.
return a:filename[:0] is# '/' || a:filename[1:2] is# ':\'
endfunction
let s:temp_dir = ale#path#Simplify(fnamemodify(ale#util#Tempname(), ':h:h'))
let s:resolved_temp_dir = resolve(s:temp_dir)
" Given a filename, return 1 if the file represents some temporary file
" created by Vim.
" created by Vim. If the temporary location is symlinked (e.g. macOS), some
" linters may report the resolved version of the path, so both are checked.
function! ale#path#IsTempName(filename) abort
return ale#path#Simplify(a:filename)[:len(s:temp_dir) - 1] is# s:temp_dir
let l:filename = ale#path#Simplify(a:filename)
return l:filename[:len(s:temp_dir) - 1] is# s:temp_dir
\|| l:filename[:len(s:resolved_temp_dir) - 1] is# s:resolved_temp_dir
endfunction
" Given a base directory, which must not have a trailing slash, and a

View File

@@ -26,7 +26,6 @@ function! ale#python#FindProjectRootIni(buffer) abort
" If you change this, update ale-python-root documentation.
if filereadable(l:path . '/MANIFEST.in')
\|| filereadable(l:path . '/setup.cfg')
\|| filereadable(l:path . '/pytest.ini')
\|| filereadable(l:path . '/tox.ini')
\|| filereadable(l:path . '/.pyre_configuration.local')
\|| filereadable(l:path . '/mypy.ini')
@@ -55,12 +54,19 @@ endfunction
" Given a buffer number, find the project root directory for Python.
" The root directory is defined as the first directory found while searching
" upwards through paths, including the current directory, until a path
" containing an init file (one from MANIFEST.in, setup.cfg, pytest.ini,
" tox.ini) is found. If it is not possible to find the project root directory
" via init file, then it will be defined as the first directory found
" searching upwards through paths, including the current directory, until no
" __init__.py files is found.
" containing an configuration file is found. (See list above)
"
" If it is not possible to find the project root directory via configuration
" file, then it will be defined as the first directory found searching upwards
" through paths, including the current directory, until no __init__.py files
" is found.
function! ale#python#FindProjectRoot(buffer) abort
let l:root = ale#linter#GetRoot(a:buffer, {'name': 'python'})
if !empty(l:root)
return l:root
endif
let l:ini_root = ale#python#FindProjectRootIni(a:buffer)
if !empty(l:ini_root)

32
doc/ale-bindzone.txt Normal file
View File

@@ -0,0 +1,32 @@
===============================================================================
ALE BINDZone Integration *ale-bindzone-options*
===============================================================================
checkzone *ale-bindzone-checkzone*
*ale-options.bindzone_checkzone_executable*
*g:ale_bindzone_checkzone_executable*
*b:ale_bindzone_checkzone_executable*
bindzone_checkzone_executable
g:ale_bindzone_checkzone_executable
Type: |String|
Default: `named-checkzone`
This variable can be changed to set the path to named-checkzone executable.
*ale-options.bindzone_checkzone_options*
*g:ale_bindzone_checkzone_options*
*b:ale_bindzone_checkzone_options*
bindzone_checkzone_options
g:ale_bindzone_checkzone_options
Type: |String|
Default: `-c IN`
This variable can be changed to add additional command-line arguments.
All available options can be found at:
https://bind9.readthedocs.io/en/stable/manpages.html#named-checkzone-zone-file-validation-tool
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@@ -144,7 +144,7 @@ g:ale_go_golangci_lint_options
Default: `''`
This variable can be changed to alter the command-line arguments to the
golangci-lint invocation.
golangci-lint run invocation.
*ale-options.go_golangci_lint_package*
*g:ale_go_golangci_lint_package*
@@ -157,6 +157,30 @@ g:ale_go_golangci_lint_package
When set to `1`, the whole Go package will be checked instead of only the
current file.
golangci_lint can also be user as a fixer to format go source files. In this
case the following configuration variables can be used to configure the
formatters:
*ale-options.go_golangci_formatter_executable*
*g:ale_go_golangci_formatter_executable*
*b:ale_go_golangci_formatter_executable*
go_golangci_formatter_executable
g:ale_go_golangci_formatter_executable
Type: |String|
Default: `'golangci-lint'`
The executable that will be run for golangci-lint.
*ale-options.go_golangci_formatter_options*
*g:ale_go_golangci_formatter_options*
*b:ale_go_golangci_formatter_options*
go_golangci_formatter_options
g:ale_go_golangci_formatter_options
Type: |String|
Default: `''`
This variable can be changed to alter the command-line arguments to the
golangci-lint fmt invocation.
===============================================================================
golangserver *ale-go-golangserver*

29
doc/ale-lean.txt Normal file
View File

@@ -0,0 +1,29 @@
===============================================================================
ALE Lean Integration *ale-lean-options*
*ale-integration-lean*
===============================================================================
Integration Information
Currently, the only supported LSP for Lean 4 is lake.
===============================================================================
lake *ale-lean-lake*
g:ale_lean_lake_executable *g:ale_lean_lake_executable*
*b:ale_lean_lake_executable*
Type: |String|
Default: `'lake'`
This variable can be modified to change the executable path for `lake`.
g:ale_lean_lake_config *g:ale_lean_lake_config*
*b:ale_lean_lake_config*
Type: |Dictionary|
Default: `{}`
Dictionary with configuration settings for lake.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@@ -55,6 +55,9 @@ For some linters, ALE will search for a Python project root by looking at the
files in directories on or above where a file being checked is. ALE applies
the following methods, in order:
If |g:ale_root| or |b:ale_root| provides a value, that value is used as the
project root instead and the searching described below is skipped.
1. Find the first directory containing a common Python configuration file.
2. If no configuration file can be found, use the first directory which does
not contain a readable file named `__init__.py`.
@@ -63,7 +66,6 @@ ALE will look for configuration files with the following filenames. >
MANIFEST.in
setup.cfg
pytest.ini
tox.ini
.pyre_configuration.local
mypy.ini
@@ -81,6 +83,7 @@ ALE will look for configuration files with the following filenames. >
poetry.lock
pyproject.toml
.tool-versions
uv.lock
<
The first directory containing any of the files named above will be used.
@@ -1616,6 +1619,69 @@ g:ale_python_pyre_auto_uv
executable.
===============================================================================
pyrefly *ale-python-pyrefly*
`pyrefly` will be run from a detected project root, per |ale-python-root|.
*ale-options.python_pyrefly_executable*
*g:ale_python_pyrefly_executable*
*b:ale_python_pyrefly_executable*
python_pyrefly_executable
g:ale_python_pyrefly_executable
Type: |String|
Default: `'pyrefly'`
See |ale-integrations-local-executables|
Set this to `'pipenv'` to invoke `'pipenv` `run` `pyrefly'`.
Set this to `'poetry'` to invoke `'poetry` `run` `pyrefly'`.
Set this to `'uv'` to invoke `'uv` `run` `pyrefly'`.
*ale-options.python_pyrefly_use_global*
*g:ale_python_pyrefly_use_global*
*b:ale_python_pyrefly_use_global*
python_pyrefly_use_global
g:ale_python_pyrefly_use_global
Type: |Number|
Default: `get(g:, 'ale_use_global_executables', 0)`
See |ale-integrations-local-executables|
*ale-options.python_pyrefly_auto_pipenv*
*g:ale_python_pyrefly_auto_pipenv*
*b:ale_python_pyrefly_auto_pipenv*
python_pyrefly_auto_pipenv
g:ale_python_pyrefly_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_pyrefly_auto_poetry*
*g:ale_python_pyrefly_auto_poetry*
*b:ale_python_pyrefly_auto_poetry*
python_pyrefly_auto_poetry
g:ale_python_pyrefly_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_pyrefly_auto_uv*
*g:ale_python_pyrefly_auto_uv*
*b:ale_python_pyrefly_auto_uv*
python_pyrefly_auto_uv
g:ale_python_pyrefly_auto_uv
Type: |Number|
Default: `0`
Set the executable to `uv` if true. This is overridden by a manually-set
executable.
===============================================================================
pyright *ale-python-pyright*

79
doc/ale-roc.txt Normal file
View File

@@ -0,0 +1,79 @@
===============================================================================
ALE Roc Integration *ale-roc-options*
*ale-integration-roc*
===============================================================================
roc_language_server *ale-roc-roc-language-server*
*ale-options.roc_roc_language_server_executable*
*g:ale_roc_roc_language_server_executable*
*b:ale_roc_roc_language_server_executable*
roc_roc_language_server_executable
g:ale_roc_roc_language_server_executable
Type: |String|
Default: `'roc_language_server'`
This variable can be modified to change the executable path for
`roc_language_server`.
*ale-options.roc_roc_language_server_config*
*g:ale_roc_roc_language_server_config*
*b:ale_roc_roc_language_server_config*
roc_roc_language_server_config
g:ale_roc_roc_language_server_config
Type: |Dictionary|
Default: `{}`
Dictionary with configuration settings for roc_language_server.
===============================================================================
roc_format *ale-roc-roc-format*
*ale-options.roc_roc_format_executable*
*g:ale_roc_roc_format_executable*
*b:ale_roc_roc_format_executable*
roc_roc_format_executable
g:ale_roc_roc_format_executable
Type: |String|
Default: `'roc'`
This variable can be modified to change the executable path for `roc`.
*ale-options.roc_roc_format_options*
*g:ale_roc_roc_format_options*
*b:ale_roc_roc_format_options*
roc_roc_format_options
g:ale_roc_roc_format_options
Type: String
Default: `''`
Additional flags for `roc format`.
===============================================================================
roc_annotate *ale-roc-roc-annotate*
*ale-options.roc_roc_annotate_executable*
*g:ale_roc_roc_annotate_executable*
*b:ale_roc_roc_annotate_executable*
roc_roc_annotate_executable
g:ale_roc_roc_annotate_executable
Type: |String|
Default: `'roc'`
This variable can be modified to change the executable path for `roc`.
*ale-options.roc_roc_annotate_options*
*g:ale_roc_roc_annotate_options*
*b:ale_roc_roc_annotate_options*
roc_roc_annotate_options
g:ale_roc_roc_annotate_options
Type: String
Default: `''`
Additional flags for `roc format annotate`.
===============================================================================
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:

View File

@@ -60,6 +60,8 @@ Notes:
* `bibclean`
* Bicep
* `bicep`
* Bindzone
* `checkzone` (named-checkzone)
* BitBake
* `oelint-adv`
* Bourne Shell
@@ -370,6 +372,8 @@ Notes:
* `textlint`
* `vale`
* `write-good`
* Lean 4
* `lake`
* Less
* `lessc`
* `prettier`
@@ -541,6 +545,7 @@ Notes:
* `pylint`!!
* `pylsp`
* `pyre`
* `pyrefly`
* `pyright`
* `refurb`
* `reorder-python-imports`
@@ -584,6 +589,10 @@ Notes:
* `write-good`
* Robot
* `rflint`
* Roc
* roc_annotate
* roc_format
* roc_language_server
* RPM spec
* `rpmlint`
* Ruby

View File

@@ -1192,13 +1192,13 @@ g:ale_detail_to_floating_preview
*b:ale_disable_lsp*
disable_lsp
g:ale_disable_lsp
Type: |Number| OR |String|
Type: |Boolean| OR |Number| OR |String|
Default: `'auto'`
When this option is set to `'auto'`, ALE will automatically disable linters
that it detects as having already been configured with the `nvim-lspconfig`
plugin. When this option is set to `1`, ALE ignores all linters powered by
LSP, and also `tsserver`.
plugin. When this option is set to `true` or `1`, ALE ignores all linters
powered by LSP, and also `tsserver`.
Any linters that are disabled will also not be usable for LSP functionality
other than just linting.
@@ -1735,6 +1735,7 @@ g:ale_linter_aliases
{
\ 'Dockerfile': 'dockerfile',
\ 'bash': 'sh',
\ 'csh': 'sh',
\ 'javascriptreact': ['javascript', 'jsx'],
\ 'plaintex': 'tex',
@@ -2296,17 +2297,18 @@ g:ale_root
Type: |Dictionary| or |String|
Default: `{}`
This option is used to determine the project root for a linter. If the value
is a |Dictionary|, it maps a linter to either a |String| containing the
project root or a |Funcref| to call to look up the root. The |Funcref| is
provided the buffer number as its argument.
This option is used to determine the project root for a linter. When set to a
|String| it will be used for all linters. When set to a |Dictionary|, the
keys are linter names and the values are either |Strings| containing project
roots or |Funcref|s which are passed the buffer number.
The buffer-specific variable may additionally be a string containing the
The buffer-specific variable may additionally be a |String| containing the
project root itself.
If neither variable yields a result, a linter-specific function is invoked to
detect a project root. If this, too, yields no result, and the linter is an
LSP linter, it will not run.
If a value can be found from either variable, ALE uses it directly and skips
searching for a project root. If no value is found, a linter-specific
function is invoked to detect a project root. If this, too, yields no result
and the linter is an LSP linter, it will not run.
*ale-options.save_hidden*
*g:ale_save_hidden*
@@ -3360,6 +3362,8 @@ documented in additional help files.
bicep...................................|ale-bicep-options|
bicep.................................|ale-bicep-bicep|
az_bicep..............................|ale-bicep-az_bicep|
bindzone................................|ale-bindzone-options|
checkzone.............................|ale-bindzone-checkzone|
bitbake.................................|ale-bitbake-options|
oelint-adv............................|ale-bitbake-oelint_adv|
c.......................................|ale-c-options|
@@ -3631,6 +3635,8 @@ documented in additional help files.
cspell................................|ale-latex-cspell|
write-good............................|ale-latex-write-good|
textlint..............................|ale-latex-textlint|
lean....................................|ale-lean-options|
lake..................................|ale-lean-lake|
less....................................|ale-less-options|
lessc.................................|ale-less-lessc|
prettier..............................|ale-less-prettier|
@@ -3783,6 +3789,7 @@ documented in additional help files.
pylint................................|ale-python-pylint|
pylsp.................................|ale-python-pylsp|
pyre..................................|ale-python-pyre|
pyrefly...............................|ale-python-pyrefly|
pyright...............................|ale-python-pyright|
refurb................................|ale-python-refurb|
reorder-python-imports................|ale-python-reorder_python_imports|
@@ -3817,6 +3824,10 @@ documented in additional help files.
write-good............................|ale-restructuredtext-write-good|
robot...................................|ale-robot-options|
rflint................................|ale-robot-rflint|
roc.....................................|ale-roc-options|
roc_language_server...................|ale-roc-roc-language-server|
roc_format............................|ale-roc-roc-format|
roc_annotate..........................|ale-roc-roc-annotate|
ruby....................................|ale-ruby-options|
brakeman..............................|ale-ruby-brakeman|
cspell................................|ale-ruby-cspell|

View File

@@ -67,7 +67,7 @@ module.send = function(buffer, loclist)
local local_cfg = { priority = sign_priority }
local global_cfg = vim.diagnostic.config().signs
if type(global_cfg) == "boolean" then
if global_cfg == false or global_cfg == true or global_cfg == nil then
signs = local_cfg
elseif type(global_cfg) == "table" then
signs = vim.tbl_extend("force", global_cfg, local_cfg)

View File

@@ -150,12 +150,14 @@ module.send_message = function(args)
success, request_id = client.request(
args.method,
args.params,
---@diagnostic disable-next-line: param-type-mismatch
function(_, result, _, _)
vim.fn["ale#lsp#HandleResponse"](client.name, {
id = request_id,
result = result,
})
end,
---@diagnostic disable-next-line: param-type-mismatch
-1
)

View File

@@ -69,6 +69,8 @@ formatting.
* [bibclean](http://ftp.math.utah.edu/pub/bibclean/)
* Bicep
* [bicep](https://github.com/Azure/bicep) :floppy_disk:
* Bindzone
* [checkzone](https://bind9.readthedocs.io/en/stable/manpages.html#named-checkzone-zone-file-validation-tool)
* BitBake
* [oelint-adv](https://github.com/priv-kweihmann/oelint-adv)
* Bourne Shell
@@ -379,6 +381,8 @@ formatting.
* [textlint](https://textlint.github.io/)
* [vale](https://github.com/ValeLint/vale)
* [write-good](https://github.com/btford/write-good)
* Lean 4
* [lake](https://github.com/leanprover/lean4)
* Less
* [lessc](https://www.npmjs.com/package/less)
* [prettier](https://github.com/prettier/prettier)
@@ -550,6 +554,7 @@ formatting.
* [pylint](https://www.pylint.org/) :floppy_disk:
* [pylsp](https://github.com/python-lsp/python-lsp-server) :warning:
* [pyre](https://github.com/facebook/pyre-check) :warning:
* [pyrefly](https://github.com/facebook/pyrefly) :warning:
* [pyright](https://github.com/microsoft/pyright)
* [refurb](https://github.com/dosisod/refurb) :floppy_disk:
* [reorder-python-imports](https://github.com/asottile/reorder_python_imports)
@@ -593,6 +598,10 @@ formatting.
* [write-good](https://github.com/btford/write-good)
* Robot
* [rflint](https://github.com/boakley/robotframework-lint)
* Roc
* [roc_annotate](https://github.com/roc-lang/roc)
* [roc_format](https://github.com/roc-lang/roc)
* [roc_language_server](https://github.com/roc-lang/roc)
* RPM spec
* [rpmlint](https://github.com/rpm-software-management/rpmlint) :warning: (see `:help ale-integration-spec`)
* Ruby

View File

@@ -14,7 +14,7 @@ Before:
let g:ale_completion_enabled = 0
let g:ale_completion_autoimport = 0
let g:ale_completion_max_suggestions = 50
let g:ale_linters = {'typescript': ['tsserver'], 'python': ['pyre']}
let g:ale_linters = {'typescript': ['tsserver'], 'python': ['pyrefly']}
unlet! b:ale_linters
let g:server_started_value = 1

View File

@@ -45,7 +45,8 @@ Execute(The clangformat callback should include style options as well):
\ {
\ 'command': ale#Escape(g:ale_c_clangformat_executable)
\ . ' --assume-filename=' . ale#Escape(bufname(bufnr('')))
\ . ' --some-option' . " -style='{BasedOnStyle: Microsoft, ColumnLimit:80,}'",
\ . ' --some-option'
\ . ' -style=' . ale#Escape(g:ale_c_clangformat_style_option)
\ },
\ ale#fixers#clangformat#Fix(bufnr(''))

View File

@@ -33,6 +33,9 @@ Execute(Emacs executable should be configurable):
let b:ale_erlang_erlang_mode_emacs_executable = '/path/to/emacs'
AssertEqual 0, stridx(Fixer('command'), ale#Escape('/path/to/emacs'))
Execute(enable-local-variables should be :safe):
Assert Fixer('command') =~# '\m\<enable-local-variables :safe\>'
Execute(erlang-indent-level should be 4 by default):
Assert Fixer('command') =~# '\m\<erlang-indent-level 4\>'

View File

@@ -1,48 +1,80 @@
Before:
call ale#assert#SetUpFixerTest('go', 'golangci_lint')
Save g:ale_go_go111module
Save g:ale_go_golangci_lint_executable
Save g:ale_go_golangci_lint_options
Save g:ale_go_golangci_lint_package
Save g:ale_go_golangci_formatter_executable
Save g:ale_go_golangci_formatter_options
" Use an invalid global executable, so we don't match it.
let g:ale_go_golangci_lint_executable = 'xxxinvalid'
let g:ale_go_golangci_lint_options = ''
call ale#test#SetDirectory('/testplugin/test/fixers')
call ale#test#SetFilename('../test-files/go/testfile.go')
After:
Restore
call ale#test#RestoreDirectory()
call ale#assert#TearDownFixerTest()
unlet! b:ale_go_go111module
call ale#test#RestoreDirectory()
Execute(The golangci-lint callback should return the correct default values with v1):
Execute(The golangci-lint callback should return the correct default values):
GivenCommandOutput ['golangci-lint has version 1.64.8 built with go1.23.0']
AssertEqual
AssertFixer
\ {
\ 'command': ale#Escape('xxxinvalid') . ' run --fix',
\ 'command': ale#Escape('golangci-lint') . ' run --fix ' . ale#Escape('testfile.go'),
\ }
Execute(The golangci-lint callback should include custom golangci-lint options with v1):
let g:ale_go_golangci_formatter_options = "--new --config /dev/null"
GivenCommandOutput ['golangci-lint has version 1.64.8 built with go1.23.0']
AssertFixer
\ {
\ 'command': ale#Escape('golangci-lint')
\ . ' run --fix ' . g:ale_go_golangci_formatter_options . ' ' . ale#Escape('testfile.go'),
\ },
\ ale#fixers#golangci_lint#Fix(bufnr(''))
Execute(The golangci-lint callback should include custom golangci-lint options):
let g:ale_go_golangci_lint_options = "--new --config /dev/null"
Execute(The golangci-lint callback should override executable with v1):
let g:ale_go_golangci_formatter_executable = 'xxxinvalid'
AssertEqual
GivenCommandOutput ['golangci-lint has version 1.64.8 built with go1.23.0']
AssertFixer
\ {
\ 'command': ale#Escape('xxxinvalid')
\ . ' run ' . g:ale_go_golangci_lint_options . ' --fix',
\ . ' run --fix '
\ . g:ale_go_golangci_formatter_options
\ . ' ' . ale#Escape('testfile.go'),
\ },
\ ale#fixers#golangci_lint#Fix(bufnr(''))
Execute(The golangci-lint callback should support per-file mode):
let g:ale_go_golangci_lint_package = 0
Execute(The golangci-lint callback should return the correct default values with v2):
AssertEqual
GivenCommandOutput ['golangci-lint has version 2.1.5 built with go1.23.0']
AssertFixer
\ {
\ 'command': ale#Escape('golangci-lint') . ' fmt --stdin ',
\ }
Execute(The golangci-lint callback should include custom golangci-lint options with v2):
let g:ale_go_golangci_formatter_options = "--new --config /dev/null"
GivenCommandOutput ['golangci-lint has version 2.1.5 built with go1.23.0']
AssertFixer
\ {
\ 'command': ale#Escape('golangci-lint')
\ . ' fmt --stdin ' . g:ale_go_golangci_formatter_options,
\ },
Execute(The golangci-lint callback should override executable with v2):
let g:ale_go_golangci_formatter_executable = 'xxxinvalid'
GivenCommandOutput ['golangci-lint has version 2.1.5 built with go1.23.0']
AssertFixer
\ {
\ 'command': ale#Escape('xxxinvalid')
\ . ' run '
\ . g:ale_go_golangci_lint_options
\ . ' --fix ' . ale#Escape('testfile.go'),
\ . ' fmt --stdin '
\ . g:ale_go_golangci_formatter_options
\ },
\ ale#fixers#golangci_lint#Fix(bufnr(''))

View File

@@ -0,0 +1,20 @@
Before:
call ale#assert#SetUpFixerTest('roc', 'roc_annotate')
After:
call ale#assert#TearDownFixerTest()
Execute(The roc annotate callback should return the correct default values):
AssertFixer {
\ 'command': 'roc format annotate %t',
\ 'read_temporary_file': 1,
\}
Execute(The roc annotate callback should allow a custom executable):
let g:ale_roc_roc_annotate_executable = 'foo/bar'
AssertFixer {
\ 'command': 'foo/bar format annotate %t',
\ 'read_temporary_file': 1,
\}

View File

@@ -0,0 +1,20 @@
Before:
call ale#assert#SetUpFixerTest('roc', 'roc_format')
After:
call ale#assert#TearDownFixerTest()
Execute(The roc format callback should return the correct default values):
AssertFixer {
\ 'command': 'roc format %t',
\ 'read_temporary_file': 1,
\}
Execute(The roc format callback should allow a custom executable):
let g:ale_roc_roc_format_executable = 'foo/bar'
AssertFixer {
\ 'command': 'foo/bar format %t',
\ 'read_temporary_file': 1,
\}

View File

@@ -0,0 +1,26 @@
Before:
runtime ale_linters/bindzone/checkzone.vim
After:
call ale#linter#Reset()
Execute(The checkzone handler should handle basic warnings):
AssertEqual
\ [
\ {
\ 'lnum': 2,
\ 'type': 'E',
\ 'text': 'unknown RR type ''fasd''',
\ },
\ {
\ 'lnum': 0,
\ 'type': 'W',
\ 'text': '_some_srv._tcp.example.com/SRV ''some.example.com'' (out of zone) has no addresses records (A or AAAA)',
\ },
\ ],
\ ale_linters#bindzone#checkzone#Handle(1, [
\ 'zone example.com/IN: _some_srv._tcp.example.com/SRV ''some.example.com'' (out of zone) has no addresses records (A or AAAA)',
\ 'zone example.com/IN: loaded serial 2025050400',
\ 'zone example.com/IN: not loaded due to errors',
\ '/tmp/vb3wXsu/2/example.com:2: unknown RR type ''fasd''',
\ ])

View File

@@ -17,7 +17,7 @@ Execute(The hadolint handler should handle a normal example):
\ 'col': 0,
\ 'type': 'W',
\ 'code': 'DL3006',
\ 'text': "DL3006: Always tag the version of an image explicitly",
\ 'text': 'Always tag the version of an image explicitly',
\ 'detail': "DL3006 ( https://github.com/hadolint/hadolint/wiki/DL3006 )\n\nAlways tag the version of an image explicitly",
\ },
\ {
@@ -25,7 +25,7 @@ Execute(The hadolint handler should handle a normal example):
\ 'col': 0,
\ 'type': 'W',
\ 'code': 'DL3033',
\ 'text': "DL3033: Specify version with `yum install -y <package>-<version>`.",
\ 'text': 'Specify version with `yum install -y <package>-<version>`.',
\ 'detail': "DL3033 ( https://github.com/hadolint/hadolint/wiki/DL3033 )\n\nSpecify version with `yum install -y <package>-<version>`.",
\ },
\ {
@@ -33,7 +33,7 @@ Execute(The hadolint handler should handle a normal example):
\ 'col': 0,
\ 'type': 'W',
\ 'code': 'SC2039',
\ 'text': "SC2039: In POSIX sh, brace expansion is undefined.",
\ 'text': 'In POSIX sh, brace expansion is undefined.',
\ 'detail': "SC2039 ( https://github.com/koalaman/shellcheck/wiki/SC2039 )\n\nIn POSIX sh, brace expansion is undefined.",
\ },
\ ],

View File

@@ -107,7 +107,7 @@ Execute(The mypy handler should handle Windows names with spaces):
\ {
\ 'lnum': 4,
\ 'col': 0,
\ 'filename': ale#path#Simplify('C:\something\with spaces.py'),
\ 'filename': ale#path#GetAbsPath(getcwd(), 'C:\something\with spaces.py'),
\ 'type': 'E',
\ 'text': 'No library stub file for module ''django.db''',
\ },

View File

@@ -27,6 +27,22 @@ Execute(The nix handler should parse nix-instantiate error messages correctly):
\ "@nix {\"unrelated\":\"message\"}"
\ ])
Execute(The nix handler should parse nix-instantiate error messages with ANSI color codes correctly):
AssertEqual
\ [
\ {
\ 'lnum': 3,
\ 'col': 5,
\ 'type': 'E',
\ 'text': "undefined variable 'foo'",
\ },
\
\ ],
\ ale_linters#nix#nix#Handle(bufnr(''), [
\ "@nix {\"line\":3,\"column\":5,\"raw_msg\":\"undefined variable '\\u001b[35;1mfoo\\u001b[0m'\"}",
\ "@nix {\"unrelated\":\"message\"}"
\ ])
Execute(The nix handler should parse message from old nix-instantiate correctly):
AssertEqual
\ [

View File

@@ -1,7 +1,18 @@
Before:
Save g:ale_warn_about_trailing_blank_lines
Save g:ale_warn_about_trailing_whitespace
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
runtime ale_linters/python/ruff.vim
After:
Restore
unlet! b:ale_warn_about_trailing_blank_lines
unlet! b:ale_warn_about_trailing_whitespace
call ale#linter#Reset()
Execute(We should handle basic output of ruff correctly):
@@ -41,3 +52,66 @@ Execute(We should handle mixed error lines and JSON output from ruff):
\ 'ERROR: oh noes!',
\ '{"cell":null,"code":"F821","end_location":{"column":8,"row":2},"filename":"/home/eduardo/Code/Python/test.py","fix":null,"location":{"column":1,"row":2},"message":"Undefined name example","noqa_row":2,"url":"https://docs.astral.sh/ruff/rules/undefined-name"}',
\ ])
Execute(Warnings about trailing whitespace should be reported by default):
AssertEqual
\ [
\ {
\ 'lnum': 6,
\ 'col': 1,
\ 'end_lnum': 6,
\ 'end_col': 1,
\ 'code': 'W291',
\ 'type': 'W',
\ 'text': 'who cares',
\ },
\ {
\ 'lnum': 6,
\ 'col': 1,
\ 'end_lnum': 6,
\ 'end_col': 1,
\ 'code': 'W293',
\ 'type': 'W',
\ 'text': 'who cares',
\ },
\ ],
\ ale_linters#python#ruff#Handle(bufnr(''), [
\ '{"cell":null,"code":"W291","end_location":{"column":2,"row":6},"filename":"/test.py","fix":null,"location":{"column":1,"row":6},"message":"who cares","noqa_row":2,"url":""}',
\ '{"cell":null,"code":"W293","end_location":{"column":2,"row":6},"filename":"/test.py","fix":null,"location":{"column":1,"row":6},"message":"who cares","noqa_row":2,"url":""}',
\ ])
Execute(Disabling trailing whitespace warnings should work):
let b:ale_warn_about_trailing_whitespace = 0
AssertEqual
\ [],
\ ale_linters#python#ruff#Handle(bufnr(''), [
\ '{"cell":null,"code":"W291","end_location":{"column":2,"row":6},"filename":"/test.py","fix":null,"location":{"column":1,"row":6},"message":"who cares","noqa_row":2,"url":""}',
\ '{"cell":null,"code":"W293","end_location":{"column":2,"row":6},"filename":"/test.py","fix":null,"location":{"column":1,"row":6},"message":"who cares","noqa_row":2,"url":""}',
\ ])
Execute(Warnings about trailing blank lines should be reported by default):
AssertEqual
\ [
\ {
\ 'lnum': 6,
\ 'col': 1,
\ 'end_lnum': 6,
\ 'end_col': 1,
\ 'code': 'W391',
\ 'type': 'W',
\ 'text': 'blank line at end of file',
\ },
\ ],
\ ale_linters#python#ruff#Handle(bufnr(''), [
\ '{"cell":null,"code":"W391","end_location":{"column":2,"row":6},"filename":"/test.py","fix":null,"location":{"column":1,"row":6},"message":"blank line at end of file","noqa_row":2,"url":""}',
\ ])
Execute(Disabling trailing blank line warnings should work):
let b:ale_warn_about_trailing_blank_lines = 0
AssertEqual
\ [],
\ ale_linters#python#ruff#Handle(bufnr(''), [
\ '{"cell":null,"code":"W391","end_location":{"column":2,"row":6},"filename":"/test.py","fix":null,"location":{"column":1,"row":6},"message":"blank line at end of file","noqa_row":2,"url":""}',
\ ])

View File

@@ -0,0 +1,19 @@
Before:
call ale#assert#SetUpLinterTest('bindzone', 'checkzone')
After:
call ale#assert#TearDownLinterTest()
Execute(The default command should be correct):
AssertLinter 'named-checkzone',
\ ale#Escape('named-checkzone') . ' -c IN example.com %t'
Execute(The default command should be overridden):
let b:ale_bindzone_checkzone_executable = '/bin/bind9-checkzone'
AssertLinter '/bin/bind9-checkzone',
\ ale#Escape('/bin/bind9-checkzone') . ' -c IN example.com %t'
Execute(The default options should be overridden):
let b:ale_bindzone_checkzone_options = '-c IN -d'
AssertLinter 'named-checkzone',
\ ale#Escape('named-checkzone') . ' -c IN -d example.com %t'

View File

@@ -125,35 +125,35 @@ Execute(The flake8 callbacks should detect virtualenv directories):
\ . ' --stdin-display-name %s -',
\]
Execute(The FindProjectRoot should detect the project root directory for namespace package via Manifest.in):
Execute(FindProjectRoot should detect the project root directory for namespace package via Manifest.in):
call ale#test#SetFilename('../test-files/python/namespace_package_manifest/namespace/foo/bar.py')
AssertEqual
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_manifest'),
\ ale#python#FindProjectRoot(bufnr(''))
Execute(The FindProjectRoot should detect the project root directory for namespace package via setup.cf):
Execute(FindProjectRoot should detect the project root directory for namespace package via setup.cf):
call ale#test#SetFilename('../test-files/python/namespace_package_setup/namespace/foo/bar.py')
AssertEqual
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_setup'),
\ ale#python#FindProjectRoot(bufnr(''))
Execute(The FindProjectRoot should detect the project root directory for namespace package via pytest.ini):
Execute(FindProjectRoot should ignore the location of pytest.ini):
call ale#test#SetFilename('../test-files/python/namespace_package_pytest/namespace/foo/bar.py')
AssertEqual
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_pytest'),
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_pytest/namespace'),
\ ale#python#FindProjectRoot(bufnr(''))
Execute(The FindProjectRoot should detect the project root directory for namespace package via tox.ini):
Execute(FindProjectRoot should detect the project root directory for namespace package via tox.ini):
call ale#test#SetFilename('../test-files/python/namespace_package_tox/namespace/foo/bar.py')
AssertEqual
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_tox'),
\ ale#python#FindProjectRoot(bufnr(''))
Execute(The FindProjectRoot should detect the project root directory for non-namespace package):
Execute(FindProjectRoot should detect the project root directory for non-namespace package):
call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py')
AssertEqual

View File

@@ -111,41 +111,6 @@ Execute(The flakehell callbacks should detect virtualenv directories):
\ . ' --stdin-display-name %s -',
\]
Execute(The FindProjectRoot should detect the project root directory for namespace package via Manifest.in):
call ale#test#SetFilename('../test-files/python/namespace_package_manifest/namespace/foo/bar.py')
AssertEqual
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_manifest'),
\ ale#python#FindProjectRoot(bufnr(''))
Execute(The FindProjectRoot should detect the project root directory for namespace package via setup.cf):
call ale#test#SetFilename('../test-files/python/namespace_package_setup/namespace/foo/bar.py')
AssertEqual
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_setup'),
\ ale#python#FindProjectRoot(bufnr(''))
Execute(The FindProjectRoot should detect the project root directory for namespace package via pytest.ini):
call ale#test#SetFilename('../test-files/python/namespace_package_pytest/namespace/foo/bar.py')
AssertEqual
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_pytest'),
\ ale#python#FindProjectRoot(bufnr(''))
Execute(The FindProjectRoot should detect the project root directory for namespace package via tox.ini):
call ale#test#SetFilename('../test-files/python/namespace_package_tox/namespace/foo/bar.py')
AssertEqual
\ ale#path#Simplify(g:dir . '/../test-files/python/namespace_package_tox'),
\ ale#python#FindProjectRoot(bufnr(''))
Execute(The FindProjectRoot should detect the project root directory for non-namespace package):
call ale#test#SetFilename('../test-files/python/no_virtualenv/subdir/foo/bar.py')
AssertEqual
\ ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir'),
\ ale#python#FindProjectRoot(bufnr(''))
" Some users currently run flakehell this way, so we should support it.
Execute(Using `python -m flakehell` should be supported for running flakehell):
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')

View File

@@ -4,6 +4,9 @@ Before:
call ale#assert#SetUpLinterTest('go', 'golangci_lint')
call ale#test#SetFilename('test.go')
" Test with version 1.64.8 by default
GivenCommandOutput ['golangci-lint has version 1.64.8 built with go1.23.0']
After:
Restore
@@ -16,6 +19,18 @@ Execute(The golangci-lint defaults should be correct):
AssertLinter 'golangci-lint',
\ ale#Escape('golangci-lint') . ' run --out-format=json --show-stats=0'
Execute(The golangci-lint defaults should be correct with no version info):
GivenCommandOutput []
AssertLinterCwd '%s:h',
AssertLinter 'golangci-lint',
\ ale#Escape('golangci-lint') . ' run --out-format=json --show-stats=0'
Execute(The golangci-lint defaults should be correct with version 2):
GivenCommandOutput ['golangci-lint has version 2.0.2 built with go1.24.0']
AssertLinterCwd '%s:h',
AssertLinter 'golangci-lint',
\ ale#Escape('golangci-lint') . ' run --output.json.path stdout --output.text.path stderr --show-stats=0'
Execute(The golangci-lint callback should use a configured executable):
let b:ale_go_golangci_lint_executable = 'something else'
@@ -23,6 +38,14 @@ Execute(The golangci-lint callback should use a configured executable):
\ ale#Escape('something else')
\ . ' run --out-format=json --show-stats=0'
Execute(The golangci-lint callback should use a configured version 2 executable):
GivenCommandOutput ['golangci-lint has version 2.0.0 built with go1.22.0']
let b:ale_go_golangci_lint_executable = 'something else'
AssertLinter 'something else',
\ ale#Escape('something else')
\ . ' run --output.json.path stdout --output.text.path stderr --show-stats=0'
Execute(The golangci-lint callback should use configured options):
let b:ale_go_golangci_lint_options = '--foobar'

View File

@@ -0,0 +1,27 @@
Before:
call ale#assert#SetUpLinterTest('lean', 'lake')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'lake', ale#Escape('lake') . ' serve'
Execute(The project root should be detected correctly without a lakefile):
AssertLSPProject '.'
Execute(The project root should be detected correctly from .toml):
call ale#test#SetFilename('../test-files/lean/lakefile_toml/lakefile.toml')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/lean/lakefile_toml')
Execute(The project root should be detected correctly from .lean):
call ale#test#SetFilename('../test-files/lean/lakefile_lean/lakefile.lean')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/lean/lakefile_lean')
Execute(The LSP values should be set correctly):
call ale#test#SetFilename('../test-files/lean/lakefile_lean/Main.lean')
AssertLSPLanguage 'lean'
AssertLSPOptions {}
AssertLSPConfig {}
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/lean/lakefile_lean')

View File

@@ -0,0 +1,69 @@
Before:
call ale#assert#SetUpLinterTest('python', 'pyrefly')
let b:bin_dir = has('win32') ? 'Scripts' : 'bin'
After:
unlet! b:bin_dir
unlet! b:executable
call ale#assert#TearDownLinterTest()
Execute(The pyrefly command callback should return default string):
call ale#test#SetFilename('./foo.py')
AssertLinter 'pyrefly', ale#Escape('pyrefly') . ' lsp'
Execute(The pyrefly executable should be configurable):
let g:ale_python_pyrefly_executable = '~/.local/bin/pyrefly'
AssertLinter '~/.local/bin/pyrefly',
\ ale#Escape('~/.local/bin/pyrefly') . ' lsp'
Execute(The pyrefly executable should be run from the virtualenv path):
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
let b:executable = ale#path#Simplify(
\ g:dir . '/../test-files/python/with_virtualenv/env/' . b:bin_dir . '/pyrefly'
\)
AssertLinter b:executable, ale#Escape(b:executable) . ' lsp'
Execute(You should be able to override the pyrefly virtualenv lookup):
call ale#test#SetFilename('../test-files/python/with_virtualenv/subdir/foo/bar.py')
let g:ale_python_pyrefly_use_global = 1
AssertLinter 'pyrefly', ale#Escape('pyrefly') . ' lsp'
Execute(Setting executable to 'pipenv' appends 'run pyrefly'):
let g:ale_python_pyrefly_executable = 'path/to/pipenv'
call ale#test#SetFilename('../test-files/dummy')
AssertLinter 'path/to/pipenv',
\ ale#Escape('path/to/pipenv') . ' run pyrefly lsp'
Execute(Pipenv is detected when python_pyrefly_auto_pipenv is set):
let g:ale_python_pyrefly_auto_pipenv = 1
call ale#test#SetFilename('../test-files/python/pipenv/whatever.py')
AssertLinter 'pipenv',
\ ale#Escape('pipenv') . ' run pyrefly lsp'
Execute(Setting executable to 'poetry' appends 'run pyrefly lsp'):
let g:ale_python_pyrefly_executable = 'path/to/poetry'
AssertLinter 'path/to/poetry',
\ ale#Escape('path/to/poetry') . ' run pyrefly lsp'
Execute(Poetry is detected when python_pyrefly_auto_poetry is set):
let g:ale_python_pyrefly_auto_poetry = 1
call ale#test#SetFilename('../test-files/python/poetry/whatever.py')
AssertLinter 'poetry',
\ ale#Escape('poetry') . ' run pyrefly lsp'
Execute(uv is detected when python_pyrefly_auto_uv is set):
let g:ale_python_pyrefly_auto_uv = 1
call ale#test#SetFilename('../test-files/python/uv/whatever.py')
AssertLinter 'uv',
\ ale#Escape('uv') . ' run pyrefly lsp'

View File

@@ -0,0 +1,23 @@
Before:
call ale#assert#SetUpLinterTest('roc', 'roc_language_server')
After:
call ale#assert#TearDownLinterTest()
Execute(The default executable path should be correct):
AssertLinter 'roc_language_server', ale#Escape('roc_language_server')
Execute(The project root should be detected correctly in empty directory):
AssertLSPProject '.'
Execute(The project root should be detected correctly with main.roc):
call ale#test#SetFilename('../test-files/roc/main.roc')
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/roc')
Execute(The LSP values should be set correctly):
call ale#test#SetFilename('../test-files/roc/main.roc')
AssertLSPLanguage 'roc'
AssertLSPOptions {}
AssertLSPConfig {}
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/roc')

View File

View File

View File

@@ -13,6 +13,15 @@ Execute(Relative paths should be resolved correctly):
AssertEqual
\ 'C:\foo\bar\baz\whatever.txt',
\ ale#path#GetAbsPath('C:\foo\bar\baz\xyz', '../whatever.txt')
AssertEqual
\ 'C:\foo\bar\baz\whatever.txt',
\ ale#path#GetAbsPath('C:\foo\bar\baz\xyz', '..\whatever.txt')
AssertEqual
\ 'C:\foo\bar\baz\whatever.txt',
\ ale#path#GetAbsPath('C:/foo/bar/baz/xyz', '../whatever.txt')
AssertEqual
\ 'C:\foo\bar\baz\whatever.txt',
\ ale#path#GetAbsPath('C:/foo/bar/baz/xyz', '..\whatever.txt')
endif
Execute(Absolute paths should be resolved correctly):
@@ -26,4 +35,12 @@ Execute(Absolute paths should be resolved correctly):
if has('win32')
AssertEqual '\ding', ale#path#GetAbsPath('/foo/bar/xyz', '\\ding')
AssertEqual 'c:\ding', ale#path#GetAbsPath('/foo/bar/xyz', 'c:/ding')
AssertEqual 'c:\ding', ale#path#GetAbsPath('/foo/bar/xyz', 'c:\ding')
AssertEqual 'c:\ding', ale#path#GetAbsPath('\foo\bar\xyz', 'c:/ding')
AssertEqual 'c:\ding', ale#path#GetAbsPath('\foo\bar\xyz', 'c:\ding')
AssertEqual 'c:\ding', ale#path#GetAbsPath('c:/foo/bar/xyz', 'c:/ding')
AssertEqual 'c:\ding', ale#path#GetAbsPath('c:/foo/bar/xyz', 'c:\ding')
AssertEqual 'c:\ding', ale#path#GetAbsPath('c:\foo\bar\xyz', 'c:/ding')
AssertEqual 'c:\ding', ale#path#GetAbsPath('c:\foo\bar\xyz', 'c:\ding')
endif

View File

@@ -407,7 +407,7 @@ Execute(PreProcess should allow the `project_root` to be set as a String):
\ 'project_root': '/foo/bar',
\})
AssertEqual '/foo/bar', ale#lsp_linter#FindProjectRoot(0, g:linter)
AssertEqual '/foo/bar', ale#linter#GetRoot(0, g:linter)
Execute(PreProcess should `project_root` be set as a Function):
let g:linter = ale#linter#PreProcess('testft', {
@@ -418,7 +418,7 @@ Execute(PreProcess should `project_root` be set as a Function):
\ 'project_root': {-> '/foo/bar'},
\})
AssertEqual '/foo/bar', ale#lsp_linter#FindProjectRoot(0, g:linter)
AssertEqual '/foo/bar', ale#linter#GetRoot(0, g:linter)
Execute(PreProcess should complain when `project_root` is invalid):
AssertThrows call ale#linter#PreProcess('testft', {

View File

@@ -0,0 +1,27 @@
Before:
Save g:ale_root
Save b:ale_root
call ale#test#SetDirectory('/testplugin/test')
After:
Restore
call ale#test#RestoreDirectory()
Execute(The global setting is used as the project root):
let g:ale_root = '/foo/python'
call ale#test#SetFilename('test-files/python/no_virtualenv/subdir/foo/bar.py')
AssertEqual '/foo/python', ale#python#FindProjectRoot(bufnr(''))
Execute(The buffer setting overrides the global setting):
let g:ale_root = '/foo/python'
let b:ale_root = '/bar/python'
call ale#test#SetFilename('test-files/python/no_virtualenv/subdir/foo/bar.py')
AssertEqual '/bar/python', ale#python#FindProjectRoot(bufnr(''))
Execute(Fallback to searching when no setting is used):
unlet! g:ale_root
unlet! b:ale_root
call ale#test#SetFilename('test-files/python/no_virtualenv/subdir/foo/bar.py')
AssertEqual \
\ ale#path#Simplify(g:dir . '/../test-files/python/no_virtualenv/subdir'),
\ ale#python#FindProjectRoot(bufnr(''))