mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 20:54:26 +08:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84004665d5 | ||
|
|
a1932b7ff5 | ||
|
|
a55f941349 | ||
|
|
80ac8ec69f | ||
|
|
e73baafd95 | ||
|
|
b4667a0432 | ||
|
|
80a16668c9 | ||
|
|
1f7679e619 | ||
|
|
964d3ab9ec |
@@ -1,40 +0,0 @@
|
|||||||
---
|
|
||||||
# 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
|
|
||||||
|
|
||||||
# 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
|
|
||||||
|
|
||||||
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"'
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
# EditorConfig is awesome: http://EditorConfig.org
|
|
||||||
|
|
||||||
# Top-most EditorConfig file
|
|
||||||
root = true
|
|
||||||
|
|
||||||
# Match and apply these rules for all file
|
|
||||||
# types you open in your code editor
|
|
||||||
[*]
|
|
||||||
# Unix-style newlines
|
|
||||||
end_of_line = lf
|
|
||||||
insert_final_newline = true
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 4
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
11
.eslintrc.js
Normal file
11
.eslintrc.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
module.exports = {
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 6,
|
||||||
|
sourceType: "module",
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
semi: 'error',
|
||||||
|
'space-infix-ops': 'warn',
|
||||||
|
radix: 'error',
|
||||||
|
}
|
||||||
|
}
|
||||||
6
.gitattributes
vendored
6
.gitattributes
vendored
@@ -1,13 +1,9 @@
|
|||||||
.* export-ignore
|
.* export-ignore
|
||||||
/CODE_OF_CONDUCT.md export-ignore
|
|
||||||
/CONTRIBUTING.md export-ignore
|
/CONTRIBUTING.md export-ignore
|
||||||
/Dockerfile export-ignore
|
/Dockerfile export-ignore
|
||||||
/ISSUE_TEMPLATE export-ignore
|
|
||||||
/ISSUE_TEMPLATE.md export-ignore
|
/ISSUE_TEMPLATE.md export-ignore
|
||||||
/Makefile export-ignore
|
/Makefile export-ignore
|
||||||
/PULL_REQUEST_TEMPLATE.md export-ignore
|
|
||||||
/README.md export-ignore
|
/README.md export-ignore
|
||||||
|
/custom-checks export-ignore
|
||||||
/img export-ignore
|
/img export-ignore
|
||||||
/run-tests export-ignore
|
|
||||||
/run-tests.bat export-ignore
|
|
||||||
/test export-ignore
|
/test export-ignore
|
||||||
|
|||||||
3
.github/CODE_OF_CONDUCT.md
vendored
3
.github/CODE_OF_CONDUCT.md
vendored
@@ -1,3 +0,0 @@
|
|||||||
Codes of conduct are totally unnecessary and dumb.
|
|
||||||
|
|
||||||
Just don't be a jerk and have fun.
|
|
||||||
25
.github/CONTRIBUTING.md
vendored
25
.github/CONTRIBUTING.md
vendored
@@ -1,25 +0,0 @@
|
|||||||
## Guidelines
|
|
||||||
|
|
||||||
Have fun, and work on whatever floats your boat. Take It Easy :tm:.
|
|
||||||
|
|
||||||
For help with contributing to ALE, see `:help ale-development` in Vim, or view
|
|
||||||
the help file online [here](/doc/ale-development.txt).
|
|
||||||
|
|
||||||
## Creating Issues
|
|
||||||
|
|
||||||
Before creating any issues, please look through the current list of issues and
|
|
||||||
pull requests, and ensure that the issue hasn't already been reported. If an
|
|
||||||
issue has already been reported, but you have some new insight, please add
|
|
||||||
a comment to the existing issue.
|
|
||||||
|
|
||||||
Please read the FAQ in the README before creating any issues. A feature
|
|
||||||
you desire may already exist and be documented, or the FAQ might explain
|
|
||||||
how to solve a problem you have already.
|
|
||||||
|
|
||||||
Please try and describe any issues reported with as much detail as you can
|
|
||||||
provide about your Vim version, the linter you were trying to run, your
|
|
||||||
operating system, or any other information you think might be helpful.
|
|
||||||
|
|
||||||
Please describe your issue in clear, grammatically correct, and easy to
|
|
||||||
understand English. You are more likely to see an issue resolved if others
|
|
||||||
can understand you.
|
|
||||||
44
.github/ISSUE_TEMPLATE/report-a-bug.md
vendored
44
.github/ISSUE_TEMPLATE/report-a-bug.md
vendored
@@ -1,44 +0,0 @@
|
|||||||
---
|
|
||||||
name: Report a bug
|
|
||||||
about: Report a bug with ALE.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
<!--
|
|
||||||
This is the template for reporting ALE bugs. Make sure you try updating ALE
|
|
||||||
to a more recent version before reporting a bug. Look through existing bug
|
|
||||||
reports for similar issues before reporting a new one. Don't leave comments
|
|
||||||
about new bugs in the comment section for old issues.
|
|
||||||
|
|
||||||
Make sure to try disabling other plugins and trying to repeat your bug before
|
|
||||||
reporting it in ALE. Some times problems can arise when two plugins are used
|
|
||||||
together, but often your issues might be problems with other plugins.
|
|
||||||
-->
|
|
||||||
|
|
||||||
## Information
|
|
||||||
|
|
||||||
**VIM version**
|
|
||||||
|
|
||||||
<!-- Paste just the first two lines of :version here. -->
|
|
||||||
|
|
||||||
Operating System: <!-- Describe your operating system version. -->
|
|
||||||
|
|
||||||
## What went wrong
|
|
||||||
|
|
||||||
<!-- Describe what went wrong here. Be specific. -->
|
|
||||||
|
|
||||||
Something went wrong in specifically this place, and I also searched through
|
|
||||||
both open and closed issues for the same problem before reporting a bug here.
|
|
||||||
|
|
||||||
## Reproducing the bug
|
|
||||||
|
|
||||||
<!-- Write a list of steps below. -->
|
|
||||||
|
|
||||||
1. I did this.
|
|
||||||
2. Then this happened.
|
|
||||||
|
|
||||||
### :ALEInfo
|
|
||||||
|
|
||||||
<!-- Paste the output of :ALEInfo here. Try :ALEInfoToClipboard -->
|
|
||||||
<!-- Make sure to run :ALEInfo from the buffer where the bug occurred. -->
|
|
||||||
<!-- Read the output. You might figure out what went wrong yourself. -->
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
name: Suggest a new linter or fixer
|
|
||||||
about: Suggest a new tool ALE can officially integrate with.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Write "Add support for foobar" as the issue title, or similar.
|
|
||||||
|
|
||||||
Fill out the details below.
|
|
||||||
-->
|
|
||||||
|
|
||||||
**Name:** foobar
|
|
||||||
**URL:** https://foo.bar.com
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Write a description of the tool, and add any other information you think might
|
|
||||||
be helpful. Consider creating a pull request to add support for the tool
|
|
||||||
yourself.
|
|
||||||
-->
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
---
|
|
||||||
name: Suggest an improvement
|
|
||||||
about: Suggest some way to improve ALE, or add a new feature.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
<!-- There's no fixed format for feature requests. Just add your thoughts. -->
|
|
||||||
13
.github/PULL_REQUEST_TEMPLATE.md
vendored
13
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,13 +0,0 @@
|
|||||||
<!--
|
|
||||||
Before creating a pull request, do the following.
|
|
||||||
|
|
||||||
* Read the Contributing guide linked above first.
|
|
||||||
* Read the documentation that comes with ALE with `:help ale-development`.
|
|
||||||
|
|
||||||
Have fun!
|
|
||||||
-->
|
|
||||||
|
|
||||||
Where are the tests? Have you added tests? Have you updated the tests? Read the
|
|
||||||
comment above and the documentation referenced in it first. Write tests!
|
|
||||||
|
|
||||||
Seriously, read `:help ale-development` and write tests.
|
|
||||||
9
.gitignore
vendored
9
.gitignore
vendored
@@ -1,7 +1,4 @@
|
|||||||
!.editorconfig
|
|
||||||
*.obj
|
|
||||||
.*
|
|
||||||
/doc/tags
|
|
||||||
/init.vim
|
/init.vim
|
||||||
/test/ale-info-test-file
|
/doc/tags
|
||||||
tags
|
.*
|
||||||
|
*.obj
|
||||||
|
|||||||
12
.travis.yml
12
.travis.yml
@@ -2,11 +2,9 @@
|
|||||||
sudo: required
|
sudo: required
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
language: generic
|
branches:
|
||||||
env:
|
only:
|
||||||
- OPTIONS=--vim-80-only
|
- master
|
||||||
- OPTIONS=--vim-81-only
|
language: python
|
||||||
- OPTIONS=--neovim-only
|
|
||||||
- OPTIONS=--linters-only
|
|
||||||
script: |
|
script: |
|
||||||
./run-tests -v $OPTIONS
|
make test
|
||||||
|
|||||||
173
CONTRIBUTING.md
Normal file
173
CONTRIBUTING.md
Normal file
@@ -0,0 +1,173 @@
|
|||||||
|
# Contributing to ALE
|
||||||
|
|
||||||
|
1. [Guidelines](#guidelines)
|
||||||
|
2. [Creating Issues](#issues)
|
||||||
|
3. [Creating Pull Requests](#pull-requests)
|
||||||
|
1. [Adding a New Linter](#adding-a-new-linter)
|
||||||
|
2. [Adding New Options](#adding-new-options)
|
||||||
|
4. [Writing Documentation](#writing-documentation)
|
||||||
|
1. [Documenting New Linters](#documenting-new-linters)
|
||||||
|
2. [Editing the Online Documentation](#editing-online-documentation)
|
||||||
|
3. [Documenting Linter Options](#documenting-new-options)
|
||||||
|
5. [In Case of Busses](#in-case-of-busses)
|
||||||
|
|
||||||
|
<a name="guidelines"></a>
|
||||||
|
|
||||||
|
# 1. Guidelines
|
||||||
|
|
||||||
|
Have fun, and work on whatever floats your boat. Take It Easy :tm:.
|
||||||
|
|
||||||
|
Don't forget to **write documentation** for whatever it is you are doing.
|
||||||
|
See the ["Writing Documentation"](#writing-documentation) section.
|
||||||
|
|
||||||
|
Remember to write Vader tests for most of the code you write. You can look at
|
||||||
|
existing Vader tests in the `test` directory for examples.
|
||||||
|
|
||||||
|
When writing code, follow the [Google Vimscript Style
|
||||||
|
Guide](https://google.github.io/styleguide/vimscriptguide.xml), and run `vint
|
||||||
|
-s` on your files to check for most of what the guide mentions and more. If you
|
||||||
|
install this plugin (ALE) and install [Vint](https://github.com/Kuniwak/vint), it
|
||||||
|
will check your code while you type.
|
||||||
|
|
||||||
|
<a name="issues"></a>
|
||||||
|
|
||||||
|
# 2. Creating Issues
|
||||||
|
|
||||||
|
Before creating any issues, please look through the current list of issues and
|
||||||
|
pull requests, and ensure that the issue hasn't already been reported. If an
|
||||||
|
issue has already been reported, but you have some new insight, please add
|
||||||
|
a comment to the existing issue.
|
||||||
|
|
||||||
|
Please read the FAQ in the README before creating any issues. A feature
|
||||||
|
you desire may already exist and be documented, or the FAQ might explain
|
||||||
|
how to solve a problem you have already.
|
||||||
|
|
||||||
|
Please try and describe any issues reported with as much detail as you can
|
||||||
|
provide about your Vim version, the linter you were trying to run, your
|
||||||
|
operating system, or any other information you think might be helpful.
|
||||||
|
|
||||||
|
Please describe your issue in clear, grammatically correct, and easy to
|
||||||
|
understand English. You are more likely to see an issue resolved if others
|
||||||
|
can understand you.
|
||||||
|
|
||||||
|
<a name="pull-requests"></a>
|
||||||
|
|
||||||
|
# 3. Creating Pull Requests
|
||||||
|
|
||||||
|
For code you write, make sure to credit yourself at the top of files you add,
|
||||||
|
and probably those you modify. You can write some comments at the top of your
|
||||||
|
VIM files.
|
||||||
|
|
||||||
|
```vim
|
||||||
|
" Author: John Smith <john.smith@gmail.com>
|
||||||
|
" Description: This file adds support for awesomelinter for the best language ever.
|
||||||
|
```
|
||||||
|
|
||||||
|
If you want to credit multiple authors, you can comma separate them.
|
||||||
|
|
||||||
|
```vim
|
||||||
|
" Author: John Smith <john.smith@gmail.com>, Jane Doe <https://jane-doe.info>
|
||||||
|
```
|
||||||
|
|
||||||
|
<a name="adding-a-new-linter"></a>
|
||||||
|
|
||||||
|
# 3.i. Adding a New Linter
|
||||||
|
|
||||||
|
If you add a new linter, look for existing handlers first in the
|
||||||
|
[handlers.vim](autoload/ale/handlers.vim) file. One of the handlers there may
|
||||||
|
already be able to handle your lines of output. If you find that your new
|
||||||
|
linter replicates an existing error handler, consider pulling it up into the
|
||||||
|
[handlers.vim](autoload/ale/handlers.vim) file, and use the generic handler in
|
||||||
|
both places.
|
||||||
|
|
||||||
|
When you add a linter, make sure the language for the linter and the linter
|
||||||
|
itself are present in the table in the [README.md](README.md) file and in the
|
||||||
|
Vim [help file](doc/ale.txt). The programs and linters should be sorted
|
||||||
|
alphabetically in the table and list.
|
||||||
|
|
||||||
|
<a name="adding-new-options"></a>
|
||||||
|
|
||||||
|
# 3.ii. Adding New Options
|
||||||
|
|
||||||
|
If you add new options to the plugin, make sure to document those new options
|
||||||
|
in the [README.md](README.md) file, and also in the [help file](doc/ale.txt).
|
||||||
|
Follow the format of other options in each. Global options should appear in the
|
||||||
|
README file, and in the relevant section in the help file. Options specific
|
||||||
|
to a particular linter should appear in the section for that linter.
|
||||||
|
|
||||||
|
Linter options for customizing general argument lists should be named
|
||||||
|
`g:ale_<filetype>_<linter>_options`, so that all linters can have similar
|
||||||
|
global variable names.
|
||||||
|
|
||||||
|
Any options for linters should be set to some default value so it is always
|
||||||
|
easy to see what the default is with `:echo g:ale...`.
|
||||||
|
|
||||||
|
<a name="writing-documentation"></a>
|
||||||
|
|
||||||
|
# 4. Writing Documentation
|
||||||
|
|
||||||
|
If you are adding new linters, changing the API, adding new options, etc., you
|
||||||
|
_must_ write some documentation describing it in the `doc/ale.txt` file. New
|
||||||
|
linters _must_ be added to the `README.md` file too, so other users can get a
|
||||||
|
quick overview of the supported tools.
|
||||||
|
|
||||||
|
<a name="documenting-new-linters"></a>
|
||||||
|
|
||||||
|
# 4.i Documenting New Linters
|
||||||
|
|
||||||
|
If you add a new linter to the project, edit the table in the `README.md` file,
|
||||||
|
and edit the list of linters at the top of the `doc/ale.txt` file. The linters
|
||||||
|
should be sorted vertically in lexicographic (alphabetical) order by the
|
||||||
|
programming language name or filetype, and the tools for each language should
|
||||||
|
be sorted in lexicographic order horizontally. Sorting in this manner is a fair
|
||||||
|
manner of presenting all of the information in an easy to scan way, without
|
||||||
|
giving some unfair preference to any particular tool or language.
|
||||||
|
|
||||||
|
<a name="editing-online-documentation"></a>
|
||||||
|
|
||||||
|
# 4.ii Editing the Online Documentation
|
||||||
|
|
||||||
|
The "online documentation" file used for this project lives in `doc/ale.txt`.
|
||||||
|
This is the file used for generating `:help` text inside Vim itself. There are
|
||||||
|
some guidlines to follow for this file.
|
||||||
|
|
||||||
|
1. Keep all text within a column size of 79 characters, inclusive.
|
||||||
|
2. Open a section with 79 `=` or `-` characters, for headings and subheadings.
|
||||||
|
3. Sections should have a _single_ blank line before or after.
|
||||||
|
4. Between descriptions of variables/functions/commands, use _two_ blank lines.
|
||||||
|
5. Up-indent the description of a variable/function/command by two spaces.
|
||||||
|
6. Place tags at the ends of lines, with the final characters on column 79.
|
||||||
|
All of the tags should line up perfectly on the same column as you scan
|
||||||
|
down through the document.
|
||||||
|
7. Keep the table of contents balanced so the longest tag link ends on column
|
||||||
|
79, and so all links line up perfectly on their first character, on the
|
||||||
|
left.
|
||||||
|
|
||||||
|
<a name="documenting-linter-options"></a>
|
||||||
|
|
||||||
|
# 4.iii Documenting Linter Options
|
||||||
|
|
||||||
|
For documenting new linter options, please add a new sub-section under the
|
||||||
|
"Linter Specific Options" section describing all of the global options added
|
||||||
|
for each linter, and what the default values of the options are. All global
|
||||||
|
options for linters should be set to some default value. This will allow users
|
||||||
|
to look up the default value easily by typing `:echo g:ale_...`.
|
||||||
|
|
||||||
|
<a name="in-case-of-busses"></a>
|
||||||
|
|
||||||
|
# 5. In Case of Busses
|
||||||
|
|
||||||
|
Should the principal author of the ALE project and all collaborators with the
|
||||||
|
required access needed to properly administrate the project on GitHub or any
|
||||||
|
other website either perish or disappear, whether by tragic traffic accident
|
||||||
|
or government adduction, etc., action should be taken to ensure that the
|
||||||
|
project continues. If no one is left to administer the project where it is
|
||||||
|
hosted, please fork the project and nominate someone capable to administer it.
|
||||||
|
Preferably, in such an event, a single fork of the project will replace the
|
||||||
|
original, and life will go on, except the life of whoever vanished, because
|
||||||
|
then they will probably be dead.
|
||||||
|
|
||||||
|
Should w0rp suddenly disappear, then he was probably killed in a traffic
|
||||||
|
accident, or the government finally decided to kill him and make it look like
|
||||||
|
suicide. In the latter event, please subvert said government and restore
|
||||||
|
order to the universe, and ensure peace for mankind.
|
||||||
16
Dockerfile
16
Dockerfile
@@ -1,20 +1,20 @@
|
|||||||
FROM tweekmonster/vim-testbed:latest
|
FROM tweekmonster/vim-testbed:latest
|
||||||
|
|
||||||
RUN install_vim -tag v8.0.0027 -build \
|
RUN install_vim -tag v8.0.0000 -build \
|
||||||
-tag v8.1.0204 -build \
|
-tag v8.0.0027 -build
|
||||||
-tag neovim:v0.2.0 -build \
|
|
||||||
-tag neovim:v0.3.0 -build
|
|
||||||
|
|
||||||
ENV PACKAGES="\
|
ENV PACKAGES="\
|
||||||
bash \
|
|
||||||
git \
|
git \
|
||||||
python \
|
python=2.7.12-r0 \
|
||||||
py-pip \
|
py-pip=8.1.2-r0 \
|
||||||
|
nodejs \
|
||||||
"
|
"
|
||||||
RUN apk --update add $PACKAGES && \
|
RUN apk --update add $PACKAGES && \
|
||||||
rm -rf /var/cache/apk/* /tmp/* /var/tmp/*
|
rm -rf /var/cache/apk/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
RUN pip install vim-vint==0.3.15
|
RUN pip install vim-vint==0.3.9
|
||||||
|
|
||||||
|
RUN npm install -g eslint@3.7.1
|
||||||
|
|
||||||
RUN git clone https://github.com/junegunn/vader.vim vader && \
|
RUN git clone https://github.com/junegunn/vader.vim vader && \
|
||||||
cd vader && git checkout c6243dd81c98350df4dec608fa972df98fa2a3af
|
cd vader && git checkout c6243dd81c98350df4dec608fa972df98fa2a3af
|
||||||
|
|||||||
10
ISSUE_TEMPLATE.md
Normal file
10
ISSUE_TEMPLATE.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
For bugs, paste output from your clipboard after running :ALEInfoToClipboard
|
||||||
|
here. If that doesn't work for some reason, try running :ALEInfo and copying
|
||||||
|
the output from that here instead. If everything is broken, run around in
|
||||||
|
circles and scream.
|
||||||
|
|
||||||
|
If you are experiencing a bug where ALE is not correctly parsing the output of
|
||||||
|
commands, set g:ale_history_log_output to 1, and run ALE again, and then
|
||||||
|
:ALEInfo should include the full output of each command which ran.
|
||||||
|
|
||||||
|
Whatever the case, describe the your issue here.
|
||||||
2
LICENSE
2
LICENSE
@@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2016-2018, w0rp <devw0rp@gmail.com>
|
Copyright (c) 2016, w0rp <devw0rp@gmail.com>
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
|||||||
53
Makefile
Normal file
53
Makefile
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
SHELL := /usr/bin/env bash
|
||||||
|
IMAGE ?= w0rp/ale
|
||||||
|
CURRENT_IMAGE_ID = 107e4efc4267
|
||||||
|
DOCKER_FLAGS = --rm -v $(PWD):/testplugin -v $(PWD)/test:/home "$(IMAGE)"
|
||||||
|
tests = test/*.vader test/*/*.vader test/*/*/*.vader test/*/*/*/*.vader
|
||||||
|
|
||||||
|
test-setup:
|
||||||
|
docker images -q w0rp/ale | grep ^$(CURRENT_IMAGE_ID) > /dev/null || \
|
||||||
|
docker pull $(IMAGE)
|
||||||
|
|
||||||
|
vader: test-setup
|
||||||
|
@:; \
|
||||||
|
vims=$$(docker run --rm $(IMAGE) ls /vim-build/bin | grep -E '^n?vim'); \
|
||||||
|
if [ -z "$$vims" ]; then echo "No Vims found!"; exit 1; fi; \
|
||||||
|
for vim in $$vims; do \
|
||||||
|
docker run -a stderr $(DOCKER_FLAGS) $$vim '+Vader! $(tests)'; \
|
||||||
|
done
|
||||||
|
|
||||||
|
test: test-setup
|
||||||
|
@:; \
|
||||||
|
vims=$$(docker run --rm $(IMAGE) ls /vim-build/bin | grep -E '^n?vim'); \
|
||||||
|
if [ -z "$$vims" ]; then echo "No Vims found!"; exit 1; fi; \
|
||||||
|
EXIT=0; \
|
||||||
|
for vim in $$vims; do \
|
||||||
|
echo; \
|
||||||
|
echo '========================================'; \
|
||||||
|
echo "Running tests for $$vim"; \
|
||||||
|
echo '========================================'; \
|
||||||
|
echo; \
|
||||||
|
docker run -a stderr $(DOCKER_FLAGS) $$vim '+Vader! $(tests)' || EXIT=$$?; \
|
||||||
|
done; \
|
||||||
|
echo; \
|
||||||
|
echo '========================================'; \
|
||||||
|
echo 'Running Vint to lint our code'; \
|
||||||
|
echo '========================================'; \
|
||||||
|
echo 'Vint warnings/errors follow:'; \
|
||||||
|
echo; \
|
||||||
|
set -o pipefail; \
|
||||||
|
docker run -a stdout $(DOCKER_FLAGS) vint -s /testplugin | sed s:^/testplugin/:: || EXIT=$$?; \
|
||||||
|
set +o pipefail; \
|
||||||
|
echo; \
|
||||||
|
echo '========================================'; \
|
||||||
|
echo 'Running custom checks'; \
|
||||||
|
echo '========================================'; \
|
||||||
|
echo 'Custom warnings/errors follow:'; \
|
||||||
|
echo; \
|
||||||
|
set -o pipefail; \
|
||||||
|
docker run -a stdout $(DOCKER_FLAGS) /testplugin/custom-checks /testplugin | sed s:^/testplugin/:: || EXIT=$$?; \
|
||||||
|
set +o pipefail; \
|
||||||
|
echo; \
|
||||||
|
exit $$EXIT;
|
||||||
|
|
||||||
|
.DEFAULT_GOAL := test
|
||||||
713
README.md
713
README.md
@@ -1,13 +1,11 @@
|
|||||||
# Asynchronous Lint Engine [](https://travis-ci.org/w0rp/ale) [](https://ci.appveyor.com/project/w0rp/ale)
|
# Asynchronous Lint Engine [](https://travis-ci.org/w0rp/ale)
|
||||||
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
ALE (Asynchronous Lint Engine) is a plugin for providing linting in NeoVim
|
ALE (Asynchronous Lint Engine) is a plugin for providing linting in NeoVim
|
||||||
0.2.0+ and Vim 8 while you edit your text files, and acts as a Vim
|
and Vim 8 while you edit your text files.
|
||||||
[Language Server Protocol](https://langserver.org/) client.
|
|
||||||
|
|
||||||
<img src="img/example.gif?raw=true" alt="A linting example with the darkspectrum color scheme in GVim." title="A linting example with the darkspectrum color scheme in GVim.">
|

|
||||||
|
|
||||||
ALE makes use of NeoVim and Vim 8 job control functions and timers to
|
ALE makes use of NeoVim and Vim 8 job control functions and timers to
|
||||||
run linters on the contents of text buffers and return errors as
|
run linters on the contents of text buffers and return errors as
|
||||||
@@ -17,62 +15,27 @@ back to a filesystem.
|
|||||||
|
|
||||||
In other words, this plugin allows you to lint while you type.
|
In other words, this plugin allows you to lint while you type.
|
||||||
|
|
||||||
ALE offers support for fixing code with command line tools in a non-blocking
|
|
||||||
manner with the `:ALEFix` feature, supporting tools in many languages, like
|
|
||||||
`prettier`, `eslint`, `autopep8`, and more.
|
|
||||||
|
|
||||||
ALE acts as a "language client" to support a variety of Language Server Protocol
|
|
||||||
features, including:
|
|
||||||
|
|
||||||
* Diagnostics (via Language Server Protocol linters)
|
|
||||||
* Go To Definition (`:ALEGoToDefinition`)
|
|
||||||
* Completion (`let g:ale_completion_enabled = 1` before ALE is loaded)
|
|
||||||
* Finding references (`:ALEFindReferences`)
|
|
||||||
* Hover information (`:ALEHover`)
|
|
||||||
* Symbol search (`:ALESymbolSearch`)
|
|
||||||
|
|
||||||
If you don't care about Language Server Protocol, ALE won't load any of the code
|
|
||||||
for working with it unless needed. One of ALE's general missions is that you
|
|
||||||
won't pay for the features that you don't use.
|
|
||||||
|
|
||||||
If you enjoy this plugin, feel free to contribute or check out the author's
|
|
||||||
other content at [w0rp.com](https://w0rp.com).
|
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
1. [Supported Languages and Tools](#supported-languages)
|
1. [Supported Languages and Tools](#supported-languages)
|
||||||
2. [Usage](#usage)
|
2. [Usage](#usage)
|
||||||
1. [Linting](#usage-linting)
|
|
||||||
2. [Fixing](#usage-fixing)
|
|
||||||
3. [Completion](#usage-completion)
|
|
||||||
4. [Go To Definition](#usage-go-to-definition)
|
|
||||||
5. [Find References](#usage-find-references)
|
|
||||||
6. [Hovering](#usage-hover)
|
|
||||||
7. [Symbol Search](#usage-symbol-search)
|
|
||||||
3. [Installation](#installation)
|
3. [Installation](#installation)
|
||||||
1. [Installation with Vim package management](#standard-installation)
|
1. [Installation with Pathogen](#installation-with-pathogen)
|
||||||
2. [Installation with Pathogen](#installation-with-pathogen)
|
2. [Installation with Vundle](#installation-with-vundle)
|
||||||
3. [Installation with Vundle](#installation-with-vundle)
|
3. [Manual Installation](#manual-installation)
|
||||||
4. [Installation with Vim-Plug](#installation-with-vim-plug)
|
|
||||||
4. [Contributing](#contributing)
|
4. [Contributing](#contributing)
|
||||||
5. [FAQ](#faq)
|
5. [FAQ](#faq)
|
||||||
1. [How do I disable particular linters?](#faq-disable-linters)
|
1. [How do I disable particular linters?](#faq-disable-linters)
|
||||||
2. [How can I keep the sign gutter open?](#faq-keep-signs)
|
2. [How can I keep the sign gutter open?](#faq-disable-linters)
|
||||||
3. [How can I change the signs ALE uses?](#faq-change-signs)
|
3. [How can I change the signs ALE uses?](#faq-change-signs)
|
||||||
4. [How can I change or disable the highlights ALE uses?](#faq-change-highlights)
|
4. [How can I show errors or warnings in my statusline?](#faq-statusline)
|
||||||
5. [How can I show errors or warnings in my statusline?](#faq-statusline)
|
5. [How can I change the format for echo messages?](#faq-echo-format)
|
||||||
6. [How can I show errors or warnings in my lightline?](#faq-lightline)
|
6. [How can I execute some code when ALE stops linting?](#faq-autocmd)
|
||||||
7. [How can I change the format for echo messages?](#faq-echo-format)
|
7. [How can I navigate between errors quickly?](#faq-navigation)
|
||||||
8. [How can I execute some code when ALE starts or stops linting?](#faq-autocmd)
|
8. [How can I run linters only when I save files?](#faq-lint-on-save)
|
||||||
9. [How can I navigate between errors quickly?](#faq-navigation)
|
9. [How can I use the quickfix list instead of the loclist?](#faq-quickfix)
|
||||||
10. [How can I run linters only when I save files?](#faq-lint-on-save)
|
10. [How can I check JSX files with both stylelint and eslint?](#faq-jsx-stylelint-eslint)
|
||||||
11. [How can I use the quickfix list instead of the loclist?](#faq-quickfix)
|
11. [Will this plugin eat all of my laptop battery power?](#faq-my-battery-is-sad)
|
||||||
12. [How can I check JSX files with both stylelint and eslint?](#faq-jsx-stylelint-eslint)
|
|
||||||
13. [How can I check Vue files with ESLint?](#faq-vue-eslint)
|
|
||||||
14. [Will this plugin eat all of my laptop battery power?](#faq-my-battery-is-sad)
|
|
||||||
15. [How can I configure my C or C++ project?](#faq-c-configuration)
|
|
||||||
16. [How can I configure ALE differently for different buffers?](#faq-buffer-configuration)
|
|
||||||
17. [How can I configure the height of the list in which ALE displays errors?](#faq-list-window-height)
|
|
||||||
|
|
||||||
<a name="supported-languages"></a>
|
<a name="supported-languages"></a>
|
||||||
|
|
||||||
@@ -85,137 +48,74 @@ tools will be run in combination, so they can be complementary.
|
|||||||
Keep the table rows sorted alphabetically by the language name,
|
Keep the table rows sorted alphabetically by the language name,
|
||||||
and the tools in the tools column sorted alphabetically by the tool
|
and the tools in the tools column sorted alphabetically by the tool
|
||||||
name. That seems to be the fairest way to arrange this table.
|
name. That seems to be the fairest way to arrange this table.
|
||||||
|
|
||||||
Remember to also update doc/ale.txt, which has a similar list with different
|
|
||||||
formatting.
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
**Notes:**
|
|
||||||
|
|
||||||
* *^ No linters for text or Vim help filetypes are enabled by default.*
|
|
||||||
* *!! These linters check only files on disk. See `:help ale-lint-file-linters`*
|
|
||||||
|
|
||||||
| Language | Tools |
|
| Language | Tools |
|
||||||
| -------- | ----- |
|
| -------- | ----- |
|
||||||
| Ada | [gcc](https://gcc.gnu.org) |
|
|
||||||
| ASM | [gcc](https://gcc.gnu.org) |
|
|
||||||
| Ansible | [ansible-lint](https://github.com/willthames/ansible-lint) |
|
| Ansible | [ansible-lint](https://github.com/willthames/ansible-lint) |
|
||||||
| API Blueprint | [drafter](https://github.com/apiaryio/drafter) |
|
| AsciiDoc | [proselint](http://proselint.com/)|
|
||||||
| AsciiDoc | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [write-good](https://github.com/btford/write-good), [vale](https://github.com/ValeLint/vale) |
|
| Bash | [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set), [shellcheck](https://www.shellcheck.net/) |
|
||||||
| Awk | [gawk](https://www.gnu.org/software/gawk/)|
|
| Bourne Shell | [-n flag](http://linux.die.net/man/1/sh), [shellcheck](https://www.shellcheck.net/) |
|
||||||
| Bash | [language-server](https://github.com/mads-hartmann/bash-language-server), shell [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set), [shellcheck](https://www.shellcheck.net/), [shfmt](https://github.com/mvdan/sh) |
|
| C | [cppcheck](http://cppcheck.sourceforge.net), [gcc](https://gcc.gnu.org/), [clang](http://clang.llvm.org/)|
|
||||||
| Bourne Shell | shell [-n flag](http://linux.die.net/man/1/sh), [shellcheck](https://www.shellcheck.net/), [shfmt](https://github.com/mvdan/sh) |
|
| C++ (filetype cpp) | [clang](http://clang.llvm.org/), [clangtidy](http://clang.llvm.org/extra/clang-tidy/), [cppcheck] (http://cppcheck.sourceforge.net), [gcc](https://gcc.gnu.org/)|
|
||||||
| C | [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint), [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html), [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html), [cquery](https://github.com/cquery-project/cquery), [flawfinder](https://www.dwheeler.com/flawfinder/), [gcc](https://gcc.gnu.org/), [uncrustify](https://github.com/uncrustify/uncrustify), [ccls](https://github.com/MaskRay/ccls) |
|
| C# | [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) |
|
||||||
| C++ (filetype cpp) | [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html), [clangcheck](http://clang.llvm.org/docs/ClangCheck.html) !!, [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html), [clazy](https://github.com/KDE/clazy) !!, [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint) !!, [cquery](https://github.com/cquery-project/cquery), [flawfinder](https://www.dwheeler.com/flawfinder/), [gcc](https://gcc.gnu.org/), [uncrustify](https://github.com/uncrustify/uncrustify), [ccls](https://github.com/MaskRay/ccls) |
|
|
||||||
| CUDA | [nvcc](http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html) |
|
|
||||||
| C# | [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) see:`help ale-cs-mcs` for details, [mcsc](http://www.mono-project.com/docs/about-mono/languages/csharp/) !! see:`help ale-cs-mcsc` for details and configuration, [uncrustify](https://github.com/uncrustify/uncrustify) |
|
|
||||||
| Chef | [foodcritic](http://www.foodcritic.io/) |
|
| Chef | [foodcritic](http://www.foodcritic.io/) |
|
||||||
| Clojure | [joker](https://github.com/candid82/joker) |
|
|
||||||
| CloudFormation | [cfn-python-lint](https://github.com/awslabs/cfn-python-lint) |
|
|
||||||
| CMake | [cmakelint](https://github.com/richq/cmake-lint) |
|
| CMake | [cmakelint](https://github.com/richq/cmake-lint) |
|
||||||
| CoffeeScript | [coffee](http://coffeescript.org/), [coffeelint](https://www.npmjs.com/package/coffeelint) |
|
| CoffeeScript | [coffee](http://coffeescript.org/), [coffeelint](https://www.npmjs.com/package/coffeelint) |
|
||||||
| Crystal | [crystal](https://crystal-lang.org/) !! |
|
| CSS | [csslint](http://csslint.net/), [stylelint](https://github.com/stylelint/stylelint) |
|
||||||
| CSS | [csslint](http://csslint.net/), [prettier](https://github.com/prettier/prettier), [stylelint](https://github.com/stylelint/stylelint) |
|
|
||||||
| Cucumber | [cucumber](https://cucumber.io/) |
|
|
||||||
| Cython (pyrex filetype) | [cython](http://cython.org/) |
|
| Cython (pyrex filetype) | [cython](http://cython.org/) |
|
||||||
| D | [dls](https://github.com/d-language-server/dls), [dmd](https://dlang.org/dmd-linux.html), [uncrustify](https://github.com/uncrustify/uncrustify) |
|
| D | [dmd](https://dlang.org/dmd-linux.html) |
|
||||||
| Dafny | [dafny](https://rise4fun.com/Dafny) !! |
|
| Dockerfile | [hadolint](https://github.com/lukasmartinelli/hadolint) |
|
||||||
| Dart | [dartanalyzer](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) !!, [language_server](https://github.com/natebosch/dart_language_server), [dartfmt](https://github.com/dart-lang/sdk/tree/master/utils/dartfmt) |
|
| Elixir | [credo](https://github.com/rrrene/credo) |
|
||||||
| Dockerfile | [dockerfile_lint](https://github.com/projectatomic/dockerfile_lint), [hadolint](https://github.com/hadolint/hadolint) |
|
| Elm | [elm-make](https://github.com/elm-lang/elm-make) |
|
||||||
| Elixir | [credo](https://github.com/rrrene/credo), [dialyxir](https://github.com/jeremyjh/dialyxir), [dogma](https://github.com/lpil/dogma), [mix](https://hexdocs.pm/mix/Mix.html) !!, [elixir-ls](https://github.com/JakeBecker/elixir-ls) |
|
| Erlang | [erlc](http://erlang.org/doc/man/erlc.html) |
|
||||||
| Elm | [elm-format](https://github.com/avh4/elm-format), [elm-make](https://github.com/elm-lang/elm-make) |
|
| Fortran | [gcc](https://gcc.gnu.org/) |
|
||||||
| Erb | [erb](https://apidock.com/ruby/ERB), [erubi](https://github.com/jeremyevans/erubi), [erubis](https://github.com/kwatch/erubis), [ruumba](https://github.com/ericqweinstein/ruumba) |
|
| Go | [gofmt -e](https://golang.org/cmd/gofmt/), [go vet](https://golang.org/cmd/vet/), [golint](https://godoc.org/github.com/golang/lint), [go build](https://golang.org/cmd/go/) |
|
||||||
| Erlang | [erlc](http://erlang.org/doc/man/erlc.html), [SyntaxErl](https://github.com/ten0s/syntaxerl) |
|
| Haml | [haml-lint](https://github.com/brigade/haml-lint)
|
||||||
| Fish | fish [-n flag](https://linux.die.net/man/1/fish)
|
| Haskell | [ghc](https://www.haskell.org/ghc/), [hlint](https://hackage.haskell.org/package/hlint), [hdevtools](https://hackage.haskell.org/package/hdevtools) |
|
||||||
| Fortran | [gcc](https://gcc.gnu.org/), [language_server](https://github.com/hansec/fortran-language-server) |
|
| HTML | [HTMLHint](http://htmlhint.com/), [proselint](http://proselint.com/), [tidy](http://www.html-tidy.org/) |
|
||||||
| Fountain | [proselint](http://proselint.com/) |
|
| Java | [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html) |
|
||||||
| FusionScript | [fusion-lint](https://github.com/RyanSquared/fusionscript) |
|
| JavaScript | [eslint](http://eslint.org/), [jscs](http://jscs.info/), [jshint](http://jshint.com/), [flow](https://flowtype.org/), [standard](http://standardjs.com/)
|
||||||
| Git Commit Messages | [gitlint](https://github.com/jorisroovers/gitlint) |
|
| JSON | [jsonlint](http://zaa.ch/jsonlint/) |
|
||||||
| GLSL | [glslang](https://github.com/KhronosGroup/glslang), [glslls](https://github.com/svenstaro/glsl-language-server) |
|
| LaTeX | [chktex](http://www.nongnu.org/chktex/), [lacheck](https://www.ctan.org/pkg/lacheck) |
|
||||||
| Go | [gofmt](https://golang.org/cmd/gofmt/), [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports), [go mod](https://golang.org/cmd/go/) !!, [go vet](https://golang.org/cmd/vet/) !!, [golint](https://godoc.org/github.com/golang/lint), [gotype](https://godoc.org/golang.org/x/tools/cmd/gotype) !!, [gometalinter](https://github.com/alecthomas/gometalinter) !!, [go build](https://golang.org/cmd/go/) !!, [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple) !!, [staticcheck](https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck) !!, [golangserver](https://github.com/sourcegraph/go-langserver), [golangci-lint](https://github.com/golangci/golangci-lint) !! |
|
| Lua | [luacheck](https://github.com/mpeterv/luacheck) |
|
||||||
| GraphQL | [eslint](http://eslint.org/), [gqlint](https://github.com/happylinks/gqlint), [prettier](https://github.com/prettier/prettier) |
|
| Markdown | [mdl](https://github.com/mivok/markdownlint), [proselint](http://proselint.com/)|
|
||||||
| Hack | [hack](http://hacklang.org/), [hackfmt](https://github.com/facebook/hhvm/tree/master/hphp/hack/hackfmt), [hhast](https://github.com/hhvm/hhast) (disabled by default; see `:help ale-integration-hack`) |
|
|
||||||
| Haml | [haml-lint](https://github.com/brigade/haml-lint) |
|
|
||||||
| Handlebars | [ember-template-lint](https://github.com/rwjblue/ember-template-lint) |
|
|
||||||
| Haskell | [brittany](https://github.com/lspitzner/brittany), [ghc](https://www.haskell.org/ghc/), [cabal-ghc](https://www.haskell.org/cabal/), [stylish-haskell](https://github.com/jaspervdj/stylish-haskell), [stack-ghc](https://haskellstack.org/), [stack-build](https://haskellstack.org/) !!, [ghc-mod](https://github.com/DanielG/ghc-mod), [hlint](https://hackage.haskell.org/package/hlint), [hdevtools](https://hackage.haskell.org/package/hdevtools), [hfmt](https://github.com/danstiner/hfmt), [hie](https://github.com/haskell/haskell-ide-engine) |
|
|
||||||
| HCL | [terraform-fmt](https://github.com/hashicorp/terraform) |
|
|
||||||
| HTML | [alex](https://github.com/wooorm/alex) !!, [HTMLHint](http://htmlhint.com/), [proselint](http://proselint.com/), [tidy](http://www.html-tidy.org/), [prettier](https://github.com/prettier/prettier), [write-good](https://github.com/btford/write-good) |
|
|
||||||
| Idris | [idris](http://www.idris-lang.org/) |
|
|
||||||
| ISPC | [ispc](https://ispc.github.io/) !! |
|
|
||||||
| Java | [checkstyle](http://checkstyle.sourceforge.net), [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html), [google-java-format](https://github.com/google/google-java-format), [PMD](https://pmd.github.io/), [javalsp](https://github.com/georgewfraser/vscode-javac), [uncrustify](https://github.com/uncrustify/uncrustify) |
|
|
||||||
| JavaScript | [eslint](http://eslint.org/), [flow](https://flowtype.org/), [jscs](http://jscs.info/), [jshint](http://jshint.com/), [prettier](https://github.com/prettier/prettier), [prettier-eslint](https://github.com/prettier/prettier-eslint-cli), [prettier-standard](https://github.com/sheerun/prettier-standard), [standard](http://standardjs.com/), [xo](https://github.com/sindresorhus/xo)
|
|
||||||
| JSON | [fixjson](https://github.com/rhysd/fixjson), [jsonlint](http://zaa.ch/jsonlint/), [jq](https://stedolan.github.io/jq/), [prettier](https://github.com/prettier/prettier) |
|
|
||||||
| Julia | [languageserver](https://github.com/JuliaEditorSupport/LanguageServer.jl) |
|
|
||||||
| Kotlin | [kotlinc](https://kotlinlang.org) !!, [ktlint](https://ktlint.github.io) !!, [languageserver](https://github.com/fwcd/KotlinLanguageServer) see `:help ale-integration-kotlin` for configuration instructions |
|
|
||||||
| LaTeX | [alex](https://github.com/wooorm/alex) !!, [chktex](http://www.nongnu.org/chktex/), [lacheck](https://www.ctan.org/pkg/lacheck), [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
|
|
||||||
| Less | [lessc](https://www.npmjs.com/package/less), [prettier](https://github.com/prettier/prettier), [stylelint](https://github.com/stylelint/stylelint) |
|
|
||||||
| LLVM | [llc](https://llvm.org/docs/CommandGuide/llc.html) |
|
|
||||||
| Lua | [luac](https://www.lua.org/manual/5.1/luac.html), [luacheck](https://github.com/mpeterv/luacheck) |
|
|
||||||
| Mail | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale) |
|
|
||||||
| Make | [checkmake](https://github.com/mrtazz/checkmake) |
|
|
||||||
| Markdown | [alex](https://github.com/wooorm/alex) !!, [markdownlint](https://github.com/DavidAnson/markdownlint) !!, [mdl](https://github.com/mivok/markdownlint), [prettier](https://github.com/prettier/prettier), [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [remark-lint](https://github.com/wooorm/remark-lint), [textlint](https://textlint.github.io/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
|
|
||||||
| MATLAB | [mlint](https://www.mathworks.com/help/matlab/ref/mlint.html) |
|
| MATLAB | [mlint](https://www.mathworks.com/help/matlab/ref/mlint.html) |
|
||||||
| Mercury | [mmc](http://mercurylang.org) !! |
|
| Nim | [nim](https://nim-lang.org/docs/nimc.html) |
|
||||||
| NASM | [nasm](https://www.nasm.us/) !! |
|
|
||||||
| Nim | [nim check](https://nim-lang.org/docs/nimc.html) !! |
|
|
||||||
| nix | [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate) |
|
| nix | [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate) |
|
||||||
| nroff | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good)|
|
| nroff | [proselint](http://proselint.com/)|
|
||||||
| Objective-C | [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html), [uncrustify](https://github.com/uncrustify/uncrustify), [ccls](https://github.com/MaskRay/ccls) |
|
| OCaml | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-integration-ocaml-merlin` for configuration instructions
|
||||||
| Objective-C++ | [clang](http://clang.llvm.org/), [clangd](https://clang.llvm.org/extra/clangd.html), [uncrustify](https://github.com/uncrustify/uncrustify) |
|
| Perl | [perl -c](https://perl.org/), [perl-critic](https://metacpan.org/pod/Perl::Critic) |
|
||||||
| OCaml | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-ocaml-merlin` for configuration instructions, [ols](https://github.com/freebroccolo/ocaml-language-server), [ocamlformat](https://github.com/ocaml-ppx/ocamlformat) |
|
| PHP | [hack](http://hacklang.org/), [php -l](https://secure.php.net/), [phpcs](https://github.com/squizlabs/PHP_CodeSniffer), [phpmd](https://phpmd.org) |
|
||||||
| Pawn | [uncrustify](https://github.com/uncrustify/uncrustify) |
|
| Pod | [proselint](http://proselint.com/)|
|
||||||
| Perl | [perl -c](https://perl.org/), [perl-critic](https://metacpan.org/pod/Perl::Critic), [perltidy](https://metacpan.org/pod/distribution/Perl-Tidy/bin/perltidy) |
|
|
||||||
| Perl6 | [perl6 -c](https://perl6.org) |
|
|
||||||
| PHP | [langserver](https://github.com/felixfbecker/php-language-server), [phan](https://github.com/phan/phan) see `:help ale-php-phan` to instructions, [php -l](https://secure.php.net/), [phpcs](https://github.com/squizlabs/PHP_CodeSniffer), [phpmd](https://phpmd.org), [phpstan](https://github.com/phpstan/phpstan), [phpcbf](https://github.com/squizlabs/PHP_CodeSniffer), [php-cs-fixer](http://cs.sensiolabs.org/), [psalm](https://getpsalm.org) !! |
|
|
||||||
| PO | [alex](https://github.com/wooorm/alex) !!, [msgfmt](https://www.gnu.org/software/gettext/manual/html_node/msgfmt-Invocation.html), [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
|
||||||
| Pod | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
|
||||||
| Pony | [ponyc](https://github.com/ponylang/ponyc) |
|
|
||||||
| Prolog | [swipl](https://github.com/SWI-Prolog/swipl-devel) |
|
|
||||||
| proto | [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint) |
|
|
||||||
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) |
|
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) |
|
||||||
| Puppet | [languageserver](https://github.com/lingua-pupuli/puppet-editor-services), [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) |
|
| Puppet | [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) |
|
||||||
| Python | [autopep8](https://github.com/hhatto/autopep8), [black](https://github.com/ambv/black), [flake8](http://flake8.pycqa.org/en/latest/), [isort](https://github.com/timothycrosley/isort), [mypy](http://mypy-lang.org/), [prospector](https://github.com/PyCQA/prospector), [pycodestyle](https://github.com/PyCQA/pycodestyle), [pyls](https://github.com/palantir/python-language-server), [pyre](https://github.com/facebook/pyre-check), [pylint](https://www.pylint.org/) !!, [vulture](https://github.com/jendrikseipp/vulture) !!, [yapf](https://github.com/google/yapf) |
|
| Python | [flake8](http://flake8.pycqa.org/en/latest/), [mypy](http://mypy-lang.org/), [pylint](https://www.pylint.org/) |
|
||||||
| QML | [qmlfmt](https://github.com/jesperhh/qmlfmt), [qmllint](https://github.com/qt/qtdeclarative/tree/5.11/tools/qmllint) |
|
| reStructuredText | [proselint](http://proselint.com/)|
|
||||||
| R | [lintr](https://github.com/jimhester/lintr) |
|
| Ruby | [rubocop](https://github.com/bbatsov/rubocop) |
|
||||||
| ReasonML | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-reasonml-ols` for configuration instructions, [ols](https://github.com/freebroccolo/ocaml-language-server), [refmt](https://github.com/reasonml/reason-cli) |
|
| Rust | [rustc](https://www.rust-lang.org/), cargo (see `:help ale-integration-rust` for configuration instructions) |
|
||||||
| reStructuredText | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [rstcheck](https://github.com/myint/rstcheck), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
|
|
||||||
| Re:VIEW | [redpen](http://redpen.cc/) |
|
|
||||||
| RPM spec | [rpmlint](https://github.com/rpm-software-management/rpmlint) (disabled by default; see `:help ale-integration-spec`) |
|
|
||||||
| Ruby | [brakeman](http://brakemanscanner.org/) !!, [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) !!, [reek](https://github.com/troessner/reek), [rubocop](https://github.com/bbatsov/rubocop), [ruby](https://www.ruby-lang.org), [rufo](https://github.com/ruby-formatter/rufo), [solargraph](https://solargraph.org) |
|
|
||||||
| Rust | [cargo](https://github.com/rust-lang/cargo) !! (see `:help ale-integration-rust` for configuration instructions), [rls](https://github.com/rust-lang-nursery/rls), [rustc](https://www.rust-lang.org/), [rustfmt](https://github.com/rust-lang-nursery/rustfmt) |
|
|
||||||
| SASS | [sass-lint](https://www.npmjs.com/package/sass-lint), [stylelint](https://github.com/stylelint/stylelint) |
|
| SASS | [sass-lint](https://www.npmjs.com/package/sass-lint), [stylelint](https://github.com/stylelint/stylelint) |
|
||||||
| SCSS | [prettier](https://github.com/prettier/prettier), [sass-lint](https://www.npmjs.com/package/sass-lint), [scss-lint](https://github.com/brigade/scss-lint), [stylelint](https://github.com/stylelint/stylelint) |
|
| SCSS | [sass-lint](https://www.npmjs.com/package/sass-lint), [scss-lint](https://github.com/brigade/scss-lint), [stylelint](https://github.com/stylelint/stylelint) |
|
||||||
| Scala | [fsc](https://www.scala-lang.org/old/sites/default/files/linuxsoft_archives/docu/files/tools/fsc.html), [sbtserver](https://www.scala-sbt.org/1.x/docs/sbt-server.html), [scalac](http://scala-lang.org), [scalafmt](https://scalameta.org/scalafmt/), [scalastyle](http://www.scalastyle.org)|
|
| Scala | [scalac](http://scala-lang.org) |
|
||||||
| Slim | [slim-lint](https://github.com/sds/slim-lint) |
|
| Slim | [slim-lint](https://github.com/sds/slim-lint)
|
||||||
| SML | [smlnj](http://www.smlnj.org/) |
|
| SML | [smlnj](http://www.smlnj.org/) |
|
||||||
| Solidity | [solhint](https://github.com/protofire/solhint), [solium](https://github.com/duaraghav8/Solium) |
|
| Swift | [swiftlint](https://swift.org/) |
|
||||||
| Stylus | [stylelint](https://github.com/stylelint/stylelint) |
|
| Tex | [proselint](http://proselint.com/) |
|
||||||
| SQL | [sqlint](https://github.com/purcell/sqlint), [sqlfmt](https://github.com/jackc/sqlfmt) |
|
| Texinfo | [proselint](http://proselint.com/)|
|
||||||
| Swift | [swiftlint](https://github.com/realm/SwiftLint), [swiftformat](https://github.com/nicklockwood/SwiftFormat) |
|
| Text^ | [proselint](http://proselint.com/) |
|
||||||
| Tcl | [nagelfar](http://nagelfar.sourceforge.net) !! |
|
| TypeScript | [tslint](https://github.com/palantir/tslint), typecheck |
|
||||||
| Terraform | [fmt](https://github.com/hashicorp/terraform), [tflint](https://github.com/wata727/tflint) |
|
|
||||||
| Texinfo | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good)|
|
|
||||||
| Text^ | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [textlint](https://textlint.github.io/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
|
|
||||||
| Thrift | [thrift](http://thrift.apache.org/) |
|
|
||||||
| TypeScript | [eslint](http://eslint.org/), [prettier](https://github.com/prettier/prettier), [tslint](https://github.com/palantir/tslint), [tsserver](https://github.com/Microsoft/TypeScript/wiki/Standalone-Server-%28tsserver%29), typecheck |
|
|
||||||
| VALA | [uncrustify](https://github.com/uncrustify/uncrustify) |
|
|
||||||
| Verilog | [iverilog](https://github.com/steveicarus/iverilog), [verilator](http://www.veripool.org/projects/verilator/wiki/Intro) |
|
| Verilog | [iverilog](https://github.com/steveicarus/iverilog), [verilator](http://www.veripool.org/projects/verilator/wiki/Intro) |
|
||||||
| Vim | [vint](https://github.com/Kuniwak/vint) |
|
| Vim | [vint](https://github.com/Kuniwak/vint) |
|
||||||
| Vim help^ | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
| Vim help^ | [proselint](http://proselint.com/)|
|
||||||
| Vue | [prettier](https://github.com/prettier/prettier), [vls](https://github.com/vuejs/vetur/tree/master/server) |
|
| XHTML | [proselint](http://proselint.com/)|
|
||||||
| XHTML | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
| YAML | [yamllint](https://yamllint.readthedocs.io/) |
|
||||||
| XML | [xmllint](http://xmlsoft.org/xmllint.html) |
|
|
||||||
| YAML | [prettier](https://github.com/prettier/prettier), [swaglint](https://github.com/byCedric/swaglint), [yamllint](https://yamllint.readthedocs.io/) |
|
* *^ No linters for text or Vim help filetypes are enabled by default.*
|
||||||
| YANG | [yang-lsp](https://github.com/theia-ide/yang-lsp) |
|
|
||||||
|
|
||||||
<a name="usage"></a>
|
<a name="usage"></a>
|
||||||
|
|
||||||
## 2. Usage
|
## 2. Usage
|
||||||
|
|
||||||
<a name="usage-linting"></a>
|
|
||||||
|
|
||||||
### 2.i Linting
|
|
||||||
|
|
||||||
Once this plugin is installed, while editing your files in supported
|
Once this plugin is installed, while editing your files in supported
|
||||||
languages and tools which have been correctly installed,
|
languages and tools which have been correctly installed,
|
||||||
this plugin will send the contents of your text buffers to a variety of
|
this plugin will send the contents of your text buffers to a variety of
|
||||||
@@ -228,175 +128,19 @@ documented in [the Vim help file](doc/ale.txt). For more information on the
|
|||||||
options ALE offers, consult `:help ale-options` for global options and `:help
|
options ALE offers, consult `:help ale-options` for global options and `:help
|
||||||
ale-linter-options` for options specified to particular linters.
|
ale-linter-options` for options specified to particular linters.
|
||||||
|
|
||||||
<a name="usage-fixing"></a>
|
|
||||||
|
|
||||||
### 2.ii Fixing
|
|
||||||
|
|
||||||
ALE can fix files with the `ALEFix` command. Functions need to be configured
|
|
||||||
either in each buffer with a `b:ale_fixers`, or globally with `g:ale_fixers`.
|
|
||||||
|
|
||||||
The recommended way to configure fixers is to define a List in an ftplugin file.
|
|
||||||
|
|
||||||
```vim
|
|
||||||
" In ~/.vim/ftplugin/javascript.vim, or somewhere similar.
|
|
||||||
|
|
||||||
" Fix files with prettier, and then ESLint.
|
|
||||||
let b:ale_fixers = ['prettier', 'eslint']
|
|
||||||
" Equivalent to the above.
|
|
||||||
let b:ale_fixers = {'javascript': ['prettier', 'eslint']}
|
|
||||||
```
|
|
||||||
|
|
||||||
You can also configure your fixers from vimrc using `g:ale_fixers`, before or
|
|
||||||
after ALE has been loaded.
|
|
||||||
|
|
||||||
A `*` in place of the filetype will apply a List of fixers to all files which
|
|
||||||
do not match some filetype in the Dictionary.
|
|
||||||
|
|
||||||
Note that using a plain List for `g:ale_fixers` is not supported.
|
|
||||||
|
|
||||||
```vim
|
|
||||||
" In ~/.vim/vimrc, or somewhere similar.
|
|
||||||
let g:ale_fixers = {
|
|
||||||
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
|
|
||||||
\ 'javascript': ['eslint'],
|
|
||||||
\}
|
|
||||||
```
|
|
||||||
|
|
||||||
If you want to automatically fix files when you save them, you need to turn
|
|
||||||
a setting on in vimrc.
|
|
||||||
|
|
||||||
```vim
|
|
||||||
" Set this variable to 1 to fix files when you save them.
|
|
||||||
let g:ale_fix_on_save = 1
|
|
||||||
```
|
|
||||||
|
|
||||||
The `:ALEFixSuggest` command will suggest some supported tools for fixing code.
|
|
||||||
Both `g:ale_fixers` and `b:ale_fixers` can also accept functions, including
|
|
||||||
lambda functions, as fixers, for fixing files with custom tools.
|
|
||||||
|
|
||||||
See `:help ale-fix` for complete information on how to fix files with ALE.
|
|
||||||
|
|
||||||
<a name="usage-completion"></a>
|
|
||||||
|
|
||||||
### 2.iii Completion
|
|
||||||
|
|
||||||
ALE offers some support for completion via hijacking of omnicompletion while you
|
|
||||||
type. All of ALE's completion information must come from Language Server
|
|
||||||
Protocol linters, or from `tsserver` for TypeScript.
|
|
||||||
|
|
||||||
```vim
|
|
||||||
" Enable completion where available.
|
|
||||||
" This setting must be set before ALE is loaded.
|
|
||||||
let g:ale_completion_enabled = 1
|
|
||||||
```
|
|
||||||
|
|
||||||
See `:help ale-completion` for more information.
|
|
||||||
|
|
||||||
<a name="usage-go-to-definition"></a>
|
|
||||||
|
|
||||||
### 2.iv Go To Definition
|
|
||||||
|
|
||||||
ALE supports jumping to the definition of words under your cursor with the
|
|
||||||
`:ALEGoToDefinition` command using any enabled Language Server Protocol linters
|
|
||||||
and `tsserver`.
|
|
||||||
|
|
||||||
See `:help ale-go-to-definition` for more information.
|
|
||||||
|
|
||||||
<a name="usage-find-references"></a>
|
|
||||||
|
|
||||||
### 2.v Find References
|
|
||||||
|
|
||||||
ALE supports finding references for words under your cursor with the
|
|
||||||
`:ALEFindReferences` command using any enabled Language Server Protocol linters
|
|
||||||
and `tsserver`.
|
|
||||||
|
|
||||||
See `:help ale-find-references` for more information.
|
|
||||||
|
|
||||||
<a name="usage-hover"></a>
|
|
||||||
|
|
||||||
### 2.vi Hovering
|
|
||||||
|
|
||||||
ALE supports "hover" information for printing brief information about symbols at
|
|
||||||
the cursor taken from Language Server Protocol linters and `tsserver` with the
|
|
||||||
`ALEHover` command.
|
|
||||||
|
|
||||||
The information can be displayed in a `balloon` tooltip in Vim or GVim by
|
|
||||||
hovering your mouse over symbols. Mouse hovering is enabled by default in GVim,
|
|
||||||
and needs to be configured for Vim 8.1+ in terminals.
|
|
||||||
|
|
||||||
See `:help ale-hover` for more information.
|
|
||||||
|
|
||||||
<a name="usage-symbol-search"></a>
|
|
||||||
|
|
||||||
### 2.vii Symbol Search
|
|
||||||
|
|
||||||
ALE supports searching for workspace symbols via Language Server Protocol
|
|
||||||
linters with the `ALESymbolSearch` command.
|
|
||||||
|
|
||||||
Search queries can be performed to find functions, types, and more which are
|
|
||||||
similar to a given query string.
|
|
||||||
|
|
||||||
See `:help ale-symbol-search` for more information.
|
|
||||||
|
|
||||||
<a name="installation"></a>
|
<a name="installation"></a>
|
||||||
|
|
||||||
## 3. Installation
|
## 3. Installation
|
||||||
|
|
||||||
To install this plugin, you should use one of the following methods.
|
To install this plugin, you should use one of the following methods.
|
||||||
For Windows users, replace usage of the Unix `~/.vim` directory with
|
For Windows users, replace usage of the Unix `~/.vim` directory with
|
||||||
`%USERPROFILE%\vimfiles`, or another directory if you have configured
|
`%USERPROFILE%\_vim`, or another directory if you have configured
|
||||||
Vim differently. On Windows, your `~/.vimrc` file will be similarly
|
Vim differently. On Windows, your `~/.vimrc` file will be similarly
|
||||||
stored in `%USERPROFILE%\_vimrc`.
|
stored in `%USERPROFILE%\_vimrc`.
|
||||||
|
|
||||||
<a name="standard-installation"></a>
|
|
||||||
|
|
||||||
### 3.i. Installation with Vim package management
|
|
||||||
|
|
||||||
In Vim 8 and NeoVim, you can install plugins easily without needing to use
|
|
||||||
any other tools. Simply clone the plugin into your `pack` directory.
|
|
||||||
|
|
||||||
#### Vim 8 on Unix
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mkdir -p ~/.vim/pack/git-plugins/start
|
|
||||||
git clone https://github.com/w0rp/ale.git ~/.vim/pack/git-plugins/start/ale
|
|
||||||
```
|
|
||||||
|
|
||||||
#### NeoVim on Unix
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mkdir -p ~/.local/share/nvim/site/pack/git-plugins/start
|
|
||||||
git clone https://github.com/w0rp/ale.git ~/.local/share/nvim/site/pack/git-plugins/start/ale
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Vim 8 on Windows
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Run these commands in the "Git for Windows" Bash terminal
|
|
||||||
mkdir -p ~/vimfiles/pack/git-plugins/start
|
|
||||||
git clone https://github.com/w0rp/ale.git ~/vimfiles/pack/git-plugins/start/ale
|
|
||||||
```
|
|
||||||
|
|
||||||
#### Generating Vim help files
|
|
||||||
|
|
||||||
You can add the following line to your vimrc files to generate documentation
|
|
||||||
tags automatically, if you don't have something similar already, so you can use
|
|
||||||
the `:help` command to consult ALE's online documentation:
|
|
||||||
|
|
||||||
```vim
|
|
||||||
" Put these lines at the very end of your vimrc file.
|
|
||||||
|
|
||||||
" Load all plugins now.
|
|
||||||
" Plugins need to be added to runtimepath before helptags can be generated.
|
|
||||||
packloadall
|
|
||||||
" Load all of the helptags now, after plugins have been loaded.
|
|
||||||
" All messages and errors will be ignored.
|
|
||||||
silent! helptags ALL
|
|
||||||
```
|
|
||||||
|
|
||||||
<a name="installation-with-pathogen"></a>
|
<a name="installation-with-pathogen"></a>
|
||||||
|
|
||||||
### 3.ii. Installation with Pathogen
|
### 3.i. Installation with Pathogen
|
||||||
|
|
||||||
To install this module with [Pathogen](https://github.com/tpope/vim-pathogen),
|
To install this module with [Pathogen](https://github.com/tpope/vim-pathogen),
|
||||||
you should clone this repository to your bundle directory, and ensure
|
you should clone this repository to your bundle directory, and ensure
|
||||||
@@ -410,7 +154,7 @@ git clone https://github.com/w0rp/ale.git
|
|||||||
|
|
||||||
<a name="installation-with-vundle"></a>
|
<a name="installation-with-vundle"></a>
|
||||||
|
|
||||||
### 3.iii. Installation with Vundle
|
### 3.ii. Installation with Vundle
|
||||||
|
|
||||||
You can install this plugin using [Vundle](https://github.com/VundleVim/Vundle.vim)
|
You can install this plugin using [Vundle](https://github.com/VundleVim/Vundle.vim)
|
||||||
by using the path on GitHub for this repository.
|
by using the path on GitHub for this repository.
|
||||||
@@ -421,18 +165,41 @@ Plugin 'w0rp/ale'
|
|||||||
|
|
||||||
See the Vundle documentation for more information.
|
See the Vundle documentation for more information.
|
||||||
|
|
||||||
<a name="installation-with-vim-plug"></a>
|
<a name="manual-installation"></a>
|
||||||
|
|
||||||
### 3.iiii. Installation with Vim-Plug
|
### 3.iii. Manual Installation
|
||||||
|
|
||||||
You can install this plugin using [Vim-Plug](https://github.com/junegunn/vim-plug)
|
For installation without a package manager, you can clone this git repository
|
||||||
by adding the GitHub path for this repository to your `~/.vimrc`
|
into a bundle directory as with pathogen, and add the repository to your
|
||||||
and running `:PlugInstall`.
|
runtime path yourself. First clone the repository.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd ~/.vim/bundle
|
||||||
|
git clone https://github.com/w0rp/ale.git
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, modify your `~/.vimrc` file to add this plugin to your runtime path.
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
Plug 'w0rp/ale'
|
set nocompatible
|
||||||
|
filetype off
|
||||||
|
|
||||||
|
let &runtimepath.=',~/.vim/bundle/ale'
|
||||||
|
|
||||||
|
filetype plugin on
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can add the following line to generate documentation tags automatically,
|
||||||
|
if you don't have something similar already, so you can use the `:help` command
|
||||||
|
to consult ALE's online documentation:
|
||||||
|
|
||||||
|
```vim
|
||||||
|
silent! helptags ALL
|
||||||
|
```
|
||||||
|
|
||||||
|
Because the author of this plugin is a weird nerd, this is his preferred
|
||||||
|
installation method.
|
||||||
|
|
||||||
<a name="contributing"></a>
|
<a name="contributing"></a>
|
||||||
|
|
||||||
## 4. Contributing
|
## 4. Contributing
|
||||||
@@ -447,9 +214,6 @@ If you are interested in the general direction of the project, check out the
|
|||||||
[wiki home page](https://github.com/w0rp/ale/wiki). The wiki includes a
|
[wiki home page](https://github.com/w0rp/ale/wiki). The wiki includes a
|
||||||
Roadmap for the future, and more.
|
Roadmap for the future, and more.
|
||||||
|
|
||||||
If you'd liked to discuss the project more directly, check out the `#vim-ale` channel
|
|
||||||
on Freenode. Web chat is available [here](https://webchat.freenode.net/?channels=vim-ale).
|
|
||||||
|
|
||||||
<a name="faq"></a>
|
<a name="faq"></a>
|
||||||
|
|
||||||
## 5. FAQ
|
## 5. FAQ
|
||||||
@@ -458,28 +222,12 @@ on Freenode. Web chat is available [here](https://webchat.freenode.net/?channels
|
|||||||
|
|
||||||
### 5.i. How do I disable particular linters?
|
### 5.i. How do I disable particular linters?
|
||||||
|
|
||||||
By default, all available tools for all supported languages will be run. If you
|
By default, all available tools for all supported languages will be run.
|
||||||
want to only select a subset of the tools, you can define `b:ale_linters` for a
|
If you want to only select a subset of the tools, simply create a
|
||||||
single buffer, or `g:ale_linters` globally.
|
`g:ale_linters` dictionary in your vimrc file mapping filetypes
|
||||||
|
to lists of linters to run.
|
||||||
The recommended way to configure linters is to define a List in an ftplugin
|
|
||||||
file.
|
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
" In ~/.vim/ftplugin/javascript.vim, or somewhere similar.
|
|
||||||
|
|
||||||
" Enable ESLint only for JavaScript.
|
|
||||||
let b:ale_linters = ['eslint']
|
|
||||||
|
|
||||||
" Equivalent to the above.
|
|
||||||
let b:ale_linters = {'javascript': ['eslint']}
|
|
||||||
```
|
|
||||||
|
|
||||||
You can also declare which linters you want to run in your vimrc file, before or
|
|
||||||
after ALE has been loaded.
|
|
||||||
|
|
||||||
```vim
|
|
||||||
" In ~/.vim/vimrc, or somewhere similar.
|
|
||||||
let g:ale_linters = {
|
let g:ale_linters = {
|
||||||
\ 'javascript': ['eslint'],
|
\ 'javascript': ['eslint'],
|
||||||
\}
|
\}
|
||||||
@@ -490,14 +238,6 @@ be run for those languages, just as when the dictionary is not defined.
|
|||||||
Running many linters should not typically obstruct editing in Vim,
|
Running many linters should not typically obstruct editing in Vim,
|
||||||
as they will all be executed in separate processes simultaneously.
|
as they will all be executed in separate processes simultaneously.
|
||||||
|
|
||||||
If you don't want ALE to run anything other than what you've explicitly asked
|
|
||||||
for, you can set `g:ale_linters_explicit` to `1`.
|
|
||||||
|
|
||||||
```vim
|
|
||||||
" Only run linters named in ale_linters settings.
|
|
||||||
let g:ale_linters_explicit = 1
|
|
||||||
```
|
|
||||||
|
|
||||||
This plugin will look for linters in the [`ale_linters`](ale_linters) directory.
|
This plugin will look for linters in the [`ale_linters`](ale_linters) directory.
|
||||||
Each directory within corresponds to a particular filetype in Vim, and each file
|
Each directory within corresponds to a particular filetype in Vim, and each file
|
||||||
in each directory corresponds to the name of a particular linter.
|
in each directory corresponds to the name of a particular linter.
|
||||||
@@ -533,93 +273,43 @@ highlight clear ALEErrorSign
|
|||||||
highlight clear ALEWarningSign
|
highlight clear ALEWarningSign
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="faq-change-highlights"></a>
|
|
||||||
|
|
||||||
### 5.iv. How can I change or disable the highlights ALE uses?
|
|
||||||
|
|
||||||
ALE's highlights problems with highlight groups which link to `SpellBad`,
|
|
||||||
`SpellCap`, `error`, and `todo` groups by default. The characters that are
|
|
||||||
highlighted depend on the linters being used, and the information provided to
|
|
||||||
ALE.
|
|
||||||
|
|
||||||
Highlighting can be disabled completely by setting `g:ale_set_highlights` to
|
|
||||||
`0`.
|
|
||||||
|
|
||||||
```vim
|
|
||||||
" Set this in your vimrc file to disabling highlighting
|
|
||||||
let g:ale_set_highlights = 0
|
|
||||||
```
|
|
||||||
|
|
||||||
You can control all of the highlights ALE uses, say if you are using a different
|
|
||||||
color scheme which produces ugly highlights. For example:
|
|
||||||
|
|
||||||
```vim
|
|
||||||
highlight ALEWarning ctermbg=DarkMagenta
|
|
||||||
```
|
|
||||||
|
|
||||||
See `:help ale-highlights` for more information.
|
|
||||||
|
|
||||||
<a name="faq-statusline"></a>
|
<a name="faq-statusline"></a>
|
||||||
|
|
||||||
### 5.v. How can I show errors or warnings in my statusline?
|
### 5.iv. How can I show errors or warnings in my statusline?
|
||||||
|
|
||||||
[vim-airline](https://github.com/vim-airline/vim-airline) integrates with ALE
|
You can use `ALEGetStatusLine()` to integrate ALE into vim statusline.
|
||||||
for displaying error information in the status bar. If you want to see the
|
To enable it, you should have in your `statusline` settings
|
||||||
status for ALE in a nice format, it is recommended to use vim-airline with ALE.
|
|
||||||
The airline extension can be enabled by adding the following to your vimrc:
|
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
" Set this. Airline will handle the rest.
|
%{ALEGetStatusLine()}
|
||||||
let g:airline#extensions#ale#enabled = 1
|
|
||||||
```
|
```
|
||||||
|
|
||||||
If you don't want to use vim-airline, you can implement your own statusline
|
When errors are detected a string showing the number of errors will be shown.
|
||||||
function without adding any other plugins. ALE provides a function for counting
|
You can customize the output format using the global list `g:ale_statusline_format` where:
|
||||||
the number of problems for this purpose, named `ale#statusline#Count`.
|
|
||||||
|
|
||||||
Say you want to display all errors as one figure, and all non-errors as another
|
- The 1st element is for errors
|
||||||
figure. You can do the following:
|
- The 2nd element is for warnings
|
||||||
|
- The 3rd element is for when no errors are detected
|
||||||
|
|
||||||
|
e.g
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
function! LinterStatus() abort
|
let g:ale_statusline_format = ['⨉ %d', '⚠ %d', '⬥ ok']
|
||||||
let l:counts = ale#statusline#Count(bufnr(''))
|
|
||||||
|
|
||||||
let l:all_errors = l:counts.error + l:counts.style_error
|
|
||||||
let l:all_non_errors = l:counts.total - l:all_errors
|
|
||||||
|
|
||||||
return l:counts.total == 0 ? 'OK' : printf(
|
|
||||||
\ '%dW %dE',
|
|
||||||
\ all_non_errors,
|
|
||||||
\ all_errors
|
|
||||||
\)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
set statusline=%{LinterStatus()}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
See `:help ale#statusline#Count()` for more information.
|

|
||||||
|

|
||||||
<a name="faq-lightline"></a>
|
|
||||||
|
|
||||||
### 5.vi. How can I show errors or warnings in my lightline?
|
|
||||||
|
|
||||||
[lightline](https://github.com/itchyny/lightline.vim) does not have built-in
|
|
||||||
support for ALE, nevertheless there is a plugin that adds this functionality: [maximbaz/lightline-ale](https://github.com/maximbaz/lightline-ale).
|
|
||||||
|
|
||||||
For more information, check out the sources of that plugin, `:help ale#statusline#Count()` and [lightline documentation](https://github.com/itchyny/lightline.vim#advanced-configuration).
|
|
||||||
|
|
||||||
<a name="faq-echo-format"></a>
|
<a name="faq-echo-format"></a>
|
||||||
|
|
||||||
### 5.vii. How can I change the format for echo messages?
|
### 5.v. How can I change the format for echo messages?
|
||||||
|
|
||||||
There are 3 global options that allow customizing the echoed message.
|
There are 3 global options that allow customizing the echoed message.
|
||||||
|
|
||||||
- `g:ale_echo_msg_format` where:
|
- `g:ale_echo_msg_format` where:
|
||||||
* `%s` is the error message itself
|
* `%s` is the error message itself
|
||||||
* `%...code...%` is an optional error code, and most characters can be
|
* `%linter%` is the linter name
|
||||||
written between the `%` characters.
|
* `%severity` is the severity type
|
||||||
* `%linter%` is the linter name
|
|
||||||
* `%severity` is the severity type
|
|
||||||
- `g:ale_echo_msg_error_str` is the string used for error severity.
|
- `g:ale_echo_msg_error_str` is the string used for error severity.
|
||||||
- `g:ale_echo_msg_warning_str` is the string used for warning severity.
|
- `g:ale_echo_msg_warning_str` is the string used for warning severity.
|
||||||
|
|
||||||
@@ -635,34 +325,24 @@ Will give you:
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
See `:help g:ale_echo_msg_format` for more information.
|
|
||||||
|
|
||||||
<a name="faq-autocmd"></a>
|
<a name="faq-autocmd"></a>
|
||||||
|
|
||||||
### 5.viii. How can I execute some code when ALE starts or stops linting?
|
### 5.vi. How can I execute some code when ALE stops linting?
|
||||||
|
|
||||||
ALE runs its own [autocmd](http://vimdoc.sourceforge.net/htmldoc/autocmd.html)
|
ALE runs its own [autocmd](http://vimdoc.sourceforge.net/htmldoc/autocmd.html)
|
||||||
events when a lint or fix cycle are started and stopped. There is also an event
|
event whenever has a linter has been successfully executed and processed. This
|
||||||
that runs when a linter job has been successfully started. These events can be
|
autocmd event can be used to call arbitrary functions after ALE stops linting.
|
||||||
used to call arbitrary functions during these respective parts of the ALE's
|
|
||||||
operation.
|
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
augroup YourGroup
|
augroup YourGroup
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd User ALELintPre call YourFunction()
|
autocmd User ALELint call YourFunction()
|
||||||
autocmd User ALELintPost call YourFunction()
|
|
||||||
|
|
||||||
autocmd User ALEJobStarted call YourFunction()
|
|
||||||
|
|
||||||
autocmd User ALEFixPre call YourFunction()
|
|
||||||
autocmd User ALEFixPost call YourFunction()
|
|
||||||
augroup END
|
augroup END
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="faq-navigation"></a>
|
<a name="faq-navigation"></a>
|
||||||
|
|
||||||
### 5.ix. How can I navigate between errors quickly?
|
### 5.vii. How can I navigate between errors quickly?
|
||||||
|
|
||||||
ALE offers some commands with `<Plug>` keybinds for moving between warnings and
|
ALE offers some commands with `<Plug>` keybinds for moving between warnings and
|
||||||
errors quickly. You can map the keys Ctrl+j and Ctrl+k to moving between errors
|
errors quickly. You can map the keys Ctrl+j and Ctrl+k to moving between errors
|
||||||
@@ -678,27 +358,25 @@ For more information, consult the online documentation with
|
|||||||
|
|
||||||
<a name="faq-lint-on-save"></a>
|
<a name="faq-lint-on-save"></a>
|
||||||
|
|
||||||
### 5.x. How can I run linters only when I save files?
|
### 5.viii. How can I run linters only when I save files?
|
||||||
|
|
||||||
ALE offers an option `g:ale_lint_on_save` for enabling running the linters
|
ALE offers an option `g:ale_lint_on_save` for enabling running the linters
|
||||||
when files are saved. This option is enabled by default. If you only
|
when files are saved. If you wish to run linters when files are saved, not
|
||||||
wish to run linters when files are saved, you can turn the other
|
as you are editing files, then you can turn the option for linting
|
||||||
options off.
|
when text is changed off too.
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
" Write this in your vimrc file
|
" Write this in your vimrc file
|
||||||
let g:ale_lint_on_text_changed = 'never'
|
let g:ale_lint_on_save = 1
|
||||||
|
let g:ale_lint_on_text_changed = 0
|
||||||
" You can disable this option too
|
" You can disable this option too
|
||||||
" if you don't want linters to run on opening a file
|
" if you don't want linters to run on opening a file
|
||||||
let g:ale_lint_on_enter = 0
|
let g:ale_lint_on_enter = 0
|
||||||
```
|
```
|
||||||
|
|
||||||
If for whatever reason you don't wish to run linters again when you save
|
|
||||||
files, you can set `g:ale_lint_on_save` to `0`.
|
|
||||||
|
|
||||||
<a name="faq-quickfix"></a>
|
<a name="faq-quickfix"></a>
|
||||||
|
|
||||||
### 5.xi. How can I use the quickfix list instead of the loclist?
|
### 5.ix. How can I use the quickfix list instead of the loclist?
|
||||||
|
|
||||||
The quickfix list can be enabled by turning the `g:ale_set_quickfix`
|
The quickfix list can be enabled by turning the `g:ale_set_quickfix`
|
||||||
option on. If you wish to also disable the loclist, you can disable
|
option on. If you wish to also disable the loclist, you can disable
|
||||||
@@ -723,18 +401,15 @@ let g:ale_open_list = 1
|
|||||||
let g:ale_keep_list_window_open = 1
|
let g:ale_keep_list_window_open = 1
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also set `let g:ale_list_vertical = 1` to open the windows vertically
|
|
||||||
instead of the default horizontally.
|
|
||||||
|
|
||||||
<a name="faq-jsx-stylelint-eslint"></a>
|
<a name="faq-jsx-stylelint-eslint"></a>
|
||||||
|
|
||||||
### 5.xii. How can I check JSX files with both stylelint and eslint?
|
### 5.x. How can I check JSX files with both stylelint and eslint?
|
||||||
|
|
||||||
If you configure ALE options correctly in your vimrc file, and install
|
If you configure ALE options correctly in your vimrc file, and install
|
||||||
the right tools, you can check JSX files with stylelint and eslint.
|
the right tools, you can check JSX files with stylelint and eslint.
|
||||||
|
|
||||||
First, install eslint and install stylelint with
|
First, install eslint and install stylelint with
|
||||||
[stylelint-processor-styled-components](https://github.com/styled-components/stylelint-processor-styled-components).
|
[https://github.com/styled-components/stylelint-processor-styled-components](stylelint-processor-styled-components).
|
||||||
|
|
||||||
Supposing you have installed both tools correctly, configure your .jsx files so
|
Supposing you have installed both tools correctly, configure your .jsx files so
|
||||||
`jsx` is included in the filetype. You can use an `autocmd` for this.
|
`jsx` is included in the filetype. You can use an `autocmd` for this.
|
||||||
@@ -747,20 +422,11 @@ augroup END
|
|||||||
```
|
```
|
||||||
|
|
||||||
Supposing the filetype has been set correctly, you can set the following
|
Supposing the filetype has been set correctly, you can set the following
|
||||||
options in a jsx.vim ftplugin file.
|
options in your vimrc file:
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
" In ~/.vim/ftplugin/jsx.vim, or somewhere similar.
|
|
||||||
let b:ale_linter_aliases = ['css', 'javascript']
|
|
||||||
let b:ale_linters = ['stylelint', 'eslint']
|
|
||||||
```
|
|
||||||
|
|
||||||
Or if you want, you can configure the linters from your vimrc file.
|
|
||||||
|
|
||||||
```vim
|
|
||||||
" In ~/.vim/vimrc, or somewhere similar.
|
|
||||||
let g:ale_linter_aliases = {'jsx': ['css, 'javascript']}
|
|
||||||
let g:ale_linters = {'jsx': ['stylelint', 'eslint']}
|
let g:ale_linters = {'jsx': ['stylelint', 'eslint']}
|
||||||
|
let g:ale_linter_aliases = {'jsx': 'css'}
|
||||||
```
|
```
|
||||||
|
|
||||||
ALE will alias the `jsx` filetype so it uses the `css` filetype linters, and
|
ALE will alias the `jsx` filetype so it uses the `css` filetype linters, and
|
||||||
@@ -768,40 +434,9 @@ use the original Array of selected linters for `jsx` from the `g:ale_linters`
|
|||||||
object. All available linters will be used for the filetype `javascript`, and
|
object. All available linters will be used for the filetype `javascript`, and
|
||||||
no linter will be run twice for the same file.
|
no linter will be run twice for the same file.
|
||||||
|
|
||||||
<a name="faq-vue-eslint"></a>
|
|
||||||
|
|
||||||
### 5.xiii. How can I check Vue files with ESLint?
|
|
||||||
|
|
||||||
To check Vue files with ESLint, your ESLint project configuration file must be
|
|
||||||
configured to use the [Vue plugin](https://github.com/vuejs/eslint-plugin-vue).
|
|
||||||
After that, you need to configure ALE so it will run the JavaScript ESLint
|
|
||||||
linter on your files. The settings you need are similar to the settings needed
|
|
||||||
for checking JSX code with both stylelint and ESLint, in the previous section.
|
|
||||||
|
|
||||||
```vim
|
|
||||||
" In ~/.vim/ftplugin/vue.vim, or somewhere similar.
|
|
||||||
|
|
||||||
" Run both javascript and vue linters for vue files.
|
|
||||||
let b:ale_linter_aliases = ['javascript', 'vue']
|
|
||||||
" Select the eslint and vls linters.
|
|
||||||
let b:ale_linters = ['eslint', 'vls']
|
|
||||||
```
|
|
||||||
|
|
||||||
Run `:ALEInfo` to see which linters are available after telling ALE to run
|
|
||||||
JavaScript linters on Vue files. Not all linters support checking Vue files.
|
|
||||||
|
|
||||||
If you don't want to configure your linters in ftplugin files for some reason,
|
|
||||||
you can configure them from your vimrc file instead.
|
|
||||||
|
|
||||||
```vim
|
|
||||||
" In ~/.vim/vimrc, or somewhere similar.
|
|
||||||
let g:ale_linter_aliases = {'vue': ['vue', 'javascript']}
|
|
||||||
let g:ale_linters = {'vue': ['eslint', 'vls']}
|
|
||||||
```
|
|
||||||
|
|
||||||
<a name="faq-my-battery-is-sad"></a>
|
<a name="faq-my-battery-is-sad"></a>
|
||||||
|
|
||||||
### 5.xiv. Will this plugin eat all of my laptop battery power?
|
### 5.xi. Will this plugin eat all of my laptop battery power?
|
||||||
|
|
||||||
ALE takes advantage of the power of various tools to check your code. This of
|
ALE takes advantage of the power of various tools to check your code. This of
|
||||||
course means that CPU time will be used to continuously check your code. If you
|
course means that CPU time will be used to continuously check your code. If you
|
||||||
@@ -815,84 +450,12 @@ type, and this delay can be increased so linters are run less often. See
|
|||||||
`:help g:ale_lint_delay` for more information.
|
`:help g:ale_lint_delay` for more information.
|
||||||
|
|
||||||
If you don't wish to run linters while you type, you can disable that
|
If you don't wish to run linters while you type, you can disable that
|
||||||
behaviour. Set `g:ale_lint_on_text_changed` to `never` or `normal`. You won't
|
behaviour. Set `g:ale_lint_on_text_changed` to `0`, and consider setting
|
||||||
|
`g:ale_lint_on_save` to `1` to enable linting when you save files. You won't
|
||||||
get as frequent error checking, but ALE shouldn't block your ability to edit a
|
get as frequent error checking, but ALE shouldn't block your ability to edit a
|
||||||
document after you save a file, so the asynchronous nature of the plugin will
|
document after you save a file, so the asynchronous nature of the plugin will
|
||||||
still be an advantage.
|
still be an advantage.
|
||||||
|
|
||||||
If you are still concerned, you can turn the automatic linting off altogether,
|
If you are still concerned, you can turn the automatic linting off altogether,
|
||||||
including the option `g:ale_lint_on_enter`, and you can run ALE manually with
|
including the option `g:ale_lint_on_enter`, and you can run ALE manually with
|
||||||
`:ALELint`.
|
`:call ale#Lint()`.
|
||||||
|
|
||||||
<a name="faq-c-configuration"></a>
|
|
||||||
|
|
||||||
### 5.xv. How can I configure my C or C++ project?
|
|
||||||
|
|
||||||
The structure of C and C++ projects varies wildly from project to project, with
|
|
||||||
many different build tools being used for building them, and many different
|
|
||||||
formats for project configuration files. ALE can run compilers easily, but
|
|
||||||
ALE cannot easily detect which compiler flags to use.
|
|
||||||
|
|
||||||
Some tools and build configurations can generate
|
|
||||||
[compile_commands.json](https://clang.llvm.org/docs/JSONCompilationDatabase.html)
|
|
||||||
files. The `cppcheck`, `clangcheck`, `clangtidy` and `cquery` linters can read
|
|
||||||
these files for automatically determining the appropriate compiler flags to
|
|
||||||
use.
|
|
||||||
|
|
||||||
For linting with compilers like `gcc` and `clang`, and with other tools, you
|
|
||||||
will need to tell ALE which compiler flags to use yourself. You can use
|
|
||||||
different options for different projects with the `g:ale_pattern_options`
|
|
||||||
setting. Consult the documentation for that setting for more information.
|
|
||||||
`b:ale_linters` can be used to select which tools you want to run, say if you
|
|
||||||
want to use only `gcc` for one project, and only `clang` for another.
|
|
||||||
|
|
||||||
You may also configure buffer-local settings for linters with project-specific
|
|
||||||
vimrc files. [local_vimrc](https://github.com/LucHermitte/local_vimrc) can be
|
|
||||||
used for executing local vimrc files which can be shared in your project.
|
|
||||||
|
|
||||||
<a name="faq-buffer-configuration"></a>
|
|
||||||
|
|
||||||
### 5.xvi. How can I configure ALE differently for different buffers?
|
|
||||||
|
|
||||||
ALE offers various ways to configure which linters or fixers are run, and
|
|
||||||
other settings. For the majority of ALE's settings, they can either be
|
|
||||||
configured globally with a `g:` variable prefix, or for a specific buffer
|
|
||||||
with a `b:` variable prefix. For example, you can configure a Python ftplugin
|
|
||||||
file like so.
|
|
||||||
|
|
||||||
```vim
|
|
||||||
" In ~/.vim/ftplugin/python.vim
|
|
||||||
|
|
||||||
" Check Python files with flake8 and pylint.
|
|
||||||
let b:ale_linters = ['flake8', 'pylint']
|
|
||||||
" Fix Python files with autopep8 and yapf.
|
|
||||||
let b:ale_fixers = ['autopep8', 'yapf']
|
|
||||||
" Disable warnings about trailing whitespace for Python files.
|
|
||||||
let b:ale_warn_about_trailing_whitespace = 0
|
|
||||||
```
|
|
||||||
|
|
||||||
For configuring files based on regular expression patterns matched against the
|
|
||||||
absolute path to a file, you can use `g:ale_pattern_options`.
|
|
||||||
|
|
||||||
```vim
|
|
||||||
" Do not lint or fix minified files.
|
|
||||||
let g:ale_pattern_options = {
|
|
||||||
\ '\.min\.js$': {'ale_linters': [], 'ale_fixers': []},
|
|
||||||
\ '\.min\.css$': {'ale_linters': [], 'ale_fixers': []},
|
|
||||||
\}
|
|
||||||
" If you configure g:ale_pattern_options outside of vimrc, you need this.
|
|
||||||
let g:ale_pattern_options_enabled = 1
|
|
||||||
```
|
|
||||||
|
|
||||||
Buffer-local variables for settings always override the global settings.
|
|
||||||
|
|
||||||
<a name="faq-list-window-height"></a>
|
|
||||||
|
|
||||||
### 5.xvii. How can I configure the height of the list in which ALE displays errors?
|
|
||||||
|
|
||||||
To set a default height for the error list, use the `g:ale_list_window_size` variable.
|
|
||||||
|
|
||||||
```vim
|
|
||||||
" Show 5 lines of errors (default: 10)
|
|
||||||
let g:ale_list_window_size = 5
|
|
||||||
```
|
|
||||||
|
|||||||
37
after/plugin/ale.vim
Normal file
37
after/plugin/ale.vim
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
" Author: w0rp <devw0rp@gmail.com>
|
||||||
|
" Description: Follow-up checks for the plugin: warn about conflicting plugins.
|
||||||
|
|
||||||
|
" A flag for ensuring that this is not run more than one time.
|
||||||
|
if exists('g:loaded_ale_after')
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Set the flag so this file is not run more than one time.
|
||||||
|
let g:loaded_ale_after = 1
|
||||||
|
|
||||||
|
" Check if the flag is available and set to 0 to disable checking for and
|
||||||
|
" emitting conflicting plugin warnings.
|
||||||
|
if exists('g:ale_emit_conflict_warnings') && !g:ale_emit_conflict_warnings
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
" Conflicting Plugins Checks
|
||||||
|
|
||||||
|
function! s:GetConflictingPluginWarning(plugin_name) abort
|
||||||
|
return 'ALE conflicts with ' . a:plugin_name
|
||||||
|
\ . '. Uninstall it, or disable this warning with '
|
||||||
|
\ . '`let g:ale_emit_conflict_warnings = 0` in your vimrc file, '
|
||||||
|
\ . '*before* plugins are loaded.'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
if exists('g:loaded_syntastic_plugin')
|
||||||
|
throw s:GetConflictingPluginWarning('Syntastic')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists('g:loaded_neomake')
|
||||||
|
throw s:GetConflictingPluginWarning('Neomake')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if exists('g:loaded_validator_plugin')
|
||||||
|
throw s:GetConflictingPluginWarning('Validator')
|
||||||
|
endif
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
" Author: Martino Pilia <martino.pilia@gmail.com>
|
|
||||||
" Description: Lint Ada files with GCC
|
|
||||||
|
|
||||||
call ale#Set('ada_gcc_executable', 'gcc')
|
|
||||||
|
|
||||||
" -gnatwa: activate most optional warnings
|
|
||||||
" -gnatq: try semantic analysis even if syntax errors have been found
|
|
||||||
call ale#Set('ada_gcc_options', '-gnatwa -gnatq')
|
|
||||||
|
|
||||||
function! ale_linters#ada#gcc#GetCommand(buffer) abort
|
|
||||||
" Build a suitable output file name. The output file is specified because
|
|
||||||
" the .ali file may be created even if no code generation is attempted.
|
|
||||||
" The output file name must match the source file name (except for the
|
|
||||||
" extension), so here we cannot use the null file as output.
|
|
||||||
let l:tmp_dir = fnamemodify(ale#engine#CreateDirectory(a:buffer), ':p')
|
|
||||||
let l:out_file = l:tmp_dir . fnamemodify(bufname(a:buffer), ':t:r') . '.o'
|
|
||||||
|
|
||||||
" -gnatc: Check syntax and semantics only (no code generation attempted)
|
|
||||||
return '%e -x ada -c -gnatc'
|
|
||||||
\ . ' -o ' . ale#Escape(l:out_file)
|
|
||||||
\ . ' -I ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
|
||||||
\ . ale#Pad(ale#Var(a:buffer, 'ada_gcc_options'))
|
|
||||||
\ . ' %t'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" For the message format please refer to:
|
|
||||||
" https://gcc.gnu.org/onlinedocs/gnat_ugn/Output-and-Error-Message-Control.html
|
|
||||||
" https://gcc.gnu.org/onlinedocs/gnat_ugn/Warning-Message-Control.html
|
|
||||||
function! ale_linters#ada#gcc#Handle(buffer, lines) abort
|
|
||||||
" Error format: <filename>:<lnum>:<col>: <text>
|
|
||||||
" Warning format: <filename>:<lnum>:<col>: warning: <text>
|
|
||||||
let l:re = '\v(.+):([0-9]+):([0-9]+):\s+(warning:)?\s*(.+)\s*'
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:re)
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'bufnr': a:buffer,
|
|
||||||
\ 'lnum': str2nr(l:match[2]),
|
|
||||||
\ 'col': str2nr(l:match[3]),
|
|
||||||
\ 'type': l:match[4] is# 'warning:' ? 'W' : 'E',
|
|
||||||
\ 'text': l:match[5],
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('ada', {
|
|
||||||
\ 'name': 'gcc',
|
|
||||||
\ 'output_stream': 'stderr',
|
|
||||||
\ 'executable_callback': ale#VarFunc('ada_gcc_executable'),
|
|
||||||
\ 'command_callback': 'ale_linters#ada#gcc#GetCommand',
|
|
||||||
\ 'callback': 'ale_linters#ada#gcc#Handle',
|
|
||||||
\})
|
|
||||||
9
ale_linters/ansible/ansible-lint.vim
Normal file
9
ale_linters/ansible/ansible-lint.vim
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
" Author: Bjorn Neergaard <bjorn@neersighted.com>
|
||||||
|
" Description: ansible-lint for ansible-yaml files
|
||||||
|
|
||||||
|
call ale#linter#Define('ansible', {
|
||||||
|
\ 'name': 'ansible',
|
||||||
|
\ 'executable': 'ansible',
|
||||||
|
\ 'command': 'ansible-lint -p %t',
|
||||||
|
\ 'callback': 'ale#handlers#HandlePEP8Format',
|
||||||
|
\})
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
" Author: Bjorn Neergaard <bjorn@neersighted.com>
|
|
||||||
" Description: ansible-lint for ansible-yaml files
|
|
||||||
|
|
||||||
call ale#Set('ansible_ansible_lint_executable', 'ansible-lint')
|
|
||||||
|
|
||||||
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
|
|
||||||
for l:line in a:lines[:10]
|
|
||||||
if match(l:line, '^Traceback') >= 0
|
|
||||||
return [{
|
|
||||||
\ 'lnum': 1,
|
|
||||||
\ 'text': 'An exception was thrown. See :ALEDetail',
|
|
||||||
\ 'detail': join(a:lines, "\n"),
|
|
||||||
\}]
|
|
||||||
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:output = []
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('ansible', {
|
|
||||||
\ 'name': 'ansible_lint',
|
|
||||||
\ 'aliases': ['ansible', 'ansible-lint'],
|
|
||||||
\ 'executable_callback': 'ale_linters#ansible#ansible_lint#GetExecutable',
|
|
||||||
\ 'command': '%e -p %t',
|
|
||||||
\ 'callback': 'ale_linters#ansible#ansible_lint#Handle',
|
|
||||||
\})
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
" Author: nametake https://nametake.github.io
|
|
||||||
" Description: apiblueprint parser
|
|
||||||
|
|
||||||
function! ale_linters#apiblueprint#drafter#HandleErrors(buffer, lines) abort
|
|
||||||
" Matches patterns line the following:
|
|
||||||
"
|
|
||||||
" warning: (3) unable to parse response signature, expected 'response [<HTTP status code>] [(<media type>)]'; line 4, column 3k - line 4, column 22
|
|
||||||
" warning: (10) message-body asset is expected to be a pre-formatted code block, separate it by a newline and indent every of its line by 12 spaces or 3 tabs; line 30, column 5 - line 30, column 9; line 31, column 9 - line 31, column 14; line 32, column 9 - line 32, column 14
|
|
||||||
let l:pattern = '\(^.*\): (\d\+) \(.\{-\}\); line \(\d\+\), column \(\d\+\) - line \d\+, column \d\+\(.*; line \d\+, column \d\+ - line \(\d\+\), column \(\d\+\)\)\{-\}$'
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines[2:], l:pattern)
|
|
||||||
let l:item = {
|
|
||||||
\ 'type': l:match[1] is# 'warning' ? 'W' : 'E',
|
|
||||||
\ 'text': l:match[2],
|
|
||||||
\ 'lnum': l:match[3] + 0,
|
|
||||||
\ 'col': l:match[4] + 0,
|
|
||||||
\}
|
|
||||||
|
|
||||||
if l:match[5] isnot# ''
|
|
||||||
let l:item.end_lnum = l:match[6] + 0
|
|
||||||
let l:item.end_col = l:match[7] + 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
call add(l:output, l:item)
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
|
|
||||||
call ale#linter#Define('apiblueprint', {
|
|
||||||
\ 'name': 'drafter',
|
|
||||||
\ 'output_stream': 'stderr',
|
|
||||||
\ 'executable': 'drafter',
|
|
||||||
\ 'command': 'drafter --use-line-num --validate',
|
|
||||||
\ 'callback': 'ale_linters#apiblueprint#drafter#HandleErrors',
|
|
||||||
\})
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
" Author: Johannes Wienke <languitar@semipol.de>
|
|
||||||
" Description: alex for asciidoc files
|
|
||||||
|
|
||||||
call ale#linter#Define('help', {
|
|
||||||
\ 'name': 'alex',
|
|
||||||
\ 'executable': 'alex',
|
|
||||||
\ 'command': 'alex %s -t',
|
|
||||||
\ 'output_stream': 'stderr',
|
|
||||||
\ 'callback': 'ale#handlers#alex#Handle',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
|
||||||
@@ -5,5 +5,5 @@ call ale#linter#Define('asciidoc', {
|
|||||||
\ 'name': 'proselint',
|
\ 'name': 'proselint',
|
||||||
\ 'executable': 'proselint',
|
\ 'executable': 'proselint',
|
||||||
\ 'command': 'proselint %t',
|
\ 'command': 'proselint %t',
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
\ 'callback': 'ale#handlers#HandleUnixFormatAsWarning',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
" Author: rhysd https://rhysd.github.io
|
|
||||||
" Description: Redpen, a proofreading tool (http://redpen.cc)
|
|
||||||
|
|
||||||
call ale#linter#Define('asciidoc', {
|
|
||||||
\ 'name': 'redpen',
|
|
||||||
\ 'executable': 'redpen',
|
|
||||||
\ 'command': 'redpen -f asciidoc -r json %t',
|
|
||||||
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
|
|
||||||
\})
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
" Author: Jeff Kreeftmeijer https://github.com/jeffkreeftmeijer
|
|
||||||
" Description: vale for AsciiDoc files
|
|
||||||
|
|
||||||
call ale#linter#Define('asciidoc', {
|
|
||||||
\ 'name': 'vale',
|
|
||||||
\ 'executable': 'vale',
|
|
||||||
\ 'command': 'vale --output=line %t',
|
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
|
||||||
\})
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
|
||||||
" Description: write-good for AsciiDoc files
|
|
||||||
|
|
||||||
call ale#handlers#writegood#DefineLinter('asciidoc')
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
" Author: Lucas Kolstad <lkolstad@uw.edu>
|
|
||||||
" Description: gcc linter for asm files
|
|
||||||
|
|
||||||
call ale#Set('asm_gcc_executable', 'gcc')
|
|
||||||
call ale#Set('asm_gcc_options', '-Wall')
|
|
||||||
|
|
||||||
function! ale_linters#asm#gcc#GetCommand(buffer) abort
|
|
||||||
return '%e -x assembler -fsyntax-only '
|
|
||||||
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
|
||||||
\ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#asm#gcc#Handle(buffer, lines) abort
|
|
||||||
let l:pattern = '^.\+:\(\d\+\): \([^:]\+\): \(.\+\)$'
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'lnum': l:match[1] + 0,
|
|
||||||
\ 'type': l:match[2] =~? 'error' ? 'E' : 'W',
|
|
||||||
\ 'text': l:match[3],
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('asm', {
|
|
||||||
\ 'name': 'gcc',
|
|
||||||
\ 'output_stream': 'stderr',
|
|
||||||
\ 'executable_callback': ale#VarFunc('asm_gcc_executable'),
|
|
||||||
\ 'command_callback': 'ale_linters#asm#gcc#GetCommand',
|
|
||||||
\ 'callback': 'ale_linters#asm#gcc#Handle',
|
|
||||||
\})
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
" Author: kmarc <korondi.mark@gmail.com>
|
|
||||||
" Description: This file adds support for using GNU awk with sripts.
|
|
||||||
|
|
||||||
call ale#Set('awk_gawk_executable', 'gawk')
|
|
||||||
call ale#Set('awk_gawk_options', '')
|
|
||||||
|
|
||||||
function! ale_linters#awk#gawk#GetCommand(buffer) abort
|
|
||||||
" note the --source 'BEGIN ...' is to prevent
|
|
||||||
" gawk from attempting to execute the body of the script
|
|
||||||
" it is linting.
|
|
||||||
return '%e --source ' . ale#Escape('BEGIN { exit } END { exit 1 }')
|
|
||||||
\ . ale#Pad(ale#Var(a:buffer, 'awk_gawk_options'))
|
|
||||||
\ . ' -f %t --lint /dev/null'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('awk', {
|
|
||||||
\ 'name': 'gawk',
|
|
||||||
\ 'executable_callback': ale#VarFunc('awk_gawk_executable'),
|
|
||||||
\ 'command_callback': 'ale_linters#awk#gawk#GetCommand',
|
|
||||||
\ 'callback': 'ale#handlers#gawk#HandleGawkFormat',
|
|
||||||
\ 'output_stream': 'both'
|
|
||||||
\})
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
" Author: Ye Jingchen <ye.jingchen@gmail.com>, Ben Falconer <ben@falconers.me.uk>, jtalowell <jtalowell@protonmail.com>
|
|
||||||
" Description: A language server for C
|
|
||||||
|
|
||||||
call ale#Set('c_ccls_executable', 'ccls')
|
|
||||||
call ale#Set('c_ccls_init_options', {})
|
|
||||||
|
|
||||||
call ale#linter#Define('c', {
|
|
||||||
\ 'name': 'ccls',
|
|
||||||
\ 'lsp': 'stdio',
|
|
||||||
\ 'executable_callback': ale#VarFunc('c_ccls_executable'),
|
|
||||||
\ 'command': '%e',
|
|
||||||
\ 'project_root_callback': 'ale#handlers#ccls#GetProjectRoot',
|
|
||||||
\ 'initialization_options_callback':ale#VarFunc('c_ccls_init_options'),
|
|
||||||
\})
|
|
||||||
@@ -1,27 +1,26 @@
|
|||||||
" Author: Masahiro H https://github.com/mshr-h
|
" Author: Masahiro H https://github.com/mshr-h
|
||||||
" Description: clang linter for c files
|
" Description: clang linter for c files
|
||||||
|
|
||||||
call ale#Set('c_clang_executable', 'clang')
|
" Set this option to change the Clang options for warnings for C.
|
||||||
call ale#Set('c_clang_options', '-std=c11 -Wall')
|
if !exists('g:ale_c_clang_options')
|
||||||
|
" let g:ale_c_clang_options = '-Wall'
|
||||||
function! ale_linters#c#clang#GetCommand(buffer, output) abort
|
" let g:ale_c_clang_options = '-std=c99 -Wall'
|
||||||
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
" c11 compatible
|
||||||
|
let g:ale_c_clang_options = '-std=c11 -Wall'
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! ale_linters#c#clang#GetCommand(buffer) abort
|
||||||
" -iquote with the directory the file is in makes #include work for
|
" -iquote with the directory the file is in makes #include work for
|
||||||
" headers in the same directory.
|
" headers in the same directory.
|
||||||
return '%e -S -x c -fsyntax-only'
|
return 'clang -S -x c -fsyntax-only '
|
||||||
\ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
\ . '-iquote ' . fnameescape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||||
\ . ale#Pad(l:cflags)
|
\ . ' ' . g:ale_c_clang_options . ' -'
|
||||||
\ . ale#Pad(ale#Var(a:buffer, 'c_clang_options')) . ' -'
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('c', {
|
call ale#linter#Define('c', {
|
||||||
\ 'name': 'clang',
|
\ 'name': 'clang',
|
||||||
\ 'output_stream': 'stderr',
|
\ 'output_stream': 'stderr',
|
||||||
\ 'executable_callback': ale#VarFunc('c_clang_executable'),
|
\ 'executable': 'clang',
|
||||||
\ 'command_chain': [
|
\ 'command_callback': 'ale_linters#c#clang#GetCommand',
|
||||||
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
|
\ 'callback': 'ale#handlers#HandleGCCFormat',
|
||||||
\ {'callback': 'ale_linters#c#clang#GetCommand'}
|
|
||||||
\ ],
|
|
||||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
|
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
" Author: Andrey Melentyev <andrey.melentyev@protonmail.com>
|
|
||||||
" Description: Clangd language server
|
|
||||||
|
|
||||||
call ale#Set('c_clangd_executable', 'clangd')
|
|
||||||
call ale#Set('c_clangd_options', '')
|
|
||||||
|
|
||||||
function! ale_linters#c#clangd#GetProjectRoot(buffer) abort
|
|
||||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
|
||||||
|
|
||||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#c#clangd#GetCommand(buffer) abort
|
|
||||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'c_clangd_options'))
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('c', {
|
|
||||||
\ 'name': 'clangd',
|
|
||||||
\ 'lsp': 'stdio',
|
|
||||||
\ 'executable_callback': ale#VarFunc('c_clangd_executable'),
|
|
||||||
\ 'command_callback': 'ale_linters#c#clangd#GetCommand',
|
|
||||||
\ 'project_root_callback': 'ale_linters#c#clangd#GetProjectRoot',
|
|
||||||
\})
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
" Author: vdeurzen <tim@kompiler.org>, w0rp <devw0rp@gmail.com>,
|
|
||||||
" gagbo <gagbobada@gmail.com>, Andrej Radovic <r.andrej@gmail.com>
|
|
||||||
" Description: clang-tidy linter for c files
|
|
||||||
|
|
||||||
call ale#Set('c_clangtidy_executable', 'clang-tidy')
|
|
||||||
" Set this option to check the checks clang-tidy will apply.
|
|
||||||
" The number of checks that can be applied to C files is limited in contrast to
|
|
||||||
" C++
|
|
||||||
"
|
|
||||||
" Consult the check list in clang-tidy's documentation:
|
|
||||||
" http://clang.llvm.org/extra/clang-tidy/checks/list.html
|
|
||||||
|
|
||||||
call ale#Set('c_clangtidy_checks', [])
|
|
||||||
" Set this option to manually set some options for clang-tidy.
|
|
||||||
" This will disable compile_commands.json detection.
|
|
||||||
call ale#Set('c_clangtidy_options', '')
|
|
||||||
call ale#Set('c_build_dir', '')
|
|
||||||
|
|
||||||
function! ale_linters#c#clangtidy#GetCommand(buffer) abort
|
|
||||||
let l:checks = join(ale#Var(a:buffer, 'c_clangtidy_checks'), ',')
|
|
||||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
|
||||||
|
|
||||||
" Get the extra options if we couldn't find a build directory.
|
|
||||||
let l:options = empty(l:build_dir)
|
|
||||||
\ ? ale#Var(a:buffer, 'c_clangtidy_options')
|
|
||||||
\ : ''
|
|
||||||
|
|
||||||
return '%e'
|
|
||||||
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
|
|
||||||
\ . ' %s'
|
|
||||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
|
||||||
\ . (!empty(l:options) ? ' -- ' . l:options : '')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('c', {
|
|
||||||
\ 'name': 'clangtidy',
|
|
||||||
\ 'output_stream': 'stdout',
|
|
||||||
\ 'executable_callback': ale#VarFunc('c_clangtidy_executable'),
|
|
||||||
\ 'command_callback': 'ale_linters#c#clangtidy#GetCommand',
|
|
||||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
|
||||||
@@ -1,34 +1,15 @@
|
|||||||
" Author: Bart Libert <bart.libert@gmail.com>
|
" Author: Bart Libert <bart.libert@gmail.com>
|
||||||
" Description: cppcheck linter for c files
|
" Description: cppcheck linter for c files
|
||||||
|
|
||||||
call ale#Set('c_cppcheck_executable', 'cppcheck')
|
" Set this option to change the cppcheck options
|
||||||
call ale#Set('c_cppcheck_options', '--enable=style')
|
let g:ale_c_cppcheck_options = get(g:, 'ale_c_cppcheck_options', '--enable=style')
|
||||||
|
|
||||||
function! ale_linters#c#cppcheck#GetCommand(buffer) abort
|
|
||||||
" Search upwards from the file for compile_commands.json.
|
|
||||||
"
|
|
||||||
" If we find it, we'll `cd` to where the compile_commands.json file is,
|
|
||||||
" then use the file to set up import paths, etc.
|
|
||||||
let l:compile_commmands_path = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
|
||||||
|
|
||||||
let l:cd_command = !empty(l:compile_commmands_path)
|
|
||||||
\ ? ale#path#CdString(fnamemodify(l:compile_commmands_path, ':h'))
|
|
||||||
\ : ''
|
|
||||||
let l:compile_commands_option = !empty(l:compile_commmands_path)
|
|
||||||
\ ? '--project=compile_commands.json '
|
|
||||||
\ : ''
|
|
||||||
|
|
||||||
return l:cd_command
|
|
||||||
\ . '%e -q --language=c '
|
|
||||||
\ . l:compile_commands_option
|
|
||||||
\ . ale#Var(a:buffer, 'c_cppcheck_options')
|
|
||||||
\ . ' %t'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('c', {
|
call ale#linter#Define('c', {
|
||||||
\ 'name': 'cppcheck',
|
\ 'name': 'cppcheck',
|
||||||
\ 'output_stream': 'both',
|
\ 'output_stream': 'both',
|
||||||
\ 'executable_callback': ale#VarFunc('c_cppcheck_executable'),
|
\ 'executable': 'cppcheck',
|
||||||
\ 'command_callback': 'ale_linters#c#cppcheck#GetCommand',
|
\ 'command': 'cppcheck -q --language=c '
|
||||||
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
|
\ . g:ale_c_cppcheck_options
|
||||||
|
\ . ' %t',
|
||||||
|
\ 'callback': 'ale#handlers#HandleCppCheckFormat',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
" Author: Ben Falconer <ben@falconers.me.uk>, jtalowell <jtalowell@protonmail.com>
|
|
||||||
" Description: A language server for C
|
|
||||||
|
|
||||||
call ale#Set('c_cquery_executable', 'cquery')
|
|
||||||
call ale#Set('c_cquery_cache_directory', expand('~/.cache/cquery'))
|
|
||||||
|
|
||||||
function! ale_linters#c#cquery#GetProjectRoot(buffer) abort
|
|
||||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
|
||||||
|
|
||||||
if empty(l:project_root)
|
|
||||||
let l:project_root = ale#path#FindNearestFile(a:buffer, '.cquery')
|
|
||||||
endif
|
|
||||||
|
|
||||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#c#cquery#GetInitializationOptions(buffer) abort
|
|
||||||
return {'cacheDirectory': ale#Var(a:buffer, 'c_cquery_cache_directory')}
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('c', {
|
|
||||||
\ 'name': 'cquery',
|
|
||||||
\ 'lsp': 'stdio',
|
|
||||||
\ 'executable_callback': ale#VarFunc('c_cquery_executable'),
|
|
||||||
\ 'command': '%e',
|
|
||||||
\ 'project_root_callback': 'ale_linters#c#cquery#GetProjectRoot',
|
|
||||||
\ 'initialization_options_callback': 'ale_linters#c#cquery#GetInitializationOptions',
|
|
||||||
\})
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
" Author: Christian Gibbons <cgibbons@gmu.edu>
|
|
||||||
" Description: flawfinder linter for c files
|
|
||||||
|
|
||||||
call ale#Set('c_flawfinder_executable', 'flawfinder')
|
|
||||||
call ale#Set('c_flawfinder_options', '')
|
|
||||||
call ale#Set('c_flawfinder_minlevel', 1)
|
|
||||||
call ale#Set('c_flawfinder_error_severity', 6)
|
|
||||||
|
|
||||||
function! ale_linters#c#flawfinder#GetCommand(buffer) abort
|
|
||||||
" Set the minimum vulnerability level for flawfinder to bother with
|
|
||||||
let l:minlevel = ' --minlevel=' . ale#Var(a:buffer, 'c_flawfinder_minlevel')
|
|
||||||
|
|
||||||
return '%e -CDQS'
|
|
||||||
\ . ale#Pad(ale#Var(a:buffer, 'c_flawfinder_options'))
|
|
||||||
\ . l:minlevel
|
|
||||||
\ . ' %t'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('c', {
|
|
||||||
\ 'name': 'flawfinder',
|
|
||||||
\ 'output_stream': 'stdout',
|
|
||||||
\ 'executable_callback': ale#VarFunc('c_flawfinder_executable'),
|
|
||||||
\ 'command_callback': 'ale_linters#c#flawfinder#GetCommand',
|
|
||||||
\ 'callback': 'ale#handlers#flawfinder#HandleFlawfinderFormat',
|
|
||||||
\})
|
|
||||||
@@ -1,27 +1,26 @@
|
|||||||
" Author: w0rp <devw0rp@gmail.com>
|
" Author: w0rp <devw0rp@gmail.com>
|
||||||
" Description: gcc linter for c files
|
" Description: gcc linter for c files
|
||||||
|
|
||||||
call ale#Set('c_gcc_executable', 'gcc')
|
" Set this option to change the GCC options for warnings for C.
|
||||||
call ale#Set('c_gcc_options', '-std=c11 -Wall')
|
if !exists('g:ale_c_gcc_options')
|
||||||
|
" let g:ale_c_gcc_options = '-Wall'
|
||||||
function! ale_linters#c#gcc#GetCommand(buffer, output) abort
|
" let g:ale_c_gcc_options = '-std=c99 -Wall'
|
||||||
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
" c11 compatible
|
||||||
|
let g:ale_c_gcc_options = '-std=c11 -Wall'
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! ale_linters#c#gcc#GetCommand(buffer) abort
|
||||||
" -iquote with the directory the file is in makes #include work for
|
" -iquote with the directory the file is in makes #include work for
|
||||||
" headers in the same directory.
|
" headers in the same directory.
|
||||||
return '%e -S -x c -fsyntax-only'
|
return 'gcc -S -x c -fsyntax-only '
|
||||||
\ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
\ . '-iquote ' . fnameescape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||||
\ . ale#Pad(l:cflags)
|
\ . ' ' . g:ale_c_gcc_options . ' -'
|
||||||
\ . ale#Pad(ale#Var(a:buffer, 'c_gcc_options')) . ' -'
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('c', {
|
call ale#linter#Define('c', {
|
||||||
\ 'name': 'gcc',
|
\ 'name': 'gcc',
|
||||||
\ 'output_stream': 'stderr',
|
\ 'output_stream': 'stderr',
|
||||||
\ 'executable_callback': ale#VarFunc('c_gcc_executable'),
|
\ 'executable': 'gcc',
|
||||||
\ 'command_chain': [
|
\ 'command_callback': 'ale_linters#c#gcc#GetCommand',
|
||||||
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
|
\ 'callback': 'ale#handlers#HandleGCCFormat',
|
||||||
\ {'callback': 'ale_linters#c#gcc#GetCommand'}
|
|
||||||
\ ],
|
|
||||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
|
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,30 +1,27 @@
|
|||||||
" Author: Edward Larkey <edwlarkey@mac.com>
|
" Author: Edward Larkey <edwlarkey@mac.com>
|
||||||
" Author: Jose Junior <jose.junior@gmail.com>
|
|
||||||
" Author: w0rp <devw0rp@gmail.com>
|
|
||||||
" Description: This file adds the foodcritic linter for Chef files.
|
" Description: This file adds the foodcritic linter for Chef files.
|
||||||
|
|
||||||
call ale#Set('chef_foodcritic_executable', 'foodcritic')
|
|
||||||
call ale#Set('chef_foodcritic_options', '')
|
|
||||||
|
|
||||||
function! ale_linters#chef#foodcritic#GetCommand(buffer) abort
|
|
||||||
let l:options = ale#Var(a:buffer, 'chef_foodcritic_options')
|
|
||||||
|
|
||||||
return '%e' . ale#Pad(escape(l:options, '~')) . ' %s'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#chef#foodcritic#Handle(buffer, lines) abort
|
function! ale_linters#chef#foodcritic#Handle(buffer, lines) abort
|
||||||
" Matches patterns line the following:
|
" Matches patterns line the following:
|
||||||
"
|
"
|
||||||
" FC002: Avoid string interpolation where not required: httpd.rb:13
|
" FC002: Avoid string interpolation where not required: httpd.rb:13
|
||||||
let l:pattern = '\v([^:]+): (.+): ([a-zA-Z]?:?[^:]+):(\d+)$'
|
let l:pattern = '^\(.\+:\s.\+\):\s\(.\+\):\(\d\+\)$'
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:line in a:lines
|
||||||
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
|
if len(l:match) == 0
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:text = l:match[1]
|
||||||
|
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'code': l:match[1],
|
\ 'bufnr': a:buffer,
|
||||||
\ 'text': l:match[2],
|
\ 'lnum': l:match[3] + 0,
|
||||||
\ 'filename': l:match[3],
|
\ 'col': 0,
|
||||||
\ 'lnum': l:match[4] + 0,
|
\ 'text': l:text,
|
||||||
\ 'type': 'W',
|
\ 'type': 'W',
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
@@ -34,8 +31,8 @@ endfunction
|
|||||||
|
|
||||||
call ale#linter#Define('chef', {
|
call ale#linter#Define('chef', {
|
||||||
\ 'name': 'foodcritic',
|
\ 'name': 'foodcritic',
|
||||||
\ 'executable_callback': ale#VarFunc('chef_foodcritic_executable'),
|
\ 'executable': 'foodcritic',
|
||||||
\ 'command_callback': 'ale_linters#chef#foodcritic#GetCommand',
|
\ 'command': 'foodcritic %t',
|
||||||
\ 'callback': 'ale_linters#chef#foodcritic#Handle',
|
\ 'callback': 'ale_linters#chef#foodcritic#Handle',
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
\})
|
||||||
|
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
" Author: Nic West <nicwest@mailbox.org>
|
|
||||||
" Description: linter for clojure using joker https://github.com/candid82/joker
|
|
||||||
|
|
||||||
function! ale_linters#clojure#joker#HandleJokerFormat(buffer, lines) abort
|
|
||||||
" output format
|
|
||||||
" <filename>:<line>:<column>: <issue type>: <message>
|
|
||||||
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+):? ((Read error|Parse error|Parse warning|Exception): ?(.+))$'
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
||||||
let l:type = 'E'
|
|
||||||
|
|
||||||
if l:match[4] is? 'Parse warning'
|
|
||||||
let l:type = 'W'
|
|
||||||
endif
|
|
||||||
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'lnum': l:match[1] + 0,
|
|
||||||
\ 'col': l:match[2] + 0,
|
|
||||||
\ 'text': l:match[3],
|
|
||||||
\ 'type': l:type,
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('clojure', {
|
|
||||||
\ 'name': 'joker',
|
|
||||||
\ 'output_stream': 'stderr',
|
|
||||||
\ 'executable': 'joker',
|
|
||||||
\ 'command': 'joker --working-dir %s --lint %t',
|
|
||||||
\ 'callback': 'ale_linters#clojure#joker#HandleJokerFormat',
|
|
||||||
\})
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
" Author: Yasuhiro Kiyota <yasuhiroki.duck@gmail.com>
|
|
||||||
" Description: Support cfn-python-lint for AWS Cloudformation template file
|
|
||||||
|
|
||||||
function! ale_linters#cloudformation#cfn_python_lint#Handle(buffer, lines) abort
|
|
||||||
" Matches patterns line the following:
|
|
||||||
"
|
|
||||||
" sample.template.yaml:96:7:96:15:E3012:Property Resources/Sample/Properties/FromPort should be of type Integer
|
|
||||||
let l:pattern = '\v^(.*):(\d+):(\d+):(\d+):(\d+):([[:alnum:]]+):(.*)$'
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
||||||
let l:code = l:match[6]
|
|
||||||
|
|
||||||
if ale#path#IsBufferPath(a:buffer, l:match[1])
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'lnum': l:match[2],
|
|
||||||
\ 'col': l:match[3],
|
|
||||||
\ 'end_lnum': l:match[4],
|
|
||||||
\ 'end_col': l:match[5],
|
|
||||||
\ 'code': l:code,
|
|
||||||
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
|
|
||||||
\ 'text': l:match[7]
|
|
||||||
\})
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('cloudformation', {
|
|
||||||
\ 'name': 'cloudformation',
|
|
||||||
\ 'executable': 'cfn-lint',
|
|
||||||
\ 'command': 'cfn-lint --template %t --format parseable',
|
|
||||||
\ 'callback': 'ale_linters#cloudformation#cfn_python_lint#Handle',
|
|
||||||
\})
|
|
||||||
@@ -8,17 +8,17 @@ let g:ale_cmake_cmakelint_options =
|
|||||||
\ get(g:, 'ale_cmake_cmakelint_options', '')
|
\ get(g:, 'ale_cmake_cmakelint_options', '')
|
||||||
|
|
||||||
function! ale_linters#cmake#cmakelint#Executable(buffer) abort
|
function! ale_linters#cmake#cmakelint#Executable(buffer) abort
|
||||||
return ale#Var(a:buffer, 'cmake_cmakelint_executable')
|
return g:ale_cmake_cmakelint_executable
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#cmake#cmakelint#Command(buffer) abort
|
function! ale_linters#cmake#cmakelint#Command(buffer) abort
|
||||||
return ale_linters#cmake#cmakelint#Executable(a:buffer)
|
return ale_linters#cmake#cmakelint#Executable(a:buffer)
|
||||||
\ . ' ' . ale#Var(a:buffer, 'cmake_cmakelint_options') . ' %t'
|
\ . ' ' . g:ale_cmake_cmakelint_options . ' %t'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('cmake', {
|
call ale#linter#Define('cmake', {
|
||||||
\ 'name': 'cmakelint',
|
\ 'name': 'cmakelint',
|
||||||
\ 'executable_callback': 'ale_linters#cmake#cmakelint#Executable',
|
\ 'executable_callback': 'ale_linters#cmake#cmakelint#Executable',
|
||||||
\ 'command_callback': 'ale_linters#cmake#cmakelint#Command',
|
\ 'command_callback': 'ale_linters#cmake#cmakelint#Command',
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
\ 'callback': 'ale#handlers#HandleUnixFormatAsWarning',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
" Description: Coffee for checking coffee files
|
" Description: Coffee for checking coffee files
|
||||||
|
|
||||||
function! ale_linters#coffee#coffee#GetExecutable(buffer) abort
|
function! ale_linters#coffee#coffee#GetExecutable(buffer) abort
|
||||||
return ale#path#ResolveLocalPath(
|
return ale#util#ResolveLocalPath(
|
||||||
\ a:buffer,
|
\ a:buffer,
|
||||||
\ 'node_modules/.bin/coffee',
|
\ 'node_modules/.bin/coffee',
|
||||||
\ 'coffee'
|
\ 'coffee'
|
||||||
@@ -19,5 +19,5 @@ call ale#linter#Define('coffee', {
|
|||||||
\ 'executable_callback': 'ale_linters#coffee#coffee#GetExecutable',
|
\ 'executable_callback': 'ale_linters#coffee#coffee#GetExecutable',
|
||||||
\ 'command_callback': 'ale_linters#coffee#coffee#GetCommand',
|
\ 'command_callback': 'ale_linters#coffee#coffee#GetCommand',
|
||||||
\ 'output_stream': 'stderr',
|
\ 'output_stream': 'stderr',
|
||||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
\ 'callback': 'ale#handlers#HandleGCCFormat',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
" Description: coffeelint linter for coffeescript files
|
" Description: coffeelint linter for coffeescript files
|
||||||
|
|
||||||
function! ale_linters#coffee#coffeelint#GetExecutable(buffer) abort
|
function! ale_linters#coffee#coffeelint#GetExecutable(buffer) abort
|
||||||
return ale#path#ResolveLocalPath(
|
return ale#util#ResolveLocalPath(
|
||||||
\ a:buffer,
|
\ a:buffer,
|
||||||
\ 'node_modules/.bin/coffeelint',
|
\ 'node_modules/.bin/coffeelint',
|
||||||
\ 'coffeelint'
|
\ 'coffeelint'
|
||||||
@@ -24,11 +24,22 @@ function! ale_linters#coffee#coffeelint#Handle(buffer, lines) abort
|
|||||||
let l:pattern = 'stdin,\(\d\+\),\(\d*\),\(.\{-1,}\),\(.\+\)'
|
let l:pattern = 'stdin,\(\d\+\),\(\d*\),\(.\{-1,}\),\(.\+\)'
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:line in a:lines
|
||||||
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
|
if len(l:match) == 0
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:line = l:match[1] + 0
|
||||||
|
let l:type = l:match[3] ==# 'error' ? 'E' : 'W'
|
||||||
|
let l:text = l:match[4]
|
||||||
|
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': str2nr(l:match[1]),
|
\ 'bufnr': a:buffer,
|
||||||
\ 'type': l:match[3] is# 'error' ? 'E' : 'W',
|
\ 'lnum': l:line,
|
||||||
\ 'text': l:match[4],
|
\ 'text': l:text,
|
||||||
|
\ 'type': l:type,
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
" Author: Ye Jingchen <ye.jingchen@gmail.com>, Ben Falconer <ben@falconers.me.uk>, jtalowell <jtalowell@protonmail.com>
|
|
||||||
" Description: A language server for C++
|
|
||||||
|
|
||||||
call ale#Set('cpp_ccls_executable', 'ccls')
|
|
||||||
call ale#Set('cpp_ccls_init_options', {})
|
|
||||||
|
|
||||||
call ale#linter#Define('cpp', {
|
|
||||||
\ 'name': 'ccls',
|
|
||||||
\ 'lsp': 'stdio',
|
|
||||||
\ 'executable_callback': ale#VarFunc('cpp_ccls_executable'),
|
|
||||||
\ 'command': '%e',
|
|
||||||
\ 'project_root_callback': 'ale#handlers#ccls#GetProjectRoot',
|
|
||||||
\ 'initialization_options_callback': ale#VarFunc('cpp_ccls_init_options'),
|
|
||||||
\})
|
|
||||||
@@ -1,27 +1,23 @@
|
|||||||
" Author: Tomota Nakamura <https://github.com/tomotanakamura>
|
" Author: Tomota Nakamura <https://github.com/tomotanakamura>
|
||||||
" Description: clang linter for cpp files
|
" Description: clang linter for cpp files
|
||||||
|
|
||||||
call ale#Set('cpp_clang_executable', 'clang++')
|
" Set this option to change the Clang options for warnings for CPP.
|
||||||
call ale#Set('cpp_clang_options', '-std=c++14 -Wall')
|
if !exists('g:ale_cpp_clang_options')
|
||||||
|
let g:ale_cpp_clang_options = '-std=c++14 -Wall'
|
||||||
function! ale_linters#cpp#clang#GetCommand(buffer, output) abort
|
endif
|
||||||
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
|
||||||
|
|
||||||
|
function! ale_linters#cpp#clang#GetCommand(buffer) abort
|
||||||
" -iquote with the directory the file is in makes #include work for
|
" -iquote with the directory the file is in makes #include work for
|
||||||
" headers in the same directory.
|
" headers in the same directory.
|
||||||
return '%e -S -x c++ -fsyntax-only'
|
return 'clang++ -S -x c++ -fsyntax-only '
|
||||||
\ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
\ . '-iquote ' . fnameescape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||||
\ . ale#Pad(l:cflags)
|
\ . ' ' . g:ale_cpp_clang_options . ' -'
|
||||||
\ . ale#Pad(ale#Var(a:buffer, 'cpp_clang_options')) . ' -'
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('cpp', {
|
call ale#linter#Define('cpp', {
|
||||||
\ 'name': 'clang',
|
\ 'name': 'clang',
|
||||||
\ 'output_stream': 'stderr',
|
\ 'output_stream': 'stderr',
|
||||||
\ 'executable_callback': ale#VarFunc('cpp_clang_executable'),
|
\ 'executable': 'clang++',
|
||||||
\ 'command_chain': [
|
\ 'command_callback': 'ale_linters#cpp#clang#GetCommand',
|
||||||
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
|
\ 'callback': 'ale#handlers#HandleGCCFormat',
|
||||||
\ {'callback': 'ale_linters#cpp#clang#GetCommand'},
|
|
||||||
\ ],
|
|
||||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
|
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
" Author: gagbo <gagbobada@gmail.com>
|
|
||||||
" Description: clang-check linter for cpp files
|
|
||||||
|
|
||||||
call ale#Set('cpp_clangcheck_executable', 'clang-check')
|
|
||||||
call ale#Set('cpp_clangcheck_options', '')
|
|
||||||
call ale#Set('c_build_dir', '')
|
|
||||||
|
|
||||||
function! ale_linters#cpp#clangcheck#GetCommand(buffer) abort
|
|
||||||
let l:user_options = ale#Var(a:buffer, 'cpp_clangcheck_options')
|
|
||||||
|
|
||||||
" Try to find compilation database to link automatically
|
|
||||||
let l:build_dir = ale#Var(a:buffer, 'c_build_dir')
|
|
||||||
|
|
||||||
if empty(l:build_dir)
|
|
||||||
let l:build_dir = ale#path#Dirname(ale#c#FindCompileCommands(a:buffer))
|
|
||||||
endif
|
|
||||||
|
|
||||||
" The extra arguments in the command are used to prevent .plist files from
|
|
||||||
" being generated. These are only added if no build directory can be
|
|
||||||
" detected.
|
|
||||||
return '%e -analyze %s'
|
|
||||||
\ . (empty(l:build_dir) ? ' -extra-arg -Xclang -extra-arg -analyzer-output=text' : '')
|
|
||||||
\ . ale#Pad(l:user_options)
|
|
||||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('cpp', {
|
|
||||||
\ 'name': 'clangcheck',
|
|
||||||
\ 'output_stream': 'stderr',
|
|
||||||
\ 'executable_callback': ale#VarFunc('cpp_clangcheck_executable'),
|
|
||||||
\ 'command_callback': 'ale_linters#cpp#clangcheck#GetCommand',
|
|
||||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
" Author: Andrey Melentyev <andrey.melentyev@protonmail.com>
|
|
||||||
" Description: Clangd language server
|
|
||||||
|
|
||||||
call ale#Set('cpp_clangd_executable', 'clangd')
|
|
||||||
call ale#Set('cpp_clangd_options', '')
|
|
||||||
|
|
||||||
function! ale_linters#cpp#clangd#GetProjectRoot(buffer) abort
|
|
||||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
|
||||||
|
|
||||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#cpp#clangd#GetCommand(buffer) abort
|
|
||||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'cpp_clangd_options'))
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('cpp', {
|
|
||||||
\ 'name': 'clangd',
|
|
||||||
\ 'lsp': 'stdio',
|
|
||||||
\ 'executable_callback': ale#VarFunc('cpp_clangd_executable'),
|
|
||||||
\ 'command_callback': 'ale_linters#cpp#clangd#GetCommand',
|
|
||||||
\ 'project_root_callback': 'ale_linters#cpp#clangd#GetProjectRoot',
|
|
||||||
\})
|
|
||||||
@@ -1,36 +1,18 @@
|
|||||||
" Author: vdeurzen <tim@kompiler.org>, w0rp <devw0rp@gmail.com>,
|
" Author: vdeurzen <tim@kompiler.org>, w0rp <devw0rp@gmail.com>
|
||||||
" gagbo <gagbobada@gmail.com>
|
|
||||||
" Description: clang-tidy linter for cpp files
|
" Description: clang-tidy linter for cpp files
|
||||||
|
|
||||||
call ale#Set('cpp_clangtidy_executable', 'clang-tidy')
|
" Set this option to change the clang-tidy options for warnings for C.
|
||||||
" Set this option to check the checks clang-tidy will apply.
|
let g:ale_cpp_clangtidy_options =
|
||||||
call ale#Set('cpp_clangtidy_checks', [])
|
\ get(g:, 'ale_cpp_clangtidy_options', '-std=c++14 -Wall')
|
||||||
" Set this option to manually set some options for clang-tidy.
|
|
||||||
" This will disable compile_commands.json detection.
|
|
||||||
call ale#Set('cpp_clangtidy_options', '')
|
|
||||||
call ale#Set('c_build_dir', '')
|
|
||||||
|
|
||||||
function! ale_linters#cpp#clangtidy#GetCommand(buffer) abort
|
function! ale_linters#cpp#clangtidy#GetCommand(buffer) abort
|
||||||
let l:checks = join(ale#Var(a:buffer, 'cpp_clangtidy_checks'), ',')
|
return 'clang-tidy %t -- ' . g:ale_cpp_clangtidy_options
|
||||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
|
||||||
|
|
||||||
" Get the extra options if we couldn't find a build directory.
|
|
||||||
let l:options = empty(l:build_dir)
|
|
||||||
\ ? ale#Var(a:buffer, 'cpp_clangtidy_options')
|
|
||||||
\ : ''
|
|
||||||
|
|
||||||
return '%e'
|
|
||||||
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
|
|
||||||
\ . ' %s'
|
|
||||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
|
||||||
\ . (!empty(l:options) ? ' -- ' . l:options : '')
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('cpp', {
|
call ale#linter#Define('cpp', {
|
||||||
\ 'name': 'clangtidy',
|
\ 'name': 'clangtidy',
|
||||||
\ 'output_stream': 'stdout',
|
\ 'output_stream': 'stdout',
|
||||||
\ 'executable_callback': ale#VarFunc('cpp_clangtidy_executable'),
|
\ 'executable': 'clang-tidy',
|
||||||
\ 'command_callback': 'ale_linters#cpp#clangtidy#GetCommand',
|
\ 'command_callback': 'ale_linters#cpp#clangtidy#GetCommand',
|
||||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
\ 'callback': 'ale#handlers#HandleGCCFormat',
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,32 +0,0 @@
|
|||||||
" Description: clazy linter for cpp files (clang-based and Qt-oriented)
|
|
||||||
|
|
||||||
call ale#Set('cpp_clazy_executable', 'clazy-standalone')
|
|
||||||
" Set this option to check the checks clazy will apply.
|
|
||||||
call ale#Set('cpp_clazy_checks', ['level1'])
|
|
||||||
" Set this option to manually set some options for clazy.
|
|
||||||
" This will disable compile_commands.json detection.
|
|
||||||
call ale#Set('cpp_clazy_options', '')
|
|
||||||
call ale#Set('c_build_dir', '')
|
|
||||||
|
|
||||||
function! ale_linters#cpp#clazy#GetCommand(buffer) abort
|
|
||||||
let l:checks = join(ale#Var(a:buffer, 'cpp_clazy_checks'), ',')
|
|
||||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
|
||||||
|
|
||||||
" Get the extra options if we couldn't find a build directory.
|
|
||||||
let l:options = ale#Var(a:buffer, 'cpp_clazy_options')
|
|
||||||
|
|
||||||
return '%e'
|
|
||||||
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
|
|
||||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
|
||||||
\ . ' %s'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('cpp', {
|
|
||||||
\ 'name': 'clazy',
|
|
||||||
\ 'output_stream': 'stderr',
|
|
||||||
\ 'executable_callback': ale#VarFunc('cpp_clazy_executable'),
|
|
||||||
\ 'command_callback': 'ale_linters#cpp#clazy#GetCommand',
|
|
||||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
|
||||||
@@ -1,34 +1,15 @@
|
|||||||
" Author: Bart Libert <bart.libert@gmail.com>
|
" Author: Bart Libert <bart.libert@gmail.com>
|
||||||
" Description: cppcheck linter for cpp files
|
" Description: cppcheck linter for cpp files
|
||||||
|
|
||||||
call ale#Set('cpp_cppcheck_executable', 'cppcheck')
|
" Set this option to change the cppcheck options
|
||||||
call ale#Set('cpp_cppcheck_options', '--enable=style')
|
let g:ale_cpp_cppcheck_options = get(g:, 'ale_cpp_cppcheck_options', '--enable=style')
|
||||||
|
|
||||||
function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
|
|
||||||
" Search upwards from the file for compile_commands.json.
|
|
||||||
"
|
|
||||||
" If we find it, we'll `cd` to where the compile_commands.json file is,
|
|
||||||
" then use the file to set up import paths, etc.
|
|
||||||
let l:compile_commmands_path = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
|
||||||
|
|
||||||
let l:cd_command = !empty(l:compile_commmands_path)
|
|
||||||
\ ? ale#path#CdString(fnamemodify(l:compile_commmands_path, ':h'))
|
|
||||||
\ : ''
|
|
||||||
let l:compile_commands_option = !empty(l:compile_commmands_path)
|
|
||||||
\ ? '--project=compile_commands.json '
|
|
||||||
\ : ''
|
|
||||||
|
|
||||||
return l:cd_command
|
|
||||||
\ . '%e -q --language=c++ '
|
|
||||||
\ . l:compile_commands_option
|
|
||||||
\ . ale#Var(a:buffer, 'cpp_cppcheck_options')
|
|
||||||
\ . ' %t'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('cpp', {
|
call ale#linter#Define('cpp', {
|
||||||
\ 'name': 'cppcheck',
|
\ 'name': 'cppcheck',
|
||||||
\ 'output_stream': 'both',
|
\ 'output_stream': 'both',
|
||||||
\ 'executable_callback': ale#VarFunc('cpp_cppcheck_executable'),
|
\ 'executable': 'cppcheck',
|
||||||
\ 'command_callback': 'ale_linters#cpp#cppcheck#GetCommand',
|
\ 'command': 'cppcheck -q --language=c++ '
|
||||||
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
|
\ . g:ale_cpp_cppcheck_options
|
||||||
|
\ . ' %t',
|
||||||
|
\ 'callback': 'ale#handlers#HandleCppCheckFormat',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
" Author: Dawid Kurek https://github.com/dawikur
|
|
||||||
" Description: cpplint for cpp files
|
|
||||||
|
|
||||||
call ale#Set('cpp_cpplint_executable', 'cpplint')
|
|
||||||
call ale#Set('cpp_cpplint_options', '')
|
|
||||||
|
|
||||||
function! ale_linters#cpp#cpplint#GetCommand(buffer) abort
|
|
||||||
let l:options = ale#Var(a:buffer, 'cpp_cpplint_options')
|
|
||||||
|
|
||||||
return '%e' . ale#Pad(l:options) . ' %s'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('cpp', {
|
|
||||||
\ 'name': 'cpplint',
|
|
||||||
\ 'output_stream': 'stderr',
|
|
||||||
\ 'executable_callback': ale#VarFunc('cpp_cpplint_executable'),
|
|
||||||
\ 'command_callback': 'ale_linters#cpp#cpplint#GetCommand',
|
|
||||||
\ 'callback': 'ale#handlers#cpplint#HandleCppLintFormat',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
" Author: Ben Falconer <ben@falconers.me.uk>
|
|
||||||
" Description: A language server for C++
|
|
||||||
|
|
||||||
call ale#Set('cpp_cquery_executable', 'cquery')
|
|
||||||
call ale#Set('cpp_cquery_cache_directory', expand('~/.cache/cquery'))
|
|
||||||
|
|
||||||
function! ale_linters#cpp#cquery#GetProjectRoot(buffer) abort
|
|
||||||
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
|
||||||
|
|
||||||
if empty(l:project_root)
|
|
||||||
let l:project_root = ale#path#FindNearestFile(a:buffer, '.cquery')
|
|
||||||
endif
|
|
||||||
|
|
||||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#cpp#cquery#GetInitializationOptions(buffer) abort
|
|
||||||
return {'cacheDirectory': ale#Var(a:buffer, 'cpp_cquery_cache_directory')}
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('cpp', {
|
|
||||||
\ 'name': 'cquery',
|
|
||||||
\ 'lsp': 'stdio',
|
|
||||||
\ 'executable_callback': ale#VarFunc('cpp_cquery_executable'),
|
|
||||||
\ 'command': '%e',
|
|
||||||
\ 'project_root_callback': 'ale_linters#cpp#cquery#GetProjectRoot',
|
|
||||||
\ 'initialization_options_callback': 'ale_linters#cpp#cquery#GetInitializationOptions',
|
|
||||||
\})
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
" Author: Christian Gibbons <cgibbons@gmu.edu>
|
|
||||||
" Description: flawfinder linter for c++ files
|
|
||||||
|
|
||||||
call ale#Set('cpp_flawfinder_executable', 'flawfinder')
|
|
||||||
call ale#Set('cpp_flawfinder_options', '')
|
|
||||||
call ale#Set('cpp_flawfinder_minlevel', 1)
|
|
||||||
call ale#Set('c_flawfinder_error_severity', 6)
|
|
||||||
|
|
||||||
function! ale_linters#cpp#flawfinder#GetCommand(buffer) abort
|
|
||||||
" Set the minimum vulnerability level for flawfinder to bother with
|
|
||||||
let l:minlevel = ' --minlevel=' . ale#Var(a:buffer, 'cpp_flawfinder_minlevel')
|
|
||||||
|
|
||||||
return '%e -CDQS'
|
|
||||||
\ . ale#Var(a:buffer, 'cpp_flawfinder_options')
|
|
||||||
\ . l:minlevel
|
|
||||||
\ . ' %t'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('cpp', {
|
|
||||||
\ 'name': 'flawfinder',
|
|
||||||
\ 'output_stream': 'stdout',
|
|
||||||
\ 'executable_callback': ale#VarFunc('cpp_flawfinder_executable'),
|
|
||||||
\ 'command_callback': 'ale_linters#cpp#flawfinder#GetCommand',
|
|
||||||
\ 'callback': 'ale#handlers#flawfinder#HandleFlawfinderFormat',
|
|
||||||
\})
|
|
||||||
@@ -1,28 +1,32 @@
|
|||||||
" Author: geam <mdelage@student.42.fr>
|
" Author: geam <mdelage@student.42.fr>
|
||||||
" Description: gcc linter for cpp files
|
" Description: gcc linter for cpp files
|
||||||
"
|
|
||||||
call ale#Set('cpp_gcc_executable', 'gcc')
|
|
||||||
call ale#Set('cpp_gcc_options', '-std=c++14 -Wall')
|
|
||||||
|
|
||||||
function! ale_linters#cpp#gcc#GetCommand(buffer, output) abort
|
" Set this option to change the GCC options for warnings for C.
|
||||||
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
if !exists('g:ale_cpp_gcc_options')
|
||||||
|
" added c++14 standard support
|
||||||
|
" POSIX thread and standard c++ thread and atomic library Linker
|
||||||
|
" let g:ale_cpp_gcc_options = '-std=c++1z' for c++17
|
||||||
|
" for previous version and default, you can just use
|
||||||
|
" let g:ale_cpp_gcc_options = '-Wall'
|
||||||
|
" for more see man pages of gcc
|
||||||
|
" $ man g++
|
||||||
|
" make sure g++ in your $PATH
|
||||||
|
" Add flags according to your requirements
|
||||||
|
let g:ale_cpp_gcc_options = '-std=c++14 -Wall'
|
||||||
|
endif
|
||||||
|
|
||||||
|
function! ale_linters#cpp#gcc#GetCommand(buffer) abort
|
||||||
" -iquote with the directory the file is in makes #include work for
|
" -iquote with the directory the file is in makes #include work for
|
||||||
" headers in the same directory.
|
" headers in the same directory.
|
||||||
return '%e -S -x c++ -fsyntax-only'
|
return 'gcc -S -x c++ -fsyntax-only '
|
||||||
\ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
\ . '-iquote ' . fnameescape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||||
\ . ale#Pad(l:cflags)
|
\ . ' ' . g:ale_cpp_gcc_options . ' -'
|
||||||
\ . ale#Pad(ale#Var(a:buffer, 'cpp_gcc_options')) . ' -'
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('cpp', {
|
call ale#linter#Define('cpp', {
|
||||||
\ 'name': 'gcc',
|
\ 'name': 'g++',
|
||||||
\ 'aliases': ['g++'],
|
|
||||||
\ 'output_stream': 'stderr',
|
\ 'output_stream': 'stderr',
|
||||||
\ 'executable_callback': ale#VarFunc('cpp_gcc_executable'),
|
\ 'executable': 'g++',
|
||||||
\ 'command_chain': [
|
\ 'command_callback': 'ale_linters#cpp#gcc#GetCommand',
|
||||||
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
|
\ 'callback': 'ale#handlers#HandleGCCFormat',
|
||||||
\ {'callback': 'ale_linters#cpp#gcc#GetCommand'},
|
|
||||||
\ ],
|
|
||||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
|
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,31 +0,0 @@
|
|||||||
" Author: Jordan Andree <https://github.com/jordanandree>, David Alexander <opensource@thelonelyghost.com>
|
|
||||||
" Description: This file adds support for checking Crystal with crystal build
|
|
||||||
|
|
||||||
function! ale_linters#crystal#crystal#Handle(buffer, lines) abort
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'lnum': l:error.line + 0,
|
|
||||||
\ 'col': l:error.column + 0,
|
|
||||||
\ 'text': l:error.message,
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#crystal#crystal#GetCommand(buffer) abort
|
|
||||||
return 'crystal build -f json --no-codegen --no-color -o '
|
|
||||||
\ . ale#Escape(g:ale#util#nul_file)
|
|
||||||
\ . ' %s'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('crystal', {
|
|
||||||
\ 'name': 'crystal',
|
|
||||||
\ 'executable': 'crystal',
|
|
||||||
\ 'output_stream': 'both',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\ 'command_callback': 'ale_linters#crystal#crystal#GetCommand',
|
|
||||||
\ 'callback': 'ale_linters#crystal#crystal#Handle',
|
|
||||||
\})
|
|
||||||
@@ -1,27 +1,29 @@
|
|||||||
let g:ale_cs_mcs_options = get(g:, 'ale_cs_mcs_options', '')
|
let g:ale_cs_mcs_options = get(g:, 'ale_cs_mcs_options', '')
|
||||||
|
|
||||||
function! ale_linters#cs#mcs#GetCommand(buffer) abort
|
function! ale_linters#cs#mcs#GetCommand(buffer) abort
|
||||||
let l:options = ale#Var(a:buffer, 'cs_mcs_options')
|
return 'mcs -unsafe --parse ' . g:ale_cs_mcs_options . ' %t'
|
||||||
|
|
||||||
return 'mcs -unsafe --parse'
|
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
|
||||||
\ . ' %t'
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#cs#mcs#Handle(buffer, lines) abort
|
function! ale_linters#cs#mcs#Handle(buffer, lines) abort
|
||||||
" Look for lines like the following.
|
" Look for lines like the following.
|
||||||
"
|
"
|
||||||
" Tests.cs(12,29): error CSXXXX: ; expected
|
" Tests.cs(12,29): error CSXXXX: ; expected
|
||||||
let l:pattern = '^\v(.+\.cs)\((\d+),(\d+)\)\: ([^ ]+) ([^ ]+): (.+)$'
|
let l:pattern = '^.\+.cs(\(\d\+\),\(\d\+\)): \(.\+\): \(.\+\)'
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:line in a:lines
|
||||||
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
|
if len(l:match) == 0
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': l:match[2] + 0,
|
\ 'bufnr': a:buffer,
|
||||||
\ 'col': l:match[3] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
\ 'col': l:match[2] + 0,
|
||||||
\ 'code': l:match[5],
|
\ 'text': l:match[3] . ': ' . l:match[4],
|
||||||
\ 'text': l:match[6],
|
\ 'type': l:match[3] =~# '^error' ? 'E' : 'W',
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
|||||||
@@ -1,81 +0,0 @@
|
|||||||
call ale#Set('cs_mcsc_options', '')
|
|
||||||
call ale#Set('cs_mcsc_source', '')
|
|
||||||
call ale#Set('cs_mcsc_assembly_path', [])
|
|
||||||
call ale#Set('cs_mcsc_assemblies', [])
|
|
||||||
|
|
||||||
function! s:GetWorkingDirectory(buffer) abort
|
|
||||||
let l:working_directory = ale#Var(a:buffer, 'cs_mcsc_source')
|
|
||||||
|
|
||||||
if !empty(l:working_directory)
|
|
||||||
return l:working_directory
|
|
||||||
endif
|
|
||||||
|
|
||||||
return expand('#' . a:buffer . ':p:h')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#cs#mcsc#GetCommand(buffer) abort
|
|
||||||
" Pass assembly paths via the -lib: parameter.
|
|
||||||
let l:path_list = ale#Var(a:buffer, 'cs_mcsc_assembly_path')
|
|
||||||
|
|
||||||
let l:lib_option = !empty(l:path_list)
|
|
||||||
\ ? '-lib:' . join(map(copy(l:path_list), 'ale#Escape(v:val)'), ',')
|
|
||||||
\ : ''
|
|
||||||
|
|
||||||
" Pass paths to DLL files via the -r: parameter.
|
|
||||||
let l:assembly_list = ale#Var(a:buffer, 'cs_mcsc_assemblies')
|
|
||||||
|
|
||||||
let l:r_option = !empty(l:assembly_list)
|
|
||||||
\ ? '-r:' . join(map(copy(l:assembly_list), 'ale#Escape(v:val)'), ',')
|
|
||||||
\ : ''
|
|
||||||
|
|
||||||
" register temporary module target file with ale
|
|
||||||
" register temporary module target file with ALE.
|
|
||||||
let l:out = ale#engine#CreateFile(a:buffer)
|
|
||||||
|
|
||||||
" The code is compiled as a module and the output is redirected to a
|
|
||||||
" temporary file.
|
|
||||||
return ale#path#CdString(s:GetWorkingDirectory(a:buffer))
|
|
||||||
\ . 'mcs -unsafe'
|
|
||||||
\ . ale#Pad(ale#Var(a:buffer, 'cs_mcsc_options'))
|
|
||||||
\ . ale#Pad(l:lib_option)
|
|
||||||
\ . ale#Pad(l:r_option)
|
|
||||||
\ . ' -out:' . l:out
|
|
||||||
\ . ' -t:module'
|
|
||||||
\ . ' -recurse:' . ale#Escape('*.cs')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#cs#mcsc#Handle(buffer, lines) abort
|
|
||||||
" Look for lines like the following.
|
|
||||||
"
|
|
||||||
" Tests.cs(12,29): error CSXXXX: ; expected
|
|
||||||
"
|
|
||||||
" NOTE: pattern also captures file name as linter compiles all
|
|
||||||
" files within the source tree rooted at the specified source
|
|
||||||
" path and not just the file loaded in the buffer
|
|
||||||
let l:pattern = '^\v(.+\.cs)\((\d+),(\d+)\)\: ([^ ]+) ([^ ]+): (.+)$'
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
let l:dir = s:GetWorkingDirectory(a:buffer)
|
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
|
||||||
\ 'lnum': l:match[2] + 0,
|
|
||||||
\ 'col': l:match[3] + 0,
|
|
||||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
|
||||||
\ 'code': l:match[5],
|
|
||||||
\ 'text': l:match[6],
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('cs',{
|
|
||||||
\ 'name': 'mcsc',
|
|
||||||
\ 'output_stream': 'stderr',
|
|
||||||
\ 'executable': 'mcs',
|
|
||||||
\ 'command_callback': 'ale_linters#cs#mcsc#GetCommand',
|
|
||||||
\ 'callback': 'ale_linters#cs#mcsc#Handle',
|
|
||||||
\ 'lint_file': 1
|
|
||||||
\})
|
|
||||||
@@ -1,18 +1,9 @@
|
|||||||
" Author: w0rp <devw0rp@gmail.com>
|
" Author: w0rp <devw0rp@gmail.com>
|
||||||
" Description: This file adds support for checking CSS code with csslint.
|
" Description: This file adds support for checking CSS code with csslint.
|
||||||
|
|
||||||
function! ale_linters#css#csslint#GetCommand(buffer) abort
|
|
||||||
let l:csslintrc = ale#path#FindNearestFile(a:buffer, '.csslintrc')
|
|
||||||
let l:config_option = !empty(l:csslintrc)
|
|
||||||
\ ? '--config=' . ale#Escape(l:csslintrc)
|
|
||||||
\ : ''
|
|
||||||
|
|
||||||
return 'csslint --format=compact ' . l:config_option . ' %t'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('css', {
|
call ale#linter#Define('css', {
|
||||||
\ 'name': 'csslint',
|
\ 'name': 'csslint',
|
||||||
\ 'executable': 'csslint',
|
\ 'executable': 'csslint',
|
||||||
\ 'command_callback': 'ale_linters#css#csslint#GetCommand',
|
\ 'command': 'csslint --format=compact %t',
|
||||||
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
|
\ 'callback': 'ale#handlers#HandleCSSLintFormat',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,19 +1,35 @@
|
|||||||
" Author: diartyz <diartyz@gmail.com>
|
" Author: diartyz <diartyz@gmail.com>
|
||||||
|
|
||||||
call ale#Set('css_stylelint_executable', 'stylelint')
|
let g:ale_css_stylelint_executable =
|
||||||
call ale#Set('css_stylelint_options', '')
|
\ get(g:, 'ale_css_stylelint_executable', 'stylelint')
|
||||||
call ale#Set('css_stylelint_use_global', get(g:, 'ale_use_global_executables', 0))
|
|
||||||
|
let g:ale_css_stylelint_options =
|
||||||
|
\ get(g:, 'ale_css_stylelint_options', '')
|
||||||
|
|
||||||
|
let g:ale_css_stylelint_use_global =
|
||||||
|
\ get(g:, 'ale_css_stylelint_use_global', 0)
|
||||||
|
|
||||||
|
function! ale_linters#css#stylelint#GetExecutable(buffer) abort
|
||||||
|
if g:ale_css_stylelint_use_global
|
||||||
|
return g:ale_css_stylelint_executable
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ale#util#ResolveLocalPath(
|
||||||
|
\ a:buffer,
|
||||||
|
\ 'node_modules/.bin/stylelint',
|
||||||
|
\ g:ale_css_stylelint_executable
|
||||||
|
\)
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#css#stylelint#GetCommand(buffer) abort
|
function! ale_linters#css#stylelint#GetCommand(buffer) abort
|
||||||
return '%e ' . ale#Pad(ale#Var(a:buffer, 'css_stylelint_options'))
|
return ale_linters#css#stylelint#GetExecutable(a:buffer)
|
||||||
|
\ . ' ' . g:ale_css_stylelint_options
|
||||||
\ . ' --stdin-filename %s'
|
\ . ' --stdin-filename %s'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('css', {
|
call ale#linter#Define('css', {
|
||||||
\ 'name': 'stylelint',
|
\ 'name': 'stylelint',
|
||||||
\ 'executable_callback': ale#node#FindExecutableFunc('css_stylelint', [
|
\ 'executable_callback': 'ale_linters#css#stylelint#GetExecutable',
|
||||||
\ 'node_modules/.bin/stylelint',
|
|
||||||
\ ]),
|
|
||||||
\ 'command_callback': 'ale_linters#css#stylelint#GetCommand',
|
\ 'command_callback': 'ale_linters#css#stylelint#GetCommand',
|
||||||
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
|
\ 'callback': 'ale#handlers#HandleStyleLintFormat',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,46 +0,0 @@
|
|||||||
" Author: Eddie Lebow https://github.com/elebow
|
|
||||||
" Description: Cucumber, a BDD test tool
|
|
||||||
|
|
||||||
function! ale_linters#cucumber#cucumber#GetCommand(buffer) abort
|
|
||||||
let l:features_dir = ale#path#FindNearestDirectory(a:buffer, 'features')
|
|
||||||
|
|
||||||
if !empty(l:features_dir)
|
|
||||||
let l:features_arg = '-r ' . ale#Escape(l:features_dir)
|
|
||||||
else
|
|
||||||
let l:features_arg = ''
|
|
||||||
endif
|
|
||||||
|
|
||||||
return 'cucumber --dry-run --quiet --strict --format=json '
|
|
||||||
\ . l:features_arg . ' %t'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#cucumber#cucumber#Handle(buffer, lines) abort
|
|
||||||
try
|
|
||||||
let l:json = ale#util#FuzzyJSONDecode(a:lines, {})[0]
|
|
||||||
catch
|
|
||||||
return []
|
|
||||||
endtry
|
|
||||||
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:element in get(l:json, 'elements', [])
|
|
||||||
for l:step in l:element['steps']
|
|
||||||
if l:step['result']['status'] is# 'undefined'
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'lnum': l:step['line'],
|
|
||||||
\ 'code': 'E',
|
|
||||||
\ 'text': 'Undefined step'
|
|
||||||
\})
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('cucumber', {
|
|
||||||
\ 'name': 'cucumber',
|
|
||||||
\ 'executable': 'cucumber',
|
|
||||||
\ 'command_callback': 'ale_linters#cucumber#cucumber#GetCommand',
|
|
||||||
\ 'callback': 'ale_linters#cucumber#cucumber#Handle'
|
|
||||||
\})
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
" Author: blahgeek <i@blahgeek.com>
|
|
||||||
" Description: NVCC linter for cuda files
|
|
||||||
|
|
||||||
call ale#Set('cuda_nvcc_executable', 'nvcc')
|
|
||||||
call ale#Set('cuda_nvcc_options', '-std=c++11')
|
|
||||||
|
|
||||||
function! ale_linters#cuda#nvcc#GetCommand(buffer) abort
|
|
||||||
" Unused: use ale#util#nul_file
|
|
||||||
" let l:output_file = ale#util#Tempname() . '.ii'
|
|
||||||
" call ale#engine#ManageFile(a:buffer, l:output_file)
|
|
||||||
return '%e -cuda'
|
|
||||||
\ . ale#Pad(ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer)))
|
|
||||||
\ . ale#Pad(ale#Var(a:buffer, 'cuda_nvcc_options'))
|
|
||||||
\ . ' %s -o ' . g:ale#util#nul_file
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#cuda#nvcc#HandleNVCCFormat(buffer, lines) abort
|
|
||||||
" Look for lines like the following.
|
|
||||||
"
|
|
||||||
" test.cu(8): error: argument of type "void *" is incompatible with parameter of type "int *"
|
|
||||||
let l:pattern = '\v^([^:\(\)]+):?\(?(\d+)\)?:(\d+)?:?\s*\w*\s*(error|warning): (.+)$'
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
||||||
let l:item = {
|
|
||||||
\ 'lnum': str2nr(l:match[2]),
|
|
||||||
\ 'type': l:match[4] =~# 'error' ? 'E' : 'W',
|
|
||||||
\ 'text': l:match[5],
|
|
||||||
\ 'filename': fnamemodify(l:match[1], ':p'),
|
|
||||||
\}
|
|
||||||
|
|
||||||
if !empty(l:match[3])
|
|
||||||
let l:item.col = str2nr(l:match[3])
|
|
||||||
endif
|
|
||||||
|
|
||||||
call add(l:output, l:item)
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('cuda', {
|
|
||||||
\ 'name': 'nvcc',
|
|
||||||
\ 'output_stream': 'stderr',
|
|
||||||
\ 'executable_callback': ale#VarFunc('cuda_nvcc_executable'),
|
|
||||||
\ 'command_callback': 'ale_linters#cuda#nvcc#GetCommand',
|
|
||||||
\ 'callback': 'ale_linters#cuda#nvcc#HandleNVCCFormat',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
" Author: aurieh <me@aurieh.me>
|
|
||||||
" Description: A Language Server implementation for D
|
|
||||||
|
|
||||||
call ale#Set('d_dls_executable', 'dls')
|
|
||||||
|
|
||||||
function! ale_linters#d#dls#GetExecutable(buffer) abort
|
|
||||||
return ale#Var(a:buffer, 'd_dls_executable')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#d#dls#FindProjectRoot(buffer) abort
|
|
||||||
" Note: this will return . if dub config is empty
|
|
||||||
" dls can run outside DUB projects just fine
|
|
||||||
return fnamemodify(ale#d#FindDUBConfig(a:buffer), ':h')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('d', {
|
|
||||||
\ 'name': 'dls',
|
|
||||||
\ 'lsp': 'stdio',
|
|
||||||
\ 'executable_callback': 'ale_linters#d#dls#GetExecutable',
|
|
||||||
\ 'command_callback': 'ale_linters#d#dls#GetExecutable',
|
|
||||||
\ 'project_root_callback': 'ale_linters#d#dls#FindProjectRoot',
|
|
||||||
\})
|
|
||||||
@@ -1,6 +1,20 @@
|
|||||||
" Author: w0rp <devw0rp@gmail.com>
|
" Author: w0rp <devw0rp@gmail.com>
|
||||||
" Description: "dmd for D files"
|
" Description: "dmd for D files"
|
||||||
|
|
||||||
|
function! s:FindDUBConfig(buffer) abort
|
||||||
|
" Find a DUB configuration file in ancestor paths.
|
||||||
|
" The most DUB-specific names will be tried first.
|
||||||
|
for l:possible_filename in ['dub.sdl', 'dub.json', 'package.json']
|
||||||
|
let l:dub_file = ale#util#FindNearestFile(a:buffer, l:possible_filename)
|
||||||
|
|
||||||
|
if !empty(l:dub_file)
|
||||||
|
return l:dub_file
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#d#dmd#DUBCommand(buffer) abort
|
function! ale_linters#d#dmd#DUBCommand(buffer) abort
|
||||||
" If we can't run dub, then skip this command.
|
" If we can't run dub, then skip this command.
|
||||||
if !executable('dub')
|
if !executable('dub')
|
||||||
@@ -8,7 +22,7 @@ function! ale_linters#d#dmd#DUBCommand(buffer) abort
|
|||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:dub_file = ale#d#FindDUBConfig(a:buffer)
|
let l:dub_file = s:FindDUBConfig(a:buffer)
|
||||||
|
|
||||||
if empty(l:dub_file)
|
if empty(l:dub_file)
|
||||||
return ''
|
return ''
|
||||||
@@ -17,7 +31,7 @@ function! ale_linters#d#dmd#DUBCommand(buffer) abort
|
|||||||
" To support older dub versions, we just change the directory to
|
" To support older dub versions, we just change the directory to
|
||||||
" the directory where we found the dub config, and then run `dub describe`
|
" the directory where we found the dub config, and then run `dub describe`
|
||||||
" from that directory.
|
" from that directory.
|
||||||
return 'cd ' . ale#Escape(fnamemodify(l:dub_file, ':h'))
|
return 'cd ' . fnameescape(fnamemodify(l:dub_file, ':h'))
|
||||||
\ . ' && dub describe --import-paths'
|
\ . ' && dub describe --import-paths'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@@ -28,11 +42,11 @@ function! ale_linters#d#dmd#DMDCommand(buffer, dub_output) abort
|
|||||||
for l:line in a:dub_output
|
for l:line in a:dub_output
|
||||||
if !empty(l:line)
|
if !empty(l:line)
|
||||||
" The arguments must be '-Ifilename', not '-I filename'
|
" The arguments must be '-Ifilename', not '-I filename'
|
||||||
call add(l:import_list, '-I' . ale#Escape(l:line))
|
call add(l:import_list, '-I' . fnameescape(l:line))
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return 'dmd '. join(l:import_list) . ' -o- -wi -vcolumns -c %t'
|
return 'dmd '. join(l:import_list) . ' -o- -vcolumns -c %t'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#d#dmd#Handle(buffer, lines) abort
|
function! ale_linters#d#dmd#Handle(buffer, lines) abort
|
||||||
@@ -42,12 +56,24 @@ function! ale_linters#d#dmd#Handle(buffer, lines) abort
|
|||||||
let l:pattern = '^[^(]\+(\([0-9]\+\)\,\?\([0-9]*\)): \([^:]\+\): \(.\+\)'
|
let l:pattern = '^[^(]\+(\([0-9]\+\)\,\?\([0-9]*\)): \([^:]\+\): \(.\+\)'
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:line in a:lines
|
||||||
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|
||||||
|
if len(l:match) == 0
|
||||||
|
break
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:line = l:match[1] + 0
|
||||||
|
let l:column = l:match[2] + 0
|
||||||
|
let l:type = l:match[3]
|
||||||
|
let l:text = l:match[4]
|
||||||
|
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': l:match[1],
|
\ 'bufnr': bufnr('%'),
|
||||||
\ 'col': l:match[2],
|
\ 'lnum': l:line,
|
||||||
\ 'type': l:match[3] is# 'Warning' ? 'W' : 'E',
|
\ 'col': l:column,
|
||||||
\ 'text': l:match[4],
|
\ 'text': l:text,
|
||||||
|
\ 'type': l:type ==# 'Warning' ? 'W' : 'E',
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
" Author: Taylor Blau <me@ttaylorr.com>
|
|
||||||
|
|
||||||
function! ale_linters#dafny#dafny#Handle(buffer, lines) abort
|
|
||||||
let l:pattern = '\v(.*)\((\d+),(\d+)\): (.*): (.*)'
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'bufnr': a:buffer,
|
|
||||||
\ 'col': l:match[3] + 0,
|
|
||||||
\ 'lnum': l:match[2] + 0,
|
|
||||||
\ 'text': l:match[5],
|
|
||||||
\ 'type': l:match[4] =~# '^Error' ? 'E' : 'W'
|
|
||||||
\ })
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('dafny', {
|
|
||||||
\ 'name': 'dafny',
|
|
||||||
\ 'executable': 'dafny',
|
|
||||||
\ 'command': 'dafny %s /compile:0',
|
|
||||||
\ 'callback': 'ale_linters#dafny#dafny#Handle',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\ })
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
" Author: w0rp <devw0rp@gmail.com>
|
|
||||||
" Description: Check Dart files with dartanalyzer
|
|
||||||
|
|
||||||
call ale#Set('dart_dartanalyzer_executable', 'dartanalyzer')
|
|
||||||
|
|
||||||
function! ale_linters#dart#dartanalyzer#GetCommand(buffer) abort
|
|
||||||
let l:path = ale#path#FindNearestFile(a:buffer, '.packages')
|
|
||||||
|
|
||||||
return '%e'
|
|
||||||
\ . (!empty(l:path) ? ' --packages ' . ale#Escape(l:path) : '')
|
|
||||||
\ . ' %s'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#dart#dartanalyzer#Handle(buffer, lines) abort
|
|
||||||
let l:pattern = '\v^ ([a-z]+) . (.+) at (.+):(\d+):(\d+) . (.+)$'
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'type': l:match[1] is# 'error' ? 'E' : 'W',
|
|
||||||
\ 'text': l:match[6] . ': ' . l:match[2],
|
|
||||||
\ 'lnum': str2nr(l:match[4]),
|
|
||||||
\ 'col': str2nr(l:match[5]),
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('dart', {
|
|
||||||
\ 'name': 'dartanalyzer',
|
|
||||||
\ 'executable_callback': ale#VarFunc('dart_dartanalyzer_executable'),
|
|
||||||
\ 'command_callback': 'ale_linters#dart#dartanalyzer#GetCommand',
|
|
||||||
\ 'callback': 'ale_linters#dart#dartanalyzer#Handle',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
" Author: aurieh <me@aurieh.me>
|
|
||||||
" Description: A language server for dart
|
|
||||||
|
|
||||||
call ale#Set('dart_language_server_executable', 'dart_language_server')
|
|
||||||
|
|
||||||
function! ale_linters#dart#language_server#GetProjectRoot(buffer) abort
|
|
||||||
" Note: pub only looks for pubspec.yaml, there's no point in adding
|
|
||||||
" support for pubspec.yml
|
|
||||||
let l:pubspec = ale#path#FindNearestFile(a:buffer, 'pubspec.yaml')
|
|
||||||
|
|
||||||
return !empty(l:pubspec) ? fnamemodify(l:pubspec, ':h:h') : ''
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('dart', {
|
|
||||||
\ 'name': 'language_server',
|
|
||||||
\ 'lsp': 'stdio',
|
|
||||||
\ 'executable_callback': ale#VarFunc('dart_language_server_executable'),
|
|
||||||
\ 'command': '%e',
|
|
||||||
\ 'project_root_callback': 'ale_linters#dart#language_server#GetProjectRoot',
|
|
||||||
\})
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
" Author: Alexander Olofsson <alexander.olofsson@liu.se>
|
|
||||||
|
|
||||||
call ale#Set('dockerfile_dockerfile_lint_executable', 'dockerfile_lint')
|
|
||||||
call ale#Set('dockerfile_dockerfile_lint_options', '')
|
|
||||||
|
|
||||||
function! ale_linters#dockerfile#dockerfile_lint#GetType(type) abort
|
|
||||||
if a:type is? 'error'
|
|
||||||
return 'E'
|
|
||||||
elseif a:type is? 'warn'
|
|
||||||
return 'W'
|
|
||||||
endif
|
|
||||||
|
|
||||||
return 'I'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#dockerfile#dockerfile_lint#Handle(buffer, lines) abort
|
|
||||||
try
|
|
||||||
let l:data = json_decode(join(a:lines, ''))
|
|
||||||
catch
|
|
||||||
return []
|
|
||||||
endtry
|
|
||||||
|
|
||||||
if empty(l:data)
|
|
||||||
" Should never happen, but it's better to be on the safe side
|
|
||||||
return []
|
|
||||||
endif
|
|
||||||
|
|
||||||
let l:messages = []
|
|
||||||
|
|
||||||
for l:type in ['error', 'warn', 'info']
|
|
||||||
for l:object in l:data[l:type]['data']
|
|
||||||
let l:line = get(l:object, 'line', -1)
|
|
||||||
let l:message = l:object['message']
|
|
||||||
|
|
||||||
if get(l:object, 'description', 'None') isnot# 'None'
|
|
||||||
let l:message = l:message . '. ' . l:object['description']
|
|
||||||
endif
|
|
||||||
|
|
||||||
call add(l:messages, {
|
|
||||||
\ 'lnum': l:line,
|
|
||||||
\ 'text': l:message,
|
|
||||||
\ 'type': ale_linters#dockerfile#dockerfile_lint#GetType(l:type),
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:messages
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#dockerfile#dockerfile_lint#GetCommand(buffer) abort
|
|
||||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'dockerfile_dockerfile_lint_options'))
|
|
||||||
\ . ' -p -j -f'
|
|
||||||
\ . ' %t'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('dockerfile', {
|
|
||||||
\ 'name': 'dockerfile_lint',
|
|
||||||
\ 'executable_callback': ale#VarFunc('dockerfile_dockerfile_lint_executable'),
|
|
||||||
\ 'command_callback': 'ale_linters#dockerfile#dockerfile_lint#GetCommand',
|
|
||||||
\ 'callback': 'ale_linters#dockerfile#dockerfile_lint#Handle',
|
|
||||||
\})
|
|
||||||
@@ -1,99 +1,43 @@
|
|||||||
" Author: hauleth - https://github.com/hauleth
|
" Author: hauleth - https://github.com/hauleth
|
||||||
|
|
||||||
" always, yes, never
|
|
||||||
call ale#Set('dockerfile_hadolint_use_docker', 'never')
|
|
||||||
call ale#Set('dockerfile_hadolint_docker_image', 'hadolint/hadolint')
|
|
||||||
|
|
||||||
function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
|
function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
|
||||||
" Matches patterns line the following:
|
" Matches patterns line the following:
|
||||||
"
|
"
|
||||||
" /dev/stdin:19 DL3001 Pipe chain should start with a raw value.
|
" stdin:19: F: Pipe chain should start with a raw value.
|
||||||
" /dev/stdin:19:3 unexpected thing
|
let l:pattern = '\v^/dev/stdin:?(\d+)? (\S+) (.+)$'
|
||||||
let l:pattern = '\v^/dev/stdin:(\d+):?(\d+)? ((DL|SC)(\d+) )?(.+)$'
|
let l:output = []
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:line in a:lines
|
||||||
let l:lnum = 0
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
let l:colnum = 0
|
|
||||||
|
|
||||||
if l:match[1] isnot# ''
|
if len(l:match) == 0
|
||||||
let l:lnum = l:match[1] + 0
|
continue
|
||||||
endif
|
|
||||||
|
|
||||||
if l:match[2] isnot# ''
|
|
||||||
let l:colnum = l:match[2] + 0
|
|
||||||
endif
|
|
||||||
|
|
||||||
let l:type = 'W'
|
|
||||||
let l:text = l:match[6]
|
|
||||||
let l:detail = l:match[6]
|
|
||||||
let l:domain = 'https://github.com/hadolint/hadolint/wiki/'
|
|
||||||
|
|
||||||
if l:match[4] is# 'SC'
|
|
||||||
let l:domain = 'https://github.com/koalaman/shellcheck/wiki/'
|
|
||||||
endif
|
|
||||||
|
|
||||||
if l:match[5] isnot# ''
|
|
||||||
let l:code = l:match[4] . l:match[5]
|
|
||||||
let l:link = ' ( ' . l:domain . l:code . ' )'
|
|
||||||
let l:detail = l:code . l:link . "\n\n" . l:detail
|
|
||||||
else
|
|
||||||
let l:type = 'E'
|
|
||||||
endif
|
|
||||||
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'lnum': l:lnum,
|
|
||||||
\ 'col': l:colnum,
|
|
||||||
\ 'type': l:type,
|
|
||||||
\ 'text': l:text,
|
|
||||||
\ 'detail': l:detail
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
" This is a little different than the typical 'executable' callback. We want
|
|
||||||
" to afford the user the chance to say always use docker, never use docker,
|
|
||||||
" and use docker if the hadolint executable is not present on the system.
|
|
||||||
"
|
|
||||||
" In the case of neither docker nor hadolint executables being present, it
|
|
||||||
" really doesn't matter which we return -- either will have the effect of
|
|
||||||
" 'nope, can't use this linter!'.
|
|
||||||
|
|
||||||
function! ale_linters#dockerfile#hadolint#GetExecutable(buffer) abort
|
|
||||||
let l:use_docker = ale#Var(a:buffer, 'dockerfile_hadolint_use_docker')
|
|
||||||
|
|
||||||
" check for mandatory directives
|
|
||||||
if l:use_docker is# 'never'
|
|
||||||
return 'hadolint'
|
|
||||||
elseif l:use_docker is# 'always'
|
|
||||||
return 'docker'
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" if we reach here, we want to use 'hadolint' if present...
|
let l:lnum = 0
|
||||||
if executable('hadolint')
|
|
||||||
return 'hadolint'
|
if l:match[1] !=# ''
|
||||||
|
let l:lnum = l:match[1] + 0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
"... and 'docker' as a fallback.
|
let l:type = 'W'
|
||||||
return 'docker'
|
let l:text = l:match[3]
|
||||||
|
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'bufnr': a:buffer,
|
||||||
|
\ 'lnum': l:lnum,
|
||||||
|
\ 'col': 0,
|
||||||
|
\ 'type': l:type,
|
||||||
|
\ 'text': l:text,
|
||||||
|
\ 'nr': l:match[2],
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#dockerfile#hadolint#GetCommand(buffer) abort
|
|
||||||
let l:command = ale_linters#dockerfile#hadolint#GetExecutable(a:buffer)
|
|
||||||
|
|
||||||
if l:command is# 'docker'
|
|
||||||
return 'docker run --rm -i ' . ale#Var(a:buffer, 'dockerfile_hadolint_docker_image')
|
|
||||||
endif
|
|
||||||
|
|
||||||
return 'hadolint -'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
|
|
||||||
call ale#linter#Define('dockerfile', {
|
call ale#linter#Define('dockerfile', {
|
||||||
\ 'name': 'hadolint',
|
\ 'name': 'hadolint',
|
||||||
\ 'executable_callback': 'ale_linters#dockerfile#hadolint#GetExecutable',
|
\ 'executable': 'hadolint',
|
||||||
\ 'command_callback': 'ale_linters#dockerfile#hadolint#GetCommand',
|
\ 'command': 'hadolint -',
|
||||||
\ 'callback': 'ale_linters#dockerfile#hadolint#Handle',
|
\ 'callback': 'ale_linters#dockerfile#hadolint#Handle' })
|
||||||
\})
|
|
||||||
|
|||||||
@@ -1,52 +1,42 @@
|
|||||||
" Author: hauleth - https://github.com/hauleth
|
" Author: hauleth - https://github.com/hauleth
|
||||||
|
|
||||||
function! ale_linters#elixir#credo#Handle(buffer, lines) abort
|
function! ale_linters#elixir#credo#Handle(buffer, lines) abort
|
||||||
" Matches patterns line the following:
|
" Matches patterns line the following:
|
||||||
"
|
"
|
||||||
" lib/filename.ex:19:7: F: Pipe chain should start with a raw value.
|
" lib/filename.ex:19:7: F: Pipe chain should start with a raw value.
|
||||||
let l:pattern = '\v:(\d+):?(\d+)?: (.): (.+)$'
|
let l:pattern = '\v:(\d+):?(\d+)?: (.): (.+)$'
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:line in a:lines
|
||||||
let l:type = l:match[3]
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
let l:text = l:match[4]
|
|
||||||
|
|
||||||
" Refactoring opportunities
|
if len(l:match) == 0
|
||||||
if l:type is# 'F'
|
continue
|
||||||
let l:type = 'W'
|
endif
|
||||||
" Consistency
|
|
||||||
elseif l:type is# 'C'
|
|
||||||
let l:type = 'W'
|
|
||||||
" Software Design
|
|
||||||
elseif l:type is# 'D'
|
|
||||||
let l:type = 'I'
|
|
||||||
" Code Readability
|
|
||||||
elseif l:type is# 'R'
|
|
||||||
let l:type = 'I'
|
|
||||||
endif
|
|
||||||
|
|
||||||
call add(l:output, {
|
let l:type = l:match[3]
|
||||||
\ 'bufnr': a:buffer,
|
let l:text = l:match[4]
|
||||||
\ 'lnum': l:match[1] + 0,
|
|
||||||
\ 'col': l:match[2] + 0,
|
|
||||||
\ 'type': l:type,
|
|
||||||
\ 'text': l:text,
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
if l:type ==# 'C'
|
||||||
endfunction
|
let l:type = 'E'
|
||||||
|
elseif l:type ==# 'R'
|
||||||
|
let l:type = 'W'
|
||||||
|
endif
|
||||||
|
|
||||||
function! ale_linters#elixir#credo#GetCommand(buffer) abort
|
call add(l:output, {
|
||||||
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
|
\ 'bufnr': a:buffer,
|
||||||
|
\ 'lnum': l:match[1] + 0,
|
||||||
|
\ 'col': l:match[2] + 0,
|
||||||
|
\ 'type': l:type,
|
||||||
|
\ 'text': l:text,
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
return ale#path#CdString(l:project_root)
|
return l:output
|
||||||
\ . ' mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s'
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('elixir', {
|
call ale#linter#Define('elixir', {
|
||||||
\ 'name': 'credo',
|
\ 'name': 'credo',
|
||||||
\ 'executable': 'mix',
|
\ 'executable': 'mix',
|
||||||
\ 'command_callback': 'ale_linters#elixir#credo#GetCommand',
|
\ 'command': 'mix credo suggest --format=flycheck --read-from-stdin %s',
|
||||||
\ 'callback': 'ale_linters#elixir#credo#Handle',
|
\ 'callback': 'ale_linters#elixir#credo#Handle' })
|
||||||
\})
|
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
" Author: Fran C. - https://github.com/franciscoj
|
|
||||||
" Description: Add dialyzer support for elixir through dialyxir
|
|
||||||
" https://github.com/jeremyjh/dialyxir
|
|
||||||
|
|
||||||
function! ale_linters#elixir#dialyxir#Handle(buffer, lines) abort
|
|
||||||
" Matches patterns line the following:
|
|
||||||
"
|
|
||||||
" lib/filename.ex:19: Function fname/1 has no local return
|
|
||||||
let l:pattern = '\v(.+):(\d+): (.+)$'
|
|
||||||
let l:output = []
|
|
||||||
let l:type = 'W'
|
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
||||||
if bufname(a:buffer) == l:match[1]
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'bufnr': a:buffer,
|
|
||||||
\ 'lnum': l:match[2] + 0,
|
|
||||||
\ 'col': 0,
|
|
||||||
\ 'type': l:type,
|
|
||||||
\ 'text': l:match[3],
|
|
||||||
\})
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#elixir#dialyxir#GetCommand(buffer) abort
|
|
||||||
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
|
|
||||||
|
|
||||||
return ale#path#CdString(l:project_root)
|
|
||||||
\ . ' mix help dialyzer && mix dialyzer'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('elixir', {
|
|
||||||
\ 'name': 'dialyxir',
|
|
||||||
\ 'executable': 'mix',
|
|
||||||
\ 'command_callback': 'ale_linters#elixir#dialyxir#GetCommand',
|
|
||||||
\ 'callback': 'ale_linters#elixir#dialyxir#Handle',
|
|
||||||
\})
|
|
||||||
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
" Author: archseer - https://github.com/archSeer
|
|
||||||
|
|
||||||
function! ale_linters#elixir#dogma#Handle(buffer, lines) abort
|
|
||||||
" Matches patterns line the following:
|
|
||||||
"
|
|
||||||
" lib/filename.ex:19:7: F: Pipe chain should start with a raw value.
|
|
||||||
let l:pattern = '\v:(\d+):?(\d+)?: (.): (.+)$'
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
||||||
let l:type = l:match[3]
|
|
||||||
let l:text = l:match[4]
|
|
||||||
|
|
||||||
if l:type is# 'C'
|
|
||||||
let l:type = 'E'
|
|
||||||
elseif l:type is# 'R'
|
|
||||||
let l:type = 'W'
|
|
||||||
endif
|
|
||||||
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'bufnr': a:buffer,
|
|
||||||
\ 'lnum': l:match[1] + 0,
|
|
||||||
\ 'col': l:match[2] + 0,
|
|
||||||
\ 'type': l:type,
|
|
||||||
\ 'text': l:text,
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#elixir#dogma#GetCommand(buffer) abort
|
|
||||||
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
|
|
||||||
|
|
||||||
return ale#path#CdString(l:project_root)
|
|
||||||
\ . ' mix help dogma && mix dogma %s --format=flycheck'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('elixir', {
|
|
||||||
\ 'name': 'dogma',
|
|
||||||
\ 'executable': 'mix',
|
|
||||||
\ 'command_callback': 'ale_linters#elixir#dogma#GetCommand',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\ 'callback': 'ale_linters#elixir#dogma#Handle',
|
|
||||||
\})
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
" Author: Jon Parise <jon@indelible.org>
|
|
||||||
" Description: ElixirLS integration (https://github.com/JakeBecker/elixir-ls)
|
|
||||||
|
|
||||||
call ale#Set('elixir_elixir_ls_release', 'elixir-ls')
|
|
||||||
call ale#Set('elixir_elixir_ls_config', {})
|
|
||||||
|
|
||||||
function! ale_linters#elixir#elixir_ls#GetExecutable(buffer) abort
|
|
||||||
let l:dir = ale#path#Simplify(ale#Var(a:buffer, 'elixir_elixir_ls_release'))
|
|
||||||
let l:cmd = ale#Has('win32') ? '\language_server.bat' : '/language_server.sh'
|
|
||||||
|
|
||||||
return l:dir . l:cmd
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('elixir', {
|
|
||||||
\ 'name': 'elixir-ls',
|
|
||||||
\ 'lsp': 'stdio',
|
|
||||||
\ 'executable_callback': 'ale_linters#elixir#elixir_ls#GetExecutable',
|
|
||||||
\ 'command_callback': 'ale_linters#elixir#elixir_ls#GetExecutable',
|
|
||||||
\ 'project_root_callback': 'ale#handlers#elixir#FindMixUmbrellaRoot',
|
|
||||||
\ 'lsp_config_callback': ale#VarFunc('elixir_elixir_ls_config'),
|
|
||||||
\})
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
" Author: evnu - https://github.com/evnu
|
|
||||||
" Author: colbydehart - https://github.com/colbydehart
|
|
||||||
" Description: Mix compile checking for Elixir files
|
|
||||||
|
|
||||||
function! ale_linters#elixir#mix#Handle(buffer, lines) abort
|
|
||||||
" Matches patterns like the following:
|
|
||||||
"
|
|
||||||
" Error format
|
|
||||||
" ** (CompileError) apps/sim/lib/sim/server.ex:87: undefined function update_in/4
|
|
||||||
"
|
|
||||||
" TODO: Warning format
|
|
||||||
" warning: variable "foobar" does not exist and is being expanded to "foobar()", please use parentheses to remove the ambiguity or change the variable name
|
|
||||||
let l:pattern = '\v\(([^\)]+Error)\) ([^:]+):([^:]+): (.+)$'
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
||||||
let l:type = 'E'
|
|
||||||
let l:text = l:match[4]
|
|
||||||
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'bufnr': a:buffer,
|
|
||||||
\ 'lnum': l:match[3] + 0,
|
|
||||||
\ 'col': 0,
|
|
||||||
\ 'type': l:type,
|
|
||||||
\ 'text': l:text,
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#elixir#mix#GetCommand(buffer) abort
|
|
||||||
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)
|
|
||||||
|
|
||||||
let l:temp_dir = ale#engine#CreateDirectory(a:buffer)
|
|
||||||
|
|
||||||
let l:mix_build_path = has('win32')
|
|
||||||
\ ? 'set MIX_BUILD_PATH=' . ale#Escape(l:temp_dir) . ' &&'
|
|
||||||
\ : 'MIX_BUILD_PATH=' . ale#Escape(l:temp_dir)
|
|
||||||
|
|
||||||
return ale#path#CdString(l:project_root)
|
|
||||||
\ . l:mix_build_path
|
|
||||||
\ . ' mix compile %s'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('elixir', {
|
|
||||||
\ 'name': 'mix',
|
|
||||||
\ 'executable': 'mix',
|
|
||||||
\ 'command_callback': 'ale_linters#elixir#mix#GetCommand',
|
|
||||||
\ 'callback': 'ale_linters#elixir#mix#Handle',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
|
||||||
@@ -1,172 +1,65 @@
|
|||||||
" Author: buffalocoder - https://github.com/buffalocoder, soywod - https://github.com/soywod, hecrj - https://github.com/hecrj
|
" Author: buffalocoder - https://github.com/buffalocoder
|
||||||
" Description: Elm linting in Ale. Closely follows the Syntastic checker in https://github.com/ElmCast/elm-vim.
|
" Description: Elm linting in Ale. Closely follows the Syntastic checker in https://github.com/ElmCast/elm-vim.
|
||||||
|
|
||||||
call ale#Set('elm_make_executable', 'elm')
|
|
||||||
call ale#Set('elm_make_use_global', get(g:, 'ale_use_global_executables', 0))
|
|
||||||
|
|
||||||
function! ale_linters#elm#make#Handle(buffer, lines) abort
|
function! ale_linters#elm#make#Handle(buffer, lines) abort
|
||||||
let l:output = []
|
let l:output = []
|
||||||
let l:unparsed_lines = []
|
let l:is_windows = has('win32')
|
||||||
|
let l:temp_dir = l:is_windows ? $TMP : $TMPDIR
|
||||||
for l:line in a:lines
|
for l:line in a:lines
|
||||||
if l:line[0] is# '{'
|
if l:line[0] ==# '['
|
||||||
" Elm 0.19
|
let l:errors = json_decode(l:line)
|
||||||
call ale_linters#elm#make#HandleElm019Line(l:line, l:output)
|
|
||||||
elseif l:line[0] is# '['
|
|
||||||
" Elm 0.18
|
|
||||||
call ale_linters#elm#make#HandleElm018Line(l:line, l:output)
|
|
||||||
elseif l:line isnot# 'Successfully generated /dev/null'
|
|
||||||
call add(l:unparsed_lines, l:line)
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
|
|
||||||
if len(l:unparsed_lines) > 0
|
for l:error in l:errors
|
||||||
call add(l:output, {
|
" Check if file is from the temp directory.
|
||||||
\ 'lnum': 1,
|
" Filters out any errors not related to the buffer.
|
||||||
\ 'type': 'E',
|
if l:is_windows
|
||||||
\ 'text': l:unparsed_lines[0],
|
let l:file_is_buffer = l:error.file[0:len(l:temp_dir) - 1] ==? l:temp_dir
|
||||||
\ 'detail': join(l:unparsed_lines, "\n")
|
else
|
||||||
\})
|
let l:file_is_buffer = l:error.file[0:len(l:temp_dir) - 1] ==# l:temp_dir
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#elm#make#HandleElm019Line(line, output) abort
|
|
||||||
let l:report = json_decode(a:line)
|
|
||||||
|
|
||||||
if l:report.type is? 'error'
|
|
||||||
" General problem
|
|
||||||
let l:details = ale_linters#elm#make#ParseMessage(l:report.message)
|
|
||||||
|
|
||||||
if empty(l:report.path)
|
|
||||||
let l:report.path = 'Elm'
|
|
||||||
endif
|
|
||||||
|
|
||||||
if ale_linters#elm#make#FileIsBuffer(l:report.path)
|
|
||||||
call add(a:output, {
|
|
||||||
\ 'lnum': 1,
|
|
||||||
\ 'type': 'E',
|
|
||||||
\ 'text': l:details,
|
|
||||||
\})
|
|
||||||
else
|
|
||||||
call add(a:output, {
|
|
||||||
\ 'lnum': 1,
|
|
||||||
\ 'type': 'E',
|
|
||||||
\ 'text': l:report.path .' - '. l:details,
|
|
||||||
\ 'detail': l:report.path ." ----------\n\n". l:details,
|
|
||||||
\})
|
|
||||||
endif
|
|
||||||
else
|
|
||||||
" Compilation errors
|
|
||||||
for l:error in l:report.errors
|
|
||||||
let l:file_is_buffer = ale_linters#elm#make#FileIsBuffer(l:error.path)
|
|
||||||
|
|
||||||
for l:problem in l:error.problems
|
|
||||||
let l:details = ale_linters#elm#make#ParseMessage(l:problem.message)
|
|
||||||
|
|
||||||
if l:file_is_buffer
|
if l:file_is_buffer
|
||||||
" Buffer module has problems
|
call add(l:output, {
|
||||||
call add(a:output, {
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': l:problem.region.start.line,
|
\ 'lnum': l:error.region.start.line,
|
||||||
\ 'col': l:problem.region.start.column,
|
\ 'col': l:error.region.start.column,
|
||||||
\ 'end_lnum': l:problem.region.end.line,
|
\ 'type': (l:error.type ==? 'error') ? 'E' : 'W',
|
||||||
\ 'end_col': l:problem.region.end.column,
|
\ 'text': l:error.overview,
|
||||||
\ 'type': 'E',
|
\ 'detail': l:error.overview . "\n\n" . l:error.details
|
||||||
\ 'text': l:details,
|
|
||||||
\})
|
|
||||||
else
|
|
||||||
" Imported module has problems
|
|
||||||
let l:location = l:error.path .':'. l:problem.region.start.line
|
|
||||||
call add(a:output, {
|
|
||||||
\ 'lnum': 1,
|
|
||||||
\ 'type': 'E',
|
|
||||||
\ 'text': l:location .' - '. l:details,
|
|
||||||
\ 'detail': l:location ." ----------\n\n". l:details,
|
|
||||||
\})
|
\})
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
endfor
|
|
||||||
endif
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#elm#make#HandleElm018Line(line, output) abort
|
|
||||||
let l:errors = json_decode(a:line)
|
|
||||||
|
|
||||||
for l:error in l:errors
|
|
||||||
let l:file_is_buffer = ale_linters#elm#make#FileIsBuffer(l:error.file)
|
|
||||||
|
|
||||||
if l:file_is_buffer
|
|
||||||
" Current buffer has problems
|
|
||||||
call add(a:output, {
|
|
||||||
\ 'lnum': l:error.region.start.line,
|
|
||||||
\ 'col': l:error.region.start.column,
|
|
||||||
\ 'end_lnum': l:error.region.end.line,
|
|
||||||
\ 'end_col': l:error.region.end.column,
|
|
||||||
\ 'type': (l:error.type is? 'error') ? 'E' : 'W',
|
|
||||||
\ 'text': l:error.overview,
|
|
||||||
\ 'detail': l:error.overview . "\n\n" . l:error.details
|
|
||||||
\})
|
|
||||||
elseif l:error.type is? 'error'
|
|
||||||
" Imported module has errors
|
|
||||||
let l:location = l:error.file .':'. l:error.region.start.line
|
|
||||||
|
|
||||||
call add(a:output, {
|
|
||||||
\ 'lnum': 1,
|
|
||||||
\ 'type': 'E',
|
|
||||||
\ 'text': l:location .' - '. l:error.overview,
|
|
||||||
\ 'detail': l:location ." ----------\n\n". l:error.overview . "\n\n" . l:error.details
|
|
||||||
\})
|
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#elm#make#FileIsBuffer(path) abort
|
return l:output
|
||||||
return ale#path#IsTempName(a:path)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#elm#make#ParseMessage(message) abort
|
|
||||||
return join(map(copy(a:message), 'ale_linters#elm#make#ParseMessageItem(v:val)'), '')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#elm#make#ParseMessageItem(item) abort
|
|
||||||
if type(a:item) is v:t_string
|
|
||||||
return a:item
|
|
||||||
else
|
|
||||||
return a:item.string
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Return the command to execute the linter in the projects directory.
|
" Return the command to execute the linter in the projects directory.
|
||||||
" If it doesn't, then this will fail when imports are needed.
|
" If it doesn't, then this will fail when imports are needed.
|
||||||
function! ale_linters#elm#make#GetCommand(buffer) abort
|
function! ale_linters#elm#make#GetCommand(buffer) abort
|
||||||
let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json')
|
let l:elm_package = ale#util#FindNearestFile(a:buffer, 'elm-package.json')
|
||||||
|
if empty(l:elm_package)
|
||||||
if empty(l:elm_json)
|
|
||||||
" Fallback to Elm 0.18
|
|
||||||
let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm-package.json')
|
|
||||||
endif
|
|
||||||
|
|
||||||
if empty(l:elm_json)
|
|
||||||
let l:dir_set_cmd = ''
|
let l:dir_set_cmd = ''
|
||||||
else
|
else
|
||||||
let l:root_dir = fnamemodify(l:elm_json, ':p:h')
|
let l:root_dir = fnamemodify(l:elm_package, ':p:h')
|
||||||
let l:dir_set_cmd = 'cd ' . ale#Escape(l:root_dir) . ' && '
|
let l:dir_set_cmd = 'cd ' . fnameescape(l:root_dir) . ' && '
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" The elm compiler, at the time of this writing, uses '/dev/null' as
|
" The elm-make compiler, at the time of this writing, uses '/dev/null' as
|
||||||
" a sort of flag to tell the compiler not to generate an output file,
|
" a sort of flag to tell the compiler not to generate an output file,
|
||||||
" which is why this is hard coded here.
|
" which is why this is hard coded here.
|
||||||
" Source: https://github.com/elm-lang/elm-compiler/blob/19d5a769b30ec0b2fc4475985abb4cd94cd1d6c3/builder/src/Generate/Output.hs#L253
|
" Source: https://github.com/elm-lang/elm-make/blob/master/src/Flags.hs
|
||||||
return l:dir_set_cmd . '%e make --report=json --output=/dev/null %t'
|
let l:elm_cmd = 'elm-make --report=json --output='.shellescape('/dev/null')
|
||||||
|
|
||||||
|
return l:dir_set_cmd . ' ' . l:elm_cmd . ' %t'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('elm', {
|
call ale#linter#Define('elm', {
|
||||||
\ 'name': 'make',
|
\ 'name': 'make',
|
||||||
\ 'executable_callback': ale#node#FindExecutableFunc('elm_make', [
|
\ 'executable': 'elm-make',
|
||||||
\ 'node_modules/.bin/elm',
|
\ 'output_stream': 'both',
|
||||||
\ ]),
|
\ 'command_callback': 'ale_linters#elm#make#GetCommand',
|
||||||
\ 'output_stream': 'both',
|
\ 'callback': 'ale_linters#elm#make#Handle'
|
||||||
\ 'command_callback': 'ale_linters#elm#make#GetCommand',
|
|
||||||
\ 'callback': 'ale_linters#elm#make#Handle'
|
|
||||||
\})
|
\})
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,9 @@
|
|||||||
let g:ale_erlang_erlc_options = get(g:, 'ale_erlang_erlc_options', '')
|
let g:ale_erlang_erlc_options = get(g:, 'ale_erlang_erlc_options', '')
|
||||||
|
|
||||||
function! ale_linters#erlang#erlc#GetCommand(buffer) abort
|
function! ale_linters#erlang#erlc#GetCommand(buffer) abort
|
||||||
let l:output_file = ale#util#Tempname()
|
let l:output_file = tempname()
|
||||||
call ale#engine#ManageFile(a:buffer, l:output_file)
|
call ale#engine#ManageFile(a:buffer, l:output_file)
|
||||||
|
return 'erlc -o ' . fnameescape(l:output_file) . ' ' . g:ale_erlang_erlc_options . ' %t'
|
||||||
return 'erlc -o ' . ale#Escape(l:output_file)
|
|
||||||
\ . ' ' . ale#Var(a:buffer, 'erlang_erlc_options')
|
|
||||||
\ . ' %t'
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#erlang#erlc#Handle(buffer, lines) abort
|
function! ale_linters#erlang#erlc#Handle(buffer, lines) abort
|
||||||
@@ -17,7 +14,7 @@ function! ale_linters#erlang#erlc#Handle(buffer, lines) abort
|
|||||||
" error.erl:4: variable 'B' is unbound
|
" error.erl:4: variable 'B' is unbound
|
||||||
" error.erl:3: Warning: function main/0 is unused
|
" error.erl:3: Warning: function main/0 is unused
|
||||||
" error.erl:4: Warning: variable 'A' is unused
|
" error.erl:4: Warning: variable 'A' is unused
|
||||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+): (Warning: )?(.+)$'
|
let l:pattern = '\v^([^:]+):(\d+): (Warning: )?(.+)$'
|
||||||
|
|
||||||
" parse_transforms are a special case. The error message does not indicate a location:
|
" parse_transforms are a special case. The error message does not indicate a location:
|
||||||
" error.erl: undefined parse transform 'some_parse_transform'
|
" error.erl: undefined parse transform 'some_parse_transform'
|
||||||
@@ -27,7 +24,7 @@ function! ale_linters#erlang#erlc#Handle(buffer, lines) abort
|
|||||||
let l:pattern_no_module_definition = '\v(no module definition)$'
|
let l:pattern_no_module_definition = '\v(no module definition)$'
|
||||||
let l:pattern_unused = '\v(.* is unused)$'
|
let l:pattern_unused = '\v(.* is unused)$'
|
||||||
|
|
||||||
let l:is_hrl = fnamemodify(bufname(a:buffer), ':e') is# 'hrl'
|
let l:is_hrl = fnamemodify(bufname(a:buffer), ':e') ==# 'hrl'
|
||||||
|
|
||||||
for l:line in a:lines
|
for l:line in a:lines
|
||||||
let l:match = matchlist(l:line, l:pattern)
|
let l:match = matchlist(l:line, l:pattern)
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
" Author: Dmitri Vereshchagin <dmitri.vereshchagin@gmail.com>
|
|
||||||
" Description: SyntaxErl linter for Erlang files
|
|
||||||
|
|
||||||
call ale#Set('erlang_syntaxerl_executable', 'syntaxerl')
|
|
||||||
|
|
||||||
function! ale_linters#erlang#syntaxerl#GetCommand(buffer, output) abort
|
|
||||||
let l:use_b_option = match(a:output, '\C\V-b, --base\>') > -1
|
|
||||||
|
|
||||||
return '%e' . (l:use_b_option ? ' -b %s %t' : ' %t')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#erlang#syntaxerl#Handle(buffer, lines) abort
|
|
||||||
let l:pattern = '\v\C:(\d+):( warning:)? (.+)'
|
|
||||||
let l:loclist = []
|
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
||||||
call add(l:loclist, {
|
|
||||||
\ 'lnum': l:match[1] + 0,
|
|
||||||
\ 'text': l:match[3],
|
|
||||||
\ 'type': empty(l:match[2]) ? 'E' : 'W',
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:loclist
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('erlang', {
|
|
||||||
\ 'name': 'syntaxerl',
|
|
||||||
\ 'executable_callback': ale#VarFunc('erlang_syntaxerl_executable'),
|
|
||||||
\ 'command_chain': [
|
|
||||||
\ {'callback': {-> '%e -h'}},
|
|
||||||
\ {'callback': 'ale_linters#erlang#syntaxerl#GetCommand'},
|
|
||||||
\ ],
|
|
||||||
\ 'callback': 'ale_linters#erlang#syntaxerl#Handle',
|
|
||||||
\})
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
" Author: Matthias Guenther - https://wikimatze.de, Eddie Lebow https://github.com/elebow
|
|
||||||
" Description: ERB from the Ruby standard library, for eruby/erb files
|
|
||||||
|
|
||||||
function! ale_linters#eruby#erb#GetCommand(buffer) abort
|
|
||||||
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
|
|
||||||
|
|
||||||
if empty(l:rails_root)
|
|
||||||
return 'erb -P -T - -x %t | ruby -c'
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Rails-flavored eRuby does not comply with the standard as understood by
|
|
||||||
" ERB, so we'll have to do some substitution. This does not reduce the
|
|
||||||
" effectiveness of the linter—the translated code is still evaluated.
|
|
||||||
return 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('eruby', {
|
|
||||||
\ 'name': 'erb',
|
|
||||||
\ 'aliases': ['erubylint'],
|
|
||||||
\ 'executable': 'erb',
|
|
||||||
\ 'output_stream': 'stderr',
|
|
||||||
\ 'command_callback': 'ale_linters#eruby#erb#GetCommand',
|
|
||||||
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
|
|
||||||
\})
|
|
||||||
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
" Author: Eddie Lebow https://github.com/elebow
|
|
||||||
" Description: eruby checker using `erubi`
|
|
||||||
|
|
||||||
function! ale_linters#eruby#erubi#CheckErubi(buffer) abort
|
|
||||||
return 'ruby -r erubi/capture_end -e ' . ale#Escape('""')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#eruby#erubi#GetCommand(buffer, check_erubi_output) abort
|
|
||||||
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
|
|
||||||
|
|
||||||
if (!empty(a:check_erubi_output))
|
|
||||||
" The empty command in CheckErubi returns nothing if erubi runs and
|
|
||||||
" emits an error if erubi is not present
|
|
||||||
return ''
|
|
||||||
endif
|
|
||||||
|
|
||||||
if empty(l:rails_root)
|
|
||||||
return 'ruby -r erubi/capture_end -e ' . ale#Escape('puts Erubi::CaptureEndEngine.new($stdin.read).src') . '< %t | ruby -c'
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Rails-flavored eRuby does not comply with the standard as understood by
|
|
||||||
" Erubi, so we'll have to do some substitution. This does not reduce the
|
|
||||||
" effectiveness of the linter---the translated code is still evaluated.
|
|
||||||
return 'ruby -r erubi/capture_end -e ' . ale#Escape('puts Erubi::CaptureEndEngine.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('eruby', {
|
|
||||||
\ 'name': 'erubi',
|
|
||||||
\ 'executable': 'ruby',
|
|
||||||
\ 'command_chain': [
|
|
||||||
\ {'callback': 'ale_linters#eruby#erubi#CheckErubi'},
|
|
||||||
\ {'callback': 'ale_linters#eruby#erubi#GetCommand', 'output_stream': 'stderr'},
|
|
||||||
\ ],
|
|
||||||
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
|
|
||||||
\})
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
" Author: Jake Zimmerman <jake@zimmerman.io>, Eddie Lebow https://github.com/elebow
|
|
||||||
" Description: eruby checker using `erubis`, instead of `erb`
|
|
||||||
|
|
||||||
function! ale_linters#eruby#erubis#GetCommand(buffer) abort
|
|
||||||
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
|
|
||||||
|
|
||||||
if empty(l:rails_root)
|
|
||||||
return 'erubis -x %t | ruby -c'
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Rails-flavored eRuby does not comply with the standard as understood by
|
|
||||||
" Erubis, so we'll have to do some substitution. This does not reduce the
|
|
||||||
" effectiveness of the linter - the translated code is still evaluated.
|
|
||||||
return 'ruby -r erubis -e ' . ale#Escape('puts Erubis::Eruby.new($stdin.read.gsub(%{<%=},%{<%})).src') . '< %t | ruby -c'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('eruby', {
|
|
||||||
\ 'name': 'erubis',
|
|
||||||
\ 'executable': 'erubis',
|
|
||||||
\ 'output_stream': 'stderr',
|
|
||||||
\ 'command_callback': 'ale_linters#eruby#erubis#GetCommand',
|
|
||||||
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
|
|
||||||
\})
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
" Author: aclemons - https://github.com/aclemons
|
|
||||||
" based on the ale rubocop linter
|
|
||||||
" Description: Ruumba, RuboCop linting for ERB templates.
|
|
||||||
|
|
||||||
call ale#Set('eruby_ruumba_executable', 'ruumba')
|
|
||||||
call ale#Set('eruby_ruumba_options', '')
|
|
||||||
|
|
||||||
function! ale_linters#eruby#ruumba#GetCommand(buffer) abort
|
|
||||||
let l:executable = ale#Var(a:buffer, 'eruby_ruumba_executable')
|
|
||||||
|
|
||||||
return ale#handlers#ruby#EscapeExecutable(l:executable, 'ruumba')
|
|
||||||
\ . ' --format json --force-exclusion '
|
|
||||||
\ . ale#Var(a:buffer, 'eruby_ruumba_options')
|
|
||||||
\ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p'))
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#eruby#ruumba#Handle(buffer, lines) abort
|
|
||||||
try
|
|
||||||
let l:errors = json_decode(a:lines[0])
|
|
||||||
catch
|
|
||||||
return []
|
|
||||||
endtry
|
|
||||||
|
|
||||||
if !has_key(l:errors, 'summary')
|
|
||||||
\|| l:errors['summary']['offense_count'] == 0
|
|
||||||
\|| empty(l:errors['files'])
|
|
||||||
return []
|
|
||||||
endif
|
|
||||||
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:error in l:errors['files'][0]['offenses']
|
|
||||||
let l:start_col = l:error['location']['column'] + 0
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'lnum': l:error['location']['line'] + 0,
|
|
||||||
\ 'col': l:start_col,
|
|
||||||
\ 'end_col': l:start_col + l:error['location']['length'] - 1,
|
|
||||||
\ 'code': l:error['cop_name'],
|
|
||||||
\ 'text': l:error['message'],
|
|
||||||
\ 'type': ale_linters#eruby#ruumba#GetType(l:error['severity']),
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#eruby#ruumba#GetType(severity) abort
|
|
||||||
if a:severity is? 'convention'
|
|
||||||
\|| a:severity is? 'warning'
|
|
||||||
\|| a:severity is? 'refactor'
|
|
||||||
return 'W'
|
|
||||||
endif
|
|
||||||
|
|
||||||
return 'E'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('eruby', {
|
|
||||||
\ 'name': 'ruumba',
|
|
||||||
\ 'executable_callback': ale#VarFunc('eruby_ruumba_executable'),
|
|
||||||
\ 'command_callback': 'ale_linters#eruby#ruumba#GetCommand',
|
|
||||||
\ 'callback': 'ale_linters#eruby#ruumba#Handle',
|
|
||||||
\})
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
" Author: Niraj Thapaliya - https://github.com/nthapaliya
|
|
||||||
" Description: Lints fish files using fish -n
|
|
||||||
|
|
||||||
function! ale_linters#fish#fish#Handle(buffer, lines) abort
|
|
||||||
" Matches patterns such as:
|
|
||||||
"
|
|
||||||
" home/.config/fish/functions/foo.fish (line 1): Missing end to balance this function definition
|
|
||||||
" function foo
|
|
||||||
" ^
|
|
||||||
"
|
|
||||||
" OR, patterns such as:
|
|
||||||
"
|
|
||||||
" Unsupported use of '||'. In fish, please use 'COMMAND; or COMMAND'.
|
|
||||||
" /tmp/vLz620o/258/test.fish (line 2): if set -q SSH_CLIENT || set -q SSH_TTY
|
|
||||||
" ^
|
|
||||||
"
|
|
||||||
" fish -n can return errors in either format.
|
|
||||||
let l:pattern = '^\(.* (line \(\d\+\)): \)\(.*\)$'
|
|
||||||
let l:column_pattern = '^ *\^'
|
|
||||||
let l:output = []
|
|
||||||
let l:column_offset = 0
|
|
||||||
let l:last_line_with_message = ''
|
|
||||||
|
|
||||||
for l:line in a:lines
|
|
||||||
" Look for error lines first.
|
|
||||||
let l:match = matchlist(l:line, l:pattern)
|
|
||||||
|
|
||||||
if !empty(l:match)
|
|
||||||
if !empty(l:last_line_with_message)
|
|
||||||
let l:text = l:last_line_with_message
|
|
||||||
else
|
|
||||||
let l:text = l:match[3]
|
|
||||||
endif
|
|
||||||
|
|
||||||
let l:column_offset = len(l:match[1])
|
|
||||||
|
|
||||||
let l:last_line_with_message = ''
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'col': 0,
|
|
||||||
\ 'lnum': str2nr(l:match[2]),
|
|
||||||
\ 'text': l:text,
|
|
||||||
\})
|
|
||||||
else
|
|
||||||
" Look for column markers like ' ^' second.
|
|
||||||
" The column index will be set according to how long the line is.
|
|
||||||
let l:column_match = matchstr(l:line, l:column_pattern)
|
|
||||||
|
|
||||||
if !empty(l:column_match) && !empty(l:output)
|
|
||||||
let l:output[-1].col = len(l:column_match) - l:column_offset
|
|
||||||
let l:last_line_with_message = ''
|
|
||||||
else
|
|
||||||
let l:last_line_with_message = l:line
|
|
||||||
let l:column_offset = 0
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('fish', {
|
|
||||||
\ 'name': 'fish',
|
|
||||||
\ 'output_stream': 'stderr',
|
|
||||||
\ 'executable': 'fish',
|
|
||||||
\ 'command': 'fish -n %t',
|
|
||||||
\ 'callback': 'ale_linters#fish#fish#Handle',
|
|
||||||
\})
|
|
||||||
@@ -1,11 +1,10 @@
|
|||||||
" Author: w0rp <devw0rp@gmail.com>
|
" Author: w0rp <devw0rp@gmail.com>
|
||||||
" Description: gcc for Fortran files
|
" Description: gcc for Fortran files
|
||||||
|
|
||||||
" This option can be set to 0 to use -ffixed-form
|
|
||||||
call ale#Set('fortran_gcc_use_free_form', 1)
|
|
||||||
call ale#Set('fortran_gcc_executable', 'gcc')
|
|
||||||
" Set this option to change the GCC options for warnings for Fortran.
|
" Set this option to change the GCC options for warnings for Fortran.
|
||||||
call ale#Set('fortran_gcc_options', '-Wall')
|
if !exists('g:ale_fortran_gcc_options')
|
||||||
|
let g:ale_fortran_gcc_options = '-Wall'
|
||||||
|
endif
|
||||||
|
|
||||||
function! ale_linters#fortran#gcc#Handle(buffer, lines) abort
|
function! ale_linters#fortran#gcc#Handle(buffer, lines) abort
|
||||||
" We have to match a starting line and a later ending line together,
|
" We have to match a starting line and a later ending line together,
|
||||||
@@ -36,7 +35,7 @@ function! ale_linters#fortran#gcc#Handle(buffer, lines) abort
|
|||||||
|
|
||||||
" Now we have the text, we can set it and add the error.
|
" Now we have the text, we can set it and add the error.
|
||||||
let l:last_loclist_obj.text = l:match[2]
|
let l:last_loclist_obj.text = l:match[2]
|
||||||
let l:last_loclist_obj.type = l:match[1] is# 'Warning' ? 'W' : 'E'
|
let l:last_loclist_obj.type = l:match[1] ==# 'Warning' ? 'W' : 'E'
|
||||||
call add(l:output, l:last_loclist_obj)
|
call add(l:output, l:last_loclist_obj)
|
||||||
else
|
else
|
||||||
let l:last_loclist_obj = {
|
let l:last_loclist_obj = {
|
||||||
@@ -53,20 +52,12 @@ function! ale_linters#fortran#gcc#Handle(buffer, lines) abort
|
|||||||
return l:output
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#fortran#gcc#GetCommand(buffer) abort
|
|
||||||
let l:layout_option = ale#Var(a:buffer, 'fortran_gcc_use_free_form')
|
|
||||||
\ ? '-ffree-form'
|
|
||||||
\ : '-ffixed-form'
|
|
||||||
|
|
||||||
return '%e -S -x f95 -fsyntax-only ' . l:layout_option
|
|
||||||
\ . ale#Pad(ale#Var(a:buffer, 'fortran_gcc_options'))
|
|
||||||
\ . ' -'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('fortran', {
|
call ale#linter#Define('fortran', {
|
||||||
\ 'name': 'gcc',
|
\ 'name': 'gcc',
|
||||||
\ 'output_stream': 'stderr',
|
\ 'output_stream': 'stderr',
|
||||||
\ 'executable_callback': ale#VarFunc('fortran_gcc_executable'),
|
\ 'executable': 'gcc',
|
||||||
\ 'command_callback': 'ale_linters#fortran#gcc#GetCommand',
|
\ 'command': 'gcc -S -x f95 -fsyntax-only -ffree-form '
|
||||||
|
\ . g:ale_fortran_gcc_options
|
||||||
|
\ . ' -',
|
||||||
\ 'callback': 'ale_linters#fortran#gcc#Handle',
|
\ 'callback': 'ale_linters#fortran#gcc#Handle',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
" Author: unpairedbracket ben.spiers22@gmail.com
|
|
||||||
" Description: A language server for fortran
|
|
||||||
|
|
||||||
call ale#Set('fortran_language_server_executable', 'fortls')
|
|
||||||
call ale#Set('fortran_language_server_use_global', get(g:, 'ale_use_global_executables', 0))
|
|
||||||
|
|
||||||
function! ale_linters#fortran#language_server#GetProjectRoot(buffer) abort
|
|
||||||
let l:fortls_file = ale#path#FindNearestFile(a:buffer, '.fortls')
|
|
||||||
|
|
||||||
return !empty(l:fortls_file) ? fnamemodify(l:fortls_file, ':h') : ''
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('fortran', {
|
|
||||||
\ 'name': 'language_server',
|
|
||||||
\ 'lsp': 'stdio',
|
|
||||||
\ 'executable_callback': ale#VarFunc('fortran_language_server_executable'),
|
|
||||||
\ 'command': '%e',
|
|
||||||
\ 'project_root_callback': 'ale_linters#fortran#language_server#GetProjectRoot',
|
|
||||||
\})
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
" Author: Jansen Mitchell https://github.com/JansenMitchell
|
|
||||||
" Description: proselint for Fountain files
|
|
||||||
|
|
||||||
call ale#linter#Define('fountain', {
|
|
||||||
\ 'name': 'proselint',
|
|
||||||
\ 'executable': 'proselint',
|
|
||||||
\ 'command': 'proselint %t',
|
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
|
||||||
\})
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
" Author: RyanSquared <vandor2012@gmail.com>
|
|
||||||
" Description: `fusion-lint` linter for FusionScript files
|
|
||||||
|
|
||||||
call ale#Set('fuse_fusionlint_executable', 'fusion-lint')
|
|
||||||
call ale#Set('fuse_fusionlint_options', '')
|
|
||||||
|
|
||||||
function! ale_linters#fuse#fusionlint#GetCommand(buffer) abort
|
|
||||||
return '%e' . ale#Pad(ale#Var(a:buffer, 'fuse_fusionlint_options'))
|
|
||||||
\ . ' --filename %s -i'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#fuse#fusionlint#Handle(buffer, lines) abort
|
|
||||||
let l:pattern = '^.*:\(\d\+\):\(\d\+\): (\([WE]\)\d\+) \(.\+\)$'
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'lnum': l:match[1] + 0,
|
|
||||||
\ 'col': l:match[2] + 0,
|
|
||||||
\ 'text': l:match[4],
|
|
||||||
\ 'type': l:match[3],
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('fuse', {
|
|
||||||
\ 'name': 'fusionlint',
|
|
||||||
\ 'executable_callback': ale#VarFunc('fuse_fusionlint_executable'),
|
|
||||||
\ 'command_callback': 'ale_linters#fuse#fusionlint#GetCommand',
|
|
||||||
\ 'callback': 'ale_linters#fuse#fusionlint#Handle',
|
|
||||||
\})
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
" Author: Nick Yamane <nick.diego@gmail.com>
|
|
||||||
" Description: gitlint for git commit message files
|
|
||||||
|
|
||||||
call ale#Set('gitcommit_gitlint_executable', 'gitlint')
|
|
||||||
call ale#Set('gitcommit_gitlint_options', '')
|
|
||||||
call ale#Set('gitcommit_gitlint_use_global', get(g:, 'ale_use_global_executables', 0))
|
|
||||||
|
|
||||||
function! ale_linters#gitcommit#gitlint#GetExecutable(buffer) abort
|
|
||||||
return ale#python#FindExecutable(a:buffer, 'gitcommit_gitlint', ['gitlint'])
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#gitcommit#gitlint#GetCommand(buffer) abort
|
|
||||||
let l:options = ale#Var(a:buffer, 'gitcommit_gitlint_options')
|
|
||||||
|
|
||||||
return '%e' . ale#Pad(l:options) . ' lint'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#gitcommit#gitlint#Handle(buffer, lines) abort
|
|
||||||
" Matches patterns line the following:
|
|
||||||
let l:pattern = '\v^(\d+): (\w+) (.*)$'
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
||||||
let l:code = l:match[2]
|
|
||||||
|
|
||||||
if !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
|
||||||
if l:code is# 'T2' || l:code is# 'B2'
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
let l:item = {
|
|
||||||
\ 'lnum': l:match[1] + 0,
|
|
||||||
\ 'text': l:match[3],
|
|
||||||
\ 'code': l:code,
|
|
||||||
\ 'type': 'E',
|
|
||||||
\}
|
|
||||||
|
|
||||||
call add(l:output, l:item)
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('gitcommit', {
|
|
||||||
\ 'name': 'gitlint',
|
|
||||||
\ 'output_stream': 'stderr',
|
|
||||||
\ 'executable_callback': 'ale_linters#gitcommit#gitlint#GetExecutable',
|
|
||||||
\ 'command_callback': 'ale_linters#gitcommit#gitlint#GetCommand',
|
|
||||||
\ 'callback': 'ale_linters#gitcommit#gitlint#Handle',
|
|
||||||
\})
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
" Author: Sven-Hendrik Haase <svenstaro@gmail.com>
|
|
||||||
" Description: glslang-based linter for glsl files
|
|
||||||
"
|
|
||||||
" TODO: Once https://github.com/KhronosGroup/glslang/pull/1047 is accepted,
|
|
||||||
" we can use stdin.
|
|
||||||
|
|
||||||
call ale#Set('glsl_glslang_executable', 'glslangValidator')
|
|
||||||
call ale#Set('glsl_glslang_options', '')
|
|
||||||
|
|
||||||
function! ale_linters#glsl#glslang#GetCommand(buffer) abort
|
|
||||||
return '%e'
|
|
||||||
\ . ale#Pad(ale#Var(a:buffer, 'glsl_glslang_options'))
|
|
||||||
\ . ' -C %t'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#glsl#glslang#Handle(buffer, lines) abort
|
|
||||||
" Matches patterns like the following:
|
|
||||||
"
|
|
||||||
" ERROR: 0:5: 'foo' : undeclared identifier
|
|
||||||
let l:pattern = '^\(.\+\): \(\d\+\):\(\d\+\): \(.\+\)'
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'lnum': str2nr(l:match[3]),
|
|
||||||
\ 'col': str2nr(l:match[2]),
|
|
||||||
\ 'text': l:match[4],
|
|
||||||
\ 'type': l:match[1] is# 'ERROR' ? 'E' : 'W',
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('glsl', {
|
|
||||||
\ 'name': 'glslang',
|
|
||||||
\ 'executable_callback': ale#VarFunc('glsl_glslang_executable'),
|
|
||||||
\ 'command_callback': 'ale_linters#glsl#glslang#GetCommand',
|
|
||||||
\ 'callback': 'ale_linters#glsl#glslang#Handle',
|
|
||||||
\})
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
" Author: Sven-Hendrik Haase <svenstaro@gmail.com>
|
|
||||||
" Description: A language server for glsl
|
|
||||||
|
|
||||||
call ale#Set('glsl_glslls_executable', 'glslls')
|
|
||||||
call ale#Set('glsl_glslls_logfile', '')
|
|
||||||
|
|
||||||
function! ale_linters#glsl#glslls#GetCommand(buffer) abort
|
|
||||||
let l:logfile = ale#Var(a:buffer, 'glsl_glslls_logfile')
|
|
||||||
let l:logfile_args = ''
|
|
||||||
|
|
||||||
if l:logfile isnot# ''
|
|
||||||
let l:logfile_args = ' --verbose -l ' . l:logfile
|
|
||||||
endif
|
|
||||||
|
|
||||||
return '%e' . l:logfile_args . ' --stdin'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#glsl#glslls#GetProjectRoot(buffer) abort
|
|
||||||
let l:project_root = ale#c#FindProjectRoot(a:buffer)
|
|
||||||
|
|
||||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h:h') : ''
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('glsl', {
|
|
||||||
\ 'name': 'glslls',
|
|
||||||
\ 'lsp': 'stdio',
|
|
||||||
\ 'executable_callback': ale#VarFunc('glsl_glslls_executable'),
|
|
||||||
\ 'command_callback': 'ale_linters#glsl#glslls#GetCommand',
|
|
||||||
\ 'project_root_callback': 'ale_linters#glsl#glslls#GetProjectRoot',
|
|
||||||
\})
|
|
||||||
@@ -1,56 +1,218 @@
|
|||||||
" Author: Joshua Rubin <joshua@rubixconsulting.com>, Ben Reedy <https://github.com/breed808>,
|
" Author: Joshua Rubin <joshua@rubixconsulting.com>
|
||||||
" Jeff Willette <jrwillette88@gmail.com>
|
|
||||||
" Description: go build for Go files
|
" Description: go build for Go files
|
||||||
|
|
||||||
" inspired by work from dzhou121 <dzhou121@gmail.com>
|
" inspired by work from dzhou121 <dzhou121@gmail.com>
|
||||||
|
|
||||||
call ale#Set('go_go_executable', 'go')
|
function! ale_linters#go#gobuild#GoEnv(buffer) abort
|
||||||
call ale#Set('go_gobuild_options', '')
|
if exists('s:go_env')
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
function! ale_linters#go#gobuild#GetCommand(buffer) abort
|
return 'go env GOPATH GOROOT'
|
||||||
let l:options = ale#Var(a:buffer, 'go_gobuild_options')
|
|
||||||
|
|
||||||
" Run go test in local directory with relative path
|
|
||||||
return ale#path#BufferCdString(a:buffer)
|
|
||||||
\ . ale#Var(a:buffer, 'go_go_executable') . ' test'
|
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
|
||||||
\ . ' -c -o /dev/null ./'
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#go#gobuild#GetMatches(lines) abort
|
let s:SplitChar = has('unix') ? ':' : ':'
|
||||||
" Matches patterns like the following:
|
|
||||||
"
|
|
||||||
" file.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args
|
|
||||||
" file.go:53:10: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
|
|
||||||
" file.go:5:2: expected declaration, found 'STRING' "log"
|
|
||||||
" go test returns relative paths so use tail of filename as part of pattern matcher
|
|
||||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:? (.+)$'
|
|
||||||
|
|
||||||
return ale#util#GetMatches(a:lines, l:pattern)
|
" get a list of all source directories from $GOPATH and $GOROOT
|
||||||
|
function! s:SrcDirs() abort
|
||||||
|
let l:paths = split(s:go_env.GOPATH, s:SplitChar)
|
||||||
|
call add(l:paths, s:go_env.GOROOT)
|
||||||
|
|
||||||
|
return l:paths
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
" figure out from a directory like `/home/user/go/src/some/package` that the
|
||||||
|
" import for that path is simply `some/package`
|
||||||
|
function! s:PackageImportPath(buffer) abort
|
||||||
|
let l:bufname = resolve(bufname(a:buffer))
|
||||||
|
let l:pkgdir = fnamemodify(l:bufname, ':p:h')
|
||||||
|
|
||||||
|
for l:path in s:SrcDirs()
|
||||||
|
let l:path = l:path . '/src/'
|
||||||
|
|
||||||
|
if stridx(l:pkgdir, l:path) == 0
|
||||||
|
return l:pkgdir[strlen(l:path):]
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" get the package info data structure using `go list`
|
||||||
|
function! ale_linters#go#gobuild#GoList(buffer, goenv_output) abort
|
||||||
|
if !empty(a:goenv_output)
|
||||||
|
let s:go_env = {
|
||||||
|
\ 'GOPATH': a:goenv_output[0],
|
||||||
|
\ 'GOROOT': a:goenv_output[1],
|
||||||
|
\}
|
||||||
|
endif
|
||||||
|
|
||||||
|
return 'go list -json ' . shellescape(s:PackageImportPath(a:buffer))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
let s:filekeys = [
|
||||||
|
\ 'GoFiles',
|
||||||
|
\ 'CgoFiles',
|
||||||
|
\ 'CFiles',
|
||||||
|
\ 'CXXFiles',
|
||||||
|
\ 'MFiles',
|
||||||
|
\ 'HFiles',
|
||||||
|
\ 'FFiles',
|
||||||
|
\ 'SFiles',
|
||||||
|
\ 'SwigFiles',
|
||||||
|
\ 'SwigCXXFiles',
|
||||||
|
\ 'SysoFiles',
|
||||||
|
\ 'TestGoFiles',
|
||||||
|
\ 'XTestGoFiles',
|
||||||
|
\]
|
||||||
|
|
||||||
|
" get the go and test go files from the package
|
||||||
|
" will return empty list if the package has any cgo or other invalid files
|
||||||
|
function! s:PkgFiles(pkginfo) abort
|
||||||
|
let l:files = []
|
||||||
|
|
||||||
|
for l:key in s:filekeys
|
||||||
|
if has_key(a:pkginfo, l:key)
|
||||||
|
call extend(l:files, a:pkginfo[l:key])
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
" resolve the path of the file relative to the window directory
|
||||||
|
return map(l:files, 'shellescape(fnamemodify(resolve(a:pkginfo.Dir . ''/'' . v:val), '':p''))')
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#go#gobuild#CopyFiles(buffer, golist_output) abort
|
||||||
|
let l:tempdir = tempname()
|
||||||
|
let l:temppkgdir = l:tempdir . '/src/' . s:PackageImportPath(a:buffer)
|
||||||
|
call mkdir(l:temppkgdir, 'p', 0700)
|
||||||
|
|
||||||
|
if empty(a:golist_output)
|
||||||
|
return 'echo ' . shellescape(l:tempdir)
|
||||||
|
endif
|
||||||
|
|
||||||
|
" parse the output
|
||||||
|
let l:pkginfo = json_decode(join(a:golist_output, "\n"))
|
||||||
|
|
||||||
|
" get all files for the package
|
||||||
|
let l:files = s:PkgFiles(l:pkginfo)
|
||||||
|
|
||||||
|
" copy the files to a temp directory with $GOPATH structure
|
||||||
|
return 'cp ' . join(l:files, ' ') . ' ' . shellescape(l:temppkgdir) . ' && echo ' . shellescape(l:tempdir)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#go#gobuild#GetCommand(buffer, copy_output) abort
|
||||||
|
" If for some reason we don't get any output from the last command, stop
|
||||||
|
" here.
|
||||||
|
if empty(a:copy_output)
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:tempdir = a:copy_output[0]
|
||||||
|
let l:importpath = s:PackageImportPath(a:buffer)
|
||||||
|
|
||||||
|
" write the a:buffer and any modified buffers from the package to the tempdir
|
||||||
|
for l:bufnum in range(1, bufnr('$'))
|
||||||
|
" ignore unloaded buffers (can't be a:buffer or a modified buffer)
|
||||||
|
if !bufloaded(l:bufnum)
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
" ignore non-Go buffers
|
||||||
|
if getbufvar(l:bufnum, '&ft') !=# 'go'
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
" only consider buffers other than a:buffer if they have the same import
|
||||||
|
" path as a:buffer and are modified
|
||||||
|
if l:bufnum != a:buffer
|
||||||
|
if s:PackageImportPath(l:bufnum) !=# l:importpath
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !getbufvar(l:bufnum, '&mod')
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
call writefile(getbufline(l:bufnum, 1, '$'), l:tempdir . '/src/' . s:PkgFile(l:bufnum))
|
||||||
|
endfor
|
||||||
|
|
||||||
|
let l:gopaths = [ l:tempdir ]
|
||||||
|
call extend(l:gopaths, split(s:go_env.GOPATH, s:SplitChar))
|
||||||
|
|
||||||
|
return 'GOPATH=' . shellescape(join(l:gopaths, s:SplitChar)) . ' go test -c -o /dev/null ' . shellescape(l:importpath)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:PkgFile(buffer) abort
|
||||||
|
let l:bufname = resolve(bufname(a:buffer))
|
||||||
|
let l:importpath = s:PackageImportPath(a:buffer)
|
||||||
|
let l:fname = fnamemodify(l:bufname, ':t')
|
||||||
|
|
||||||
|
return l:importpath . '/' . l:fname
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:FindBuffer(file) abort
|
||||||
|
for l:buffer in range(1, bufnr('$'))
|
||||||
|
if !buflisted(l:buffer)
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:pkgfile = s:PkgFile(l:buffer)
|
||||||
|
|
||||||
|
if a:file =~ '/' . l:pkgfile . '$'
|
||||||
|
return l:buffer
|
||||||
|
endif
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return -1
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
let s:path_pattern = '[a-zA-Z]\?\\\?:\?[[:alnum:]/\.\-_]\+'
|
||||||
|
let s:handler_pattern = '^\(' . s:path_pattern . '\):\(\d\+\):\?\(\d\+\)\?: \(.\+\)$'
|
||||||
|
|
||||||
|
let s:multibuffer = 0
|
||||||
|
|
||||||
function! ale_linters#go#gobuild#Handler(buffer, lines) abort
|
function! ale_linters#go#gobuild#Handler(buffer, lines) abort
|
||||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
let l:output = []
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:match in ale_linters#go#gobuild#GetMatches(a:lines)
|
for l:line in a:lines
|
||||||
call add(l:output, {
|
let l:match = matchlist(l:line, s:handler_pattern)
|
||||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
|
||||||
\ 'lnum': l:match[2] + 0,
|
|
||||||
\ 'col': l:match[3] + 0,
|
|
||||||
\ 'text': l:match[4],
|
|
||||||
\ 'type': 'E',
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
if len(l:match) == 0
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
let l:buffer = s:FindBuffer(l:match[1])
|
||||||
|
|
||||||
|
if l:buffer == -1
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !s:multibuffer && l:buffer != a:buffer
|
||||||
|
" strip lines from other buffers
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
|
call add(l:output, {
|
||||||
|
\ 'bufnr': l:buffer,
|
||||||
|
\ 'lnum': l:match[2] + 0,
|
||||||
|
\ 'col': l:match[3] + 0,
|
||||||
|
\ 'text': l:match[4],
|
||||||
|
\ 'type': 'E',
|
||||||
|
\})
|
||||||
|
endfor
|
||||||
|
|
||||||
|
return l:output
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('go', {
|
call ale#linter#Define('go', {
|
||||||
\ 'name': 'gobuild',
|
\ 'name': 'go build',
|
||||||
\ 'aliases': ['go build'],
|
\ 'executable': 'go',
|
||||||
\ 'executable_callback': ale#VarFunc('go_go_executable'),
|
\ 'command_chain': [
|
||||||
\ 'command_callback': 'ale_linters#go#gobuild#GetCommand',
|
\ {'callback': 'ale_linters#go#gobuild#GoEnv', 'output_stream': 'stdout'},
|
||||||
\ 'output_stream': 'stderr',
|
\ {'callback': 'ale_linters#go#gobuild#GoList', 'output_stream': 'stdout'},
|
||||||
|
\ {'callback': 'ale_linters#go#gobuild#CopyFiles', 'output_stream': 'stdout'},
|
||||||
|
\ {'callback': 'ale_linters#go#gobuild#GetCommand', 'output_stream': 'stderr'},
|
||||||
|
\ ],
|
||||||
\ 'callback': 'ale_linters#go#gobuild#Handler',
|
\ 'callback': 'ale_linters#go#gobuild#Handler',
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -6,5 +6,5 @@ call ale#linter#Define('go', {
|
|||||||
\ 'output_stream': 'stderr',
|
\ 'output_stream': 'stderr',
|
||||||
\ 'executable': 'gofmt',
|
\ 'executable': 'gofmt',
|
||||||
\ 'command': 'gofmt -e %t',
|
\ 'command': 'gofmt -e %t',
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsError',
|
\ 'callback': 'ale#handlers#HandleUnixFormatAsError',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
" Author: Sascha Grunert <mail@saschagrunert.de>
|
|
||||||
" Description: Adds support of golangci-lint
|
|
||||||
|
|
||||||
call ale#Set('go_golangci_lint_options', '--enable-all')
|
|
||||||
call ale#Set('go_golangci_lint_executable', 'golangci-lint')
|
|
||||||
call ale#Set('go_golangci_lint_package', 0)
|
|
||||||
|
|
||||||
function! ale_linters#go#golangci_lint#GetCommand(buffer) 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 l:lint_package
|
|
||||||
return ale#path#BufferCdString(a:buffer)
|
|
||||||
\ . '%e run '
|
|
||||||
\ . l:options
|
|
||||||
endif
|
|
||||||
|
|
||||||
return ale#path#BufferCdString(a:buffer)
|
|
||||||
\ . '%e run '
|
|
||||||
\ . ale#Escape(l:filename)
|
|
||||||
\ . ' ' . l:options
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#go#golangci_lint#GetMatches(lines) abort
|
|
||||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:?:?:?\s\*?(.+)$'
|
|
||||||
|
|
||||||
return ale#util#GetMatches(a:lines, l:pattern)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#go#golangci_lint#Handler(buffer, lines) abort
|
|
||||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:match in ale_linters#go#golangci_lint#GetMatches(a:lines)
|
|
||||||
" l:match[1] will already be an absolute path, output from
|
|
||||||
" golangci_lint
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
|
||||||
\ 'lnum': l:match[2] + 0,
|
|
||||||
\ 'col': l:match[3] + 0,
|
|
||||||
\ 'type': 'E',
|
|
||||||
\ 'text': l:match[4],
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('go', {
|
|
||||||
\ 'name': 'golangci-lint',
|
|
||||||
\ 'executable_callback': ale#VarFunc('go_golangci_lint_executable'),
|
|
||||||
\ 'command_callback': 'ale_linters#go#golangci_lint#GetCommand',
|
|
||||||
\ 'callback': 'ale_linters#go#golangci_lint#Handler',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
|
||||||
@@ -1,21 +1,9 @@
|
|||||||
" Author: neersighted <bjorn@neersighted.com>
|
" Author: neersighted <bjorn@neersighted.com>
|
||||||
" Description: golint for Go files
|
" Description: golint for Go files
|
||||||
|
|
||||||
call ale#Set('go_golint_executable', 'golint')
|
|
||||||
call ale#Set('go_golint_options', '')
|
|
||||||
|
|
||||||
function! ale_linters#go#golint#GetCommand(buffer) abort
|
|
||||||
let l:options = ale#Var(a:buffer, 'go_golint_options')
|
|
||||||
|
|
||||||
return '%e'
|
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
|
||||||
\ . ' %t'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('go', {
|
call ale#linter#Define('go', {
|
||||||
\ 'name': 'golint',
|
\ 'name': 'golint',
|
||||||
\ 'output_stream': 'both',
|
\ 'executable': 'golint',
|
||||||
\ 'executable_callback': ale#VarFunc('go_golint_executable'),
|
\ 'command': 'golint %t',
|
||||||
\ 'command_callback': 'ale_linters#go#golint#GetCommand',
|
\ 'callback': 'ale#handlers#HandleUnixFormatAsWarning',
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,57 +0,0 @@
|
|||||||
" Author: Ben Reedy <https://github.com/breed808>, Jeff Willette <jrwillette88@gmail.com>
|
|
||||||
" Description: Adds support for the gometalinter suite for Go files
|
|
||||||
|
|
||||||
call ale#Set('go_gometalinter_options', '')
|
|
||||||
call ale#Set('go_gometalinter_executable', 'gometalinter')
|
|
||||||
call ale#Set('go_gometalinter_lint_package', 0)
|
|
||||||
|
|
||||||
function! ale_linters#go#gometalinter#GetCommand(buffer) abort
|
|
||||||
let l:filename = expand('#' . a:buffer . ':t')
|
|
||||||
let l:options = ale#Var(a:buffer, 'go_gometalinter_options')
|
|
||||||
let l:lint_package = ale#Var(a:buffer, 'go_gometalinter_lint_package')
|
|
||||||
|
|
||||||
" BufferCdString is used so that we can be sure the paths output from gometalinter can
|
|
||||||
" be calculated to absolute paths in the Handler
|
|
||||||
if l:lint_package
|
|
||||||
return ale#path#BufferCdString(a:buffer)
|
|
||||||
\ . '%e'
|
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
|
||||||
endif
|
|
||||||
|
|
||||||
return ale#path#BufferCdString(a:buffer)
|
|
||||||
\ . '%e'
|
|
||||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(l:filename))
|
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#go#gometalinter#GetMatches(lines) abort
|
|
||||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:?:?(warning|error):?\s\*?(.+)$'
|
|
||||||
|
|
||||||
return ale#util#GetMatches(a:lines, l:pattern)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#go#gometalinter#Handler(buffer, lines) abort
|
|
||||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:match in ale_linters#go#gometalinter#GetMatches(a:lines)
|
|
||||||
" l:match[1] will already be an absolute path, output from gometalinter
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
|
||||||
\ 'lnum': l:match[2] + 0,
|
|
||||||
\ 'col': l:match[3] + 0,
|
|
||||||
\ 'type': tolower(l:match[4]) is# 'warning' ? 'W' : 'E',
|
|
||||||
\ 'text': l:match[5],
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('go', {
|
|
||||||
\ 'name': 'gometalinter',
|
|
||||||
\ 'executable_callback': ale#VarFunc('go_gometalinter_executable'),
|
|
||||||
\ 'command_callback': 'ale_linters#go#gometalinter#GetCommand',
|
|
||||||
\ 'callback': 'ale_linters#go#gometalinter#Handler',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
" Author: Ben Reedy <https://github.com/breed808>
|
|
||||||
" Description: gosimple for Go files
|
|
||||||
|
|
||||||
function! ale_linters#go#gosimple#GetCommand(buffer) abort
|
|
||||||
return ale#path#BufferCdString(a:buffer) . ' gosimple .'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('go', {
|
|
||||||
\ 'name': 'gosimple',
|
|
||||||
\ 'executable': 'gosimple',
|
|
||||||
\ 'command_callback': 'ale_linters#go#gosimple#GetCommand',
|
|
||||||
\ 'callback': 'ale#handlers#go#Handler',
|
|
||||||
\ 'output_stream': 'both',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
" Author: Jelte Fennema <github-public@jeltef.nl>
|
|
||||||
" Description: gotype for Go files
|
|
||||||
|
|
||||||
function! ale_linters#go#gotype#GetCommand(buffer) abort
|
|
||||||
if expand('#' . a:buffer . ':p') =~# '_test\.go$'
|
|
||||||
return ''
|
|
||||||
endif
|
|
||||||
|
|
||||||
return ale#path#BufferCdString(a:buffer) . ' gotype .'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('go', {
|
|
||||||
\ 'name': 'gotype',
|
|
||||||
\ 'output_stream': 'stderr',
|
|
||||||
\ 'executable': 'gotype',
|
|
||||||
\ 'command_callback': 'ale_linters#go#gotype#GetCommand',
|
|
||||||
\ 'callback': 'ale#handlers#go#Handler',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
|
||||||
@@ -1,27 +1,10 @@
|
|||||||
" Author: neersighted <bjorn@neersighted.com>
|
" Author: neersighted <bjorn@neersighted.com>
|
||||||
" Description: go vet for Go files
|
" Description: go vet for Go files
|
||||||
"
|
|
||||||
" Author: John Eikenberry <jae@zhar.net>
|
|
||||||
" Description: updated to work with go1.10
|
|
||||||
|
|
||||||
call ale#Set('go_go_executable', 'go')
|
|
||||||
call ale#Set('go_govet_options', '')
|
|
||||||
|
|
||||||
function! ale_linters#go#govet#GetCommand(buffer) abort
|
|
||||||
let l:options = ale#Var(a:buffer, 'go_govet_options')
|
|
||||||
|
|
||||||
return ale#path#BufferCdString(a:buffer) . ' '
|
|
||||||
\ . ale#Var(a:buffer, 'go_go_executable') . ' vet '
|
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
|
||||||
\ . ' .'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('go', {
|
call ale#linter#Define('go', {
|
||||||
\ 'name': 'govet',
|
\ 'name': 'go vet',
|
||||||
\ 'aliases': ['go vet'],
|
|
||||||
\ 'output_stream': 'stderr',
|
\ 'output_stream': 'stderr',
|
||||||
\ 'executable_callback': ale#VarFunc('go_go_executable'),
|
\ 'executable': 'go',
|
||||||
\ 'command_callback': 'ale_linters#go#govet#GetCommand',
|
\ 'command': 'go vet %t',
|
||||||
\ 'callback': 'ale#handlers#go#Handler',
|
\ 'callback': 'ale#handlers#HandleUnixFormatAsError',
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
" Author: Horacio Sanson <https://github.com/hsanson>
|
|
||||||
" Description: Support for go-langserver https://github.com/sourcegraph/go-langserver
|
|
||||||
|
|
||||||
call ale#Set('go_langserver_executable', 'go-langserver')
|
|
||||||
call ale#Set('go_langserver_options', '')
|
|
||||||
|
|
||||||
function! ale_linters#go#langserver#GetCommand(buffer) abort
|
|
||||||
let l:executable = [ale#Escape(ale#Var(a:buffer, 'go_langserver_executable'))]
|
|
||||||
let l:options = ale#Var(a:buffer, 'go_langserver_options')
|
|
||||||
let l:options = substitute(l:options, '-gocodecompletion', '', 'g')
|
|
||||||
let l:options = filter(split(l:options, ' '), 'empty(v:val) != 1')
|
|
||||||
|
|
||||||
if(ale#Var(a:buffer, 'completion_enabled') == 1)
|
|
||||||
call add(l:options, '-gocodecompletion')
|
|
||||||
endif
|
|
||||||
|
|
||||||
let l:options = uniq(sort(l:options))
|
|
||||||
|
|
||||||
return join(extend(l:executable, l:options), ' ')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('go', {
|
|
||||||
\ 'name': 'golangserver',
|
|
||||||
\ 'lsp': 'stdio',
|
|
||||||
\ 'executable_callback': ale#VarFunc('go_langserver_executable'),
|
|
||||||
\ 'command_callback': 'ale_linters#go#langserver#GetCommand',
|
|
||||||
\ 'project_root_callback': 'ale#go#FindProjectRoot',
|
|
||||||
\})
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
" Author: Ben Reedy <https://github.com/breed808>
|
|
||||||
" Description: staticcheck for Go files
|
|
||||||
|
|
||||||
call ale#Set('go_staticcheck_options', '')
|
|
||||||
call ale#Set('go_staticcheck_lint_package', 0)
|
|
||||||
|
|
||||||
function! ale_linters#go#staticcheck#GetCommand(buffer) abort
|
|
||||||
let l:filename = expand('#' . a:buffer . ':t')
|
|
||||||
let l:options = ale#Var(a:buffer, 'go_staticcheck_options')
|
|
||||||
let l:lint_package = ale#Var(a:buffer, 'go_staticcheck_lint_package')
|
|
||||||
|
|
||||||
" BufferCdString is used so that we can be sure the paths output from
|
|
||||||
" staticcheck can be calculated to absolute paths in the Handler
|
|
||||||
if l:lint_package
|
|
||||||
return ale#path#BufferCdString(a:buffer)
|
|
||||||
\ . 'staticcheck'
|
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
|
||||||
endif
|
|
||||||
|
|
||||||
return ale#path#BufferCdString(a:buffer)
|
|
||||||
\ . 'staticcheck'
|
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
|
||||||
\ . ' ' . ale#Escape(l:filename)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('go', {
|
|
||||||
\ 'name': 'staticcheck',
|
|
||||||
\ 'executable': 'staticcheck',
|
|
||||||
\ 'command_callback': 'ale_linters#go#staticcheck#GetCommand',
|
|
||||||
\ 'callback': 'ale#handlers#go#Handler',
|
|
||||||
\ 'output_stream': 'both',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
" Author: Benjie Gillam <code@benjiegillam.com>
|
|
||||||
" Description: eslint for GraphQL files
|
|
||||||
|
|
||||||
call ale#linter#Define('graphql', {
|
|
||||||
\ 'name': 'eslint',
|
|
||||||
\ 'executable_callback': 'ale#handlers#eslint#GetExecutable',
|
|
||||||
\ 'command_callback': 'ale#handlers#eslint#GetCommand',
|
|
||||||
\ 'callback': 'ale#handlers#eslint#Handle',
|
|
||||||
\})
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user