mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-07 05:04:28 +08:00
Compare commits
349 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1568bf8128 | ||
|
|
73f61514c9 | ||
|
|
cc8e5502c8 | ||
|
|
0ad2547997 | ||
|
|
647c798eb7 | ||
|
|
f74e22b938 | ||
|
|
d2bea5c310 | ||
|
|
a7d51afda5 | ||
|
|
532594839c | ||
|
|
2cacba5758 | ||
|
|
91090f1af8 | ||
|
|
79aaec5a99 | ||
|
|
5577d567d1 | ||
|
|
1e574ed5f7 | ||
|
|
fdaac9bd78 | ||
|
|
31241e9ed8 | ||
|
|
e0c3cbd16f | ||
|
|
8afd9a70a6 | ||
|
|
e4821c7f2f | ||
|
|
af7eb2b979 | ||
|
|
1626fce1c9 | ||
|
|
fdde8af894 | ||
|
|
30c5bb3772 | ||
|
|
938c150880 | ||
|
|
d3cf02ecda | ||
|
|
65a99c1615 | ||
|
|
ad1aee0b89 | ||
|
|
96b90b45db | ||
|
|
c4956657dc | ||
|
|
fc151d7b30 | ||
|
|
55e09a4a2d | ||
|
|
7e793c9d71 | ||
|
|
09d3ecc49b | ||
|
|
7284270120 | ||
|
|
c8ee402cce | ||
|
|
a22def45b9 | ||
|
|
e06f2ded9d | ||
|
|
78d1f5f5df | ||
|
|
e7eb272714 | ||
|
|
0d046f5f01 | ||
|
|
55ca96bd83 | ||
|
|
d2a6d9a915 | ||
|
|
4825cce1cc | ||
|
|
7a88a3605c | ||
|
|
9152effa9f | ||
|
|
cebe7c3918 | ||
|
|
0700c2d900 | ||
|
|
fcfd1025cc | ||
|
|
2d3d6d3a10 | ||
|
|
92f20b0e51 | ||
|
|
7d932a239c | ||
|
|
b6efb5649e | ||
|
|
7a71186d62 | ||
|
|
fbc8ac9553 | ||
|
|
c6fc9cdb7b | ||
|
|
63ecc8341d | ||
|
|
d6bf13502a | ||
|
|
0e57ca3df3 | ||
|
|
440ef30b79 | ||
|
|
f66837818a | ||
|
|
85e0bd3314 | ||
|
|
e2a8f759d8 | ||
|
|
57e1b03435 | ||
|
|
3e1bd8d922 | ||
|
|
0d627d4613 | ||
|
|
159733c459 | ||
|
|
fba3c57872 | ||
|
|
2f9869de44 | ||
|
|
a4f8506227 | ||
|
|
acd1260339 | ||
|
|
2bd966c5cc | ||
|
|
f5fc746d00 | ||
|
|
83760a0952 | ||
|
|
122fdfd329 | ||
|
|
6650c9a901 | ||
|
|
499c154272 | ||
|
|
51b127a4fd | ||
|
|
6053f764bd | ||
|
|
daee4a4722 | ||
|
|
6b3927820b | ||
|
|
948035e13d | ||
|
|
0406af4484 | ||
|
|
a990188e27 | ||
|
|
fd261264d7 | ||
|
|
c977bb2d05 | ||
|
|
5d65980c42 | ||
|
|
6503b85d3d | ||
|
|
edb3a0c5e4 | ||
|
|
a43ada93e4 | ||
|
|
0ab689db0a | ||
|
|
4e821e64c7 | ||
|
|
bba6b4c23c | ||
|
|
b0114deabc | ||
|
|
09f9c21f1b | ||
|
|
e84ee4332f | ||
|
|
d4ea0423a2 | ||
|
|
f311a46f79 | ||
|
|
17f93b16ab | ||
|
|
17574e2fe1 | ||
|
|
21b460bb1d | ||
|
|
01318b6930 | ||
|
|
c07b3b9bfc | ||
|
|
ae7cd2c090 | ||
|
|
8254e507d6 | ||
|
|
b1a6abdda6 | ||
|
|
2e50aadd56 | ||
|
|
7dfe690b0b | ||
|
|
f99b027cc6 | ||
|
|
5160f814d9 | ||
|
|
6318a08e08 | ||
|
|
8dd542bed0 | ||
|
|
d07b5b71a4 | ||
|
|
fbfde6968a | ||
|
|
9857e0a4b7 | ||
|
|
6e65998ca7 | ||
|
|
b5ec1a5fd0 | ||
|
|
91fe749d03 | ||
|
|
5d2ab192cf | ||
|
|
5ed6f66f77 | ||
|
|
4b4762697c | ||
|
|
382cb4d538 | ||
|
|
520541cd2d | ||
|
|
3f70f1cbf1 | ||
|
|
e7865d2f94 | ||
|
|
074a011b08 | ||
|
|
796fb651d6 | ||
|
|
52f3ad7c75 | ||
|
|
e6fb32b792 | ||
|
|
8be85c2997 | ||
|
|
3ef98f42bd | ||
|
|
ac7f69063d | ||
|
|
ce2986cfa5 | ||
|
|
d465b71362 | ||
|
|
7ea3aba5e5 | ||
|
|
5a3a695586 | ||
|
|
c9e203e620 | ||
|
|
b9f02ffb27 | ||
|
|
f20e5a4cf0 | ||
|
|
f224ce8a37 | ||
|
|
9420c411bd | ||
|
|
597507e519 | ||
|
|
0cb8130d0e | ||
|
|
cc04a7aaa0 | ||
|
|
1afe2992e2 | ||
|
|
344add6a28 | ||
|
|
151f9f857c | ||
|
|
62904d39ee | ||
|
|
fa7f0e2b85 | ||
|
|
b16c82f2f1 | ||
|
|
d7a60ade77 | ||
|
|
01b2971d04 | ||
|
|
7123f7236b | ||
|
|
c012563984 | ||
|
|
3c8f3221df | ||
|
|
40e26f0bc2 | ||
|
|
41cb174f3a | ||
|
|
cefc5dc5b8 | ||
|
|
2b50e68c7e | ||
|
|
7455e2e97d | ||
|
|
49ccfb1a00 | ||
|
|
0e96d4576a | ||
|
|
5635b3c864 | ||
|
|
22ec81e1de | ||
|
|
a139b387c8 | ||
|
|
79f15b0e30 | ||
|
|
ca345ffb62 | ||
|
|
44cd07d39c | ||
|
|
b390c69642 | ||
|
|
1f4f19cbd4 | ||
|
|
3ddb858881 | ||
|
|
e232ea07c2 | ||
|
|
f1314b285c | ||
|
|
f90a2d5474 | ||
|
|
ee07be5f59 | ||
|
|
c9c52ef370 | ||
|
|
71d34fc0c6 | ||
|
|
981cb95d80 | ||
|
|
7565a45b6f | ||
|
|
d585123d64 | ||
|
|
eda20d0585 | ||
|
|
1d65e5692f | ||
|
|
cf538c3a58 | ||
|
|
08f4f8f0fc | ||
|
|
b14377915b | ||
|
|
e721f851b4 | ||
|
|
290ed4885b | ||
|
|
e12e5c912c | ||
|
|
38bc489604 | ||
|
|
8f80708da6 | ||
|
|
ff5c6b0509 | ||
|
|
37f2f70439 | ||
|
|
a36129eab0 | ||
|
|
48be035da8 | ||
|
|
d48506f9c1 | ||
|
|
6b2c61a5cc | ||
|
|
2e9cd978a2 | ||
|
|
48eb362fca | ||
|
|
20a01404f3 | ||
|
|
425482116e | ||
|
|
16e7dc2371 | ||
|
|
d8f9aef84a | ||
|
|
037aaae593 | ||
|
|
fea708cff3 | ||
|
|
8a3a2da87e | ||
|
|
764a33b1c9 | ||
|
|
6c112dd1cc | ||
|
|
a5f7f51c9a | ||
|
|
ad7ea36307 | ||
|
|
ea7f68226e | ||
|
|
e9e29e003c | ||
|
|
584e0bc7f2 | ||
|
|
70623ca8a7 | ||
|
|
7d056b0839 | ||
|
|
e7b9befaa6 | ||
|
|
3c34848e02 | ||
|
|
5b3094558b | ||
|
|
7edcb2210b | ||
|
|
cd5da50531 | ||
|
|
3aff1df961 | ||
|
|
d20e3bc71c | ||
|
|
b98387d0fa | ||
|
|
099df0af52 | ||
|
|
365d023d0e | ||
|
|
5df6ce6bb8 | ||
|
|
39107a48b9 | ||
|
|
8e0d1f57c6 | ||
|
|
555743a2ba | ||
|
|
8cd1ccff84 | ||
|
|
6c60ca24c1 | ||
|
|
52b6024997 | ||
|
|
4952e2f143 | ||
|
|
8bc44ed585 | ||
|
|
a8c5e0f4dc | ||
|
|
911b6d8f71 | ||
|
|
0741612db7 | ||
|
|
cb3a25f276 | ||
|
|
27e2f53ac9 | ||
|
|
ae08f80ead | ||
|
|
3111c6c1ca | ||
|
|
f6ac8a9eb9 | ||
|
|
4d44996af6 | ||
|
|
b789b9eaad | ||
|
|
fb00acf734 | ||
|
|
f8fec369e5 | ||
|
|
9e7c493e7e | ||
|
|
bac02c9d81 | ||
|
|
8c1d6eda81 | ||
|
|
6c014a25e8 | ||
|
|
1ddc3eec6d | ||
|
|
bb271859ef | ||
|
|
27780cbb23 | ||
|
|
d425b8a18a | ||
|
|
1ad7d5e6ca | ||
|
|
4bc31fcd18 | ||
|
|
7ed82ab712 | ||
|
|
decf8188bc | ||
|
|
c1fa88e78c | ||
|
|
bcc215c4e0 | ||
|
|
732d8e3ed6 | ||
|
|
8ef8a35462 | ||
|
|
8a4cf923a8 | ||
|
|
86e8074017 | ||
|
|
da8012971a | ||
|
|
105251c1de | ||
|
|
248a5eb2f6 | ||
|
|
1bf894f48c | ||
|
|
d97924b698 | ||
|
|
e4cd371621 | ||
|
|
3a57e4d151 | ||
|
|
b5254e9760 | ||
|
|
8e71f82f8f | ||
|
|
3cbf716d72 | ||
|
|
89832884c9 | ||
|
|
fa7d041c26 | ||
|
|
3c8e6ed51c | ||
|
|
716b22d524 | ||
|
|
7086586b17 | ||
|
|
7b5108d934 | ||
|
|
caed406e16 | ||
|
|
34674e088d | ||
|
|
d851f399c0 | ||
|
|
9c0a5635df | ||
|
|
9010458581 | ||
|
|
c26e5e277e | ||
|
|
54f44c2d0f | ||
|
|
1752ad9ad1 | ||
|
|
a09db595f1 | ||
|
|
a786e01127 | ||
|
|
3115d2025a | ||
|
|
9cd0d75c4f | ||
|
|
0ed639a116 | ||
|
|
50f7ad3552 | ||
|
|
1575b3d7dd | ||
|
|
634eb1920c | ||
|
|
daecbad543 | ||
|
|
1aa737cdc9 | ||
|
|
5fc2b98b73 | ||
|
|
ea3a8e3c62 | ||
|
|
6e681d9066 | ||
|
|
0e848b608c | ||
|
|
36898436b5 | ||
|
|
73b8181ce6 | ||
|
|
d4d939bea9 | ||
|
|
6490d3a5e6 | ||
|
|
33c2c20e66 | ||
|
|
3ac92ea529 | ||
|
|
3ab069c9bd | ||
|
|
22e8050639 | ||
|
|
e4456a4e0e | ||
|
|
6ed456f99c | ||
|
|
40f5e54198 | ||
|
|
aca66a54a5 | ||
|
|
f15c8f4127 | ||
|
|
0702cb59b7 | ||
|
|
5917de565d | ||
|
|
2f5b94e07d | ||
|
|
da365134b5 | ||
|
|
7eb16836d0 | ||
|
|
f38ced1e4c | ||
|
|
4af7219078 | ||
|
|
25d2af0b25 | ||
|
|
b0b91ba897 | ||
|
|
45ed37a5d9 | ||
|
|
960ae62aaa | ||
|
|
680672117f | ||
|
|
5029078df3 | ||
|
|
94bdabb8c3 | ||
|
|
eec529ad9d | ||
|
|
7ac07a30b8 | ||
|
|
780844ad73 | ||
|
|
db769fb060 | ||
|
|
1a5ef969a5 | ||
|
|
d644dc797f | ||
|
|
b401772d23 | ||
|
|
1c56bebd7c | ||
|
|
fe729dab58 | ||
|
|
07dad64acb | ||
|
|
b172cd8b17 | ||
|
|
c248885e57 | ||
|
|
0e4dd95e5d | ||
|
|
5a91f7e19f | ||
|
|
c96e7402ba | ||
|
|
f0a0aef33d | ||
|
|
4884e33f8b | ||
|
|
be1377f6d7 | ||
|
|
3212278c91 | ||
|
|
43653ef548 | ||
|
|
ed93cd1494 | ||
|
|
35031a0b8a |
@@ -1,8 +1,28 @@
|
||||
<!--
|
||||
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.
|
||||
|
||||
Whatever the case, describe the your issue here.
|
||||
This is a template for bug reports. If you want to request a new feature,
|
||||
you can clear this entire form field and write a short description of what
|
||||
you want.
|
||||
-->
|
||||
|
||||
## Information
|
||||
|
||||
**VIM version**
|
||||
|
||||
PASTE JUST THE FIRST TWO LINES OF `:version` HERE.
|
||||
|
||||
Operating System: WHAT OS WERE YOU USING?
|
||||
|
||||
### :ALEInfo
|
||||
|
||||
PASTE OUTPUT OF `:ALEInfo` HERE. YOU CAN TRY `:ALEInfoToClipboard`.
|
||||
|
||||
## What went wrong
|
||||
|
||||
WRITE WHAT WENT WRONG HERE.
|
||||
|
||||
## Reproducing the bug
|
||||
|
||||
Steps for repeating the bug:
|
||||
|
||||
1. Write a list of steps.
|
||||
2. Otherwise nobody will fix the bug.
|
||||
|
||||
274
README.md
274
README.md
@@ -17,8 +17,7 @@ back to a filesystem.
|
||||
In other words, this plugin allows you to lint while you type.
|
||||
|
||||
In addition to linting support, ALE offers some support for fixing code with
|
||||
formatting tools, and completion via Language Server Protocol servers, or
|
||||
servers with similar enough protocols, like `tsserver`.
|
||||
formatting tools, and some Language Server Protocol and `tsserver` features.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
@@ -27,6 +26,7 @@ servers with similar enough protocols, like `tsserver`.
|
||||
1. [Linting](#usage-linting)
|
||||
2. [Fixing](#usage-fixing)
|
||||
3. [Completion](#usage-completion)
|
||||
4. [Go To Definition](#usage-go-to-definition)
|
||||
3. [Installation](#installation)
|
||||
1. [Installation with Vim package management](#standard-installation)
|
||||
2. [Installation with Pathogen](#installation-with-pathogen)
|
||||
@@ -36,15 +36,18 @@ servers with similar enough protocols, like `tsserver`.
|
||||
1. [How do I disable particular linters?](#faq-disable-linters)
|
||||
2. [How can I keep the sign gutter open?](#faq-keep-signs)
|
||||
3. [How can I change the signs ALE uses?](#faq-change-signs)
|
||||
4. [How can I show errors or warnings in my statusline?](#faq-statusline)
|
||||
5. [How can I show errors or warnings in my lightline?](#faq-lightline)
|
||||
6. [How can I change the format for echo messages?](#faq-echo-format)
|
||||
7. [How can I execute some code when ALE stops linting?](#faq-autocmd)
|
||||
8. [How can I navigate between errors quickly?](#faq-navigation)
|
||||
9. [How can I run linters only when I save files?](#faq-lint-on-save)
|
||||
10. [How can I use the quickfix list instead of the loclist?](#faq-quickfix)
|
||||
11. [How can I check JSX files with both stylelint and eslint?](#faq-jsx-stylelint-eslint)
|
||||
12. [Will this plugin eat all of my laptop battery power?](#faq-my-battery-is-sad)
|
||||
4. [How can I change or disable the highlights ALE uses?](#faq-change-highlights)
|
||||
5. [How can I show errors or warnings in my statusline?](#faq-statusline)
|
||||
6. [How can I show errors or warnings in my lightline?](#faq-lightline)
|
||||
7. [How can I change the format for echo messages?](#faq-echo-format)
|
||||
8. [How can I execute some code when ALE starts or stops linting?](#faq-autocmd)
|
||||
9. [How can I navigate between errors quickly?](#faq-navigation)
|
||||
10. [How can I run linters only when I save files?](#faq-lint-on-save)
|
||||
11. [How can I use the quickfix list instead of the loclist?](#faq-quickfix)
|
||||
12. [How can I check JSX files with both stylelint and eslint?](#faq-jsx-stylelint-eslint)
|
||||
13. [Will this plugin eat all of my laptop battery power?](#faq-my-battery-is-sad)
|
||||
14. [How can I configure my C or C++ project?](#faq-c-configuration)
|
||||
15. [How can I configure ALE differently for different buffers?](#faq-buffer-configuration)
|
||||
|
||||
<a name="supported-languages"></a>
|
||||
|
||||
@@ -71,22 +74,25 @@ formatting.
|
||||
| -------- | ----- |
|
||||
| ASM | [gcc](https://gcc.gnu.org) |
|
||||
| Ansible | [ansible-lint](https://github.com/willthames/ansible-lint) |
|
||||
| AsciiDoc | [proselint](http://proselint.com/) |
|
||||
| API Blueprint | [drafter](https://github.com/apiaryio/drafter) |
|
||||
| AsciiDoc | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [write-good](https://github.com/btford/write-good) |
|
||||
| Awk | [gawk](https://www.gnu.org/software/gawk/)|
|
||||
| Bash | shell [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set), [shellcheck](https://www.shellcheck.net/) |
|
||||
| Bourne Shell | shell [-n flag](http://linux.die.net/man/1/sh), [shellcheck](https://www.shellcheck.net/) |
|
||||
| Bash | 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) |
|
||||
| Bourne Shell | shell [-n flag](http://linux.die.net/man/1/sh), [shellcheck](https://www.shellcheck.net/), [shfmt](https://github.com/mvdan/sh) |
|
||||
| C | [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint), [gcc](https://gcc.gnu.org/), [clang](http://clang.llvm.org/), [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html)|
|
||||
| C++ (filetype cpp) | [clang](http://clang.llvm.org/), [clangcheck](http://clang.llvm.org/docs/ClangCheck.html) !!, [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint) !!, [gcc](https://gcc.gnu.org/), [clang-format](https://clang.llvm.org/docs/ClangFormat.html)|
|
||||
| C++ (filetype cpp) | [clang](http://clang.llvm.org/), [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), [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint) !!, [gcc](https://gcc.gnu.org/) |
|
||||
| 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|
|
||||
| Chef | [foodcritic](http://www.foodcritic.io/) |
|
||||
| Clojure | [joker](https://github.com/candid82/joker) |
|
||||
| CMake | [cmakelint](https://github.com/richq/cmake-lint) |
|
||||
| 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), [prettier](https://github.com/prettier/prettier) |
|
||||
| CSS | [csslint](http://csslint.net/), [prettier](https://github.com/prettier/prettier), [stylelint](https://github.com/stylelint/stylelint) |
|
||||
| Cython (pyrex filetype) | [cython](http://cython.org/) |
|
||||
| D | [dmd](https://dlang.org/dmd-linux.html) |
|
||||
| Dart | [dartanalyzer](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) |
|
||||
| Dafny | [dafny](https://rise4fun.com/Dafny) !! |
|
||||
| Dart | [dartanalyzer](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) !!, [language_server](https://github.com/natebosch/dart_language_server) |
|
||||
| Dockerfile | [hadolint](https://github.com/lukasmartinelli/hadolint) |
|
||||
| Elixir | [credo](https://github.com/rrrene/credo), [dogma](https://github.com/lpil/dogma) !! |
|
||||
| Elm | [elm-format](https://github.com/avh4/elm-format), [elm-make](https://github.com/elm-lang/elm-make) |
|
||||
@@ -94,60 +100,66 @@ formatting.
|
||||
| Erlang | [erlc](http://erlang.org/doc/man/erlc.html), [SyntaxErl](https://github.com/ten0s/syntaxerl) |
|
||||
| Fortran | [gcc](https://gcc.gnu.org/) |
|
||||
| FusionScript | [fusion-lint](https://github.com/RyanSquared/fusionscript) |
|
||||
| GLSL | [glslang](https://github.com/KhronosGroup/glslang) |
|
||||
| Go | [gofmt](https://golang.org/cmd/gofmt/), [go vet](https://golang.org/cmd/vet/), [golint](https://godoc.org/github.com/golang/lint), [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) |
|
||||
| GraphQL | [gqlint](https://github.com/happylinks/gqlint) |
|
||||
| GLSL | [glslang](https://github.com/KhronosGroup/glslang), [glslls](https://github.com/svenstaro/glsl-language-server) |
|
||||
| Go | [gofmt](https://golang.org/cmd/gofmt/), [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports), [go vet](https://golang.org/cmd/vet/), [golint](https://godoc.org/github.com/golang/lint), [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) !! |
|
||||
| GraphQL | [eslint](http://eslint.org/), [gqlint](https://github.com/happylinks/gqlint) |
|
||||
| Haml | [haml-lint](https://github.com/brigade/haml-lint) |
|
||||
| Handlebars | [ember-template-lint](https://github.com/rwjblue/ember-template-lint) |
|
||||
| Haskell | [ghc](https://www.haskell.org/ghc/), [stack-ghc](https://haskellstack.org/), [stack-build](https://haskellstack.org/) !!, [ghc-mod](https://github.com/DanielG/ghc-mod), [stack-ghc-mod](https://github.com/DanielG/ghc-mod), [hlint](https://hackage.haskell.org/package/hlint), [hdevtools](https://hackage.haskell.org/package/hdevtools) |
|
||||
| HTML | [HTMLHint](http://htmlhint.com/), [proselint](http://proselint.com/), [tidy](http://www.html-tidy.org/) |
|
||||
| Haskell | [brittany](https://github.com/lspitzner/brittany), [ghc](https://www.haskell.org/ghc/), [stack-ghc](https://haskellstack.org/), [stack-build](https://haskellstack.org/) !!, [ghc-mod](https://github.com/DanielG/ghc-mod), [stack-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) |
|
||||
| HTML | [alex](https://github.com/wooorm/alex) !!, [HTMLHint](http://htmlhint.com/), [proselint](http://proselint.com/), [tidy](http://www.html-tidy.org/), [write-good](https://github.com/btford/write-good) |
|
||||
| Idris | [idris](http://www.idris-lang.org/) |
|
||||
| Java | [checkstyle](http://checkstyle.sourceforge.net), [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html) |
|
||||
| JavaScript | [eslint](http://eslint.org/), [jscs](http://jscs.info/), [jshint](http://jshint.com/), [flow](https://flowtype.org/), [prettier](https://github.com/prettier/prettier), prettier-eslint >= 4.2.0, prettier-standard, [standard](http://standardjs.com/), [xo](https://github.com/sindresorhus/xo)
|
||||
| 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) |
|
||||
| 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), [prettier-standard](https://github.com/sheerun/prettier-standard), [standard](http://standardjs.com/), [xo](https://github.com/sindresorhus/xo)
|
||||
| JSON | [jsonlint](http://zaa.ch/jsonlint/), [prettier](https://github.com/prettier/prettier) |
|
||||
| Kotlin | [kotlinc](https://kotlinlang.org) !!, [ktlint](https://ktlint.github.io) !! see `:help ale-integration-kotlin` for configuration instructions |
|
||||
| LaTeX | [chktex](http://www.nongnu.org/chktex/), [lacheck](https://www.ctan.org/pkg/lacheck), [proselint](http://proselint.com/) |
|
||||
| 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 | [luacheck](https://github.com/mpeterv/luacheck) |
|
||||
| Markdown | [mdl](https://github.com/mivok/markdownlint), [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale), [remark-lint](https://github.com/wooorm/remark-lint) !! |
|
||||
| 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) !!, [mdl](https://github.com/mivok/markdownlint), [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [remark-lint](https://github.com/wooorm/remark-lint) !!, [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) |
|
||||
| Nim | [nim check](https://nim-lang.org/docs/nimc.html) !! |
|
||||
| nix | [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate) |
|
||||
| nroff | [proselint](http://proselint.com/)|
|
||||
| nroff | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good)|
|
||||
| Objective-C | [clang](http://clang.llvm.org/) |
|
||||
| Objective-C++ | [clang](http://clang.llvm.org/) |
|
||||
| OCaml | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-ocaml-merlin` for configuration instructions |
|
||||
| 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) |
|
||||
| Perl | [perl -c](https://perl.org/), [perl-critic](https://metacpan.org/pod/Perl::Critic) |
|
||||
| PHP | [hack](http://hacklang.org/), [langserver](https://github.com/felixfbecker/php-language-server), [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) |
|
||||
| Pod | [proselint](http://proselint.com/)|
|
||||
| PHP | [hack](http://hacklang.org/), [hackfmt](https://github.com/facebook/flow/tree/master/hack/hackfmt), [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) |
|
||||
| Pod | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
||||
| proto | [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint) |
|
||||
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) |
|
||||
| Puppet | [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) |
|
||||
| Python | [autopep8](https://github.com/hhatto/autopep8), [flake8](http://flake8.pycqa.org/en/latest/), [isort](https://github.com/timothycrosley/isort), [mypy](http://mypy-lang.org/), [pycodestyle](https://github.com/PyCQA/pycodestyle), [pylint](https://www.pylint.org/) !!, [yapf](https://github.com/google/yapf) |
|
||||
| Python | [autopep8](https://github.com/hhatto/autopep8), [flake8](http://flake8.pycqa.org/en/latest/), [isort](https://github.com/timothycrosley/isort), [mypy](http://mypy-lang.org/), [prospector](http://github.com/landscapeio/prospector), [pycodestyle](https://github.com/PyCQA/pycodestyle), [pyls](https://github.com/palantir/python-language-server), [pylint](https://www.pylint.org/) !!, [yapf](https://github.com/google/yapf) |
|
||||
| R | [lintr](https://github.com/jimhester/lintr) |
|
||||
| ReasonML | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-integration-reason-merlin` for configuration instructions |
|
||||
| reStructuredText | [proselint](http://proselint.com/) |
|
||||
| ReasonML | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-integration-reason-merlin` for configuration instructions, [ols](https://github.com/freebroccolo/ocaml-language-server), [refmt](https://github.com/reasonml/reason-cli) |
|
||||
| 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) |
|
||||
| Rust | cargo !! (see `:help ale-integration-rust` for configuration instructions), [rls](https://github.com/rust-lang-nursery/rls), [rustc](https://www.rust-lang.org/) |
|
||||
| Rust | 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) |
|
||||
| SCSS | [sass-lint](https://www.npmjs.com/package/sass-lint), [scss-lint](https://github.com/brigade/scss-lint), [stylelint](https://github.com/stylelint/stylelint), [prettier](https://github.com/prettier/prettier) |
|
||||
| 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) |
|
||||
| Scala | [scalac](http://scala-lang.org), [scalastyle](http://www.scalastyle.org) |
|
||||
| Slim | [slim-lint](https://github.com/sds/slim-lint) |
|
||||
| SML | [smlnj](http://www.smlnj.org/) |
|
||||
| Solidity | [solium](https://github.com/duaraghav8/Solium) |
|
||||
| Solidity | [solhint](https://github.com/protofire/solhint), [solium](https://github.com/duaraghav8/Solium) |
|
||||
| Stylus | [stylelint](https://github.com/stylelint/stylelint) |
|
||||
| SQL | [sqlint](https://github.com/purcell/sqlint) |
|
||||
| Swift | [swiftlint](https://github.com/realm/SwiftLint), [swiftformat](https://github.com/nicklockwood/SwiftFormat) |
|
||||
| Tcl | [nagelfar](http://nagelfar.sourceforge.net) !! |
|
||||
| Texinfo | [proselint](http://proselint.com/)|
|
||||
| Text^ | [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale) |
|
||||
| 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/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good), [redpen](http://redpen.cc/) |
|
||||
| Thrift | [thrift](http://thrift.apache.org/) |
|
||||
| TypeScript | [eslint](http://eslint.org/), [tslint](https://github.com/palantir/tslint), tsserver, typecheck, [prettier](https://github.com/prettier/prettier) |
|
||||
| TypeScript | [eslint](http://eslint.org/), [prettier](https://github.com/prettier/prettier), [tslint](https://github.com/palantir/tslint), tsserver, typecheck |
|
||||
| Verilog | [iverilog](https://github.com/steveicarus/iverilog), [verilator](http://www.veripool.org/projects/verilator/wiki/Intro) |
|
||||
| Vim | [vint](https://github.com/Kuniwak/vint) |
|
||||
| Vim help^ | [proselint](http://proselint.com/)|
|
||||
| XHTML | [proselint](http://proselint.com/)|
|
||||
| XML | [xmllint](http://xmlsoft.org/xmllint.html)|
|
||||
| Vim help^ | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
||||
| XHTML | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
||||
| XML | [xmllint](http://xmlsoft.org/xmllint.html) |
|
||||
| YAML | [swaglint](https://github.com/byCedric/swaglint), [yamllint](https://yamllint.readthedocs.io/) |
|
||||
|
||||
<a name="usage"></a>
|
||||
@@ -211,6 +223,15 @@ 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 LSP linters and `tsserver`.
|
||||
|
||||
See `:help ale-go-to-definition` for more information.
|
||||
|
||||
<a name="installation"></a>
|
||||
|
||||
## 3. Installation
|
||||
@@ -370,9 +391,35 @@ highlight clear ALEErrorSign
|
||||
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>
|
||||
|
||||
### 5.iv. How can I show errors or warnings in my statusline?
|
||||
### 5.v. How can I show errors or warnings in my statusline?
|
||||
|
||||
[vim-airline](https://github.com/vim-airline/vim-airline) integrates with ALE
|
||||
for displaying error information in the status bar. If you want to see the
|
||||
@@ -412,68 +459,16 @@ See `:help ale#statusline#Count()` for more information.
|
||||
|
||||
<a name="faq-lightline"></a>
|
||||
|
||||
### 5.v. How can I show errors or warnings in my lightline?
|
||||
### 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 it's easy to do it yourself:
|
||||
support for ALE, nevertheless there is a plugin that adds this functionality: [maximbaz/lightline-ale](https://github.com/maximbaz/lightline-ale).
|
||||
|
||||
```vim
|
||||
" This is regular lightline configuration, we just added
|
||||
" 'linter_warnings', 'linter_errors' and 'linter_ok' to
|
||||
" the active right panel. Feel free to move it anywhere.
|
||||
" `component_expand' and `component_type' are required.
|
||||
"
|
||||
" For more info on how this works, see lightline documentation.
|
||||
let g:lightline = {
|
||||
\ 'active': {
|
||||
\ 'right': [ [ 'lineinfo' ],
|
||||
\ [ 'percent' ],
|
||||
\ [ 'linter_warnings', 'linter_errors', 'linter_ok' ],
|
||||
\ [ 'fileformat', 'fileencoding', 'filetype' ] ]
|
||||
\ },
|
||||
\ 'component_expand': {
|
||||
\ 'linter_warnings': 'LightlineLinterWarnings',
|
||||
\ 'linter_errors': 'LightlineLinterErrors',
|
||||
\ 'linter_ok': 'LightlineLinterOK'
|
||||
\ },
|
||||
\ 'component_type': {
|
||||
\ 'linter_warnings': 'warning',
|
||||
\ 'linter_errors': 'error',
|
||||
\ 'linter_ok': 'ok'
|
||||
\ },
|
||||
\ }
|
||||
|
||||
autocmd User ALELint call lightline#update()
|
||||
|
||||
" ale + lightline
|
||||
function! LightlineLinterWarnings() abort
|
||||
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 ? '' : printf('%d --', all_non_errors)
|
||||
endfunction
|
||||
|
||||
function! LightlineLinterErrors() abort
|
||||
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 ? '' : printf('%d >>', all_errors)
|
||||
endfunction
|
||||
|
||||
function! LightlineLinterOK() abort
|
||||
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 ? '✓' : ''
|
||||
endfunction
|
||||
```
|
||||
|
||||
See `:help ale#statusline#Count()` and [lightline documentation](https://github.com/itchyny/lightline.vim#advanced-configuration)
|
||||
for more information.
|
||||
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>
|
||||
|
||||
### 5.vi. How can I change the format for echo messages?
|
||||
### 5.vii. How can I change the format for echo messages?
|
||||
|
||||
There are 3 global options that allow customizing the echoed message.
|
||||
|
||||
@@ -498,22 +493,24 @@ Will give you:
|
||||
|
||||
<a name="faq-autocmd"></a>
|
||||
|
||||
### 5.vii. How can I execute some code when ALE stops linting?
|
||||
### 5.viii. How can I execute some code when ALE starts or stops linting?
|
||||
|
||||
ALE runs its own [autocmd](http://vimdoc.sourceforge.net/htmldoc/autocmd.html)
|
||||
event whenever has a linter has been successfully executed and processed. This
|
||||
autocmd event can be used to call arbitrary functions after ALE stops linting.
|
||||
events whenever has a linter is started and has been successfully executed and
|
||||
processed. These events can be used to call arbitrary functions before and after
|
||||
ALE stops linting.
|
||||
|
||||
```vim
|
||||
augroup YourGroup
|
||||
autocmd!
|
||||
autocmd User ALELint call YourFunction()
|
||||
autocmd User ALELintPre call YourFunction()
|
||||
autocmd User ALELintPost call YourFunction()
|
||||
augroup END
|
||||
```
|
||||
|
||||
<a name="faq-navigation"></a>
|
||||
|
||||
### 5.viii. How can I navigate between errors quickly?
|
||||
### 5.ix. How can I navigate between errors quickly?
|
||||
|
||||
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
|
||||
@@ -529,7 +526,7 @@ For more information, consult the online documentation with
|
||||
|
||||
<a name="faq-lint-on-save"></a>
|
||||
|
||||
### 5.ix. How can I run linters only when I save files?
|
||||
### 5.x. How can I run linters only when I save files?
|
||||
|
||||
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
|
||||
@@ -549,7 +546,7 @@ files, you can set `g:ale_lint_on_save` to `0`.
|
||||
|
||||
<a name="faq-quickfix"></a>
|
||||
|
||||
### 5.x. How can I use the quickfix list instead of the loclist?
|
||||
### 5.xi. How can I use the quickfix list instead of the loclist?
|
||||
|
||||
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
|
||||
@@ -576,7 +573,7 @@ let g:ale_keep_list_window_open = 1
|
||||
|
||||
<a name="faq-jsx-stylelint-eslint"></a>
|
||||
|
||||
### 5.xi. How can I check JSX files with both stylelint and eslint?
|
||||
### 5.xii. How can I check JSX files with both stylelint and eslint?
|
||||
|
||||
If you configure ALE options correctly in your vimrc file, and install
|
||||
the right tools, you can check JSX files with stylelint and eslint.
|
||||
@@ -609,7 +606,7 @@ no linter will be run twice for the same file.
|
||||
|
||||
<a name="faq-my-battery-is-sad"></a>
|
||||
|
||||
### 5.xii. Will this plugin eat all of my laptop battery power?
|
||||
### 5.xiii. 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
|
||||
course means that CPU time will be used to continuously check your code. If you
|
||||
@@ -631,3 +628,64 @@ still be an advantage.
|
||||
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
|
||||
`:ALELint`.
|
||||
|
||||
<a name="faq-c-configuration"></a>
|
||||
|
||||
### 5.xiv. 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` and `clangtidy` 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.xv. 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.
|
||||
|
||||
@@ -21,7 +21,7 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:code = l:match[4]
|
||||
|
||||
if l:code is# 'EANSIBLE002'
|
||||
if l:code is# 'EANSIBLE0002'
|
||||
\&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
||||
" Skip warnings for trailing whitespace if the option is off.
|
||||
continue
|
||||
@@ -31,7 +31,8 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:code . ': ' . l:match[5],
|
||||
\ 'text': l:match[5],
|
||||
\ 'code': l:code,
|
||||
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
|
||||
\})
|
||||
endif
|
||||
|
||||
36
ale_linters/apiblueprint/drafter.vim
Normal file
36
ale_linters/apiblueprint/drafter.vim
Normal file
@@ -0,0 +1,36 @@
|
||||
" 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 %t',
|
||||
\ 'callback': 'ale_linters#apiblueprint#drafter#HandleErrors',
|
||||
\})
|
||||
11
ale_linters/asciidoc/alex.vim
Normal file
11
ale_linters/asciidoc/alex.vim
Normal file
@@ -0,0 +1,11 @@
|
||||
" 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,
|
||||
\})
|
||||
9
ale_linters/asciidoc/redpen.vim
Normal file
9
ale_linters/asciidoc/redpen.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" 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',
|
||||
\})
|
||||
9
ale_linters/asciidoc/write-good.vim
Normal file
9
ale_linters/asciidoc/write-good.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for AsciiDoc files
|
||||
|
||||
call ale#linter#Define('asciidoc', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
||||
@@ -1,10 +1,16 @@
|
||||
" Author: Lucas Kolstad <lkolstad@uw.edu>
|
||||
" Description: gcc linter for asm files
|
||||
|
||||
let g:ale_asm_gcc_options = get(g:, 'ale_asm_gcc_options', '-Wall')
|
||||
call ale#Set('asm_gcc_executable', 'gcc')
|
||||
call ale#Set('asm_gcc_options', '-Wall')
|
||||
|
||||
function! ale_linters#asm#gcc#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'asm_gcc_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#asm#gcc#GetCommand(buffer) abort
|
||||
return 'gcc -x assembler -fsyntax-only '
|
||||
return ale#Escape(ale_linters#asm#gcc#GetExecutable(a:buffer))
|
||||
\ . ' -x assembler -fsyntax-only '
|
||||
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
\ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -'
|
||||
endfunction
|
||||
@@ -27,7 +33,7 @@ endfunction
|
||||
call ale#linter#Define('asm', {
|
||||
\ 'name': 'gcc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'gcc',
|
||||
\ 'executable_callback': 'ale_linters#asm#gcc#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#asm#gcc#GetCommand',
|
||||
\ 'callback': 'ale_linters#asm#gcc#Handle',
|
||||
\})
|
||||
|
||||
@@ -1,24 +1,37 @@
|
||||
" 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.
|
||||
|
||||
" Support options!
|
||||
let g:ale_chef_foodcritic_options = get(g:, 'ale_chef_foodcritic_options', '')
|
||||
let g:ale_chef_foodcritic_executable = get(g:, 'ale_chef_foodcritic_executable', 'foodcritic')
|
||||
call ale#Set('chef_foodcritic_executable', 'foodcritic')
|
||||
call ale#Set('chef_foodcritic_options', '')
|
||||
|
||||
function! ale_linters#chef#foodcritic#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'chef_foodcritic_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#chef#foodcritic#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#chef#foodcritic#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'chef_foodcritic_options')
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . escape(l:options, '~') : '')
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#chef#foodcritic#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" FC002: Avoid string interpolation where not required: httpd.rb:13
|
||||
let l:pattern = '^\(.\+:\s.\+\):\s\(.\+\):\(\d\+\)$'
|
||||
let l:pattern = '\v([^:]+): (.+): ([a-zA-Z]?:?[^:]+):(\d+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:text = l:match[1]
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[3] + 0,
|
||||
\ 'text': l:text,
|
||||
\ 'code': l:match[1],
|
||||
\ 'text': l:match[2],
|
||||
\ 'filename': l:match[3],
|
||||
\ 'lnum': l:match[4] + 0,
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
endfor
|
||||
@@ -26,17 +39,10 @@ function! ale_linters#chef#foodcritic#Handle(buffer, lines) abort
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#chef#foodcritic#GetCommand(buffer) abort
|
||||
return printf('%s %s %%t',
|
||||
\ ale#Var(a:buffer, 'chef_foodcritic_executable'),
|
||||
\ escape(ale#Var(a:buffer, 'chef_foodcritic_options'), '~')
|
||||
\)
|
||||
endfunction
|
||||
|
||||
|
||||
call ale#linter#Define('chef', {
|
||||
\ 'name': 'foodcritic',
|
||||
\ 'executable': 'foodcritic',
|
||||
\ 'executable_callback': 'ale_linters#chef#foodcritic#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#chef#foodcritic#GetCommand',
|
||||
\ 'callback': 'ale_linters#chef#foodcritic#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
||||
32
ale_linters/clojure/joker.vim
Normal file
32
ale_linters/clojure/joker.vim
Normal file
@@ -0,0 +1,32 @@
|
||||
" 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 --lint %t',
|
||||
\ 'callback': 'ale_linters#clojure#joker#HandleJokerFormat',
|
||||
\})
|
||||
@@ -8,15 +8,16 @@ function! ale_linters#cs#mcs#Handle(buffer, lines) abort
|
||||
" Look for lines like the following.
|
||||
"
|
||||
" Tests.cs(12,29): error CSXXXX: ; expected
|
||||
let l:pattern = '^.\+.cs(\(\d\+\),\(\d\+\)): \(.\+\): \(.\+\)'
|
||||
let l:pattern = '^\v(.+\.cs)\((\d+),(\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[3] . ': ' . l:match[4],
|
||||
\ 'type': l:match[3] =~# '^error' ? 'E' : 'W',
|
||||
\ '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
|
||||
|
||||
|
||||
@@ -1,55 +1,47 @@
|
||||
" general mcs options which are likely to stay constant across
|
||||
" source trees like -pkg:dotnet
|
||||
let g:ale_cs_mcsc_options = get(g:, 'ale_cs_mcsc_options', '')
|
||||
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', [])
|
||||
|
||||
" path string pointing the linter to the base path of the
|
||||
" source tree to check
|
||||
let g:ale_cs_mcsc_source = get(g:, 'ale_cs_mcsc_source','.')
|
||||
function! s:GetWorkingDirectory(buffer) abort
|
||||
let l:working_directory = ale#Var(a:buffer, 'cs_mcsc_source')
|
||||
|
||||
" list of search paths for additional assemblies to consider
|
||||
let g:ale_cs_mcsc_assembly_path = get(g:, 'ale_cs_mcsc_assembly_path',[])
|
||||
if !empty(l:working_directory)
|
||||
return l:working_directory
|
||||
endif
|
||||
|
||||
return fnamemodify(bufname(a:buffer), ':p:h')
|
||||
endfunction
|
||||
|
||||
" list of assemblies to consider
|
||||
let g:ale_cs_mcsc_assemblies = get(g:, 'ale_cs_mcsc_assemblies',[])
|
||||
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')
|
||||
|
||||
" if list of assembly search paths is not empty convert it to
|
||||
" appropriate -lib: parameter of mcs
|
||||
let l:path = 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)'), ',')
|
||||
\ : ''
|
||||
|
||||
if !empty(l:path)
|
||||
let l:path = '-lib:"' . join(l:path, '","') .'"'
|
||||
else
|
||||
let l:path =''
|
||||
endif
|
||||
" Pass paths to DLL files via the -r: parameter.
|
||||
let l:assembly_list = ale#Var(a:buffer, 'cs_mcsc_assemblies')
|
||||
|
||||
" if list of assemblies to link is not empty convert it to the
|
||||
" appropriate -r: parameter of mcs
|
||||
let l:assemblies = ale#Var(a:buffer, 'cs_mcsc_assemblies')
|
||||
|
||||
if !empty(l:assemblies)
|
||||
let l:assemblies = '-r:"' . join(l:assemblies, '","') . '"'
|
||||
else
|
||||
let l:assemblies =''
|
||||
endif
|
||||
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
|
||||
let l:out = tempname()
|
||||
call ale#engine#ManageFile(a:buffer, l:out)
|
||||
|
||||
" assemble linter command string to be executed by ale
|
||||
" implicitly set -unsafe mcs flag set compilation
|
||||
" target to module (-t:module), direct mcs output to
|
||||
" temporary file (-out)
|
||||
"
|
||||
return 'cd "' . ale#Var(a:buffer, 'cs_mcsc_source') . '";'
|
||||
" 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#Var(a:buffer, 'cs_mcsc_options')
|
||||
\ . ' ' . l:path
|
||||
\ . ' ' . l:assemblies
|
||||
\ . ' ' . l:lib_option
|
||||
\ . ' ' . l:r_option
|
||||
\ . ' -out:' . l:out
|
||||
\ . ' -t:module'
|
||||
\ . ' -recurse:"*.cs"'
|
||||
\ . ' -recurse:' . ale#Escape('*.cs')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cs#mcsc#Handle(buffer, lines) abort
|
||||
@@ -60,17 +52,19 @@ function! ale_linters#cs#mcsc#Handle(buffer, lines) abort
|
||||
" 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 = '^\(.\+\.cs\)(\(\d\+\),\(\d\+\)): \(.\+\): \(.\+\)'
|
||||
let l:pattern = '^\v(.+\.cs)\((\d+),(\d+)\)\: ([^ ]+) ([^ ]+): (.+)$'
|
||||
let l:output = []
|
||||
let l:source = ale#Var(a:buffer, 'cs_mcsc_source')
|
||||
|
||||
let l:dir = s:GetWorkingDirectory(a:buffer)
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'filename': fnamemodify(l:source . '/' . l:match[1], ':p'),
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[4] . ': ' . l:match[5],
|
||||
\ 'type': l:match[4] =~# '^error' ? 'E' : 'W',
|
||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
||||
\ 'code': l:match[5],
|
||||
\ 'text': l:match[6],
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
||||
25
ale_linters/dafny/dafny.vim
Normal file
25
ale_linters/dafny/dafny.vim
Normal file
@@ -0,0 +1,25 @@
|
||||
" 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,
|
||||
\ })
|
||||
@@ -13,7 +13,7 @@ function! ale_linters#dart#dartanalyzer#GetCommand(buffer) abort
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . (!empty(l:path) ? ' --packages ' . ale#Escape(l:path) : '')
|
||||
\ . ' %t'
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dart#dartanalyzer#Handle(buffer, lines) abort
|
||||
@@ -37,4 +37,5 @@ call ale#linter#Define('dart', {
|
||||
\ 'executable_callback': 'ale_linters#dart#dartanalyzer#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#dart#dartanalyzer#GetCommand',
|
||||
\ 'callback': 'ale_linters#dart#dartanalyzer#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
||||
30
ale_linters/dart/language_server.vim
Normal file
30
ale_linters/dart/language_server.vim
Normal file
@@ -0,0 +1,30 @@
|
||||
" 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#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'dart_language_server_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dart#language_server#GetLanguage(buffer) abort
|
||||
return 'dart'
|
||||
endfunction
|
||||
|
||||
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_linters#dart#language_server#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#dart#language_server#GetExecutable',
|
||||
\ 'language_callback': 'ale_linters#dart#language_server#GetLanguage',
|
||||
\ 'project_root_callback': 'ale_linters#dart#language_server#GetProjectRoot',
|
||||
\})
|
||||
|
||||
@@ -17,7 +17,7 @@ function! ale_linters#erlang#erlc#Handle(buffer, lines) abort
|
||||
" error.erl:4: variable 'B' is unbound
|
||||
" error.erl:3: Warning: function main/0 is unused
|
||||
" error.erl:4: Warning: variable 'A' is unused
|
||||
let l:pattern = '\v^([^:]+):(\d+): (Warning: )?(.+)$'
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+): (Warning: )?(.+)$'
|
||||
|
||||
" parse_transforms are a special case. The error message does not indicate a location:
|
||||
" error.erl: undefined parse transform 'some_parse_transform'
|
||||
|
||||
25
ale_linters/eruby/erb.vim
Normal file
25
ale_linters/eruby/erb.vim
Normal file
@@ -0,0 +1,25 @@
|
||||
" 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,11 +1,23 @@
|
||||
" Author: Jake Zimmerman <jake@zimmerman.io>
|
||||
" 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': 'erubis -x %t | ruby -c',
|
||||
\ 'command_callback': 'ale_linters#eruby#erubis#GetCommand',
|
||||
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
|
||||
\})
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
" Author: Matthias Guenther - https://wikimatze.de
|
||||
" Description: erb-lint for eruby/erb files
|
||||
|
||||
call ale#linter#Define('eruby', {
|
||||
\ 'name': 'erubylint',
|
||||
\ 'executable': 'erb',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command': 'erb -P -x %t | ruby -c',
|
||||
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
|
||||
\})
|
||||
|
||||
38
ale_linters/glsl/glslls.vim
Normal file
38
ale_linters/glsl/glslls.vim
Normal file
@@ -0,0 +1,38 @@
|
||||
" 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#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'glsl_glslls_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#glsl#glslls#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#glsl#glslls#GetExecutable(a:buffer)
|
||||
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 ale#Escape(l:executable) . l:logfile_args . ' --stdin'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#glsl#glslls#GetLanguage(buffer) abort
|
||||
return 'glsl'
|
||||
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_linters#glsl#glslls#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#glsl#glslls#GetCommand',
|
||||
\ 'language_callback': 'ale_linters#glsl#glslls#GetLanguage',
|
||||
\ 'project_root_callback': 'ale_linters#glsl#glslls#GetProjectRoot',
|
||||
\})
|
||||
@@ -1,4 +1,5 @@
|
||||
" Author: Joshua Rubin <joshua@rubixconsulting.com>, Ben Reedy <https://github.com/breed808>
|
||||
" Author: Joshua Rubin <joshua@rubixconsulting.com>, Ben Reedy <https://github.com/breed808>,
|
||||
" Jeff Willette <jrwillette88@gmail.com>
|
||||
" Description: go build for Go files
|
||||
|
||||
" inspired by work from dzhou121 <dzhou121@gmail.com>
|
||||
@@ -39,15 +40,12 @@ function! ale_linters#go#gobuild#GetMatches(lines) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gobuild#Handler(buffer, lines) abort
|
||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale_linters#go#gobuild#GetMatches(a:lines)
|
||||
" Omit errors from imported go packages
|
||||
if !ale#path#IsBufferPath(a:buffer, l:match[1])
|
||||
continue
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[4],
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'golint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': 'golint',
|
||||
\ 'command': 'golint %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
" Author: Ben Reedy <https://github.com/breed808>
|
||||
" 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#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'go_gometalinter_executable')
|
||||
@@ -10,13 +11,22 @@ endfunction
|
||||
|
||||
function! ale_linters#go#gometalinter#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#go#gometalinter#GetExecutable(a:buffer)
|
||||
let l:filename = expand('#' . a:buffer)
|
||||
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')
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . ' --include=' . ale#Escape('^' . ale#util#EscapePCRE(l:filename))
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' ' . ale#Escape(fnamemodify(l:filename, ':h'))
|
||||
" 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)
|
||||
\ . ale#Escape(l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||
endif
|
||||
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#Escape(l:executable)
|
||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(l:filename))
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gometalinter#GetMatches(lines) abort
|
||||
@@ -26,10 +36,13 @@ function! ale_linters#go#gometalinter#GetMatches(lines) abort
|
||||
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',
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'gosimple',
|
||||
\ 'executable': 'gosimple',
|
||||
\ 'command': 'gosimple %t',
|
||||
\ 'command': 'gosimple %s',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\ 'output_stream': 'both'
|
||||
\ 'output_stream': 'both',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'staticcheck',
|
||||
\ 'executable': 'staticcheck',
|
||||
\ 'command': 'staticcheck %t',
|
||||
\ 'command': 'staticcheck %s',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\ 'output_stream': 'both'
|
||||
\ 'output_stream': 'both',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
||||
9
ale_linters/graphql/eslint.vim
Normal file
9
ale_linters/graphql/eslint.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" 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',
|
||||
\})
|
||||
@@ -1,6 +1,31 @@
|
||||
" Author: Patrick Lewis - https://github.com/patricklewis
|
||||
" Author: Patrick Lewis - https://github.com/patricklewis, thenoseman - https://github.com/thenoseman
|
||||
" Description: haml-lint for Haml files
|
||||
|
||||
function! ale_linters#haml#hamllint#GetCommand(buffer) abort
|
||||
let l:prefix = ''
|
||||
|
||||
let l:rubocop_config_file_path = ale#path#FindNearestFile(a:buffer, '.rubocop.yml')
|
||||
let l:hamllint_config_file_path = ale#path#FindNearestFile(a:buffer, '.haml-lint.yml')
|
||||
|
||||
" Set HAML_LINT_RUBOCOP_CONF variable as it is needed for haml-lint to
|
||||
" pick up the rubocop config.
|
||||
"
|
||||
" See https://github.com/brigade/haml-lint/blob/master/lib/haml_lint/linter/rubocop.rb#L89
|
||||
" HamlLint::Linter::RuboCop#rubocop_flags
|
||||
if !empty(l:rubocop_config_file_path)
|
||||
if ale#Has('win32')
|
||||
let l:prefix = 'set HAML_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config_file_path) . ' &&'
|
||||
else
|
||||
let l:prefix = 'HAML_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config_file_path)
|
||||
endif
|
||||
endif
|
||||
|
||||
return (!empty(l:prefix) ? l:prefix . ' ' : '')
|
||||
\ . 'haml-lint'
|
||||
\ . (!empty(l:hamllint_config_file_path) ? ' --config ' . ale#Escape(l:hamllint_config_file_path) : '')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#haml#hamllint#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
" <path>:51 [W] RuboCop: Use the new Ruby 1.9 hash syntax.
|
||||
@@ -21,6 +46,6 @@ endfunction
|
||||
call ale#linter#Define('haml', {
|
||||
\ 'name': 'hamllint',
|
||||
\ 'executable': 'haml-lint',
|
||||
\ 'command': 'haml-lint %t',
|
||||
\ 'command_callback': 'ale_linters#haml#hamllint#GetCommand',
|
||||
\ 'callback': 'ale_linters#haml#hamllint#Handle'
|
||||
\})
|
||||
|
||||
@@ -22,15 +22,13 @@ function! ale_linters#handlebars#embertemplatelint#Handle(buffer, lines) abort
|
||||
for l:error in get(values(l:json), 0, [])
|
||||
if has_key(l:error, 'fatal')
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': 1,
|
||||
\ 'col': 1,
|
||||
\ 'lnum': get(l:error, 'line', 1),
|
||||
\ 'col': get(l:error, 'column', 1),
|
||||
\ 'text': l:error.message,
|
||||
\ 'type': l:error.severity == 1 ? 'W' : 'E',
|
||||
\})
|
||||
else
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:error.line,
|
||||
\ 'col': l:error.column,
|
||||
\ 'text': l:error.rule . ': ' . l:error.message,
|
||||
|
||||
11
ale_linters/help/alex.vim
Normal file
11
ale_linters/help/alex.vim
Normal file
@@ -0,0 +1,11 @@
|
||||
" Author: Johannes Wienke <languitar@semipol.de>
|
||||
" Description: alex for help 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,
|
||||
\})
|
||||
9
ale_linters/help/write-good.vim
Normal file
9
ale_linters/help/write-good.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for vim Help files
|
||||
|
||||
call ale#linter#Define('help', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
||||
11
ale_linters/html/alex.vim
Normal file
11
ale_linters/html/alex.vim
Normal file
@@ -0,0 +1,11 @@
|
||||
" Author: Johannes Wienke <languitar@semipol.de>
|
||||
" Description: alex for HTML files
|
||||
|
||||
call ale#linter#Define('html', {
|
||||
\ 'name': 'alex',
|
||||
\ 'executable': 'alex',
|
||||
\ 'command': 'alex %s -t',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale#handlers#alex#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
9
ale_linters/html/write-good.vim
Normal file
9
ale_linters/html/write-good.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for nroff files
|
||||
|
||||
call ale#linter#Define('html', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
||||
@@ -2,27 +2,17 @@
|
||||
" Description: checkstyle for Java files
|
||||
|
||||
function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
|
||||
let l:patterns = [
|
||||
\ '\v\[(WARN|ERROR)\] .*:(\d+):(\d+): (.*)',
|
||||
\ '\v\[(WARN|ERROR)\] .*:(\d+): (.*)',
|
||||
\]
|
||||
let l:pattern = '\v\[(WARN|ERROR)\] [a-zA-Z]?:?[^:]+:(\d+):(\d+)?:? (.*) \[(.+)\]$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:patterns)
|
||||
let l:args = {
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'type': l:match[1] is? 'WARN' ? 'W' : 'E',
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'type': l:match[1] =~? 'WARN' ? 'W' : 'E'
|
||||
\ }
|
||||
|
||||
let l:col = l:match[3] + 0
|
||||
if l:col > 0
|
||||
let l:args['col'] = l:col
|
||||
let l:args['text'] = l:match[4]
|
||||
else
|
||||
let l:args['text'] = l:match[3]
|
||||
endif
|
||||
|
||||
call add(l:output, l:args)
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[4],
|
||||
\ 'code': l:match[5],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
|
||||
@@ -41,15 +41,42 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort
|
||||
|
||||
" Find the src directory, for files in this project.
|
||||
let l:src_dir = ale#path#FindNearestDirectory(a:buffer, 'src/main/java')
|
||||
let l:sp_dirs = []
|
||||
|
||||
if !empty(l:src_dir)
|
||||
let l:sp_option = '-sourcepath ' . ale#Escape(l:src_dir)
|
||||
call add(l:sp_dirs, l:src_dir)
|
||||
|
||||
" Automatically include the jaxb directory too, if it's there.
|
||||
let l:jaxb_dir = fnamemodify(l:src_dir, ':h:h')
|
||||
\ . (has('win32') ? '\jaxb\' : '/jaxb/')
|
||||
|
||||
if isdirectory(l:jaxb_dir)
|
||||
call add(l:sp_dirs, l:jaxb_dir)
|
||||
endif
|
||||
|
||||
" Automatically include the test directory, but only for test code.
|
||||
if expand('#' . a:buffer . ':p') =~? '\vsrc[/\\]test[/\\]java'
|
||||
let l:test_dir = fnamemodify(l:src_dir, ':h:h:h')
|
||||
\ . (has('win32') ? '\test\java\' : '/test/java/')
|
||||
|
||||
if isdirectory(l:test_dir)
|
||||
call add(l:sp_dirs, l:test_dir)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if !empty(l:sp_dirs)
|
||||
let l:sp_option = '-sourcepath '
|
||||
\ . ale#Escape(join(l:sp_dirs, s:classpath_sep))
|
||||
endif
|
||||
|
||||
" Create .class files in a temporary directory, which we will delete later.
|
||||
let l:class_file_directory = ale#engine#CreateDirectory(a:buffer)
|
||||
|
||||
return 'javac -Xlint'
|
||||
" Always run javac from the directory the file is in, so we can resolve
|
||||
" relative paths correctly.
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . 'javac -Xlint'
|
||||
\ . ' ' . l:cp_option
|
||||
\ . ' ' . l:sp_option
|
||||
\ . ' -d ' . ale#Escape(l:class_file_directory)
|
||||
@@ -63,14 +90,15 @@ function! ale_linters#java#javac#Handle(buffer, lines) abort
|
||||
" Main.java:13: warning: [deprecation] donaught() in Testclass has been deprecated
|
||||
" Main.java:16: error: ';' expected
|
||||
|
||||
let l:pattern = '\v^.*:(\d+): (.+):(.+)$'
|
||||
let l:directory = expand('#' . a:buffer . ':p:h')
|
||||
let l:pattern = '\v^(.*):(\d+): (.+):(.+)$'
|
||||
let l:col_pattern = '\v^(\s*\^)$'
|
||||
let l:symbol_pattern = '\v^ +symbol: *(class|method) +([^ ]+)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, [l:pattern, l:col_pattern, l:symbol_pattern])
|
||||
if empty(l:match[2]) && empty(l:match[3])
|
||||
let l:output[-1].col = len(l:match[1])
|
||||
let l:output[-1].col = len(l:match[1])
|
||||
elseif empty(l:match[3])
|
||||
" Add symbols to 'cannot find symbol' errors.
|
||||
if l:output[-1].text is# 'error: cannot find symbol'
|
||||
@@ -78,9 +106,10 @@ function! ale_linters#java#javac#Handle(buffer, lines) abort
|
||||
endif
|
||||
else
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'text': l:match[2] . ':' . l:match[3],
|
||||
\ 'type': l:match[2] is# 'error' ? 'E' : 'W',
|
||||
\ 'filename': ale#path#GetAbsPath(l:directory, l:match[1]),
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'text': l:match[3] . ':' . l:match[4],
|
||||
\ 'type': l:match[3] is# 'error' ? 'E' : 'W',
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
105
ale_linters/javascript/flow.vim
Normal file → Executable file
105
ale_linters/javascript/flow.vim
Normal file → Executable file
@@ -1,21 +1,12 @@
|
||||
" Author: Zach Perrault -- @zperrault
|
||||
" Author: Florian Beeres <yuuki@protonmail.com>
|
||||
" Description: FlowType checking for JavaScript files
|
||||
|
||||
call ale#Set('javascript_flow_executable', 'flow')
|
||||
call ale#Set('javascript_flow_use_home_config', 0)
|
||||
call ale#Set('javascript_flow_use_global', 0)
|
||||
|
||||
function! ale_linters#javascript#flow#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_flow', [
|
||||
\ 'node_modules/.bin/flow',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#flow#VersionCheck(buffer) abort
|
||||
return ale#Escape(ale_linters#javascript#flow#GetExecutable(a:buffer))
|
||||
\ . ' --version'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#flow#GetCommand(buffer, version_lines) abort
|
||||
let l:flow_config = ale#path#FindNearestFile(a:buffer, '.flowconfig')
|
||||
|
||||
if empty(l:flow_config)
|
||||
@@ -23,18 +14,43 @@ function! ale_linters#javascript#flow#GetCommand(buffer, version_lines) abort
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:use_respect_pragma = 1
|
||||
" Don't run Flow with a configuration file from the home directory by
|
||||
" default, which can eat all of your RAM.
|
||||
if fnamemodify(l:flow_config, ':h') is? $HOME
|
||||
\&& !ale#Var(a:buffer, 'javascript_flow_use_home_config')
|
||||
return ''
|
||||
endif
|
||||
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_flow', [
|
||||
\ 'node_modules/.bin/flow',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#flow#VersionCheck(buffer) abort
|
||||
let l:executable = ale_linters#javascript#flow#GetExecutable(a:buffer)
|
||||
|
||||
if empty(l:executable)
|
||||
return ''
|
||||
endif
|
||||
|
||||
return ale#Escape(l:executable) . ' --version'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#flow#GetCommand(buffer, version_lines) abort
|
||||
let l:executable = ale_linters#javascript#flow#GetExecutable(a:buffer)
|
||||
|
||||
if empty(l:executable)
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:version = ale#semver#GetVersion(l:executable, a:version_lines)
|
||||
|
||||
" If we can parse the version number, then only use --respect-pragma
|
||||
" if the version is >= 0.36.0, which added the argument.
|
||||
for l:match in ale#util#GetMatches(a:version_lines, '\v\d+\.\d+\.\d+$')
|
||||
let l:use_respect_pragma = ale#semver#GreaterOrEqual(
|
||||
\ ale#semver#Parse(l:match[0]),
|
||||
\ [0, 36, 0]
|
||||
\)
|
||||
endfor
|
||||
let l:use_respect_pragma = empty(l:version)
|
||||
\ || ale#semver#GTE(l:version, [0, 36])
|
||||
|
||||
return ale#Escape(ale_linters#javascript#flow#GetExecutable(a:buffer))
|
||||
return ale#Escape(l:executable)
|
||||
\ . ' check-contents'
|
||||
\ . (l:use_respect_pragma ? ' --respect-pragma': '')
|
||||
\ . ' --json --from ale %s'
|
||||
@@ -56,6 +72,44 @@ function! s:GetJSONLines(lines) abort
|
||||
return a:lines[l:start_index :]
|
||||
endfunction
|
||||
|
||||
function! s:ExtraErrorMsg(current, new) abort
|
||||
let l:newMsg = ''
|
||||
|
||||
if a:current is# ''
|
||||
" extra messages appear to already have a :
|
||||
let l:newMsg = a:new
|
||||
else
|
||||
let l:newMsg = a:current . ' ' . a:new
|
||||
endif
|
||||
|
||||
return l:newMsg
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:GetDetails(error) abort
|
||||
let l:detail = ''
|
||||
|
||||
for l:extra_error in a:error.extra
|
||||
|
||||
if has_key(l:extra_error, 'message')
|
||||
for l:extra_message in l:extra_error.message
|
||||
let l:detail = s:ExtraErrorMsg(l:detail, l:extra_message.descr)
|
||||
endfor
|
||||
endif
|
||||
|
||||
if has_key(l:extra_error, 'children')
|
||||
for l:child in l:extra_error.children
|
||||
for l:child_message in l:child.message
|
||||
let l:detail = l:detail . ' ' . l:child_message.descr
|
||||
endfor
|
||||
endfor
|
||||
endif
|
||||
|
||||
endfor
|
||||
|
||||
return l:detail
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#flow#Handle(buffer, lines) abort
|
||||
let l:str = join(s:GetJSONLines(a:lines), '')
|
||||
|
||||
@@ -94,12 +148,19 @@ function! ale_linters#javascript#flow#Handle(buffer, lines) abort
|
||||
let l:text = l:text . ' See also: ' . l:error.operation.descr
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
let l:errorToAdd = {
|
||||
\ 'lnum': l:line,
|
||||
\ 'col': l:col,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:error.level is# 'error' ? 'E' : 'W',
|
||||
\})
|
||||
\ 'type': has_key(l:error, 'level') && l:error.level is# 'error' ? 'E' : 'W',
|
||||
\}
|
||||
|
||||
if has_key(l:error, 'extra')
|
||||
let l:errorToAdd.detail = s:GetDetails(l:error)
|
||||
endif
|
||||
|
||||
call add(l:output, l:errorToAdd)
|
||||
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
|
||||
@@ -35,19 +35,23 @@ function! ale_linters#javascript#jscs#Handle(buffer, lines) abort
|
||||
"
|
||||
" foobar.js: line 2, col 1, Expected indentation of 1 characters
|
||||
"
|
||||
let l:pattern = '^.*:\s\+line \(\d\+\),\s\+col\s\+\(\d\+\),\s\+\(.*\)$'
|
||||
let l:pattern = '\v^.*:\s+line (\d+),\s+col\s+(\d+),\s+(.*)$'
|
||||
let l:output = []
|
||||
let l:m = ale#util#GetMatches(a:lines, [l:pattern])
|
||||
|
||||
for l:match in l:m
|
||||
let l:text = l:match[3]
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:obj = {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[3]
|
||||
\}
|
||||
|
||||
let l:code_match = matchlist(l:match[3], '\v([^ :]+): (.+)$')
|
||||
|
||||
if !empty(l:code_match)
|
||||
let l:obj.code = l:code_match[1]
|
||||
let l:obj.text = l:code_match[2]
|
||||
endif
|
||||
|
||||
call add(l:output, l:obj)
|
||||
endfor
|
||||
|
||||
|
||||
56
ale_linters/less/lessc.vim
Executable file
56
ale_linters/less/lessc.vim
Executable file
@@ -0,0 +1,56 @@
|
||||
" Author: zanona <https://github.com/zanona>, w0rp <devw0rp@gmail.com>
|
||||
" Description: This file adds support for checking Less code with lessc.
|
||||
|
||||
call ale#Set('less_lessc_executable', 'lessc')
|
||||
call ale#Set('less_lessc_options', '')
|
||||
call ale#Set('less_lessc_use_global', 0)
|
||||
|
||||
function! ale_linters#less#lessc#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'less_lessc', [
|
||||
\ 'node_modules/.bin/lessc',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#less#lessc#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#less#lessc#GetExecutable(a:buffer)
|
||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||
let l:options = ale#Var(a:buffer, 'less_lessc_options')
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . ' --no-color --lint'
|
||||
\ . ' --include-path=' . ale#Escape(l:dir)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' -'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#less#lessc#Handle(buffer, lines) abort
|
||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||
" Matches patterns like the following:
|
||||
let l:pattern = '^\(\w\+\): \(.\{-}\) in \(.\{-}\) on line \(\d\+\), column \(\d\+\):$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:item = {
|
||||
\ 'lnum': l:match[4] + 0,
|
||||
\ 'col': l:match[5] + 0,
|
||||
\ 'text': l:match[2],
|
||||
\ 'type': 'E',
|
||||
\}
|
||||
|
||||
if l:match[3] isnot# '-'
|
||||
let l:item.filename = ale#path#GetAbsPath(l:dir, l:match[3])
|
||||
endif
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('less', {
|
||||
\ 'name': 'lessc',
|
||||
\ 'executable_callback': 'ale_linters#less#lessc#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#less#lessc#GetCommand',
|
||||
\ 'callback': 'ale_linters#less#lessc#Handle',
|
||||
\ 'output_stream': 'stderr',
|
||||
\})
|
||||
27
ale_linters/less/stylelint.vim
Normal file
27
ale_linters/less/stylelint.vim
Normal file
@@ -0,0 +1,27 @@
|
||||
" Author: diartyz <diartyz@gmail.com>, w0rp <devw0rp@gmail.com>
|
||||
|
||||
call ale#Set('less_stylelint_executable', 'stylelint')
|
||||
call ale#Set('less_stylelint_options', '')
|
||||
call ale#Set('less_stylelint_use_global', 0)
|
||||
|
||||
function! ale_linters#less#stylelint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'less_stylelint', [
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#less#stylelint#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#less#stylelint#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'less_stylelint_options')
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' --stdin-filename %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('less', {
|
||||
\ 'name': 'stylelint',
|
||||
\ 'executable_callback': 'ale_linters#less#stylelint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#less#stylelint#GetCommand',
|
||||
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
|
||||
\})
|
||||
@@ -35,8 +35,9 @@ function! ale_linters#lua#luacheck#Handle(buffer, lines) abort
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[3] . l:match[4] . ': ' . l:match[5],
|
||||
\ 'type': l:match[3],
|
||||
\ 'code': l:match[3] . l:match[4],
|
||||
\ 'text': l:match[5],
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
||||
11
ale_linters/mail/alex.vim
Normal file
11
ale_linters/mail/alex.vim
Normal file
@@ -0,0 +1,11 @@
|
||||
" Author: Johannes Wienke <languitar@semipol.de>
|
||||
" Description: alex for HTML files
|
||||
|
||||
call ale#linter#Define('mail', {
|
||||
\ 'name': 'alex',
|
||||
\ 'executable': 'alex',
|
||||
\ 'command': 'alex %s -t',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale#handlers#alex#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
9
ale_linters/mail/proselint.vim
Normal file
9
ale_linters/mail/proselint.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: Daniel M. Capella https://github.com/polyzen
|
||||
" Description: proselint for mail files
|
||||
|
||||
call ale#linter#Define('mail', {
|
||||
\ 'name': 'proselint',
|
||||
\ 'executable': 'proselint',
|
||||
\ 'command': 'proselint %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
||||
9
ale_linters/mail/vale.vim
Normal file
9
ale_linters/mail/vale.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: chew-z https://github.com/chew-z
|
||||
" Description: vale for Markdown files
|
||||
|
||||
call ale#linter#Define('mail', {
|
||||
\ 'name': 'vale',
|
||||
\ 'executable': 'vale',
|
||||
\ 'command': 'vale --output=JSON %t',
|
||||
\ 'callback': 'ale#handlers#vale#Handle',
|
||||
\})
|
||||
24
ale_linters/make/checkmake.vim
Normal file
24
ale_linters/make/checkmake.vim
Normal file
@@ -0,0 +1,24 @@
|
||||
" Author: aurieh - https://github.com/aurieh
|
||||
|
||||
function! ale_linters#make#checkmake#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^(\d+):(.+):(.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'type': 'E',
|
||||
\ 'code': l:match[2],
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endfor
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('make', {
|
||||
\ 'name': 'checkmake',
|
||||
\ 'executable': 'checkmake',
|
||||
\ 'command': 'checkmake %s --format="{{.LineNumber}}:{{.Rule}}:{{.Violation}}"',
|
||||
\ 'callback': 'ale_linters#make#checkmake#Handle',
|
||||
\})
|
||||
11
ale_linters/markdown/alex.vim
Normal file
11
ale_linters/markdown/alex.vim
Normal file
@@ -0,0 +1,11 @@
|
||||
" Author: Johannes Wienke <languitar@semipol.de>
|
||||
" Description: alex for markdown files
|
||||
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'alex',
|
||||
\ 'executable': 'alex',
|
||||
\ 'command': 'alex %s -t',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale#handlers#alex#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
9
ale_linters/markdown/redpen.vim
Normal file
9
ale_linters/markdown/redpen.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: rhysd https://rhysd.github.io
|
||||
" Description: Redpen, a proofreading tool (http://redpen.cc)
|
||||
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'redpen',
|
||||
\ 'executable': 'redpen',
|
||||
\ 'command': 'redpen -f markdown -r json %t',
|
||||
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
|
||||
\})
|
||||
@@ -4,6 +4,6 @@
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'vale',
|
||||
\ 'executable': 'vale',
|
||||
\ 'command': 'vale --output=line %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\ 'command': 'vale --output=JSON %t',
|
||||
\ 'callback': 'ale#handlers#vale#Handle',
|
||||
\})
|
||||
|
||||
9
ale_linters/markdown/write-good.vim
Normal file
9
ale_linters/markdown/write-good.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for Markdown files
|
||||
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
||||
@@ -10,33 +10,40 @@ function! ale_linters#nim#nimcheck#Handle(buffer, lines) abort
|
||||
" Only show errors of the current buffer
|
||||
" NOTE: Checking filename only is OK because nim enforces unique
|
||||
" module names.
|
||||
|
||||
let l:temp_buffer_filename = fnamemodify(l:match[1], ':p:t')
|
||||
|
||||
if l:buffer_filename isnot# '' && l:temp_buffer_filename isnot# l:buffer_filename
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:line = l:match[2] + 0
|
||||
let l:column = l:match[3] + 0
|
||||
let l:text = l:match[4]
|
||||
let l:type = 'W'
|
||||
let l:item = {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[4],
|
||||
\ 'type': 'W',
|
||||
\}
|
||||
|
||||
" Extract error type from message of type 'Error: Some error message'
|
||||
let l:textmatch = matchlist(l:match[4], '^\(.\{-}\): .\+$')
|
||||
let l:error_match = matchlist(l:item.text, '^\(.\{-}\): \(.\+\)$')
|
||||
|
||||
if len(l:textmatch) > 0
|
||||
let l:errortype = l:textmatch[1]
|
||||
if l:errortype is# 'Error'
|
||||
let l:type = 'E'
|
||||
if !empty(l:error_match)
|
||||
if l:error_match[1] is# 'Error'
|
||||
let l:item.type = 'E'
|
||||
let l:item.text = l:error_match[2]
|
||||
elseif l:error_match[1] is# 'Warning'
|
||||
\|| l:error_match[1] is# 'Hint'
|
||||
let l:item.text = l:error_match[2]
|
||||
endif
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:line,
|
||||
\ 'col': l:column,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type,
|
||||
\})
|
||||
let l:code_match = matchlist(l:item.text, '\v^(.+) \[([^ \[]+)\]$')
|
||||
|
||||
if !empty(l:code_match)
|
||||
let l:item.text = l:code_match[1]
|
||||
let l:item.code = l:code_match[2]
|
||||
endif
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
|
||||
11
ale_linters/nroff/alex.vim
Normal file
11
ale_linters/nroff/alex.vim
Normal file
@@ -0,0 +1,11 @@
|
||||
" Author: Johannes Wienke <languitar@semipol.de>
|
||||
" Description: alex for nroff files
|
||||
|
||||
call ale#linter#Define('nroff', {
|
||||
\ 'name': 'alex',
|
||||
\ 'executable': 'alex',
|
||||
\ 'command': 'alex %s -t',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale#handlers#alex#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
9
ale_linters/nroff/write-good.vim
Normal file
9
ale_linters/nroff/write-good.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for nroff files
|
||||
|
||||
call ale#linter#Define('nroff', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
||||
14
ale_linters/ocaml/ols.vim
Normal file
14
ale_linters/ocaml/ols.vim
Normal file
@@ -0,0 +1,14 @@
|
||||
" Author: Michael Jungo <michaeljungo92@gmail.com>
|
||||
" Description: A language server for OCaml
|
||||
|
||||
call ale#Set('ocaml_ols_executable', 'ocaml-language-server')
|
||||
call ale#Set('ocaml_ols_use_global', 0)
|
||||
|
||||
call ale#linter#Define('ocaml', {
|
||||
\ 'name': 'ols',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale#handlers#ols#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#ols#GetCommand',
|
||||
\ 'language_callback': 'ale#handlers#ols#GetLanguage',
|
||||
\ 'project_root_callback': 'ale#handlers#ols#GetProjectRoot',
|
||||
\})
|
||||
@@ -12,7 +12,7 @@ function! ale_linters#perl#perl#GetExecutable(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#perl#perl#GetCommand(buffer) abort
|
||||
return ale_linters#perl#perl#GetExecutable(a:buffer)
|
||||
return ale#Escape(ale_linters#perl#perl#GetExecutable(a:buffer))
|
||||
\ . ' ' . ale#Var(a:buffer, 'perl_perl_options')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
@@ -61,6 +61,7 @@ function! ale_linters#perl#perlcritic#Handle(buffer, lines) abort
|
||||
\ 'lnum': l:match[1],
|
||||
\ 'col': l:match[2],
|
||||
\ 'text': l:match[3],
|
||||
\ 'type': 'W'
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
||||
36
ale_linters/php/phan.vim
Normal file
36
ale_linters/php/phan.vim
Normal file
@@ -0,0 +1,36 @@
|
||||
" Author: diegoholiveira <https://github.com/diegoholiveira>
|
||||
" Description: static analyzer for PHP
|
||||
|
||||
" Define the minimum severity
|
||||
let g:ale_php_phan_minimum_severity = get(g:, 'ale_php_phan_minimum_severity', 0)
|
||||
|
||||
function! ale_linters#php#phan#GetCommand(buffer) abort
|
||||
return 'phan -y '
|
||||
\ . ale#Var(a:buffer, 'php_phan_minimum_severity')
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#php#phan#Handle(buffer, lines) abort
|
||||
" Matches against lines like the following:
|
||||
"
|
||||
" /path/to/some-filename.php:18 ERRORTYPE message
|
||||
let l:pattern = '^.*:\(\d\+\)\s\(\w\+\)\s\(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'text': l:match[3],
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('php', {
|
||||
\ 'name': 'phan',
|
||||
\ 'executable': 'phan',
|
||||
\ 'command_callback': 'ale_linters#php#phan#GetCommand',
|
||||
\ 'callback': 'ale_linters#php#phan#Handle',
|
||||
\})
|
||||
@@ -4,12 +4,14 @@
|
||||
function! ale_linters#php#php#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
"
|
||||
" Parse error: syntax error, unexpected ';', expecting ']' in - on line 15
|
||||
let l:pattern = '\v^%(Fatal|Parse) error:\s+(.+unexpected ''(.+)%(expecting.+)@<!''.*|.+) in - on line (\d+)'
|
||||
" PHP 7.1<= - Parse error: syntax error, unexpected ';', expecting ']' in - on line 15
|
||||
" PHP 7.2>= - Parse error: syntax error, unexpected ';', expecting ']' in Standard input code on line 15
|
||||
let l:pattern = '\v^%(Fatal|Parse) error:\s+(.+unexpected ''(.+)%(expecting.+)@<!''.*|.+) in %(-|Standard input code) on line (\d+)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:col = empty(l:match[2]) ? 0 : stridx(getline(l:match[3]), l:match[2]) + 1
|
||||
|
||||
let l:obj = {
|
||||
\ 'lnum': l:match[3] + 0,
|
||||
\ 'col': l:col,
|
||||
@@ -30,6 +32,6 @@ call ale#linter#Define('php', {
|
||||
\ 'name': 'php',
|
||||
\ 'executable': 'php',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'command': 'php -l -d error_reporting=E_ALL -d display_errors=1 --',
|
||||
\ 'command': 'php -l -d error_reporting=E_ALL -d display_errors=1 -d log_errors=0 --',
|
||||
\ 'callback': 'ale_linters#php#php#Handle',
|
||||
\})
|
||||
|
||||
@@ -29,11 +29,12 @@ function! ale_linters#php#phpcs#Handle(buffer, lines) abort
|
||||
" Matches against lines like the following:
|
||||
"
|
||||
" /path/to/some-filename.php:18:3: error - Line indented incorrectly; expected 4 spaces, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
|
||||
let l:pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) - \(.\+\) \(\(.\+\)\)$'
|
||||
let l:pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) - \(.\+\) (\(.\+\))$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:text = l:match[4]
|
||||
let l:code = l:match[5]
|
||||
let l:text = l:match[4] . ' (' . l:code . ')'
|
||||
let l:type = l:match[3]
|
||||
|
||||
call add(l:output, {
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
" Author: medains <https://github.com/medains>
|
||||
" Author: medains <https://github.com/medains>, David Sierra <https://github.com/davidsierradz>
|
||||
" Description: phpmd for PHP files
|
||||
|
||||
let g:ale_php_phpmd_executable = get(g:, 'ale_php_phpmd_executable', 'phpmd')
|
||||
|
||||
" Set to change the ruleset
|
||||
let g:ale_php_phpmd_ruleset = get(g:, 'ale_php_phpmd_ruleset', 'cleancode,codesize,controversial,design,naming,unusedcode')
|
||||
|
||||
function! ale_linters#php#phpmd#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'php_phpmd_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#php#phpmd#GetCommand(buffer) abort
|
||||
return 'phpmd %s text '
|
||||
let l:executable = ale_linters#php#phpmd#GetExecutable(a:buffer)
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . ' %s text '
|
||||
\ . ale#Var(a:buffer, 'php_phpmd_ruleset')
|
||||
\ . ' --ignore-violations-on-exit %t'
|
||||
endfunction
|
||||
@@ -30,7 +39,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('php', {
|
||||
\ 'name': 'phpmd',
|
||||
\ 'executable': 'phpmd',
|
||||
\ 'executable_callback': 'ale_linters#php#phpmd#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#php#phpmd#GetCommand',
|
||||
\ 'callback': 'ale_linters#php#phpmd#Handle',
|
||||
\})
|
||||
|
||||
11
ale_linters/pod/alex.vim
Normal file
11
ale_linters/pod/alex.vim
Normal file
@@ -0,0 +1,11 @@
|
||||
" Author: Johannes Wienke <languitar@semipol.de>
|
||||
" Description: alex for pod files
|
||||
|
||||
call ale#linter#Define('pod', {
|
||||
\ 'name': 'alex',
|
||||
\ 'executable': 'alex',
|
||||
\ 'command': 'alex %s -t',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale#handlers#alex#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
9
ale_linters/pod/write-good.vim
Normal file
9
ale_linters/pod/write-good.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for Pod files
|
||||
|
||||
call ale#linter#Define('pod', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
||||
19
ale_linters/proto/protoc_gen_lint.vim
Normal file
19
ale_linters/proto/protoc_gen_lint.vim
Normal file
@@ -0,0 +1,19 @@
|
||||
" Author: Jeff Willette <jrwillette88@gmail.com>
|
||||
" Description: run the protoc-gen-lint plugin for the protoc binary
|
||||
|
||||
function! ale_linters#proto#protoc_gen_lint#GetCommand(buffer) abort
|
||||
let l:dirname = expand('#' . a:buffer . ':p:h')
|
||||
|
||||
return 'protoc'
|
||||
\ . ' -I ' . ale#Escape(l:dirname)
|
||||
\ . ' --lint_out=. ' . '%s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('proto', {
|
||||
\ 'name': 'protoc-gen-lint',
|
||||
\ 'lint_file': 1,
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'protoc',
|
||||
\ 'command_callback': 'ale_linters#proto#protoc_gen_lint#GetCommand',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsError',
|
||||
\})
|
||||
@@ -3,8 +3,9 @@
|
||||
function! ale_linters#puppet#puppet#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
" Error: Could not parse for environment production: Syntax error at ':' at /root/puppetcode/modules/nginx/manifests/init.pp:43:12
|
||||
" Error: Could not parse for environment production: Syntax error at '='; expected '}' at /root/puppetcode/modules/pancakes/manifests/init.pp:5"
|
||||
|
||||
let l:pattern = '^Error: .*: \(.\+\) at .\+:\(\d\+\):\(\d\+\)$'
|
||||
let l:pattern = '^Error: .*: \(.\+\) at .\+\.pp:\(\d\+\):\=\(\d*\)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
|
||||
@@ -10,10 +10,6 @@ let g:ale_python_flake8_options =
|
||||
\ get(g:, 'ale_python_flake8_options', s:default_options)
|
||||
let g:ale_python_flake8_use_global = get(g:, 'ale_python_flake8_use_global', 0)
|
||||
|
||||
" A map from Python executable paths to semver strings parsed for those
|
||||
" executables, so we don't have to look up the version number constantly.
|
||||
let s:version_cache = {}
|
||||
|
||||
function! s:UsingModule(buffer) abort
|
||||
return ale#Var(a:buffer, 'python_flake8_options') =~# ' *-m flake8'
|
||||
endfunction
|
||||
@@ -26,62 +22,35 @@ function! ale_linters#python#flake8#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'python_flake8_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#flake8#ClearVersionCache() abort
|
||||
let s:version_cache = {}
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#flake8#VersionCheck(buffer) abort
|
||||
let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer)
|
||||
|
||||
" If we have previously stored the version number in a cache, then
|
||||
" don't look it up again.
|
||||
if has_key(s:version_cache, l:executable)
|
||||
if ale#semver#HasVersion(l:executable)
|
||||
" Returning an empty string skips this command.
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:executable = ale#Escape(ale_linters#python#flake8#GetExecutable(a:buffer))
|
||||
let l:executable = ale#Escape(l:executable)
|
||||
let l:module_string = s:UsingModule(a:buffer) ? ' -m flake8' : ''
|
||||
|
||||
return l:executable . l:module_string . ' --version'
|
||||
endfunction
|
||||
|
||||
" Get the flake8 version from the output, or the cache.
|
||||
function! s:GetVersion(buffer, version_output) abort
|
||||
let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer)
|
||||
let l:version = []
|
||||
|
||||
" Get the version from the cache.
|
||||
if has_key(s:version_cache, l:executable)
|
||||
return s:version_cache[l:executable]
|
||||
endif
|
||||
|
||||
if !empty(a:version_output)
|
||||
" Parse the version string, and store it in the cache.
|
||||
let l:version = ale#semver#Parse(a:version_output[0])
|
||||
let s:version_cache[l:executable] = l:version
|
||||
endif
|
||||
|
||||
return l:version
|
||||
endfunction
|
||||
|
||||
" flake8 versions 3 and up support the --stdin-display-name argument.
|
||||
function! s:SupportsDisplayName(version) abort
|
||||
return !empty(a:version) && ale#semver#GreaterOrEqual(a:version, [3, 0, 0])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#flake8#GetCommand(buffer, version_output) abort
|
||||
let l:version = s:GetVersion(a:buffer, a:version_output)
|
||||
let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer)
|
||||
let l:version = ale#semver#GetVersion(l:executable, a:version_output)
|
||||
|
||||
" Only include the --stdin-display-name argument if we can parse the
|
||||
" flake8 version, and it is recent enough to support it.
|
||||
let l:display_name_args = s:SupportsDisplayName(l:version)
|
||||
let l:display_name_args = ale#semver#GTE(l:version, [3, 0, 0])
|
||||
\ ? ' --stdin-display-name %s'
|
||||
\ : ''
|
||||
|
||||
let l:options = ale#Var(a:buffer, 'python_flake8_options')
|
||||
|
||||
return ale#Escape(ale_linters#python#flake8#GetExecutable(a:buffer))
|
||||
return ale#Escape(l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' --format=default'
|
||||
\ . l:display_name_args . ' -'
|
||||
@@ -122,10 +91,17 @@ function! ale_linters#python#flake8#Handle(buffer, lines) abort
|
||||
continue
|
||||
endif
|
||||
|
||||
if l:code is# 'W391'
|
||||
\&& !ale#Var(a:buffer, 'warn_about_trailing_blank_lines')
|
||||
" Skip warnings for trailing blank lines if the option is off
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:item = {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:code . ': ' . l:match[4],
|
||||
\ 'text': l:match[4],
|
||||
\ 'code': l:code,
|
||||
\ 'type': 'W',
|
||||
\}
|
||||
|
||||
|
||||
82
ale_linters/python/prospector.vim
Normal file
82
ale_linters/python/prospector.vim
Normal file
@@ -0,0 +1,82 @@
|
||||
" Author: chocoelho <carlospecter@gmail.com>
|
||||
" Description: prospector linter python files
|
||||
|
||||
let g:ale_python_prospector_executable =
|
||||
\ get(g:, 'ale_python_prospector_executable', 'prospector')
|
||||
|
||||
let g:ale_python_prospector_options =
|
||||
\ get(g:, 'ale_python_prospector_options', '')
|
||||
|
||||
let g:ale_python_prospector_use_global = get(g:, 'ale_python_prospector_use_global', 0)
|
||||
|
||||
function! ale_linters#python#prospector#GetExecutable(buffer) abort
|
||||
return ale#python#FindExecutable(a:buffer, 'python_prospector', ['prospector'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#prospector#GetCommand(buffer) abort
|
||||
return ale#Escape(ale_linters#python#prospector#GetExecutable(a:buffer))
|
||||
\ . ' ' . ale#Var(a:buffer, 'python_prospector_options')
|
||||
\ . ' --messages-only --absolute-paths --zero-exit --output-format json'
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#prospector#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
let l:prospector_error = json_decode(join(a:lines, ''))
|
||||
|
||||
for l:error in l:prospector_error.messages
|
||||
if (l:error.code is# 'W291' || l:error.code is# 'W293' || l:error.code is# 'trailing-whitespace')
|
||||
\ && !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
||||
" Skip warnings for trailing whitespace if the option is off.
|
||||
continue
|
||||
endif
|
||||
|
||||
if l:error.code is# 'W391'
|
||||
\&& !ale#Var(a:buffer, 'warn_about_trailing_blank_lines')
|
||||
" Skip warnings for trailing blank lines if the option is off
|
||||
continue
|
||||
endif
|
||||
|
||||
if l:error.source =~# '\v\[%(dodgy|mccabe|pep8|pep257|pyroma)\]$'
|
||||
let l:sub_type = 'style'
|
||||
else
|
||||
let l:sub_type = ''
|
||||
endif
|
||||
|
||||
if l:error.source =~# '\v\[pylint\]$'
|
||||
let l:type = l:error.code =~? '\m^[CRW]' ? 'W' : 'E'
|
||||
elseif l:error.source =~# '\v\[%(frosted|pep8)\]$'
|
||||
let l:type = l:error.code =~? '\m^W' ? 'W' : 'E'
|
||||
elseif l:error.source =~# '\v\[%(dodgy|pyroma|vulture)\]$'
|
||||
let l:type = 'W'
|
||||
else
|
||||
let l:type = 'E'
|
||||
endif
|
||||
|
||||
let l:item = {
|
||||
\ 'lnum': l:error.location.line,
|
||||
\ 'col': l:error.location.character + 1,
|
||||
\ 'text': l:error.message,
|
||||
\ 'code': printf('(%s) %s', l:error.source, l:error.code),
|
||||
\ 'type': l:type,
|
||||
\ 'sub_type': l:sub_type,
|
||||
\}
|
||||
|
||||
if l:sub_type is# ''
|
||||
unlet l:item.sub_type
|
||||
endif
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'prospector',
|
||||
\ 'executable_callback': 'ale_linters#python#prospector#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#python#prospector#GetCommand',
|
||||
\ 'callback': 'ale_linters#python#prospector#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
@@ -17,18 +17,39 @@ function! ale_linters#python#pycodestyle#GetCommand(buffer) abort
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pycodestyle#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^(\S*):(\d*):(\d*): ((([EW])\d+) .*)$'
|
||||
let l:pattern = '\v^(\S*):(\d*):(\d*): ([EW]\d+) (.*)$'
|
||||
let l:output = []
|
||||
|
||||
" lines are formatted as follows:
|
||||
" file.py:21:26: W291 trailing whitespace
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
if(l:match[4] is# 'W291' || l:match[4] is# 'W293')
|
||||
\&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
||||
" Skip warnings for trailing whitespace if the option is off.
|
||||
continue
|
||||
endif
|
||||
|
||||
if l:match[4] is# 'W391'
|
||||
\&& !ale#Var(a:buffer, 'warn_about_trailing_blank_lines')
|
||||
" Skip warnings for trailing blank lines if the option is off
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:item = {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': l:match[6],
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
\ 'type': l:match[4][0],
|
||||
\ 'sub_type': 'style',
|
||||
\ 'text': l:match[5],
|
||||
\ 'code': l:match[4],
|
||||
\}
|
||||
|
||||
" E999 is not a style error, it's a syntax error.
|
||||
if l:match[4] is# 'E999'
|
||||
unlet l:item.sub_type
|
||||
endif
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
|
||||
38
ale_linters/python/pyflakes.vim
Normal file
38
ale_linters/python/pyflakes.vim
Normal file
@@ -0,0 +1,38 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: pyflakes for python files
|
||||
|
||||
call ale#Set('python_pyflakes_executable', 'pyflakes')
|
||||
call ale#Set('python_pyflakes_use_global', 0)
|
||||
|
||||
function! ale_linters#python#pyflakes#GetExecutable(buffer) abort
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pyflakes', ['pyflakes'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pyflakes#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#pyflakes#GetExecutable(a:buffer)
|
||||
|
||||
return ale#Escape(l:executable) . ' %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pyflakes#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\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[3],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'pyflakes',
|
||||
\ 'executable_callback': 'ale_linters#python#pyflakes#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#python#pyflakes#GetCommand',
|
||||
\ 'callback': 'ale_linters#python#pyflakes#Handle',
|
||||
\ 'output_stream': 'both',
|
||||
\})
|
||||
@@ -45,7 +45,8 @@ function! ale_linters#python#pylint#Handle(buffer, lines) abort
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 1,
|
||||
\ 'text': l:code . ': ' . l:match[5] . ' (' . l:match[4] . ')',
|
||||
\ 'text': l:match[5],
|
||||
\ 'code': l:match[4],
|
||||
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
28
ale_linters/python/pyls.vim
Normal file
28
ale_linters/python/pyls.vim
Normal file
@@ -0,0 +1,28 @@
|
||||
" Author: aurieh <me@aurieh.me>
|
||||
" Description: A language server for Python
|
||||
|
||||
call ale#Set('python_pyls_executable', 'pyls')
|
||||
call ale#Set('python_pyls_use_global', 0)
|
||||
|
||||
function! ale_linters#python#pyls#GetExecutable(buffer) abort
|
||||
return ale#python#FindExecutable(a:buffer, 'python_pyls', ['pyls'])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pyls#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#python#pyls#GetExecutable(a:buffer)
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pyls#GetLanguage(buffer) abort
|
||||
return 'python'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'pyls',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#python#pyls#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#python#pyls#GetCommand',
|
||||
\ 'language_callback': 'ale_linters#python#pyls#GetLanguage',
|
||||
\ 'project_root_callback': 'ale#python#FindProjectRoot',
|
||||
\})
|
||||
14
ale_linters/reason/ols.vim
Normal file
14
ale_linters/reason/ols.vim
Normal file
@@ -0,0 +1,14 @@
|
||||
" Author: Michael Jungo <michaeljungo92@gmail.com>
|
||||
" Description: A language server for Reason
|
||||
|
||||
call ale#Set('reason_ols_executable', 'ocaml-language-server')
|
||||
call ale#Set('reason_ols_use_global', 0)
|
||||
|
||||
call ale#linter#Define('reason', {
|
||||
\ 'name': 'ols',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale#handlers#ols#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#ols#GetCommand',
|
||||
\ 'language_callback': 'ale#handlers#ols#GetLanguage',
|
||||
\ 'project_root_callback': 'ale#handlers#ols#GetProjectRoot',
|
||||
\})
|
||||
9
ale_linters/review/redpen.vim
Normal file
9
ale_linters/review/redpen.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: rhysd https://rhysd.github.io
|
||||
" Description: Redpen, a proofreading tool (http://redpen.cc)
|
||||
|
||||
call ale#linter#Define('review', {
|
||||
\ 'name': 'redpen',
|
||||
\ 'executable': 'redpen',
|
||||
\ 'command': 'redpen -f review -r json %t',
|
||||
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
|
||||
\})
|
||||
11
ale_linters/rst/alex.vim
Normal file
11
ale_linters/rst/alex.vim
Normal file
@@ -0,0 +1,11 @@
|
||||
" Author: Johannes Wienke <languitar@semipol.de>
|
||||
" Description: alex for rst files
|
||||
|
||||
call ale#linter#Define('rst', {
|
||||
\ 'name': 'alex',
|
||||
\ 'executable': 'alex',
|
||||
\ 'command': 'alex %s -t',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale#handlers#alex#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
9
ale_linters/rst/redpen.vim
Normal file
9
ale_linters/rst/redpen.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: rhysd https://rhysd.github.io
|
||||
" Description: Redpen, a proofreading tool (http://redpen.cc)
|
||||
|
||||
call ale#linter#Define('rst', {
|
||||
\ 'name': 'redpen',
|
||||
\ 'executable': 'redpen',
|
||||
\ 'command': 'redpen -f rest -r json %t',
|
||||
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
|
||||
\})
|
||||
37
ale_linters/rst/rstcheck.vim
Normal file
37
ale_linters/rst/rstcheck.vim
Normal file
@@ -0,0 +1,37 @@
|
||||
" Author: John Nduli https://github.com/jnduli
|
||||
" Description: Rstcheck for reStructuredText files
|
||||
"
|
||||
|
||||
function! ale_linters#rst#rstcheck#Handle(buffer, lines) abort
|
||||
" matches: 'bad_rst.rst:1: (SEVERE/4) Title overline & underline
|
||||
" mismatch.'
|
||||
let l:pattern = '\v^(.+):(\d*): \(([a-zA-Z]*)/\d*\) (.+)$'
|
||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||
let l:output = []
|
||||
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': 0,
|
||||
\ 'type': l:match[3] is# 'SEVERE' ? 'E' : 'W',
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#rst#rstcheck#GetCommand(buffer) abort
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . 'rstcheck'
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
|
||||
call ale#linter#Define('rst', {
|
||||
\ 'name': 'rstcheck',
|
||||
\ 'executable': 'rstcheck',
|
||||
\ 'command_callback': 'ale_linters#rst#rstcheck#GetCommand',
|
||||
\ 'callback': 'ale_linters#rst#rstcheck#Handle',
|
||||
\ 'output_stream': 'both',
|
||||
\})
|
||||
9
ale_linters/rst/vale.vim
Normal file
9
ale_linters/rst/vale.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: chew-z https://github.com/chew-z
|
||||
" Description: vale for RST files
|
||||
|
||||
call ale#linter#Define('rst', {
|
||||
\ 'name': 'vale',
|
||||
\ 'executable': 'vale',
|
||||
\ 'command': 'vale --output=JSON %t',
|
||||
\ 'callback': 'ale#handlers#vale#Handle',
|
||||
\})
|
||||
9
ale_linters/rst/write-good.vim
Normal file
9
ale_linters/rst/write-good.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for reStructuredText files
|
||||
|
||||
call ale#linter#Define('rst', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
||||
@@ -13,6 +13,7 @@ function! ale_linters#ruby#reek#Handle(buffer, lines) abort
|
||||
\ 'lnum': l:location,
|
||||
\ 'type': 'W',
|
||||
\ 'text': s:BuildText(a:buffer, l:error),
|
||||
\ 'code': l:error.smell_type,
|
||||
\})
|
||||
endfor
|
||||
endfor
|
||||
@@ -21,19 +22,19 @@ function! ale_linters#ruby#reek#Handle(buffer, lines) abort
|
||||
endfunction
|
||||
|
||||
function! s:BuildText(buffer, error) abort
|
||||
let l:text = a:error.smell_type . ':'
|
||||
let l:parts = []
|
||||
|
||||
if ale#Var(a:buffer, 'ruby_reek_show_context')
|
||||
let l:text .= ' ' . a:error.context
|
||||
call add(l:parts, a:error.context)
|
||||
endif
|
||||
|
||||
let l:text .= ' ' . a:error.message
|
||||
call add(l:parts, a:error.message)
|
||||
|
||||
if ale#Var(a:buffer, 'ruby_reek_show_wiki_link')
|
||||
let l:text .= ' [' . a:error.wiki_link . ']'
|
||||
call add(l:parts, '[' . a:error.wiki_link . ']')
|
||||
endif
|
||||
|
||||
return l:text
|
||||
return join(l:parts, ' ')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ruby', {
|
||||
|
||||
@@ -34,7 +34,8 @@ function! ale_linters#ruby#rubocop#Handle(buffer, lines) abort
|
||||
\ 'lnum': l:error['location']['line'] + 0,
|
||||
\ 'col': l:start_col,
|
||||
\ 'end_col': l:start_col + l:error['location']['length'] - 1,
|
||||
\ 'text': printf('%s [%s]', l:error['message'], l:error['cop_name']),
|
||||
\ 'code': l:error['cop_name'],
|
||||
\ 'text': l:error['message'],
|
||||
\ 'type': ale_linters#ruby#rubocop#GetType(l:error['severity']),
|
||||
\})
|
||||
endfor
|
||||
|
||||
@@ -1,10 +1,22 @@
|
||||
" Author: Brandon Roehl - https://github.com/BrandonRoehl
|
||||
" Description: Ruby MRI for Ruby files
|
||||
|
||||
call ale#Set('ruby_ruby_executable', 'ruby')
|
||||
|
||||
function! ale_linters#ruby#ruby#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'ruby_ruby_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ruby#ruby#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#ruby#ruby#GetExecutable(a:buffer)
|
||||
|
||||
return ale#Escape(l:executable) . ' -w -c -T1 %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ruby', {
|
||||
\ 'name': 'ruby',
|
||||
\ 'executable': 'ruby',
|
||||
\ 'executable_callback': 'ale_linters#ruby#ruby#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#ruby#ruby#GetCommand',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command': 'ruby -w -c -T1 %t',
|
||||
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
|
||||
\})
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
" Author: Daniel Schemala <istjanichtzufassen@gmail.com>
|
||||
" Description: rustc invoked by cargo for rust files
|
||||
|
||||
let g:ale_rust_cargo_use_check = get(g:, 'ale_rust_cargo_use_check', 0)
|
||||
call ale#Set('rust_cargo_use_check', 1)
|
||||
call ale#Set('rust_cargo_check_all_targets', 0)
|
||||
|
||||
function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort
|
||||
if ale#path#FindNearestFile(a:bufnr, 'Cargo.toml') isnot# ''
|
||||
@@ -13,19 +14,35 @@ function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale_linters#rust#cargo#GetCommand(buffer) abort
|
||||
let l:command = ale#Var(a:buffer, 'rust_cargo_use_check')
|
||||
\ ? 'check'
|
||||
\ : 'build'
|
||||
function! ale_linters#rust#cargo#VersionCheck(buffer) abort
|
||||
return !ale#semver#HasVersion('cargo')
|
||||
\ ? 'cargo --version'
|
||||
\ : ''
|
||||
endfunction
|
||||
|
||||
return 'cargo ' . l:command . ' --frozen --message-format=json -q'
|
||||
function! ale_linters#rust#cargo#GetCommand(buffer, version_output) abort
|
||||
let l:version = ale#semver#GetVersion('cargo', a:version_output)
|
||||
|
||||
let l:use_check = ale#Var(a:buffer, 'rust_cargo_use_check')
|
||||
\ && ale#semver#GTE(l:version, [0, 17, 0])
|
||||
let l:use_all_targets = l:use_check
|
||||
\ && ale#Var(a:buffer, 'rust_cargo_check_all_targets')
|
||||
\ && ale#semver#GTE(l:version, [0, 22, 0])
|
||||
|
||||
return 'cargo '
|
||||
\ . (l:use_check ? 'check' : 'build')
|
||||
\ . (l:use_all_targets ? ' --all-targets' : '')
|
||||
\ . ' --frozen --message-format=json -q'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('rust', {
|
||||
\ 'name': 'cargo',
|
||||
\ 'executable_callback': 'ale_linters#rust#cargo#GetCargoExecutable',
|
||||
\ 'command_callback': 'ale_linters#rust#cargo#GetCommand',
|
||||
\ 'command_chain': [
|
||||
\ {'callback': 'ale_linters#rust#cargo#VersionCheck'},
|
||||
\ {'callback': 'ale_linters#rust#cargo#GetCommand'},
|
||||
\ ],
|
||||
\ 'callback': 'ale#handlers#rust#HandleRustErrors',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
" Description: A language server for Rust
|
||||
|
||||
call ale#Set('rust_rls_executable', 'rls')
|
||||
call ale#Set('rust_rls_toolchain', 'nightly')
|
||||
|
||||
function! ale_linters#rust#rls#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'rust_rls_executable')
|
||||
@@ -9,8 +10,10 @@ endfunction
|
||||
|
||||
function! ale_linters#rust#rls#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#rust#rls#GetExecutable(a:buffer)
|
||||
let l:toolchain = ale#Var(a:buffer, 'rust_rls_toolchain')
|
||||
|
||||
return ale#Escape(l:executable) . ' +nightly'
|
||||
return ale#Escape(l:executable)
|
||||
\ . ' +' . ale#Escape(l:toolchain)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#rust#rls#GetLanguage(buffer) abort
|
||||
|
||||
@@ -1,21 +1,27 @@
|
||||
" Author: Daniel Schemala <istjanichtzufassen@gmail.com>
|
||||
" Description: rustc for rust files
|
||||
|
||||
function! ale_linters#rust#rustc#RustcCommand(buffer_number) abort
|
||||
call ale#Set('rust_rustc_options', '-Z no-trans')
|
||||
|
||||
function! ale_linters#rust#rustc#RustcCommand(buffer) abort
|
||||
" Try to guess the library search path. If the project is managed by cargo,
|
||||
" it's usually <project root>/target/debug/deps/ or
|
||||
" <project root>/target/release/deps/
|
||||
let l:cargo_file = ale#path#FindNearestFile(a:buffer_number, 'Cargo.toml')
|
||||
let l:cargo_file = ale#path#FindNearestFile(a:buffer, 'Cargo.toml')
|
||||
|
||||
if l:cargo_file isnot# ''
|
||||
let l:project_root = fnamemodify(l:cargo_file, ':h')
|
||||
let l:dependencies = '-L ' . l:project_root . '/target/debug/deps -L ' .
|
||||
\ l:project_root . '/target/release/deps'
|
||||
let l:root = fnamemodify(l:cargo_file, ':h')
|
||||
let l:dependencies = ' -L ' . ale#Escape(ale#path#GetAbsPath(l:root, 'target/debug/deps'))
|
||||
\ . ' -L ' . ale#Escape(ale#path#GetAbsPath(l:root, 'target/release/deps'))
|
||||
else
|
||||
let l:dependencies = ''
|
||||
endif
|
||||
|
||||
return 'rustc --error-format=json -Z no-trans ' . l:dependencies . ' -'
|
||||
let l:options = ale#Var(a:buffer, 'rust_rustc_options')
|
||||
|
||||
return 'rustc --error-format=json'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . l:dependencies . ' -'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('rust', {
|
||||
|
||||
@@ -23,36 +23,95 @@ function! ale_linters#sh#shellcheck#GetDialectArgument(buffer) abort
|
||||
let l:shell_type = ale#handlers#sh#GetShellType(a:buffer)
|
||||
|
||||
if !empty(l:shell_type)
|
||||
" Use the dash dialect for /bin/ash, etc.
|
||||
if l:shell_type is# 'ash'
|
||||
return 'dash'
|
||||
endif
|
||||
|
||||
return l:shell_type
|
||||
endif
|
||||
|
||||
" If there's no hashbang, try using Vim's buffer variables.
|
||||
if get(b:, 'is_bash')
|
||||
if getbufvar(a:buffer, 'is_bash', 0)
|
||||
return 'bash'
|
||||
elseif get(b:, 'is_sh')
|
||||
elseif getbufvar(a:buffer, 'is_sh', 0)
|
||||
return 'sh'
|
||||
elseif get(b:, 'is_kornshell')
|
||||
elseif getbufvar(a:buffer, 'is_kornshell', 0)
|
||||
return 'ksh'
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#sh#shellcheck#GetCommand(buffer) abort
|
||||
function! ale_linters#sh#shellcheck#VersionCheck(buffer) abort
|
||||
let l:executable = ale_linters#sh#shellcheck#GetExecutable(a:buffer)
|
||||
|
||||
" Don't check the version again if we've already cached it.
|
||||
return !ale#semver#HasVersion(l:executable)
|
||||
\ ? ale#Escape(l:executable) . ' --version'
|
||||
\ : ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#sh#shellcheck#GetCommand(buffer, version_output) abort
|
||||
let l:executable = ale_linters#sh#shellcheck#GetExecutable(a:buffer)
|
||||
let l:version = ale#semver#GetVersion(l:executable, a:version_output)
|
||||
|
||||
let l:options = ale#Var(a:buffer, 'sh_shellcheck_options')
|
||||
let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions')
|
||||
let l:dialect = ale_linters#sh#shellcheck#GetDialectArgument(a:buffer)
|
||||
let l:external_option = ale#semver#GTE(l:version, [0, 4, 0]) ? ' -x' : ''
|
||||
|
||||
return ale_linters#sh#shellcheck#GetExecutable(a:buffer)
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#Escape(l:executable)
|
||||
\ . (!empty(l:dialect) ? ' -s ' . l:dialect : '')
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . (!empty(l:exclude_option) ? ' -e ' . l:exclude_option : '')
|
||||
\ . l:external_option
|
||||
\ . ' -f gcc -'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#sh#shellcheck#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+) \[([^\]]+)\]$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
if l:match[4] is# 'error'
|
||||
let l:type = 'E'
|
||||
elseif l:match[4] is# 'note'
|
||||
let l:type = 'I'
|
||||
else
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
let l:item = {
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'type': l:type,
|
||||
\ 'text': l:match[5],
|
||||
\ 'code': l:match[6],
|
||||
\}
|
||||
|
||||
if !empty(l:match[3])
|
||||
let l:item.col = str2nr(l:match[3])
|
||||
endif
|
||||
|
||||
" If the filename is something like <stdin>, <nofile> or -, then
|
||||
" this is an error for the file we checked.
|
||||
if l:match[1] isnot# '-' && l:match[1][0] isnot# '<'
|
||||
let l:item['filename'] = l:match[1]
|
||||
endif
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('sh', {
|
||||
\ 'name': 'shellcheck',
|
||||
\ 'executable_callback': 'ale_linters#sh#shellcheck#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#sh#shellcheck#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'command_chain': [
|
||||
\ {'callback': 'ale_linters#sh#shellcheck#VersionCheck'},
|
||||
\ {'callback': 'ale_linters#sh#shellcheck#GetCommand'},
|
||||
\ ],
|
||||
\ 'callback': 'ale_linters#sh#shellcheck#Handle',
|
||||
\})
|
||||
|
||||
@@ -28,11 +28,20 @@ function! ale_linters#slim#slimlint#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
let l:item = {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'type': l:match[2],
|
||||
\ 'text': l:match[3]
|
||||
\})
|
||||
\}
|
||||
|
||||
let l:code_match = matchlist(l:item.text, '\v^([^:]+): (.+)$')
|
||||
|
||||
if !empty(l:code_match)
|
||||
let l:item.code = l:code_match[1]
|
||||
let l:item.text = l:code_match[2]
|
||||
endif
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
|
||||
30
ale_linters/solidity/solhint.vim
Normal file
30
ale_linters/solidity/solhint.vim
Normal file
@@ -0,0 +1,30 @@
|
||||
" Author: Franco Victorio - https://github.com/fvictorio
|
||||
" Description: Report errors in Solidity code with solhint
|
||||
|
||||
function! ale_linters#solidity#solhint#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
" /path/to/file/file.sol: line 1, col 10, Error - 'addOne' is defined but never used. (no-unused-vars)
|
||||
|
||||
let l:pattern = '\v^[^:]+: line (\d+), col (\d+), (Error|Warning) - (.*) \((.*)\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:isError = l:match[3] is? 'error'
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[4],
|
||||
\ 'code': l:match[5],
|
||||
\ 'type': l:isError ? 'E' : 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('solidity', {
|
||||
\ 'name': 'solhint',
|
||||
\ 'executable': 'solhint',
|
||||
\ 'command': 'solhint --formatter compact %t',
|
||||
\ 'callback': 'ale_linters#solidity#solhint#Handle',
|
||||
\})
|
||||
@@ -1,9 +1,51 @@
|
||||
" Author: David Mohundro <david@mohundro.com>
|
||||
" Description: swiftlint for swift files
|
||||
|
||||
|
||||
function! ale_linters#swift#swiftlint#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+)$'
|
||||
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] is# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[5],
|
||||
\}
|
||||
|
||||
if l:match[4] is# 'error'
|
||||
let l:item.type = 'E'
|
||||
elseif l:match[4] is# 'note'
|
||||
let l:item.type = 'I'
|
||||
endif
|
||||
|
||||
if !empty(l:match[3])
|
||||
let l:item.col = str2nr(l:match[3])
|
||||
endif
|
||||
|
||||
" If the filename is something like <stdin>, <nofile> or -, then
|
||||
" this is an error for the file we checked.
|
||||
if l:match[1] isnot# '-' && l:match[1][0] isnot# '<'
|
||||
let l:item['filename'] = l:match[1]
|
||||
endif
|
||||
|
||||
" Parse the code if it's there.
|
||||
let l:code_match = matchlist(l:item.text, '\v^(.+) \(([^ (]+)\)$')
|
||||
|
||||
if !empty(l:code_match)
|
||||
let l:item.text = l:code_match[1]
|
||||
let l:item.code = l:code_match[2]
|
||||
endif
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('swift', {
|
||||
\ 'name': 'swiftlint',
|
||||
\ 'executable': 'swiftlint',
|
||||
\ 'command': 'swiftlint lint --use-stdin',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'callback': 'ale_linters#swift#swiftlint#Handle',
|
||||
\})
|
||||
|
||||
62
ale_linters/terraform/tflint.vim
Normal file
62
ale_linters/terraform/tflint.vim
Normal file
@@ -0,0 +1,62 @@
|
||||
" Author: Nat Williams <nat.williams@gmail.com>
|
||||
" Description: tflint for Terraform files
|
||||
"
|
||||
" See: https://www.terraform.io/
|
||||
" https://github.com/wata727/tflint
|
||||
|
||||
call ale#Set('terraform_tflint_options', '')
|
||||
call ale#Set('terraform_tflint_executable', 'tflint')
|
||||
|
||||
function! ale_linters#terraform#tflint#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
|
||||
if l:error.type is# 'ERROR'
|
||||
let l:type = 'E'
|
||||
elseif l:error.type is# 'NOTICE'
|
||||
let l:type = 'I'
|
||||
else
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:error.line,
|
||||
\ 'text': l:error.message,
|
||||
\ 'type': l:type,
|
||||
\ 'code': l:error.detector,
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#terraform#tflint#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'terraform_tflint_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#terraform#tflint#GetCommand(buffer) abort
|
||||
let l:cmd = ale#Escape(ale#Var(a:buffer, 'terraform_tflint_executable'))
|
||||
|
||||
let l:config_file = ale#path#FindNearestFile(a:buffer, '.tflint.hcl')
|
||||
if !empty(l:config_file)
|
||||
let l:cmd .= ' --config ' . ale#Escape(l:config_file)
|
||||
endif
|
||||
|
||||
let l:opts = ale#Var(a:buffer, 'terraform_tflint_options')
|
||||
if !empty(l:opts)
|
||||
let l:cmd .= ' ' . l:opts
|
||||
endif
|
||||
|
||||
let l:cmd .= ' -f json %t'
|
||||
|
||||
return l:cmd
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('terraform', {
|
||||
\ 'name': 'tflint',
|
||||
\ 'executable_callback': 'ale_linters#terraform#tflint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#terraform#tflint#GetCommand',
|
||||
\ 'callback': 'ale_linters#terraform#tflint#Handle',
|
||||
\})
|
||||
|
||||
" vim:sw=4
|
||||
11
ale_linters/tex/alex.vim
Normal file
11
ale_linters/tex/alex.vim
Normal file
@@ -0,0 +1,11 @@
|
||||
" Author: Johannes Wienke <languitar@semipol.de>
|
||||
" Description: alex for TeX files
|
||||
|
||||
call ale#linter#Define('tex', {
|
||||
\ 'name': 'alex',
|
||||
\ 'executable': 'alex',
|
||||
\ 'command': 'alex %s -t',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale#handlers#alex#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
9
ale_linters/tex/redpen.vim
Normal file
9
ale_linters/tex/redpen.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: rhysd https://rhysd.github.io
|
||||
" Description: Redpen, a proofreading tool (http://redpen.cc)
|
||||
|
||||
call ale#linter#Define('tex', {
|
||||
\ 'name': 'redpen',
|
||||
\ 'executable': 'redpen',
|
||||
\ 'command': 'redpen -f latex -r json %t',
|
||||
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
|
||||
\})
|
||||
9
ale_linters/tex/vale.vim
Normal file
9
ale_linters/tex/vale.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: chew-z https://github.com/chew-z
|
||||
" Description: vale for LaTeX files
|
||||
|
||||
call ale#linter#Define('tex', {
|
||||
\ 'name': 'vale',
|
||||
\ 'executable': 'vale',
|
||||
\ 'command': 'vale --output=JSON %t',
|
||||
\ 'callback': 'ale#handlers#vale#Handle',
|
||||
\})
|
||||
9
ale_linters/tex/write-good.vim
Normal file
9
ale_linters/tex/write-good.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for TeX files
|
||||
|
||||
call ale#linter#Define('tex', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
||||
11
ale_linters/texinfo/alex.vim
Normal file
11
ale_linters/texinfo/alex.vim
Normal file
@@ -0,0 +1,11 @@
|
||||
" Author: Johannes Wienke <languitar@semipol.de>
|
||||
" Description: alex for texinfo files
|
||||
|
||||
call ale#linter#Define('texinfo', {
|
||||
\ 'name': 'alex',
|
||||
\ 'executable': 'alex',
|
||||
\ 'command': 'alex %s -t',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale#handlers#alex#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
9
ale_linters/texinfo/write-good.vim
Normal file
9
ale_linters/texinfo/write-good.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for Texinfo files
|
||||
|
||||
call ale#linter#Define('texinfo', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
||||
11
ale_linters/text/alex.vim
Normal file
11
ale_linters/text/alex.vim
Normal file
@@ -0,0 +1,11 @@
|
||||
" Author: Johannes Wienke <languitar@semipol.de>
|
||||
" Description: alex for text files
|
||||
|
||||
call ale#linter#Define('text', {
|
||||
\ 'name': 'alex',
|
||||
\ 'executable': 'alex',
|
||||
\ 'command': 'alex %s -t',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale#handlers#alex#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
9
ale_linters/text/redpen.vim
Normal file
9
ale_linters/text/redpen.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: rhysd https://rhysd.github.io
|
||||
" Description: Redpen, a proofreading tool (http://redpen.cc)
|
||||
|
||||
call ale#linter#Define('text', {
|
||||
\ 'name': 'redpen',
|
||||
\ 'executable': 'redpen',
|
||||
\ 'command': 'redpen -f plain -r json %t',
|
||||
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
|
||||
\})
|
||||
@@ -4,6 +4,6 @@
|
||||
call ale#linter#Define('text', {
|
||||
\ 'name': 'vale',
|
||||
\ 'executable': 'vale',
|
||||
\ 'command': 'vale --output=line %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\ 'command': 'vale --output=JSON %t',
|
||||
\ 'callback': 'ale#handlers#vale#Handle',
|
||||
\})
|
||||
|
||||
9
ale_linters/text/write-good.vim
Normal file
9
ale_linters/text/write-good.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for text files
|
||||
|
||||
call ale#linter#Define('text', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
||||
@@ -24,17 +24,31 @@ function! ale_linters#typescript#tslint#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
|
||||
call add(l:output, {
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:error.name),
|
||||
if get(l:error, 'ruleName', '') is# 'no-implicit-dependencies'
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:item = {
|
||||
\ 'type': (get(l:error, 'ruleSeverity', '') is# 'WARNING' ? 'W' : 'E'),
|
||||
\ 'text': has_key(l:error, 'ruleName')
|
||||
\ ? l:error.ruleName . ': ' . l:error.failure
|
||||
\ : l:error.failure,
|
||||
\ 'text': l:error.failure,
|
||||
\ 'lnum': l:error.startPosition.line + 1,
|
||||
\ 'col': l:error.startPosition.character + 1,
|
||||
\ 'end_lnum': l:error.endPosition.line + 1,
|
||||
\ 'end_col': l:error.endPosition.character + 1,
|
||||
\})
|
||||
\}
|
||||
|
||||
let l:filename = ale#path#GetAbsPath(l:dir, l:error.name)
|
||||
|
||||
" Assume temporary files are this file.
|
||||
if !ale#path#IsTempName(l:filename)
|
||||
let l:item.filename = l:filename
|
||||
endif
|
||||
|
||||
if has_key(l:error, 'ruleName')
|
||||
let l:item.code = l:error.ruleName
|
||||
endif
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
" Author: Masahiro H https://github.com/mshr-h
|
||||
" Description: iverilog for verilog files
|
||||
|
||||
call ale#Set('verilog_iverilog_options', '')
|
||||
|
||||
function! ale_linters#verilog#iverilog#GetCommand(buffer) abort
|
||||
return 'iverilog -t null -Wall '
|
||||
\ . ale#Var(a:buffer, 'verilog_iverilog_options')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#verilog#iverilog#Handle(buffer, lines) abort
|
||||
" Look for lines like the following.
|
||||
"
|
||||
@@ -30,6 +38,6 @@ call ale#linter#Define('verilog', {
|
||||
\ 'name': 'iverilog',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'iverilog',
|
||||
\ 'command': 'iverilog -t null -Wall %t',
|
||||
\ 'command_callback': 'ale_linters#verilog#iverilog#GetCommand',
|
||||
\ 'callback': 'ale_linters#verilog#iverilog#Handle',
|
||||
\})
|
||||
|
||||
@@ -6,25 +6,19 @@ let g:ale_vim_vint_show_style_issues =
|
||||
\ get(g:, 'ale_vim_vint_show_style_issues', 1)
|
||||
let s:enable_neovim = has('nvim') ? ' --enable-neovim ' : ''
|
||||
let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {description} (see {reference})"'
|
||||
let s:vint_version = []
|
||||
|
||||
function! ale_linters#vim#vint#VersionCommand(buffer) abort
|
||||
if empty(s:vint_version)
|
||||
" Check the Vint version if we haven't checked it already.
|
||||
return 'vint --version'
|
||||
endif
|
||||
|
||||
return ''
|
||||
" Check the Vint version if we haven't checked it already.
|
||||
return !ale#semver#HasVersion('vint')
|
||||
\ ? 'vint --version'
|
||||
\ : ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#vim#vint#GetCommand(buffer, version_output) abort
|
||||
if empty(s:vint_version) && !empty(a:version_output)
|
||||
" Parse the version out of the --version output.
|
||||
let s:vint_version = ale#semver#Parse(join(a:version_output, "\n"))
|
||||
endif
|
||||
let l:version = ale#semver#GetVersion('vint', a:version_output)
|
||||
|
||||
let l:can_use_no_color_flag = empty(s:vint_version)
|
||||
\ || ale#semver#GreaterOrEqual(s:vint_version, [0, 3, 7])
|
||||
let l:can_use_no_color_flag = empty(l:version)
|
||||
\ || ale#semver#GTE(l:version, [0, 3, 7])
|
||||
|
||||
let l:warning_flag = ale#Var(a:buffer, 'vim_vint_show_style_issues') ? '-s' : '-w'
|
||||
|
||||
|
||||
11
ale_linters/xhtml/alex.vim
Normal file
11
ale_linters/xhtml/alex.vim
Normal file
@@ -0,0 +1,11 @@
|
||||
" Author: Johannes Wienke <languitar@semipol.de>
|
||||
" Description: alex for XHTML files
|
||||
|
||||
call ale#linter#Define('xhtml', {
|
||||
\ 'name': 'alex',
|
||||
\ 'executable': 'alex',
|
||||
\ 'command': 'alex %s -t',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale#handlers#alex#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
9
ale_linters/xhtml/write-good.vim
Normal file
9
ale_linters/xhtml/write-good.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for XHTML files
|
||||
|
||||
call ale#linter#Define('xhtml', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user