Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into fix-3271
Browse files Browse the repository at this point in the history
* origin/master: (219 commits)
  Updated `solhint` linter to be able to use a local installation (dense-analysis#3682)
  Don't exit visual mode on floating preview close (dense-analysis#3689)
  hadolint: fix color output and stdin shown as "-" (dense-analysis#3680)
  feat: Add protolint as linter and fixer (dense-analysis#2911)
  apple-swift-format: linter and fixer with config swiftpm support (dense-analysis#3671)
  improve DMD handler (dense-analysis#3647)
  Add support for V: "v" (compiler) and "vfmt" fixer. (dense-analysis#3622)
  Add nixfmt as a Nix fixer. (dense-analysis#3651)
  Switch to using buildifier's -path option (dense-analysis#3640)
  Add support for `ptop` fixer (dense-analysis#3652)
  Add more parameters to the DMD linting command (dense-analysis#3639)
  dense-analysis#3633 - Move linter tests into test/linter
  Allow more time before PRs become stale
  Add support for clangd with CUDA (dense-analysis#3598)
  add support for svelte via svelteserver language server (dense-analysis#3644)
  dense-analysis#3633 - Put all dummy test files in test/test-files
  Add desktop-file-validate
  Fix a typo in a test filename
  issue 3033 (dense-analysis#3620)
  dense-analysis#3632 Add ale#util#MapMatches
  ...
  • Loading branch information
jsit committed Apr 19, 2021
2 parents fb1510b + 1c90d8c commit 11d6347
Show file tree
Hide file tree
Showing 980 changed files with 8,957 additions and 3,366 deletions.
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
blank_issues_enabled: false
contact_links:
- name: Ask for Help
url: https://github.com/dense-analysis/ale/discussions/new?category=q-a-ask-for-help-with-problems
about: Ask for Help in ALE Discussions
6 changes: 3 additions & 3 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
# This configuration closes stale PRs after 28 + 7 days.
# That's 4 weeks until stale bot complains, and a week until it closes a PR.
# This configuration closes stale PRs after 56 + 7 days.
# That's 8 weeks until stale bot complains, and a week until it closes a PR.
# Issues in ALE are never, ever stale. They are either resolved or not.
only: pulls
daysUntilStale: 28
daysUntilStale: 56
daysUntilClose: 7
exemptLabels: []
staleLabel: stale
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: CI
on: # yamllint disable-line rule:truthy
push:
branches: [ master ] # yamllint disable-line rule:brackets
tags:
- /^v\d+\.\d+\.(x|\d+)$/
pull_request:
branches: [ master ] # yamllint disable-line rule:brackets

jobs:
build_image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build docker run image
shell: bash
env:
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
DOCKER_HUB_PASS: ${{ secrets.DOCKER_HUB_PASS }}
run: ./run-tests --build-image
test_ale:
needs: build_image
runs-on: ubuntu-latest
strategy:
matrix:
vim-version:
- '--vim-80-only'
- '--vim-82-only'
- '--neovim-02-only'
- '--neovim-04-only'
- '--linters-only'
steps:
- uses: actions/checkout@v2
- name: Run tests
run: ./run-tests -v ${{ matrix.vim-version }}
16 changes: 0 additions & 16 deletions .travis.yml

This file was deleted.

10 changes: 8 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
FROM tweekmonster/vim-testbed:latest

RUN install_vim -tag v8.0.0027 -build \
-tag v8.1.0519 -build \
-tag v8.2.2401 -build \
-tag neovim:v0.2.0 -build \
-tag neovim:v0.3.5 -build
-tag neovim:v0.4.4 -build

ENV PACKAGES="\
bash \
git \
python \
py-pip \
grep \
sed \
"
RUN apk --update add $PACKAGES && \
rm -rf /var/cache/apk/* /tmp/* /var/tmp/*
Expand All @@ -18,3 +20,7 @@ RUN pip install vim-vint==0.3.15

RUN git clone https://github.com/junegunn/vader.vim vader && \
cd vader && git checkout c6243dd81c98350df4dec608fa972df98fa2a3af

ARG GIT_VERSION
LABEL Version=${GIT_VERSION}
LABEL Name=w0rp/ale
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Asynchronous Lint Engine [![Travis CI Build Status](https://travis-ci.com/dense-analysis/ale.svg?branch=master)](https://travis-ci.com/dense-analysis/ale) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/r0ef1xu8xjmik58d/branch/master?svg=true)](https://ci.appveyor.com/project/dense-analysis/ale) [![Join the chat at https://gitter.im/vim-ale/Lobby](https://badges.gitter.im/vim-ale/Lobby.svg)](https://gitter.im/vim-ale/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
# Asynchronous Lint Engine [![GitHub Build Status](https://github.com/dense-analysis/ale/workflows/CI/badge.svg)](https://github.com/dense-analysis/ale/actions?query=event%3Apush+workflow%3ACI+branch%3Amaster++) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/r0ef1xu8xjmik58d/branch/master?svg=true)](https://ci.appveyor.com/project/dense-analysis/ale) [![Join the chat at https://gitter.im/vim-ale/Lobby](https://badges.gitter.im/vim-ale/Lobby.svg)](https://gitter.im/vim-ale/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)


![ALE Logo by Mark Grealish - https://www.bhalash.com/](https://user-images.githubusercontent.com/3518142/59195920-2c339500-8b85-11e9-9c22-f6b7f69637b8.jpg)
Expand Down Expand Up @@ -81,6 +81,7 @@ other content at [w0rp.com](https://w0rp.com).
18. [How can I configure ALE differently for different buffers?](#faq-buffer-configuration)
19. [How can I configure the height of the list in which ALE displays errors?](#faq-list-window-height)
20. [How can I run linters or fixers via Docker or a VM?](#faq-vm)
21. [How can I change the borders for floating preview windows?](#faq-window-borders)

<a name="supported-languages"></a>

Expand Down Expand Up @@ -907,3 +908,23 @@ tools are well-integrated with ALE, and ALE is properly configured to run the
correct commands and map filename paths between different file systems. See
`:help ale-lint-other-machines` for the full documentation on how to configure
ALE to support this.

<a name="faq-window-borders"></a>

### 5.xxi. How can I change the borders for floating preview windows?

Borders for floating preview windows are enabled by default. You can use the
`g:ale_floating_window_border` setting to configure them.

You could disable the border with an empty list.

```vim
let g:ale_floating_window_border = []
```

If the terminal supports Unicode, you might try setting the value like below, to
make it look nicer.

```vim
let g:ale_floating_window_border = ['│', '─', '╭', '╮', '╯', '╰']
```
26 changes: 26 additions & 0 deletions ale_linters/ada/adals.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
" Author: Bartek Jasicki http://github.com/thindil
" Description: Support for Ada Language Server

call ale#Set('ada_adals_executable', 'ada_language_server')
call ale#Set('ada_adals_project', 'default.gpr')
call ale#Set('ada_adals_encoding', 'utf-8')

function! ale_linters#ada#adals#GetAdaLSConfig(buffer) abort
return {
\ 'ada.projectFile': ale#Var(a:buffer, 'ada_adals_project'),
\ 'ada.defaultCharset': ale#Var(a:buffer, 'ada_adals_encoding')
\}
endfunction

function! ale_linters#ada#adals#GetRootDirectory(buffer) abort
return fnamemodify(bufname(a:buffer), ':p:h')
endfunction

call ale#linter#Define('ada', {
\ 'name': 'adals',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'ada_adals_executable')},
\ 'command': '%e',
\ 'project_root': function('ale_linters#ada#adals#GetRootDirectory'),
\ 'lsp_config': function('ale_linters#ada#adals#GetAdaLSConfig')
\})
97 changes: 72 additions & 25 deletions ale_linters/ansible/ansible_lint.vim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
" Author: Bjorn Neergaard <[email protected]>
" Authors: Bjorn Neergaard <[email protected]>, Vytautas Macionis <[email protected]>
" Description: ansible-lint for ansible-yaml files

call ale#Set('ansible_ansible_lint_executable', 'ansible-lint')
Expand All @@ -7,7 +7,7 @@ function! ale_linters#ansible#ansible_lint#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'ansible_ansible_lint_executable')
endfunction

function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort
for l:line in a:lines[:10]
if match(l:line, '^Traceback') >= 0
return [{
Expand All @@ -18,39 +18,86 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
endif
endfor

" Matches patterns line the following:
"
" test.yml:35: [EANSIBLE0002] Trailing whitespace
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: \[?([[:alnum:]]+)\]? (.*)$'
let l:version_group = ale#semver#GTE(a:version, [5, 0, 0]) ? '>=5.0.0' : '<5.0.0'
let l:output = []

for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:code = l:match[4]
if '>=5.0.0' is# l:version_group
" Matches patterns line the following:
" test.yml:3:148: syntax-check 'var' is not a valid attribute for a Play
" roles/test/tasks/test.yml:8: [package-latest] [VERY_LOW] Package installs should not use latest
" D:\test\tasks\test.yml:8: [package-latest] [VERY_LOW] package installs should not use latest
let l:pattern = '\v^(%([a-zA-Z]:)?[^:]+):(\d+):%((\d+):)? %(\[([-[:alnum:]]+)\]) %(\[([_[:alnum:]]+)\]) (.*)$'
let l:error_codes = { 'VERY_HIGH': 'E', 'HIGH': 'E', 'MEDIUM': 'W', 'LOW': 'W', 'VERY_LOW': 'W', 'INFO': 'I' }

if l:code is# 'EANSIBLE0002'
\&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
" Skip warnings for trailing whitespace if the option is off.
continue
endif
for l:match in ale#util#GetMatches(a:lines, l:pattern)
if ale#path#IsBufferPath(a:buffer, l:match[1])
call add(l:output, {
\ 'lnum': l:match[2] + 0,
\ 'col': l:match[3] + 0,
\ 'text': l:match[6],
\ 'code': l:match[4],
\ 'type': l:error_codes[l:match[5]],
\})
endif
endfor
endif

if ale#path#IsBufferPath(a:buffer, l:match[1])
call add(l:output, {
\ 'lnum': l:match[2] + 0,
\ 'col': l:match[3] + 0,
\ 'text': l:match[5],
\ 'code': l:code,
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
\})
endif
endfor
if '<5.0.0' is# l:version_group
" Matches patterns line the following:
" test.yml:35: [EANSIBLE0002] Trailing whitespace
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: \[?([[:alnum:]]+)\]? (.*)$'

for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:code = l:match[4]

if l:code is# 'EANSIBLE0002'
\&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
" Skip warnings for trailing whitespace if the option is off.
continue
endif

if ale#path#IsBufferPath(a:buffer, l:match[1])
call add(l:output, {
\ 'lnum': l:match[2] + 0,
\ 'col': l:match[3] + 0,
\ 'text': l:match[5],
\ 'code': l:code,
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
\})
endif
endfor
endif

return l:output
endfunction

function! ale_linters#ansible#ansible_lint#GetCommand(buffer, version) abort
let l:commands = {
\ '>=5.0.0': '%e --parseable-severity -x yaml',
\ '<5.0.0': '%e -p %t'
\}
let l:command = ale#semver#GTE(a:version, [5, 0]) ? l:commands['>=5.0.0'] : l:commands['<5.0.0']

return l:command
endfunction

call ale#linter#Define('ansible', {
\ 'name': 'ansible_lint',
\ 'aliases': ['ansible', 'ansible-lint'],
\ 'executable': function('ale_linters#ansible#ansible_lint#GetExecutable'),
\ 'command': '%e -p %t',
\ 'callback': 'ale_linters#ansible#ansible_lint#Handle',
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
\ buffer,
\ ale_linters#ansible#ansible_lint#GetExecutable(buffer),
\ '%e --version',
\ function('ale_linters#ansible#ansible_lint#GetCommand'),
\ )},
\ 'callback': {buffer, lines -> ale#semver#RunWithVersionCheck(
\ buffer,
\ ale_linters#ansible#ansible_lint#GetExecutable(buffer),
\ '%e --version',
\ {buffer, version -> ale_linters#ansible#ansible_lint#Handle(
\ buffer,
\ l:version,
\ lines)},
\ )},
\})
12 changes: 12 additions & 0 deletions ale_linters/apkbuild/apkbuild_lint.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
" Author: Leo <[email protected]>
" Description: apkbuild-lint from atools linter for APKBUILDs

call ale#Set('apkbuild_apkbuild_lint_executable', 'apkbuild-lint')

call ale#linter#Define('apkbuild', {
\ 'name': 'apkbuild_lint',
\ 'output_stream': 'stdout',
\ 'executable': {b -> ale#Var(b, 'apkbuild_apkbuild_lint_executable')},
\ 'command': '%e %t',
\ 'callback': 'ale#handlers#atools#Handle',
\})
12 changes: 12 additions & 0 deletions ale_linters/apkbuild/secfixes_check.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
" Author: Leo <[email protected]>
" Description: secfixes-check from atools linter for APKBUILDs

call ale#Set('apkbuild_secfixes_check_executable', 'secfixes-check')

call ale#linter#Define('apkbuild', {
\ 'name': 'secfixes_check',
\ 'output_stream': 'stdout',
\ 'executable': {b -> ale#Var(b, 'apkbuild_secfixes_check_executable')},
\ 'command': '%e %t',
\ 'callback': 'ale#handlers#atools#Handle',
\})
7 changes: 3 additions & 4 deletions ale_linters/c/cppcheck.vim
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ call ale#Set('c_cppcheck_executable', 'cppcheck')
call ale#Set('c_cppcheck_options', '--enable=style')

function! ale_linters#c#cppcheck#GetCommand(buffer) abort
let l:cd_command = ale#handlers#cppcheck#GetCdCommand(a:buffer)
let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer)
let l:buffer_path_include = empty(l:compile_commands_option)
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
\ : ''
let l:template = ' --template=''{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}'''
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')

return l:cd_command
\ . '%e -q --language=c'
return '%e -q --language=c'
\ . l:template
\ . ale#Pad(l:compile_commands_option)
\ . ale#Pad(ale#Var(a:buffer, 'c_cppcheck_options'))
Expand All @@ -25,6 +23,7 @@ call ale#linter#Define('c', {
\ 'name': 'cppcheck',
\ 'output_stream': 'both',
\ 'executable': {b -> ale#Var(b, 'c_cppcheck_executable')},
\ 'cwd': function('ale#handlers#cppcheck#GetCwd'),
\ 'command': function('ale_linters#c#cppcheck#GetCommand'),
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
\})
1 change: 1 addition & 0 deletions ale_linters/cloudformation/cfn_python_lint.vim
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ endfunction

call ale#linter#Define('cloudformation', {
\ 'name': 'cloudformation',
\ 'aliases': ['cfn-lint'],
\ 'executable': 'cfn-lint',
\ 'command': 'cfn-lint --template %t --format parseable',
\ 'callback': 'ale_linters#cloudformation#cfn_python_lint#Handle',
Expand Down
10 changes: 6 additions & 4 deletions ale_linters/cpp/clangtidy.vim
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ function! ale_linters#cpp#clangtidy#GetCommand(buffer, output) abort
let l:options = ale#Var(a:buffer, 'cpp_clangtidy_options')
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
let l:options .= !empty(l:options) ? ale#Pad(l:cflags) : l:cflags
endif

" Tell clang-tidy a .h header with a C++ filetype in Vim is a C++ file.
if expand('#' . a:buffer) =~# '\.h$'
let l:options .= !empty(l:options) ? ' -x c++' : '-x c++'
" Tell clang-tidy a .h header with a C++ filetype in Vim is a C++ file
" only when compile-commands.json file is not there. Adding these
" flags makes clang-tidy completely ignore compile commmands.
if expand('#' . a:buffer) =~# '\.h$'
let l:options .= !empty(l:options) ? ' -x c++' : '-x c++'
endif
endif

" Get the options to pass directly to clang-tidy
Expand Down
7 changes: 3 additions & 4 deletions ale_linters/cpp/cppcheck.vim
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@ call ale#Set('cpp_cppcheck_executable', 'cppcheck')
call ale#Set('cpp_cppcheck_options', '--enable=style')

function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
let l:cd_command = ale#handlers#cppcheck#GetCdCommand(a:buffer)
let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer)
let l:buffer_path_include = empty(l:compile_commands_option)
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
\ : ''
let l:template = ' --template=''{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}'''
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')

return l:cd_command
\ . '%e -q --language=c++'
return '%e -q --language=c++'
\ . l:template
\ . ale#Pad(l:compile_commands_option)
\ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options'))
Expand All @@ -25,6 +23,7 @@ call ale#linter#Define('cpp', {
\ 'name': 'cppcheck',
\ 'output_stream': 'both',
\ 'executable': {b -> ale#Var(b, 'cpp_cppcheck_executable')},
\ 'cwd': function('ale#handlers#cppcheck#GetCwd'),
\ 'command': function('ale_linters#cpp#cppcheck#GetCommand'),
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
\})
Loading

0 comments on commit 11d6347

Please sign in to comment.