Compare commits

..

1 Commits

Author SHA1 Message Date
Andrew Wray 0b0f8d91bc Prefer ale_root setting for project roots 2025-06-25 20:50:15 +01:00
365 changed files with 1193 additions and 5845 deletions
+62
View File
@@ -0,0 +1,62 @@
---
# Disabling building for AppVeyor. We are just testing things.
build: false
clone_depth: 10
# Use the directory C:\testplugin so test directories will mostly work.
clone_folder: C:\testplugin
branches:
only:
- master
- /v\d+\.\d+\.(x|\d+)/
# Skip running Windows tests if we only change files that can't impact
# Windows tests.
skip_commits:
files:
- '.github/**/*'
- .gitattributes
- Dockerfile
- README.md
- doc/*
- lua/*
- run-tests
- supported-tools.md
- syntax/*
# Cache the vim and vader directories between builds.
cache:
- C:\vim -> .appveyor.yml
- C:\vader -> .appveyor.yml
init:
# Stop git from changing newlines
- git config --global core.autocrlf input
# NOTE: If you change the Vim or Vader versions here, please also update the
# instructions for running tests on Windows in ale-development.txt
install:
# Download and unpack Vim
- ps: >-
if (!(Test-Path -Path C:\vim)){
Add-Type -A System.IO.Compression.FileSystem
Invoke-WebRequest ftp://ftp.vim.org/pub/vim/pc/vim80-586w32.zip `
-OutFile C:\vim.zip
[IO.Compression.ZipFile]::ExtractToDirectory('C:\vim.zip', 'C:\vim')
Invoke-WebRequest ftp://ftp.vim.org/pub/vim/pc/vim80-586rt.zip `
-OutFile C:\rt.zip
[IO.Compression.ZipFile]::ExtractToDirectory('C:\rt.zip', 'C:\vim')
}
# Clone Vader and check out the commit we want
- ps: >-
if (!(Test-Path -Path C:\vader)){
git clone https://github.com/junegunn/vader.vim C:\vader 2> $null
cd C:\vader
git checkout -qf c6243dd81c98350df4dec608fa972df98fa2a3af 2> $null
}
test_script:
- cd C:\testplugin
- 'C:\vim\vim\vim80\vim.exe -u test\vimrc "+Vader!
test/*.vader test/*/*.vader test/*/*/*.vader test/*/*/*.vader"'
+10 -60
View File
@@ -11,10 +11,9 @@ on: # yamllint disable-line rule:truthy
jobs:
build_image:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v4
- name: Build docker run image
shell: bash
env:
@@ -22,67 +21,18 @@ jobs:
DOCKER_HUB_PASS: ${{ secrets.DOCKER_HUB_PASS }}
run: ./run-tests --build-image
test_ale:
name: ${{ matrix.name }}
needs: build_image
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: Lint
test-args: --linters-only
- name: Lua
test-args: --lua-only
- name: Neovim 0.10 Linux
test-args: --neovim-010-only
- name: Neovim 0.12 Linux
test-args: --neovim-012-only
- name: Vim 8.2 Linux
test-args: --vim-82-only
- name: Vim 9.2 Linux
test-args: --vim-92-only
vim-version:
- '--vim-80-only'
- '--vim-90-only'
- '--neovim-07-only'
- '--neovim-08-only'
- '--lua-only'
- '--linters-only'
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v4
- name: Run tests
run: ./run-tests -v ${{ matrix.test-args }}
test_ale_windows:
name: ${{ matrix.name }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- name: Neovim 0.10 Windows
editor: neovim
version: v0.10.4
- name: Neovim 0.12 Windows
editor: neovim
version: v0.12.1
- name: Vim 8.2 Windows
editor: vim
version: v8.2.4843
- name: Vim 9.2 Windows
editor: vim
version: v9.2.0329
steps:
- uses: actions/checkout@v6
- name: Setup ${{ matrix.editor }} ${{ matrix.version }}
uses: rhysd/action-setup-vim@v1
id: editor
with:
neovim: ${{ matrix.editor == 'neovim' }}
version: ${{ matrix.version }}
- name: Clone Vader
shell: cmd
run: |
git clone https://github.com/junegunn/vader.vim C:\vader
git -C C:\vader checkout -qf c6243dd81c98350df4dec608fa972df98fa2a3af
- name: Run tests
shell: cmd
env:
VIM_EXE: ${{ steps.editor.outputs.executable }}
VIM_HEADLESS: ${{ matrix.editor == 'neovim' && '--headless' || '--not-a-term' }}
run: |
set TMP=%CD:~0,2%\tmp
set TEMP=%CD:~0,2%\tmp
if not exist "%CD:~0,2%\tmp" mkdir "%CD:~0,2%\tmp"
run-tests.bat
run: ./run-tests -v ${{ matrix.vim-version }}
-6
View File
@@ -1,6 +0,0 @@
# ALE Agent instructions
1. Read documentation from `doc/ale-development.txt` to understand how to be an
ALE developer.
2. Run Vader/Vim tests with `./run-tests -q --fast test/path/some_file.vader`
3. When editing Lua code run Lua tests with `./run-tests -q --lua-only`
+10 -60
View File
@@ -1,78 +1,28 @@
#############################################################################
# Base testbed image copied from:
# https://github.com/Vimjas/vim-testbed/blob/master/Dockerfile
FROM alpine:3.23 as testbed
ARG TESTBED_VIM_VERSION=24
RUN apk --no-cache upgrade
FROM testbed/vim:${TESTBED_VIM_VERSION}
ENV PACKAGES="\
build-base \
linux-headers \
cmake \
coreutils \
msgpack-c-dev \
libtermkey-dev \
libvterm-dev \
unibilium-dev \
ncurses-dev \
lua5.1 \
lua5.1-dev \
lua5.1-lpeg \
lua5.1-mpack \
lua5.1-busted \
bash \
git \
grep \
sed \
python2 \
python3 \
py3-pip \
gettext-dev \
libuv-dev \
libluv \
lua-luv-dev \
utf8proc-dev \
vint \
curl \
gettext-dev \
libtool \
ninja \
tree-sitter-dev \
grep \
sed \
"
RUN apk --update add $PACKAGES && \
rm -rf /var/cache/apk/* /tmp/* /var/tmp/*
RUN adduser -h /home/vimtest -s /bin/sh -D -u 8465 vimtest
RUN install_vim -tag v8.0.0027 -build \
-tag v9.0.0297 -build \
-tag neovim:v0.7.0 -build \
-tag neovim:v0.8.0 -build
RUN mkdir -p /vim /vim-build/bin /plugins
RUN chown vimtest:vimtest /home /plugins
# Useful during tests to have these packages in a deeper layer cached already.
# RUN apk --no-cache add --virtual vim-build build-base
ADD docker/argecho.sh /vim-build/bin/argecho
ADD docker/install_vim.sh /sbin/install_vim
ADD docker/run_vim.sh /sbin/run_vim
RUN chmod +x /vim-build/bin/argecho /sbin/install_vim /sbin/run_vim
# The user directory for setup
VOLUME /home/vimtest
# Your plugin
VOLUME /testplugin
ENTRYPOINT ["/sbin/run_vim"]
#############################################################################
# ALE Test image
#
FROM testbed
RUN install_vim -tag v8.2.5172 -build \
-tag v9.2.0329 -build \
-tag neovim:v0.10.4 -build \
-tag neovim:v0.12.1 -build
RUN pip install vim-vint==0.3.21
RUN git clone https://github.com/junegunn/vader.vim vader && \
cd vader && git checkout c6243dd81c98350df4dec608fa972df98fa2a3af
+2 -10
View File
@@ -1,11 +1,11 @@
# Asynchronous Lint Engine
[![Vim](https://img.shields.io/badge/VIM-%2311AB00.svg?style=for-the-badge&logo=vim&logoColor=white)](https://www.vim.org/) [![Neovim](https://img.shields.io/badge/NeoVim-%2357A143.svg?&style=for-the-badge&logo=neovim&logoColor=white)](https://neovim.io/) [![CI](https://img.shields.io/github/actions/workflow/status/dense-analysis/ale/main.yml?branch=master&label=CI&logo=github&style=for-the-badge)](https://github.com/dense-analysis/ale/actions?query=event%3Apush+workflow%3ACI+branch%3Amaster++) [![Join the Dense Analysis Discord server](https://img.shields.io/badge/chat-Discord-5865F2?style=for-the-badge&logo=appveyor)](https://discord.gg/5zFD6pQxDk)
[![Vim](https://img.shields.io/badge/VIM-%2311AB00.svg?style=for-the-badge&logo=vim&logoColor=white)](https://www.vim.org/) [![Neovim](https://img.shields.io/badge/NeoVim-%2357A143.svg?&style=for-the-badge&logo=neovim&logoColor=white)](https://neovim.io/) [![CI](https://img.shields.io/github/actions/workflow/status/dense-analysis/ale/main.yml?branch=master&label=CI&logo=github&style=for-the-badge)](https://github.com/dense-analysis/ale/actions?query=event%3Apush+workflow%3ACI+branch%3Amaster++) [![AppVeyor Build Status](https://img.shields.io/appveyor/build/dense-analysis/ale?label=Windows&style=for-the-badge)](https://ci.appveyor.com/project/dense-analysis/ale) [![Join the Dense Analysis Discord server](https://img.shields.io/badge/chat-Discord-5865F2?style=for-the-badge&logo=appveyor)](https://discord.gg/5zFD6pQxDk)
![ALE Logo by Mark Grealish - https://www.bhalash.com/](https://user-images.githubusercontent.com/3518142/59195920-2c339500-8b85-11e9-9c22-f6b7f69637b8.jpg)
ALE (Asynchronous Lint Engine) is a plugin providing linting (syntax checking
and semantic errors) in Neovim 0.7.0+ and Vim 8.2+ while you edit your text files,
and semantic errors) in Neovim 0.7.0+ and Vim 8.0+ while you edit your text files,
and acts as a Vim [Language Server Protocol](https://langserver.org/) client.
<video autoplay="true" muted="true" loop="true" controls="false" src="https://user-images.githubusercontent.com/3518142/210141215-8f2ff760-6a87-4704-a11e-c109b8e9ec41.mp4" title="An example showing what ALE can do."></video>
@@ -61,14 +61,6 @@ linting and fixing of code in Vim. ALE offers the following.
* Windows support
* Well-integrated with other plugins
## Sponsorship
If you would like to donate to Dense Analysis to say thank you for ALE, please
consider visiting our [Sponsorship page](https://denseanalysis.org/sponsors/).
Funds will be used to pay for our hosting fees and research. Whilst visiting our
site, please feel free to make use of our educational resources and other
recommended tools.
## Supported Languages and Tools
ALE supports a wide variety of languages and tools. See the
+13 -68
View File
@@ -2,44 +2,11 @@
" Description: ansible-lint for ansible-yaml files
call ale#Set('ansible_ansible_lint_executable', 'ansible-lint')
call ale#Set('ansible_ansible_lint_auto_pipenv', 0)
call ale#Set('ansible_ansible_lint_auto_poetry', 0)
call ale#Set('ansible_ansible_lint_auto_uv', 0)
call ale#Set('ansible_ansible_lint_change_directory', 1)
function! ale_linters#ansible#ansible_lint#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv')
\ || ale#Var(a:buffer, 'ansible_ansible_lint_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry')
\ || ale#Var(a:buffer, 'ansible_ansible_lint_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv')
\ || ale#Var(a:buffer, 'ansible_ansible_lint_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#Var(a:buffer, 'ansible_ansible_lint_executable')
endfunction
function! ale_linters#ansible#ansible_lint#GetCwd(buffer) abort
if ale#Var(a:buffer, 'ansible_ansible_lint_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#ansible#ansible_lint#Handle(buffer, version, lines) abort
for l:line in a:lines[:10]
if match(l:line, '^Traceback') >= 0
@@ -136,50 +103,28 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort
endfunction
function! ale_linters#ansible#ansible_lint#GetCommand(buffer, version) abort
let l:executable = ale_linters#ansible#ansible_lint#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
\ ? ' run ansible-lint'
\ : ''
let l:opts_map = {
\ '>=6.0.0': ' --nocolor -f json -x yaml %s',
\ '>=5.0.0': ' --nocolor --parseable-severity -x yaml %s',
\ '<5.0.0': ' --nocolor -p %t'
let l:commands = {
\ '>=6.0.0': '%e --nocolor -f json -x yaml %s',
\ '>=5.0.0': '%e --nocolor --parseable-severity -x yaml %s',
\ '<5.0.0': '%e --nocolor -p %t'
\}
let l:cmd_opts = ale#semver#GTE(a:version, [6, 0]) ? l:opts_map['>=6.0.0'] :
\ ale#semver#GTE(a:version, [5, 0]) ? l:opts_map['>=5.0.0'] :
\ l:opts_map['<5.0.0']
let l:command = ale#Escape(l:executable) . l:exec_args . l:cmd_opts
let l:command = ale#semver#GTE(a:version, [6, 0]) ? l:commands['>=6.0.0'] :
\ ale#semver#GTE(a:version, [5, 0]) ? l:commands['>=5.0.0'] :
\ l:commands['<5.0.0']
return l:command
endfunction
function! ale_linters#ansible#ansible_lint#RunWithVersionCheck(buffer) abort
let l:executable = ale_linters#ansible#ansible_lint#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
\ ? ' run ansible-lint'
\ : ''
let l:command = ale#Escape(l:executable) . l:exec_args . ' --version'
return ale#semver#RunWithVersionCheck(
\ a:buffer,
\ l:executable,
\ l:command,
\ function('ale_linters#ansible#ansible_lint#GetCommand'),
\)
endfunction
call ale#linter#Define('ansible', {
\ 'name': 'ansible_lint',
\ 'aliases': ['ansible', 'ansible-lint'],
\ 'executable': function('ale_linters#ansible#ansible_lint#GetExecutable'),
\ 'cwd': function('ale_linters#ansible#ansible_lint#GetCwd'),
\ 'command': function('ale_linters#ansible#ansible_lint#RunWithVersionCheck'),
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
\ buffer,
\ ale_linters#ansible#ansible_lint#GetExecutable(buffer),
\ '%e --version',
\ function('ale_linters#ansible#ansible_lint#GetCommand'),
\ )},
\ 'lint_file': 1,
\ 'callback': {buffer, lines -> ale#semver#RunWithVersionCheck(
\ buffer,
+2 -4
View File
@@ -1,11 +1,9 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for AsciiDoc files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('asciidoc', {
\ 'name': 'proselint',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
+6 -1
View File
@@ -1,4 +1,9 @@
" Author: rhysd https://rhysd.github.io
" Description: Redpen, a proofreading tool (http://redpen.cc)
call ale#handlers#redpen#DefineLinter('asciidoc')
call ale#linter#Define('asciidoc', {
\ 'name': 'redpen',
\ 'executable': 'redpen',
\ 'command': 'redpen -f asciidoc -r json %t',
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
\})
+1 -1
View File
@@ -9,7 +9,7 @@ function! ale_linters#asm#gcc#GetCommand(buffer) abort
" -fsyntax-only doesn't catch everything.
return '%e -x assembler'
\ . ' -o ' . g:ale#util#nul_file
\ . ' -iquote %s:h'
\ . '-iquote %s:h'
\ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -'
endfunction
+11 -18
View File
@@ -5,14 +5,6 @@ call ale#Set('bitbake_oelint_adv_executable', 'oelint-adv')
call ale#Set('bitbake_oelint_adv_options', '')
call ale#Set('bitbake_oelint_adv_config', '.oelint.cfg')
function! ale_linters#bitbake#oelint_adv#StripAnsiCodes(line) abort
return substitute(a:line, '\e\[[0-9;]\+[mK]', '', 'g')
endfunction
function! ale_linters#bitbake#oelint_adv#RemoveBranch(line) abort
return substitute(a:line, ' \[branch:.*', '', 'g')
endfunction
function! ale_linters#bitbake#oelint_adv#Command(buffer) abort
let l:config_file = ale#path#FindNearestFile(a:buffer,
\ ale#Var(a:buffer, 'bitbake_oelint_adv_config'))
@@ -25,25 +17,26 @@ function! ale_linters#bitbake#oelint_adv#Command(buffer) abort
endfunction
function! ale_linters#bitbake#oelint_adv#Handle(buffer, lines) abort
let l:pattern = '\v^(.{-}):(.{-}):(.{-}):(.{-}):(.{-})$'
let l:pattern = '\v^(.+):(.+):(.+):(.+):(.+)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'lnum': str2nr(l:match[2]),
\ 'type': l:match[3] is# 'error'
\ ? 'E'
\ : (l:match[3] is# 'warning' ? 'W' : 'I'),
\ 'text': ale_linters#bitbake#oelint_adv#RemoveBranch(
\ ale_linters#bitbake#oelint_adv#StripAnsiCodes(l:match[5])
\ ),
\ 'code': l:match[4],
\})
\ 'lnum': str2nr(l:match[2]),
\ 'type': l:match[3] is# 'error'
\ ? 'E' : (l:match[3] is# 'warning' ? 'W' : 'I'),
\ 'text': StripAnsiCodes(l:match[5]),
\ 'code': l:match[4]
\ })
endfor
return l:output
endfunction
function! StripAnsiCodes(line) abort
return substitute(a:line, '\e\[[0-9;]\+[mK]', '', 'g')
endfunction
call ale#linter#Define('bitbake', {
\ 'name': 'oelint_adv',
\ 'output_stream': 'both',
+1 -6
View File
@@ -10,18 +10,13 @@ function! ale_linters#c#cppcheck#GetCommand(buffer) abort
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
\ : ''
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
" Versions >=2.13 don't allow using --project in conjunction with an
" explicit source file.
let l:source_file = stridx(l:compile_commands_option, '--project=') < 0
\ ? ' %t'
\ : ''
return '%e -q --language=c'
\ . l:template
\ . ale#Pad(l:compile_commands_option)
\ . ale#Pad(ale#Var(a:buffer, 'c_cppcheck_options'))
\ . l:buffer_path_include
\ . l:source_file
\ . ' %t'
endfunction
call ale#linter#Define('c', {
-41
View File
@@ -1,41 +0,0 @@
" Author: J. Handsel <jennpbc@posteo.net>, Thyme-87 <thyme-87@posteo.me>
" Description: use checkov for providing warnings for cloudformation via ale
call ale#Set('cloudformation_checkov_executable', 'checkov')
call ale#Set('cloudformation_checkov_options', '')
function! ale_linters#cloudformation#checkov#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'cloudformation_checkov_executable')
endfunction
function! ale_linters#cloudformation#checkov#GetCommand(buffer) abort
return '%e ' . '-f %t -o json --quiet --framework cloudformation ' . ale#Var(a:buffer, 'cloudformation_checkov_options')
endfunction
function! ale_linters#cloudformation#checkov#Handle(buffer, lines) abort
let l:output = []
let l:results = get(get(ale#util#FuzzyJSONDecode(a:lines, {}), 'results', []), 'failed_checks', [])
for l:violation in l:results
call add(l:output, {
\ 'filename': l:violation['file_path'],
\ 'lnum': l:violation['file_line_range'][0],
\ 'end_lnum': l:violation['file_line_range'][1],
\ 'text': l:violation['check_name'] . ' [' . l:violation['check_id'] . ']',
\ 'detail': l:violation['check_id'] . ': ' . l:violation['check_name'] . "\n" .
\ 'For more information, see: '. l:violation['guideline'],
\ 'type': 'W',
\ })
endfor
return l:output
endfunction
call ale#linter#Define('cloudformation', {
\ 'name': 'checkov',
\ 'output_stream': 'stdout',
\ 'executable': function('ale_linters#cloudformation#checkov#GetExecutable'),
\ 'command': function('ale_linters#cloudformation#checkov#GetCommand'),
\ 'callback': 'ale_linters#cloudformation#checkov#Handle',
\})
+1 -1
View File
@@ -18,7 +18,7 @@ function! ale_linters#cpp#clazy#GetCommand(buffer) abort
return '%e'
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
\ . ale#Pad(l:options)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' %s'
endfunction
+1 -6
View File
@@ -10,18 +10,13 @@ function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
\ : ''
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
" Versions >=2.13 don't allow using --project in conjunction with an
" explicit source file.
let l:source_file = stridx(l:compile_commands_option, '--project=') < 0
\ ? ' %t'
\ : ''
return '%e -q --language=c++'
\ . l:template
\ . ale#Pad(l:compile_commands_option)
\ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options'))
\ . l:buffer_path_include
\ . l:source_file
\ . ' %t'
endfunction
call ale#linter#Define('cpp', {
+1 -1
View File
@@ -4,7 +4,7 @@ function! ale_linters#cs#mcs#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'cs_mcs_options')
return 'mcs -unsafe --parse'
\ . ale#Pad(l:options)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' %t'
endfunction
+1 -1
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'))
\ . ' --no-color --stdin-filename %s'
\ . ' --stdin-filename %s'
endfunction
call ale#linter#Define('css', {
+1 -1
View File
@@ -23,7 +23,7 @@ function! ale_linters#cuda#nvcc#HandleNVCCFormat(buffer, lines) abort
\ 'lnum': str2nr(l:match[2]),
\ 'type': l:match[4] =~# 'error' ? 'E' : 'W',
\ 'text': l:match[5],
\ 'filename': ale#path#Simplify(fnamemodify(l:match[1], ':p')),
\ 'filename': fnamemodify(l:match[1], ':p'),
\}
if !empty(l:match[3])
+1 -3
View File
@@ -87,9 +87,7 @@ function! ale_linters#d#dmd#Handle(buffer, lines) abort
" Matches patterns lines like the following:
" /tmp/tmp.qclsa7qLP7/file.d(1): Error: function declaration without return type. (Note that constructors are always named 'this')
" /tmp/tmp.G1L5xIizvB.d(8,8): Error: module weak_reference is in file 'dstruct/weak_reference.d' which cannot be read
" Use [^(]+ instead of \f+ because NeoVim's 'isfname' on Windows does
" not include \ or :, so \f+ cannot match Windows absolute paths.
let l:pattern = '\v^([^(]+)\((\d+)(,(\d+))?\): (\w+): (.+)$'
let l:pattern = '\v^(\f+)\((\d+)(,(\d+))?\): (\w+): (.+)$'
let l:output = []
let l:dir = expand('#' . a:buffer . ':p:h')
-12
View File
@@ -1,12 +0,0 @@
" 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 --stdio',
\ 'project_root': function('ale#handlers#elixir#FindMixUmbrellaRoot'),
\})
-47
View File
@@ -1,47 +0,0 @@
" Author: gomfol12
" Desciption: A linter for fortran using fortitude.
call ale#Set('fortran_fortitude_executable', 'fortitude')
call ale#Set('fortran_fortitude_options', '')
let s:severity_map = {
\ 'E': 'E',
\ 'C': 'W',
\ 'OB': 'I',
\ 'MOD': 'I',
\ 'S': 'I',
\ 'PORT': 'I',
\ 'FORT': 'I',
\}
function! ale_linters#fortran#fortitude#Handle(buffer, lines) abort
let l:output = []
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
let l:prefix = matchstr(l:error['code'], '^\a\+')
let l:type = get(s:severity_map, l:prefix, 'I')
call add(l:output, {
\ 'lnum': l:error['location']['row'],
\ 'end_lnum': l:error['end_location']['row'],
\ 'col': l:error['location']['column'],
\ 'end_col': l:error['end_location']['column'],
\ 'text': l:error['message'],
\ 'type': l:type,
\ 'code': l:error['code'],
\})
endfor
return l:output
endfunction
call ale#linter#Define('fortran', {
\ 'name': 'fortitude',
\ 'output_stream': 'stdout',
\ 'executable': {b -> ale#Var(b, 'fortran_fortitude_executable')},
\ 'command': {b ->
\ '%e' . ' check --output-format json' . ale#Pad(ale#Var(b, 'fortran_fortitude_options')) . ' %s'
\ },
\ 'callback': 'ale_linters#fortran#fortitude#Handle',
\ 'lint_file': 1,
\})
+4 -6
View File
@@ -1,11 +1,9 @@
" Author: Jansen Mitchell https://github.com/JansenMitchell
" Description: proselint for Fountain files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('fountain', {
\ 'name': 'proselint',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\ 'name': 'proselint',
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
+1 -1
View File
@@ -8,7 +8,7 @@ function! ale_linters#go#revive#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'go_revive_options')
return ale#go#EnvString(a:buffer) . '%e'
\ . ale#Pad(l:options)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' %t'
endfunction
+2 -2
View File
@@ -13,11 +13,11 @@ function! ale_linters#go#staticcheck#GetCommand(buffer) abort
if l:lint_package
return l:env . '%e'
\ . ale#Pad(l:options) . ' .'
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
endif
return l:env . '%e'
\ . ale#Pad(l:options)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' %s:t'
endfunction
+1 -1
View File
@@ -8,7 +8,7 @@ function! ale_linters#groovy#npmgroovylint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'groovy_npmgroovylint_options')
return '%e --failon none --output json'
\ . ale#Pad(l:options)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' %t'
endfunction
+2 -4
View File
@@ -1,11 +1,9 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for Vim help files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('help', {
\ 'name': 'proselint',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
+2 -4
View File
@@ -1,11 +1,9 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for HTML files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('html', {
\ 'name': 'proselint',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
+2 -2
View File
@@ -15,8 +15,8 @@ function! ale_linters#html#stylelint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'html_stylelint_options')
return ale#Escape(l:executable)
\ . ale#Pad(l:options)
\ . ' --no-color --stdin-filename %s'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' --stdin-filename %s'
endfunction
call ale#linter#Define('html', {
-34
View File
@@ -1,34 +0,0 @@
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',
\})
+1 -1
View File
@@ -19,7 +19,7 @@ function! ale_linters#javascript#standard#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'javascript_standard_options')
return ale#node#Executable(a:buffer, l:executable)
\ . ale#Pad(l:options)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' --stdin %s'
endfunction
-46
View File
@@ -1,46 +0,0 @@
" Description: linter for jinja using j2lint
call ale#Set('jinja_j2lint_executable', 'j2lint')
call ale#Set('jinja_j2lint_options', '')
call ale#Set('jinja_j2lint_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('jinja_j2lint_auto_pipenv', 0)
call ale#Set('jinja_j2lint_auto_poetry', 0)
call ale#Set('jinja_j2lint_auto_uv', 0)
function! ale_linters#jinja#j2lint#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'jinja_j2lint_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
if (ale#Var(a:buffer, 'python_auto_poetry') || ale#Var(a:buffer, 'jinja_j2lint_auto_poetry'))
\ && ale#python#PoetryPresent(a:buffer)
return 'poetry'
endif
if (ale#Var(a:buffer, 'python_auto_uv') || ale#Var(a:buffer, 'jinja_j2lint_auto_uv'))
\ && ale#python#UvPresent(a:buffer)
return 'uv'
endif
return ale#python#FindExecutable(a:buffer, 'jinja_j2lint', ['j2lint'])
endfunction
function! ale_linters#jinja#j2lint#GetCommand(buffer) abort
let l:executable = ale_linters#jinja#j2lint#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'pipenv\|poetry\|uv$'
\ ? ' run j2lint'
\ : ''
return ale#Escape(l:executable) . l:exec_args
\ . ale#Pad(ale#Var(a:buffer, 'jinja_j2lint_options'))
\ . ' %t'
endfunction
call ale#linter#Define('jinja', {
\ 'name': 'j2lint',
\ 'executable': function('ale_linters#jinja#j2lint#GetExecutable'),
\ 'command': function('ale_linters#jinja#j2lint#GetCommand'),
\ 'callback': 'ale#handlers#unix#HandleAsError',
\})
+1 -1
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) . ' --no-color --stdin-filename %s'
return '%e' . ale#Pad(l:options) . ' --stdin-filename %s'
endfunction
call ale#linter#Define('less', {
-40
View File
@@ -1,40 +0,0 @@
" Author: Sam Bottoni
" Description: lilypond linter for LilyPond files
call ale#Set('lilypond_lilypond_executable', 'lilypond')
let g:ale_lilypond_lilypond_options = get(g:, 'ale_lilypond_lilypond_options', '')
function! ale_linters#lilypond#lilypond#GetCommand(buffer) abort
return '%e --loglevel=WARNING -dbackend=null -dno-print-pages -o /tmp'
\ . ale#Pad(ale#Var(a:buffer, 'lilypond_lilypond_options'))
\ . ' %t 2>&1'
endfunction
function! ale_linters#lilypond#lilypond#Handle(buffer, lines) abort
let l:output = []
for l:line in a:lines
" Match: file:line:col: error|warning|programming error: message
let l:match = matchlist(l:line,
\ '\v^.*:(\d+):(\d+): (error|warning|programming error): (.*)$')
if !empty(l:match)
call add(l:output, {
\ 'lnum': str2nr(l:match[1]),
\ 'col': str2nr(l:match[2]),
\ 'type': l:match[3] =~? 'error' ? 'E' : 'W',
\ 'text': l:match[4]
\})
endif
endfor
return l:output
endfunction
call ale#linter#Define('lilypond', {
\ 'name': 'lilypond',
\ 'executable': {b -> ale#Var(b, 'lilypond_lilypond_executable')},
\ 'command': function('ale_linters#lilypond#lilypond#GetCommand'),
\ 'callback': 'ale_linters#lilypond#lilypond#Handle',
\})
+2 -4
View File
@@ -1,11 +1,9 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for mail files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('mail', {
\ 'name': 'proselint',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
-32
View File
@@ -1,32 +0,0 @@
" Author: Armand Halbert <armand.halbert@gmail.com>
" Description: Harper for Markdown files
call ale#Set('markdown_harper_config', {
\ 'harper-ls': {
\ 'diagnosticSeverity': 'hint',
\ 'dialect': 'American',
\ 'linters': {
\ 'SpellCheck': v:true,
\ 'SentenceCapitalization': v:true,
\ 'RepeatedWords': v:true,
\ 'LongSentences': v:true,
\ 'AnA': v:true,
\ 'Spaces': v:true,
\ 'SpelledNumbers': v:false,
\ 'WrongQuotes': v:false,
\ },
\ },
\})
call ale#linter#Define('markdown', {
\ 'name': 'harper',
\ 'lsp': 'stdio',
\ 'executable': 'harper-ls',
\ 'command': '%e --stdio',
\ 'project_root': function('ale_linters#markdown#harper#GetProjectRoot'),
\ 'lsp_config': {b -> ale#Var(b, 'markdown_harper_config')},
\})
function! ale_linters#markdown#harper#GetProjectRoot(buffer) abort
return fnamemodify(bufname(a:buffer), ':p:h')
endfunction
+1 -1
View File
@@ -14,7 +14,7 @@ function! ale_linters#markdown#markdownlint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'markdown_markdownlint_options')
return ale#Escape(l:executable)
\ . ale#Pad(l:options) . ' %s'
\ . (!empty(l:options) ? ' ' . l:options : '') . ' %s'
endfunction
call ale#linter#Define('markdown', {
+1 -1
View File
@@ -17,7 +17,7 @@ function! ale_linters#markdown#mdl#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'markdown_mdl_options')
return ale#Escape(l:executable) . l:exec_args
\ . ' -j' . ale#Pad(l:options)
\ . ' -j' . (!empty(l:options) ? ' ' . l:options : '')
endfunction
function! ale_linters#markdown#mdl#Handle(buffer, lines) abort
+2 -4
View File
@@ -1,11 +1,9 @@
" Author: poohzrn https://github.com/poohzrn
" Description: proselint for Markdown files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('markdown', {
\ 'name': 'proselint',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
+3 -2
View File
@@ -33,8 +33,9 @@ function! ale_linters#markdown#pymarkdown#GetCommand(buffer) abort
\ : ''
return ale#Escape(l:executable) . l:exec_args
\ . ale#Pad(ale#Var(a:buffer, 'markdown_pymarkdown_options'))
\ . ' scan-stdin'
\ . ' '
\ . ale#Var(a:buffer, 'markdown_pymarkdown_options')
\ . 'scan-stdin'
endfunction
function! ale_linters#markdown#pymarkdown#Handle(buffer, lines) abort
+6 -1
View File
@@ -1,4 +1,9 @@
" Author: rhysd https://rhysd.github.io
" Description: Redpen, a proofreading tool (http://redpen.cc)
call ale#handlers#redpen#DefineLinter('markdown')
call ale#linter#Define('markdown', {
\ 'name': 'redpen',
\ 'executable': 'redpen',
\ 'command': 'redpen -f markdown -r json %t',
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
\})
-48
View File
@@ -1,48 +0,0 @@
" Author: Evan Chen <evan@evanchen.cc>
" Description: Fast Markdown linter and formatter written in Rust
call ale#Set('markdown_rumdl_executable', 'rumdl')
call ale#Set('markdown_rumdl_options', '')
function! ale_linters#markdown#rumdl#GetProjectRoot(buffer) abort
let l:dotconfig = ale#path#FindNearestFile(a:buffer, '.rumdl.toml')
let l:config = ale#path#FindNearestFile(a:buffer, 'rumdl.toml')
if !empty(l:dotconfig) && !empty(l:config)
let l:nearest = len(l:dotconfig) >= len(l:config) ? l:dotconfig : l:config
return fnamemodify(l:nearest, ':h')
elseif !empty(l:dotconfig)
return fnamemodify(l:dotconfig, ':h')
elseif !empty(l:config)
return fnamemodify(l:config, ':h')
endif
" Try to find nearest pyproject.toml
let l:pyproject_file = ale#path#FindNearestFile(a:buffer, 'pyproject.toml')
if !empty(l:pyproject_file)
return fnamemodify(l:pyproject_file . '/', ':p:h:h')
endif
" Try to find nearest `git` directory
let l:gitdir = ale#path#FindNearestFile(a:buffer, '.git')
if !empty(l:gitdir)
return fnamemodify(l:gitdir . '/', ':p:h:h')
endif
return fnamemodify(bufname(a:buffer), ':p:h')
endfunction
call ale#linter#Define('markdown', {
\ 'name': 'rumdl',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'markdown_rumdl_executable')},
\ 'command': {b -> ale#Escape(ale#Var(b, 'markdown_rumdl_executable'))
\ . ' server --stdio'
\ . ale#Pad(ale#Var(b, 'markdown_rumdl_options'))},
\ 'project_root': function('ale_linters#markdown#rumdl#GetProjectRoot'),
\ 'language': 'markdown',
\})
+2 -4
View File
@@ -1,11 +1,9 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for nroff files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('nroff', {
\ 'name': 'proselint',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
-26
View File
@@ -1,26 +0,0 @@
" Authors: ophirr33 <coghlan.ty@gmail.com>, rymdbar <https://rymdbar.x20.se/>
" Description: Perl::LanguageServer for perl, from cpan.org
" This should have the same value as in perl.vim
call ale#Set('perl_perl_executable', 'perl')
" Please note that perl_perl_options does not exist here.
call ale#Set('perl_languageserver_config', {})
function! s:get_lsp_config(buffer) abort
" This tool doesn't kick in unless workspace/didChangeConfiguration is
" called, thus this function returning a fallback dict when there is no
" config.
let l:lsp_config = ale#Var(a:buffer, 'perl_languageserver_config')
return empty(l:lsp_config) ? { 'perl': { 'enable': 1 } } : l:lsp_config
endfunction
call ale#linter#Define('perl', {
\ 'name': 'languageserver',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'perl_perl_executable')},
\ 'command': '%e -MPerl::LanguageServer -ePerl::LanguageServer::run',
\ 'lsp_config': {b -> s:get_lsp_config(b)},
\ 'project_root': function('ale#handlers#perl#GetProjectRoot'),
\ })
-15
View File
@@ -1,15 +0,0 @@
" Author: rymdbar <https://rymdbar.x20.se/>
" Description: Perl Navigator Language Server
" See: https://github.com/bscan/PerlNavigator
call ale#Set('perl_perlnavigator_config', {})
call ale#Set('perl_perlnavigator_executable', 'perlnavigator')
call ale#linter#Define('perl', {
\ 'name': 'perlnavigator',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'perl_perlnavigator_executable')},
\ 'command': '%e --stdio',
\ 'lsp_config': {b -> ale#Var(b, 'perl_perlnavigator_config')},
\ 'project_root': function('ale#handlers#perl#GetProjectRoot'),
\ })
+1 -5
View File
@@ -1,9 +1,6 @@
" Author: Arizard <https://github.com/Arizard>
" Description: PHPactor integration for ALE
call ale#Set('php_phpactor_executable', 'phpactor')
call ale#Set('php_phpactor_init_options', {})
" Copied from langserver.vim
function! ale_linters#php#phpactor#GetProjectRoot(buffer) abort
let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json')
@@ -20,8 +17,7 @@ endfunction
call ale#linter#Define('php', {
\ 'name': 'phpactor',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'php_phpactor_executable')},
\ 'executable': 'phpactor',
\ 'command': '%e language-server',
\ 'initialization_options': {b -> ale#Var(b, 'php_phpactor_init_options')},
\ 'project_root': function('ale_linters#php#phpactor#GetProjectRoot'),
\})
+1 -29
View File
@@ -7,34 +7,6 @@ call ale#Set('php_phpcs_options', '')
call ale#Set('php_phpcs_executable', 'phpcs')
call ale#Set('php_phpcs_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#php#phpcs#GetCwd(buffer) abort
let l:result = ale#path#Dirname(ale_linters#php#phpcs#FindProjectRoot(a:buffer))
return empty(l:result) ? v:null : l:result
endfunction
function! ale_linters#php#phpcs#FindProjectRoot(buffer) abort
let l:result = ale#path#FindNearestFile(a:buffer, 'phpcs.xml')
if empty(l:result)
let l:result = ale#path#FindNearestFile(a:buffer, 'phpcs.xml.dist')
endif
if empty(l:result)
let l:result = ale#path#FindNearestFile(a:buffer, '.phpcs.xml')
endif
if empty(l:result)
let l:result = ale#path#FindNearestFile(a:buffer, '.phpcs.xml.dist')
endif
if empty(l:result)
let l:result = ale#path#FindNearestFile(a:buffer, 'composer.json')
endif
return l:result
endfunction
function! ale_linters#php#phpcs#GetCommand(buffer) abort
let l:standard = ale#Var(a:buffer, 'php_phpcs_standard')
let l:standard_option = !empty(l:standard)
@@ -76,7 +48,7 @@ call ale#linter#Define('php', {
\ 'vendor/bin/phpcs',
\ 'phpcs'
\ ])},
\ 'cwd': function('ale_linters#php#phpcs#GetCwd'),
\ 'cwd': '%s:h',
\ 'command': function('ale_linters#php#phpcs#GetCommand'),
\ 'callback': 'ale_linters#php#phpcs#Handle',
\})
-8
View File
@@ -27,10 +27,6 @@ function! ale_linters#php#phpstan#GetCommand(buffer, version) abort
let l:level = ale#Var(a:buffer, 'php_phpstan_level')
if type(l:level) is v:t_number
let l:level = string(l:level)
endif
if empty(l:level) && empty(ale_linters#php#phpstan#FindConfigFile(a:buffer))
" if no configuration file is found, then use 4 as a default level
let l:level = '4'
@@ -87,10 +83,6 @@ function! ale_linters#php#phpstan#FindConfigFile(buffer) abort
let l:result = ale#path#FindNearestFile(a:buffer, 'phpstan.neon.dist')
endif
if empty(l:result)
let l:result = ale#path#FindNearestFile(a:buffer, 'phpstan.dist.neon')
endif
return l:result
endfunction
+1 -1
View File
@@ -31,7 +31,7 @@ function! ale_linters#php#tlint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'php_tlint_options')
return ale#node#Executable(a:buffer, l:executable)
\ . ale#Pad(l:options)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' lint %s'
endfunction
+2 -4
View File
@@ -1,11 +1,9 @@
" Author: Cian Butler https://github.com/butlerx
" Description: proselint for PO files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('po', {
\ 'name': 'proselint',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
+2 -4
View File
@@ -1,11 +1,9 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for Pod files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('pod', {
\ 'name': 'proselint',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
+1 -1
View File
@@ -11,7 +11,7 @@ function! ale_linters#proto#buf_lint#GetCommand(buffer) abort
return '%e lint'
\ . (!empty(l:config) ? ' --config=' . ale#Escape(l:config) : '')
\ . ale#Pad(l:options)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' %s#include_package_files=true'
endfunction
+1 -1
View File
@@ -87,7 +87,7 @@ function! ale_linters#python#flake8#GetCommand(buffer, version) abort
let l:options = ale#Var(a:buffer, 'python_flake8_options')
return ale#Escape(l:executable) . l:exec_args
\ . ale#Pad(l:options)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' --format=default'
\ . l:display_name_args . ' -'
endfunction
+1 -1
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
+1 -1
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
+6 -21
View File
@@ -34,22 +34,6 @@ function! ale_linters#python#ruff#GetExecutable(buffer) abort
return ale#python#FindExecutable(a:buffer, 'python_ruff', ['ruff'])
endfunction
function! ale_linters#python#ruff#RunWithVersionCheck(buffer) abort
let l:executable = ale_linters#python#ruff#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? '\(pipenv\|poetry\|uv\)$'
\ ? ' run ruff'
\ : ''
let l:command = ale#Escape(l:executable) . l:exec_args . ' --version'
return ale#semver#RunWithVersionCheck(
\ a:buffer,
\ l:executable,
\ l:command,
\ function('ale_linters#python#ruff#GetCommand'),
\)
endfunction
function! ale_linters#python#ruff#GetCwd(buffer) abort
if ale#Var(a:buffer, 'python_ruff_change_directory')
" Run from project root if found, else from buffer dir.
@@ -92,10 +76,6 @@ function! ale_linters#python#ruff#Handle(buffer, lines) abort
continue
endtry
if empty(l:item)
continue
endif
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.
@@ -126,7 +106,12 @@ call ale#linter#Define('python', {
\ 'name': 'ruff',
\ 'executable': function('ale_linters#python#ruff#GetExecutable'),
\ 'cwd': function('ale_linters#python#ruff#GetCwd'),
\ 'command': function('ale_linters#python#ruff#RunWithVersionCheck'),
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
\ buffer,
\ ale_linters#python#ruff#GetExecutable(buffer),
\ '%e --version',
\ function('ale_linters#python#ruff#GetCommand'),
\ )},
\ 'callback': 'ale_linters#python#ruff#Handle',
\ 'output_stream': 'both',
\ 'read_buffer': 1,
+1 -1
View File
@@ -12,7 +12,7 @@ function! ale_linters#rego#opacheck#GetCommand(buffer) abort
return ale#Escape(ale_linters#rego#opacheck#GetExecutable(a:buffer))
\ . ' check %s:h --format json '
\ . ale#Pad(l:options)
\ . (!empty(l:options) ? ' ' . l:options : '')
endfunction
function! ale_linters#rego#opacheck#Handle(buffer, lines) abort
@@ -1,24 +0,0 @@
" Author: John Jackson <john@johnridesa.bike>
" Description: The official language server for ReScript.
call ale#Set('rescript_language_server_executable', 'rescript-language-server')
call ale#Set(
\ 'rescript_language_server_use_global',
\ get(g:, 'ale_use_global_executables', v:true),
\ )
function! s:GetProjectRoot(buffer) abort
let l:config_file = ale#path#FindNearestFile(a:buffer, 'rescript.json')
return !empty(l:config_file) ? fnamemodify(l:config_file, ':h') : ''
endfunction
call ale#linter#Define('rescript', {
\ 'name': 'rescript_language_server',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#path#FindExecutable(b, 'rescript_language_server', [
\ 'node_modules/.bin/rescript-language-server'
\ ])},
\ 'command': '%e --stdio',
\ 'project_root': function('s:GetProjectRoot'),
\})
+6 -1
View File
@@ -1,4 +1,9 @@
" Author: rhysd https://rhysd.github.io
" Description: Redpen, a proofreading tool (http://redpen.cc)
call ale#handlers#redpen#DefineLinter('review')
call ale#linter#Define('review', {
\ 'name': 'redpen',
\ 'executable': 'redpen',
\ 'command': 'redpen -f review -r json %t',
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
\})
+3 -5
View File
@@ -1,11 +1,9 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for reStructuredrst files
call ale#Set('proselint_executable', 'proselint')
" Description: proselint for reStructuredText files
call ale#linter#Define('rst', {
\ 'name': 'proselint',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
+6 -1
View File
@@ -1,4 +1,9 @@
" Author: rhysd https://rhysd.github.io
" Description: Redpen, a proofreading tool (http://redpen.cc)
call ale#handlers#redpen#DefineLinter('rst')
call ale#linter#Define('rst', {
\ 'name': 'redpen',
\ 'executable': 'redpen',
\ 'command': 'redpen -f rest -r json %t',
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
\})
+3 -35
View File
@@ -1,13 +1,5 @@
" Authors:
" John Nduli https://github.com/jnduli,
" Michael Goerz https://github.com/goerz
call ale#Set('rst_rstcheck_executable', 'rstcheck')
call ale#Set('rst_rstcheck_options', '')
function! ale_linters#rst#rstcheck#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'rst_rstcheck_executable')
endfunction
" Author: John Nduli https://github.com/jnduli
" Description: Rstcheck for reStructuredText files
function! ale_linters#rst#rstcheck#Handle(buffer, lines) abort
" matches: 'bad_rst.rst:1: (SEVERE/4) Title overline & underline
@@ -29,35 +21,11 @@ function! ale_linters#rst#rstcheck#Handle(buffer, lines) abort
return l:output
endfunction
function! ale_linters#rst#rstcheck#GetCommand(buffer, version) abort
let l:executable = ale_linters#rst#rstcheck#GetExecutable(a:buffer)
let l:options = ale#Var(a:buffer, 'rst_rstcheck_options')
let l:dir = expand('#' . a:buffer . ':p:h')
let l:exec_args = ale#Pad(l:options)
if ale#semver#GTE(a:version, [3, 4, 0])
let l:exec_args .= ' --config ' . ale#Escape(l:dir)
endif
return ale#Escape(l:executable)
\ . l:exec_args
\ . ' %t'
endfunction
function! ale_linters#rst#rstcheck#GetCommandWithVersionCheck(buffer) abort
return ale#semver#RunWithVersionCheck(
\ a:buffer,
\ ale_linters#rst#rstcheck#GetExecutable(a:buffer),
\ '%e --version',
\ function('ale_linters#rst#rstcheck#GetCommand')
\)
endfunction
call ale#linter#Define('rst', {
\ 'name': 'rstcheck',
\ 'executable': 'rstcheck',
\ 'cwd': '%s:h',
\ 'command': function('ale_linters#rst#rstcheck#GetCommandWithVersionCheck'),
\ 'command': 'rstcheck %t',
\ 'callback': 'ale_linters#rst#rstcheck#Handle',
\ 'output_stream': 'both',
\})
+1 -4
View File
@@ -8,10 +8,7 @@ call ale#Set('ruby_solargraph_executable', 'solargraph')
call ale#Set('ruby_solargraph_options', {})
function! ale_linters#ruby#solargraph#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'ruby_solargraph_executable')
return ale#ruby#EscapeExecutable(l:executable, 'solargraph')
\ . ale#Pad('stdio')
return '%e' . ale#Pad('stdio')
endfunction
call ale#linter#Define('ruby', {
+3 -4
View File
@@ -1,7 +1,6 @@
call ale#Set('ruby_sorbet_executable', 'srb')
call ale#Set('ruby_sorbet_options', '')
call ale#Set('ruby_sorbet_enable_watchman', 0)
call ale#Set('ruby_sorbet_initialization_options', { 'highlightUntyped': v:false })
function! ale_linters#ruby#sorbet#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'ruby_sorbet_executable')
@@ -10,7 +9,7 @@ function! ale_linters#ruby#sorbet#GetCommand(buffer) abort
return ale#ruby#EscapeExecutable(l:executable, 'srb')
\ . ' tc'
\ . ale#Pad(l:options)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' --lsp'
\ . (l:enable_watchman ? '' : ' --disable-watchman')
endfunction
@@ -22,6 +21,6 @@ call ale#linter#Define('ruby', {
\ 'language': 'ruby',
\ 'executable': {b -> ale#Var(b, 'ruby_sorbet_executable')},
\ 'command': function('ale_linters#ruby#sorbet#GetCommand'),
\ 'project_root': function('ale#ruby#FindProjectRoot'),
\ 'initialization_options': {b -> ale#Var(b, 'ruby_sorbet_initialization_options')}
\ 'project_root': function('ale#ruby#FindProjectRoot')
\})
+1 -1
View File
@@ -20,7 +20,7 @@ function! ale_linters#rust#rustc#RustcCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'rust_rustc_options')
return 'rustc --error-format=json'
\ . ale#Pad(l:options)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . l:dependencies . ' -'
endfunction
+1 -1
View File
@@ -16,7 +16,7 @@ function! ale_linters#sass#sasslint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'sass_sasslint_options')
return ale#node#Executable(a:buffer, l:executable)
\ . ale#Pad(l:options)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' -v -q -f compact %t'
endfunction
+1 -1
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 --no-color --stdin-filename %s',
\ 'command': '%e --stdin-filename %s',
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
\})
-1
View File
@@ -13,7 +13,6 @@ function! ale_linters#scala#metals#GetProjectRoot(buffer) abort
let l:potential_roots = [
\ 'build.sc',
\ 'build.mill',
\ 'build.sbt',
\ '.bloop',
\ '.metals',
+1 -1
View File
@@ -16,7 +16,7 @@ function! ale_linters#scss#sasslint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'scss_sasslint_options')
return ale#node#Executable(a:buffer, l:executable)
\ . ale#Pad(l:options)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' -v -q -f compact %t'
endfunction
+1 -1
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'))
\ . ' --no-color --stdin-filename %s'
\ . ' --stdin-filename %s'
endfunction
call ale#linter#Define('scss', {
+1 -1
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'))
\ . ' --no-color --stdin-filename %s'
\ . ' --stdin-filename %s'
endfunction
call ale#linter#Define('stylus', {
+1 -1
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'
\ . ' --no-color --stdin-filename %s'
\ . ' --stdin-filename %s'
endfunction
call ale#linter#Define('sugarss', {
-4
View File
@@ -25,10 +25,6 @@ endfunction
function! ale_linters#terraform#terraform_ls#GetProjectRoot(buffer) abort
let l:tf_dir = ale#path#FindNearestDirectory(a:buffer, '.terraform')
if empty(l:tf_dir)
let l:tf_dir = ale#path#FindNearestDirectory(a:buffer, '.')
endif
return !empty(l:tf_dir) ? fnamemodify(l:tf_dir, ':h:h') : ''
endfunction
+2 -4
View File
@@ -1,11 +1,9 @@
" Author: poohzrn https://github.com/poohzrn
" Description: proselint for TeX files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('tex', {
\ 'name': 'proselint',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
+6 -1
View File
@@ -1,4 +1,9 @@
" Author: rhysd https://rhysd.github.io
" Description: Redpen, a proofreading tool (http://redpen.cc)
call ale#handlers#redpen#DefineLinter('tex')
call ale#linter#Define('tex', {
\ 'name': 'redpen',
\ 'executable': 'redpen',
\ 'command': 'redpen -f latex -r json %t',
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
\})
+2 -4
View File
@@ -1,11 +1,9 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for Texinfo files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('texinfo', {
\ 'name': 'proselint',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
+2 -4
View File
@@ -1,11 +1,9 @@
" Author: poohzrn https://github.com/poohzrn
" Description: proselint for text files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('text', {
\ 'name': 'proselint',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
+6 -1
View File
@@ -1,4 +1,9 @@
" Author: rhysd https://rhysd.github.io
" Description: Redpen, a proofreading tool (http://redpen.cc)
call ale#handlers#redpen#DefineLinter('text')
call ale#linter#Define('text', {
\ 'name': 'redpen',
\ 'executable': 'redpen',
\ 'command': 'redpen -f plain -r json %t',
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
\})
+1 -14
View File
@@ -1,22 +1,9 @@
" Author: chew-z https://github.com/chew-z
" Description: vale for text files
call ale#Set('vale_executable', 'vale')
call ale#Set('vale_options', '')
function! ale_linters#text#vale#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'vale_executable')
let l:options = ale#Var(a:buffer, 'vale_options')
return ale#Escape(l:executable)
\ . ale#Pad(l:options)
\ . ' --output=JSON %t'
endfunction
call ale#linter#Define('text', {
\ 'name': 'vale',
\ 'executable': 'vale',
\ 'command': function('ale_linters#text#vale#GetCommand'),
\ 'command': 'vale --output=JSON %t',
\ 'callback': 'ale#handlers#vale#Handle',
\})
-51
View File
@@ -1,51 +0,0 @@
" Author: Ben Boeckel <github@me.benboeckel.net>
" Description: TOML Formatter / Linter / Language Server
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
let l:tombiconfig_file = ale#path#FindNearestFile(a:buffer, 'tombi.toml')
if !empty(l:tombiconfig_file)
return fnamemodify(l:tombiconfig_file . '/', ':p:h:h')
endif
" Try to find nearest pyproject.toml
let l:pyproject_file = ale#path#FindNearestFile(a:buffer, 'pyproject.toml')
if !empty(l:pyproject_file)
return fnamemodify(l:pyproject_file . '/', ':p:h:h')
endif
" Try to find nearest `git` directory
let l:gitdir = ale#path#FindNearestFile(a:buffer, '.git')
if !empty(l:gitdir)
return fnamemodify(l:gitdir . '/', ':p:h:h')
endif
return ''
endfunction
call ale#linter#Define('toml', {
\ 'name': 'tombi',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'toml_tombi_executable')},
\ 'command': function('ale_linters#toml#tombi#GetCommand'),
\ 'project_root': function('ale_linters#toml#tombi#GetProjectRoot'),
\})
+1 -1
View File
@@ -18,7 +18,7 @@ function! ale_linters#typescript#standard#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'typescript_standard_options')
return ale#node#Executable(a:buffer, l:executable)
\ . ale#Pad(l:options)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' --stdin %s'
endfunction
-3
View File
@@ -9,9 +9,7 @@ endif
" --lint-only
function! ale_linters#verilog#slang#GetCommand(buffer) abort
return 'slang -Weverything '
\ . '--diag-abs-paths '
\ . '-I%s:h '
\ . '-y%s:h '
\ . ale#Var(a:buffer, 'verilog_slang_options') .' '
\ . '%t'
endfunction
@@ -30,7 +28,6 @@ function! ale_linters#verilog#slang#Handle(buffer, lines) abort
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:item = {
\ 'filename': l:match[1],
\ 'lnum': str2nr(l:match[2]),
\ 'type': (l:match[4] is# 'error') ? 'E' : 'W',
\ 'text': s:RemoveUnicodeQuotes(l:match[5]),
-43
View File
@@ -1,43 +0,0 @@
" Author: Nicolas Derumigny <https://github.com/nicolasderumigny>
" Description: Verible LSP for verilog
call ale#Set('verilog_verible_ls_options', '--rules_config_search')
call ale#Set('verilog_verible_ls_rules', '')
call ale#Set('verilog_verible_ls_executable', 'verible-verilog-ls')
call ale#Set('verilog_verible_ls_config', {})
function! ale_linters#verilog#verible_ls#GetProjectRoot(buffer) abort
let l:git_dir = ale#path#FindNearestFile(a:buffer, 'verible.filelist')
if !empty(l:git_dir)
return fnamemodify(l:git_dir, ':p:h')
else
return fnamemodify('', ':h')
endif
endfunction
function! ale_linters#verilog#verible_ls#GetCommand(buffer) abort
let l:command = ale#Escape(ale#Var(a:buffer, 'verilog_verible_ls_executable'))
let l:options = ale#Var(a:buffer, 'verilog_verible_ls_options')
let l:rules = ale#Var(a:buffer, 'verilog_verible_ls_rules')
if l:options isnot# ''
let l:command .= ' ' . l:options
endif
if l:rules isnot# ''
let l:command .= ' --rules=' . l:rules
endif
return l:command
endfunction
call ale#linter#Define('verilog', {
\ 'name': 'verible_ls',
\ 'lsp': 'stdio',
\ 'lsp_config': {b -> ale#Var(b, 'verilog_verible_ls_config')},
\ 'executable': {b -> ale#Var(b, 'verilog_verible_ls_executable')},
\ 'command': function('ale_linters#verilog#verible_ls#GetCommand') ,
\ 'project_root': function('ale_linters#verilog#verible_ls#GetProjectRoot'),
\})
-1
View File
@@ -10,7 +10,6 @@ function! ale_linters#verilog#verilator#GetCommand(buffer) abort
" the path to the current file is systematically added to the search path
return 'verilator --lint-only -Wall -Wno-DECLFILENAME '
\ . '-I%s:h '
\ . '-y %s:h '
\ . ale#Var(a:buffer, 'verilog_verilator_options') .' '
\ . '%t'
endfunction
+2 -4
View File
@@ -1,11 +1,9 @@
" Author: Daniel M. Capella https://github.com/polyzen
" Description: proselint for XHTML files
call ale#Set('proselint_executable', 'proselint')
call ale#linter#Define('xhtml', {
\ 'name': 'proselint',
\ 'executable': function('ale#proselint#GetExecutable'),
\ 'command': function('ale#proselint#GetCommandWithVersionCheck'),
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})
+1 -1
View File
@@ -48,7 +48,7 @@ function! ale#ShouldDoNothing(buffer) abort
endif
" Do nothing for diff buffers.
if getbufvar(a:buffer, '&diff') && !get(g:, 'ale_lint_diff', 0)
if getbufvar(a:buffer, '&diff')
return 1
endif
+1 -1
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
+21 -49
View File
@@ -5,20 +5,21 @@ call ale#Set('c_parse_makefile', 0)
call ale#Set('c_always_make', has('unix') && !has('macunix'))
call ale#Set('c_parse_compile_commands', 1)
let s:is_windows = has('win32') || has('win64') || has('win32unix')
let s:sep = s:is_windows ? '\' : '/'
let s:sep = has('win32') ? '\' : '/'
" Set just so tests can override it.
let g:__ale_c_project_filenames = ['.git/HEAD', 'configure', 'Makefile', 'CMakeLists.txt']
call ale#Set('c_build_dir_names', [
let g:ale_c_build_dir_names = get(g:, 'ale_c_build_dir_names', [
\ 'build',
\ 'build/Debug',
\ 'build/Release',
\ 'bin',
\])
function! s:CanParseMakefile(buffer) abort
" Something somewhere seems to delete this setting in tests, so ensure we
" always have a default value.
call ale#Set('c_parse_makefile', 0)
return ale#Var(a:buffer, 'c_parse_makefile')
endfunction
@@ -246,19 +247,11 @@ function! ale#c#FindCompileCommands(buffer) abort
" Search in build directories if we can't find it in the project.
for l:path in ale#path#Upwards(expand('#' . a:buffer . ':p:h'))
for l:dirname in ale#Var(a:buffer, 'c_build_dir_names')
let l:c_build_dir = ale#path#GetAbsPath(l:path, l:dirname)
let l:c_build_dir = l:path . s:sep . l:dirname
let l:json_file = l:c_build_dir . s:sep . 'compile_commands.json'
if filereadable(l:json_file)
" For absolute build dir paths, use the parent
" of the build dir as the project root. For
" relative paths, use the directory found by
" searching upwards from the file.
let l:root = ale#path#IsAbsolute(l:dirname)
\ ? fnamemodify(l:c_build_dir, ':h')
\ : l:path
return [l:root, l:json_file]
return [l:path, l:json_file]
endif
endfor
endfor
@@ -387,40 +380,23 @@ function! ale#c#ParseCompileCommandsFlags(buffer, file_lookup, dir_lookup) abort
let l:file_list = get(a:file_lookup, l:buffer_filename, [])
" We may have to look for /foo/bar instead of C:\foo\bar
if empty(l:file_list) && s:is_windows
" Try without the drive letter.
let l:no_drive = ale#path#RemoveDriveLetter(l:buffer_filename)
let l:file_list = get(a:file_lookup, l:no_drive, [])
" Also try by iterating keys in case Simplify produced different
" results for the key and the lookup value.
if empty(l:file_list)
for [l:key, l:val] in items(a:file_lookup)
if ale#path#RemoveDriveLetter(l:key) is? l:no_drive
let l:file_list = l:val
break
endif
endfor
endif
if empty(l:file_list) && has('win32')
let l:file_list = get(
\ a:file_lookup,
\ ale#path#RemoveDriveLetter(l:buffer_filename),
\ []
\)
endif
" Try the absolute path to the directory second.
let l:dir_list = get(a:dir_lookup, l:dir, [])
if empty(l:dir_list) && s:is_windows
let l:no_drive_dir = ale#path#RemoveDriveLetter(l:dir)
let l:dir_list = get(a:dir_lookup, l:no_drive_dir, [])
if empty(l:dir_list)
for [l:key, l:val] in items(a:dir_lookup)
if ale#path#RemoveDriveLetter(l:key) is? l:no_drive_dir
let l:dir_list = l:val
break
endif
endfor
endif
if empty(l:dir_list) && has('win32')
let l:dir_list = get(
\ a:dir_lookup,
\ ale#path#RemoveDriveLetter(l:dir),
\ []
\)
endif
if empty(l:file_list) && empty(l:dir_list)
@@ -442,7 +418,7 @@ function! ale#c#ParseCompileCommandsFlags(buffer, file_lookup, dir_lookup) abort
let l:key = fnamemodify(l:buffer_filename, ':r') . l:suffix
let l:file_list = get(a:file_lookup, l:key, [])
if empty(l:file_list) && s:is_windows
if empty(l:file_list) && has('win32')
let l:file_list = get(
\ a:file_lookup,
\ ale#path#RemoveDriveLetter(l:key),
@@ -468,12 +444,8 @@ function! ale#c#ParseCompileCommandsFlags(buffer, file_lookup, dir_lookup) abort
" Load the flags for this file, or for a source file matching the
" header file.
" On Windows, bufnr() may fail to match when one path has a drive
" letter and the other doesn't, so fall back to path comparison.
if (
\ bufnr(l:filename) is a:buffer
\ || ale#path#RemoveDriveLetter(l:filename)
\ is? ale#path#RemoveDriveLetter(l:buffer_filename)
\ || (
\ !empty(l:source_file)
\ && l:filename[-len(l:source_file):] is? l:source_file
+3 -5
View File
@@ -7,8 +7,6 @@ if !exists('s:buffer_data')
let s:buffer_data = {}
endif
let s:is_windows = has('win32') || has('win64') || has('win32unix')
" The regular expression used for formatting filenames with modifiers.
let s:path_format_regex = '\v\%s(%(:h|:t|:r|:e)*)'
@@ -142,7 +140,7 @@ function! s:TemporaryFilename(buffer) abort
" Create a temporary filename, <temp_dir>/<original_basename>
" The file itself will not be created by this function.
return ale#util#Tempname() . (s:is_windows ? '\' : '/') . l:filename
return ale#util#Tempname() . (has('win32') ? '\' : '/') . l:filename
endfunction
" Given part of a command, replace any % with %%, so that no characters in
@@ -180,7 +178,7 @@ function! ale#command#CdString(directory) abort
\ ? a:directory
\ : ale#Escape(a:directory)
if s:is_windows
if has('win32')
return 'cd /d ' . l:directory . ' && '
endif
@@ -394,7 +392,7 @@ function! ale#command#Run(buffer, command, Callback, ...) abort
let s:fake_job_id = get(s:, 'fake_job_id', 0) + 1
let l:job_id = s:fake_job_id
endif
elseif s:is_windows
elseif has('win32')
let l:job_id = ale#job#StartWithCmd(l:command, l:job_options)
else
let l:job_id = ale#job#Start(l:command, l:job_options)
+1 -2
View File
@@ -23,7 +23,7 @@ function! ale#cursor#TruncatedEcho(original_message) abort
" Change tabs to spaces.
let l:message = substitute(l:message, "\t", ' ', 'g')
" Remove any newlines in the message.
let l:message = substitute(l:message, "\n", ' ', 'g')
let l:message = substitute(l:message, "\n", '', 'g')
" Convert indentation groups into single spaces for better legibility when
" put on a single line
let l:message = substitute(l:message, ' \+', ' ', 'g')
@@ -93,7 +93,6 @@ function! ale#cursor#EchoCursorWarning(...) abort
if !empty(l:loc)
let l:format = ale#Var(l:buffer, 'echo_msg_format')
let l:msg = ale#GetLocItemMessage(l:loc, l:format)
call ale#cursor#TruncatedEcho(l:msg)
let l:info.echoed = 1
elseif get(l:info, 'echoed')
+1 -12
View File
@@ -1,8 +1,6 @@
" Author: w0rp <devw0rp@gmail.com>
" Description: Logic for handling mappings between files
let s:is_windows = has('win32') || has('win64') || has('win32unix')
" Invert filesystem mappings so they can be mapped in reverse.
function! ale#filename_mapping#Invert(filename_mappings) abort
return map(copy(a:filename_mappings), '[v:val[1], v:val[0]]')
@@ -16,16 +14,7 @@ function! ale#filename_mapping#Map(filename, filename_mappings) abort
let l:mapping_from = ale#path#Simplify(l:mapping_from)
if l:simplified_filename[:len(l:mapping_from) - 1] is# l:mapping_from
let l:suffix = l:simplified_filename[len(l:mapping_from):]
" On Windows, the simplified suffix uses backslashes, but the
" mapping target may use forward slashes for a remote path.
" Normalize the suffix separator to match the mapping target.
if s:is_windows && l:mapping_to =~# '/'
let l:suffix = substitute(l:suffix, '\\', '/', 'g')
endif
return l:mapping_to . l:suffix
return l:mapping_to . l:simplified_filename[len(l:mapping_from):]
endif
endfor
-45
View File
@@ -192,11 +192,6 @@ 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'],
@@ -207,11 +202,6 @@ let s:default_registry = {
\ 'suggested_filetypes': ['puppet'],
\ 'description': 'Run puppet-lint -f on a file.',
\ },
\ 'replace_emdash': {
\ 'function': 'ale#fixers#generic#ReplaceEmDash',
\ 'suggested_filetypes': [],
\ 'description': 'Replace em dash with -- ASCII characters.',
\ },
\ 'remove_trailing_lines': {
\ 'function': 'ale#fixers#generic#RemoveTrailingBlankLines',
\ 'suggested_filetypes': [],
@@ -462,11 +452,6 @@ let s:default_registry = {
\ 'suggested_filetypes': ['markdown'],
\ 'description': 'Fix markdown files with pandoc.',
\ },
\ 'pymarkdown': {
\ 'function': 'ale#fixers#pymarkdown#Fix',
\ 'suggested_filetypes': ['markdown'],
\ 'description': 'Fix markdown files with pymarkdown.',
\ },
\ 'shfmt': {
\ 'function': 'ale#fixers#shfmt#Fix',
\ 'suggested_filetypes': ['sh'],
@@ -682,11 +667,6 @@ let s:default_registry = {
\ 'suggested_filetypes': ['racket'],
\ 'description': 'Fix Racket files with raco fmt.',
\ },
\ 'rescript_format': {
\ 'function': 'ale#fixers#rescript_format#Fix',
\ 'suggested_filetypes': ['rescript'],
\ 'description': 'Official formatter for ReScript.',
\ },
\ 'ruff': {
\ 'function': 'ale#fixers#ruff#Fix',
\ 'suggested_filetypes': ['python'],
@@ -752,31 +732,6 @@ let s:default_registry = {
\ 'suggested_filetypes': ['roc'],
\ 'description': 'Annotates all top-level definitions in Roc files.',
\ },
\ 'tombi_format': {
\ 'function': 'ale#fixers#tombi_format#Fix',
\ 'suggested_filetypes': ['toml'],
\ 'description': 'Formats TOML files',
\ },
\ 'tombi_lint': {
\ 'function': 'ale#fixers#tombi_lint#Fix',
\ 'suggested_filetypes': ['toml'],
\ 'description': 'Lints TOML files',
\ },
\ 'verible_format': {
\ 'function': 'ale#fixers#verible_format#Fix',
\ 'suggested_filetypes': ['verilog'],
\ 'description': 'Formats verilog files using verible.',
\ },
\ 'markdownlint': {
\ 'function': 'ale#fixers#markdownlint#Fix',
\ 'suggested_filetypes': ['markdown'],
\ 'description': 'Fix markdown files with markdownlint.',
\ },
\ 'rumdl': {
\ 'function': 'ale#fixers#rumdl#Fix',
\ 'suggested_filetypes': ['markdown'],
\ 'description': 'Fix markdown files with rumdl.',
\ },
\}
" Reset the function registry to the default entries.
+1 -1
View File
@@ -7,7 +7,7 @@ function! ale#fixers#alejandra#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' -- -'
\}
endfunction
+1 -1
View File
@@ -12,7 +12,7 @@ function! ale#fixers#apkbuild_fixer#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ' -p ' . ale#Var(a:buffer, 'apkbuild_apkbuild_fixer_lint_executable')
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
\}
+1 -1
View File
@@ -38,7 +38,7 @@ function! ale#fixers#autoflake#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable) . l:exec_args
\ . ale#Pad(l:options)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' --in-place '
\ . ' %t',
\ 'read_temporary_file': 1,
+1 -1
View File
@@ -39,7 +39,7 @@ function! ale#fixers#autoimport#Fix(buffer) abort
return {
\ 'cwd': '%s:h',
\ 'command': ale#Escape(l:executable) . l:exec_args
\ . ale#Pad(l:options)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' -',
\}
endfunction
+1 -1
View File
@@ -38,7 +38,7 @@ function! ale#fixers#autopep8#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable) . l:exec_args
\ . ale#Pad(l:options)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' -',
\}
endfunction
+5 -4
View File
@@ -1,11 +1,12 @@
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:unsafe = ale#Var(a:buffer, 'biome_fixer_apply_unsafe') ? ' --unsafe' : ''
let l:apply = ale#Var(a:buffer, 'biome_fixer_apply_unsafe') ? '--write --unsafe' : '--write'
return {
\ 'command': ale#Escape(l:executable) . ' check '
\ . '--write --stdin-file-path %s' . l:unsafe
\ . ale#Pad(l:options)
\ 'read_temporary_file': 1,
\ 'command': ale#Escape(l:executable) . ' check ' . l:apply
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' %t'
\}
endfunction
+1 -1
View File
@@ -36,7 +36,7 @@ function! ale#fixers#clangtidy#GetCommand(buffer) abort
return ' -fix' . (l:fix_errors ? ' -fix-errors' : '')
\ . (empty(l:checks) ? '' : ' -checks=' . ale#Escape(l:checks))
\ . ale#Pad(l:extra_options)
\ . (empty(l:extra_options) ? '' : ' ' . l:extra_options)
\ . (empty(l:build_dir) ? '' : ' -p ' . ale#Escape(l:build_dir))
\ . ' %t' . (empty(l:options) ? '' : ' -- ' . l:options)
endfunction
+1 -1
View File
@@ -10,7 +10,7 @@ function! ale#fixers#cmakeformat#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' -'
\}
endfunction
+1 -1
View File
@@ -11,7 +11,7 @@ function! ale#fixers#dart_format#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ' format'
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
\}
+1 -1
View File
@@ -11,7 +11,7 @@ function! ale#fixers#dartfmt#Fix(buffer) abort
return {
\ 'command': ale#Escape(l:executable)
\ . ' -w'
\ . ale#Pad(l:options)
\ . (empty(l:options) ? '' : ' ' . l:options)
\ . ' %t',
\ 'read_temporary_file': 1,
\}

Some files were not shown because too many files have changed in this diff Show More