mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 20:54:26 +08:00
Compare commits
543 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c7a9ffcb9c | ||
|
|
af1b881c8b | ||
|
|
80e973a29e | ||
|
|
2381b7afe8 | ||
|
|
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 | ||
|
|
be5c7a09ce | ||
|
|
b952dda386 | ||
|
|
231398dddc | ||
|
|
be1377f6d7 | ||
|
|
3212278c91 | ||
|
|
43653ef548 | ||
|
|
c4579e1809 | ||
|
|
5b986ce5d3 | ||
|
|
0b0cbfa80a | ||
|
|
ed93cd1494 | ||
|
|
35031a0b8a | ||
|
|
841acf725c | ||
|
|
3878be9977 | ||
|
|
b43ed6baf5 | ||
|
|
e023e7a2fe | ||
|
|
346c91fb6b | ||
|
|
a97afd3380 | ||
|
|
658ec4b10e | ||
|
|
4339af2bb6 | ||
|
|
5292d2f349 | ||
|
|
81d993086e | ||
|
|
5946a128c3 | ||
|
|
8a8879a28f | ||
|
|
07ebfbeef0 | ||
|
|
a790077136 | ||
|
|
090f8a8f38 | ||
|
|
90d4fb139c | ||
|
|
515dcdef29 | ||
|
|
d090dec8b4 | ||
|
|
ef495ba32d | ||
|
|
010ebc2459 | ||
|
|
b2e6d0dff8 | ||
|
|
69d6ff6020 | ||
|
|
40e69794eb | ||
|
|
d8ea83e344 | ||
|
|
8eb41dc94c | ||
|
|
6fd10f80de | ||
|
|
5204f2dbc2 | ||
|
|
618074a053 | ||
|
|
663fe75d0f | ||
|
|
e71c4a8bea | ||
|
|
dded246aba | ||
|
|
221cb0f8cf | ||
|
|
3ddbe48d84 | ||
|
|
d8a638f38a | ||
|
|
844354cfed | ||
|
|
02c8793c53 | ||
|
|
be547a0111 | ||
|
|
620ec32da1 | ||
|
|
3859ac0c9b | ||
|
|
70177480ba | ||
|
|
a809c4fa3a | ||
|
|
65aa88a7d5 | ||
|
|
f21f52343d | ||
|
|
47577564a2 | ||
|
|
25045641fb | ||
|
|
a300014396 | ||
|
|
e376f0ae44 | ||
|
|
3ab414de1a | ||
|
|
7392f808c0 | ||
|
|
753592ca66 | ||
|
|
e0bd490ed9 | ||
|
|
54a08c5f8c | ||
|
|
5091e2de45 | ||
|
|
638ca42082 | ||
|
|
4634b1be93 | ||
|
|
5731616cd2 | ||
|
|
c76f721b59 | ||
|
|
a640d3b022 | ||
|
|
1d1b5155e6 | ||
|
|
c989ef0fc6 | ||
|
|
9fc01bd246 | ||
|
|
8f6044b8b6 | ||
|
|
49b6805b09 | ||
|
|
0be77c60c5 | ||
|
|
cde50f1091 | ||
|
|
cb56cbb714 | ||
|
|
2bd352370f | ||
|
|
3910b025b2 | ||
|
|
70fdeb7c22 | ||
|
|
5a1ebdb633 | ||
|
|
8bc66cff39 | ||
|
|
6ebd8f355c | ||
|
|
a59d1ddbf3 | ||
|
|
71c2e65d64 | ||
|
|
52c933cd72 | ||
|
|
3d2bddf4af | ||
|
|
677263f115 | ||
|
|
7302bedc5e | ||
|
|
91df9ba2c0 | ||
|
|
4e9420d1f5 | ||
|
|
e2271b769c | ||
|
|
7f42aedaec | ||
|
|
661ed6e40b | ||
|
|
a7614d9502 | ||
|
|
8eb99c3cec | ||
|
|
b6a487ccf9 | ||
|
|
cb8a140141 | ||
|
|
e19a81cb09 | ||
|
|
65e6e50bf8 | ||
|
|
9d24cc4047 | ||
|
|
c4ad92e458 | ||
|
|
18a7d32c4c | ||
|
|
c11d2ae375 | ||
|
|
1a52a2b880 | ||
|
|
18f4d5a6da | ||
|
|
f3da8f45c1 | ||
|
|
b3a9a0e3e8 | ||
|
|
8055a03067 | ||
|
|
f238e15f10 | ||
|
|
574cb11594 | ||
|
|
d9bdbd5a58 | ||
|
|
a33b3f189d | ||
|
|
26195efa0b | ||
|
|
1c5253b928 | ||
|
|
89cc8ca314 | ||
|
|
ff28836616 | ||
|
|
73d031d7ea | ||
|
|
555d23c035 | ||
|
|
8198c2b63c | ||
|
|
b8963f21bf | ||
|
|
9474a9d319 | ||
|
|
963e16870b | ||
|
|
02aad45aa6 | ||
|
|
59fd98b8b2 | ||
|
|
fbc846b4ba | ||
|
|
dd77b6eac5 | ||
|
|
e951056e7b | ||
|
|
2be39d3e1c | ||
|
|
2b34cf098a | ||
|
|
9821b2c414 | ||
|
|
6661ff9794 | ||
|
|
a9823cbfd5 | ||
|
|
03f1c1e81b | ||
|
|
c277cdef8c | ||
|
|
ad1bd424fa | ||
|
|
a170cc806a | ||
|
|
22a0cd6e05 | ||
|
|
a21a75c19e | ||
|
|
8595fcdeb9 | ||
|
|
5239ef9c83 | ||
|
|
edfe65a22c | ||
|
|
e53debe000 | ||
|
|
c2f547b6e3 | ||
|
|
984c4f0658 | ||
|
|
1ea5400e8d | ||
|
|
b60a7224ab | ||
|
|
29ffd5134f | ||
|
|
6833e01f23 | ||
|
|
0aa8640d07 | ||
|
|
e235e5a6a5 | ||
|
|
63e8946fc8 | ||
|
|
c7fbcb3c02 | ||
|
|
d482b8e3b7 | ||
|
|
f9b43a566c | ||
|
|
52eff3bd83 | ||
|
|
7c2a5052a8 | ||
|
|
1d86a724f2 | ||
|
|
f36f38c960 | ||
|
|
301d30229b | ||
|
|
05ce86ea33 | ||
|
|
6e423a94cd | ||
|
|
c09f8f5764 | ||
|
|
33278f0fce | ||
|
|
9958a8d32e | ||
|
|
ed9cdca127 | ||
|
|
fca77266bd | ||
|
|
688212130d | ||
|
|
3bde390c58 | ||
|
|
0cdb653c9c | ||
|
|
40dca63891 | ||
|
|
b8f5a4923c | ||
|
|
f4c5d29c64 | ||
|
|
c7536fb4fd | ||
|
|
3152e5c207 | ||
|
|
d08d2dac79 | ||
|
|
8264e265a8 | ||
|
|
ec178b0b3b | ||
|
|
b36882e72e | ||
|
|
87fb72346a | ||
|
|
2a238fda9e | ||
|
|
54900d5216 | ||
|
|
22db934db9 | ||
|
|
4a0735a195 | ||
|
|
0827cb5483 | ||
|
|
8e3c1dbd11 | ||
|
|
b031531e79 | ||
|
|
e4a6da936d | ||
|
|
70cd1d5a57 | ||
|
|
a767578d44 | ||
|
|
6d732b9fb4 | ||
|
|
710c3ee3d2 | ||
|
|
3bb75a6fde | ||
|
|
8ea9044667 | ||
|
|
cddb26558f |
40
.appveyor.yml
Normal file
40
.appveyor.yml
Normal file
@@ -0,0 +1,40 @@
|
||||
---
|
||||
# Disabling building for AppVeyor. We are just testing things.
|
||||
build: false
|
||||
clone_depth: 10
|
||||
# Use the directory C:\testplugin so test directories will mostly work.
|
||||
clone_folder: C:\testplugin
|
||||
|
||||
# Cache the vim and vader directories between builds.
|
||||
cache:
|
||||
- C:\vim -> .appveyor.yml
|
||||
- C:\vader -> .appveyor.yml
|
||||
|
||||
init:
|
||||
# Stop git from changing newlines
|
||||
- git config --global core.autocrlf input
|
||||
|
||||
install:
|
||||
# Download and unpack Vim
|
||||
- ps: >-
|
||||
if (!(Test-Path -Path C:\vim)){
|
||||
Add-Type -A System.IO.Compression.FileSystem
|
||||
Invoke-WebRequest ftp://ftp.vim.org/pub/vim/pc/vim80-586w32.zip `
|
||||
-OutFile C:\vim.zip
|
||||
[IO.Compression.ZipFile]::ExtractToDirectory('C:\vim.zip', 'C:\vim')
|
||||
Invoke-WebRequest ftp://ftp.vim.org/pub/vim/pc/vim80-586rt.zip `
|
||||
-OutFile C:\rt.zip
|
||||
[IO.Compression.ZipFile]::ExtractToDirectory('C:\rt.zip', 'C:\vim')
|
||||
}
|
||||
# Clone Vader and check out the commit we want
|
||||
- ps: >-
|
||||
if (!(Test-Path -Path C:\vader)){
|
||||
git clone https://github.com/junegunn/vader.vim C:\vader 2> $null
|
||||
cd C:\vader
|
||||
git checkout -qf c6243dd81c98350df4dec608fa972df98fa2a3af 2> $null
|
||||
}
|
||||
|
||||
test_script:
|
||||
- cd C:\testplugin
|
||||
- 'C:\vim\vim\vim80\vim.exe -u test\vimrc "+Vader!
|
||||
test/*.vader test/*/*.vader test/*/*/*.vader test/*/*/*.vader"'
|
||||
14
.editorconfig
Normal file
14
.editorconfig
Normal file
@@ -0,0 +1,14 @@
|
||||
# EditorConfig is awesome: http://EditorConfig.org
|
||||
|
||||
# Top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Match and apply these rules for all file
|
||||
# types you open in your code editor
|
||||
[*]
|
||||
# Unix-style newlines
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -6,7 +6,7 @@
|
||||
/Makefile export-ignore
|
||||
/PULL_REQUEST_TEMPLATE.md export-ignore
|
||||
/README.md export-ignore
|
||||
/custom-checks export-ignore
|
||||
/img export-ignore
|
||||
/run-tests export-ignore
|
||||
/run-tests.bat export-ignore
|
||||
/test export-ignore
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,5 +1,6 @@
|
||||
/init.vim
|
||||
/doc/tags
|
||||
.*
|
||||
!.editorconfig
|
||||
*.obj
|
||||
tags
|
||||
|
||||
@@ -129,7 +129,7 @@ giving some unfair preference to any particular tool or language.
|
||||
|
||||
The "online documentation" file used for this project lives in `doc/ale.txt`.
|
||||
This is the file used for generating `:help` text inside Vim itself. There are
|
||||
some guidlines to follow for this file.
|
||||
some guidelines to follow for this file.
|
||||
|
||||
1. Keep all text within a column size of 79 characters, inclusive.
|
||||
2. Open a section with 79 `=` or `-` characters, for headings and subheadings.
|
||||
@@ -160,7 +160,7 @@ to look up the default value easily by typing `:echo g:ale_...`.
|
||||
Should the principal author of the ALE project and all collaborators with the
|
||||
required access needed to properly administrate the project on GitHub or any
|
||||
other website either perish or disappear, whether by tragic traffic accident
|
||||
or government adduction, etc., action should be taken to ensure that the
|
||||
or government abduction, etc., action should be taken to ensure that the
|
||||
project continues. If no one is left to administer the project where it is
|
||||
hosted, please fork the project and nominate someone capable to administer it.
|
||||
Preferably, in such an event, a single fork of the project will replace the
|
||||
|
||||
@@ -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.
|
||||
|
||||
262
README.md
262
README.md
@@ -1,4 +1,5 @@
|
||||
# Asynchronous Lint Engine [](https://travis-ci.org/w0rp/ale)
|
||||
# Asynchronous Lint Engine [](https://travis-ci.org/w0rp/ale) [](https://ci.appveyor.com/project/w0rp/ale)
|
||||
|
||||
|
||||

|
||||
|
||||
@@ -16,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
|
||||
|
||||
@@ -26,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)
|
||||
@@ -35,14 +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 change the format for echo messages?](#faq-echo-format)
|
||||
6. [How can I execute some code when ALE stops linting?](#faq-autocmd)
|
||||
7. [How can I navigate between errors quickly?](#faq-navigation)
|
||||
8. [How can I run linters only when I save files?](#faq-lint-on-save)
|
||||
9. [How can I use the quickfix list instead of the loclist?](#faq-quickfix)
|
||||
10. [How can I check JSX files with both stylelint and eslint?](#faq-jsx-stylelint-eslint)
|
||||
11. [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>
|
||||
|
||||
@@ -55,88 +60,108 @@ tools will be run in combination, so they can be complementary.
|
||||
Keep the table rows sorted alphabetically by the language name,
|
||||
and the tools in the tools column sorted alphabetically by the tool
|
||||
name. That seems to be the fairest way to arrange this table.
|
||||
|
||||
Remember to also update doc/ale.txt, which has a similar list with different
|
||||
formatting.
|
||||
-->
|
||||
|
||||
**Notes:**
|
||||
|
||||
* *^ No linters for text or Vim help filetypes are enabled by default.*
|
||||
* *!! These linters check only files on disk. See `:help ale-lint-file-linters`*
|
||||
|
||||
| Language | Tools |
|
||||
| -------- | ----- |
|
||||
| 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 | [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set), [shellcheck](https://www.shellcheck.net/) |
|
||||
| Bourne Shell | [-n flag](http://linux.die.net/man/1/sh), [shellcheck](https://www.shellcheck.net/) |
|
||||
| C | [cppcheck](http://cppcheck.sourceforge.net), [gcc](https://gcc.gnu.org/), [clang](http://clang.llvm.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/), [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# | [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) |
|
||||
| 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/) !!, [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) |
|
||||
| Crystal | [crystal](https://crystal-lang.org/) !! |
|
||||
| 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-make](https://github.com/elm-lang/elm-make) |
|
||||
| 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) |
|
||||
| Erb | [erb](https://github.com/jeremyevans/erubi), [erubis](https://github.com/kwatch/erubis) |
|
||||
| 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) |
|
||||
| Go | [gofmt -e](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) |
|
||||
| Haml | [haml-lint](https://github.com/brigade/haml-lint)
|
||||
| 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/), [standard](http://standardjs.com/), [prettier](https://github.com/prettier/prettier) (and `prettier-eslint`, `prettier-standard`), [xo](https://github.com/sindresorhus/xo)
|
||||
| JSON | [jsonlint](http://zaa.ch/jsonlint/) |
|
||||
| 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/) |
|
||||
| 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 | [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) |
|
||||
| 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](https://nim-lang.org/docs/nimc.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-integration-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/) |
|
||||
| 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/), [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) |
|
||||
| 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)
|
||||
| Slim | [slim-lint](https://github.com/sds/slim-lint) |
|
||||
| SML | [smlnj](http://www.smlnj.org/) |
|
||||
| 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) |
|
||||
| TypeScript | [eslint](http://eslint.org/), [tslint](https://github.com/palantir/tslint), tsserver, typecheck |
|
||||
| Tcl | [nagelfar](http://nagelfar.sourceforge.net) !! |
|
||||
| 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/), [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/) |
|
||||
|
||||
* *^ No linters for text or Vim help filetypes are enabled by default.*
|
||||
|
||||
<a name="usage"></a>
|
||||
|
||||
## 2. Usage
|
||||
@@ -198,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
|
||||
@@ -357,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
|
||||
@@ -397,9 +457,18 @@ set statusline=%{LinterStatus()}
|
||||
|
||||
See `:help ale#statusline#Count()` for more information.
|
||||
|
||||
<a name="faq-lightline"></a>
|
||||
|
||||
### 5.vi. How can I show errors or warnings in my lightline?
|
||||
|
||||
[lightline](https://github.com/itchyny/lightline.vim) does not have built-in
|
||||
support for ALE, nevertheless there is a plugin that adds this functionality: [maximbaz/lightline-ale](https://github.com/maximbaz/lightline-ale).
|
||||
|
||||
For more information, check out the sources of that plugin, `:help ale#statusline#Count()` and [lightline documentation](https://github.com/itchyny/lightline.vim#advanced-configuration).
|
||||
|
||||
<a name="faq-echo-format"></a>
|
||||
|
||||
### 5.v. 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.
|
||||
|
||||
@@ -424,22 +493,24 @@ Will give you:
|
||||
|
||||
<a name="faq-autocmd"></a>
|
||||
|
||||
### 5.vi. 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.vii. 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
|
||||
@@ -455,7 +526,7 @@ For more information, consult the online documentation with
|
||||
|
||||
<a name="faq-lint-on-save"></a>
|
||||
|
||||
### 5.viii. 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
|
||||
@@ -475,7 +546,7 @@ files, you can set `g:ale_lint_on_save` to `0`.
|
||||
|
||||
<a name="faq-quickfix"></a>
|
||||
|
||||
### 5.ix. 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
|
||||
@@ -502,7 +573,7 @@ let g:ale_keep_list_window_open = 1
|
||||
|
||||
<a name="faq-jsx-stylelint-eslint"></a>
|
||||
|
||||
### 5.x. 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.
|
||||
@@ -535,7 +606,7 @@ no linter will be run twice for the same file.
|
||||
|
||||
<a name="faq-my-battery-is-sad"></a>
|
||||
|
||||
### 5.xi. 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
|
||||
@@ -557,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',
|
||||
\})
|
||||
|
||||
64
ale_linters/c/clangtidy.vim
Normal file
64
ale_linters/c/clangtidy.vim
Normal file
@@ -0,0 +1,64 @@
|
||||
" Author: vdeurzen <tim@kompiler.org>, w0rp <devw0rp@gmail.com>,
|
||||
" gagbo <gagbobada@gmail.com>, Andrej Radovic <r.andrej@gmail.com>
|
||||
" Description: clang-tidy linter for c files
|
||||
|
||||
call ale#Set('c_clangtidy_executable', 'clang-tidy')
|
||||
" Set this option to check the checks clang-tidy will apply.
|
||||
" The number of checks that can be applied to C files is limited in contrast to
|
||||
" C++
|
||||
"
|
||||
" Consult the check list in clang-tidy's documentation:
|
||||
" http://clang.llvm.org/extra/clang-tidy/checks/list.html
|
||||
|
||||
call ale#Set('c_clangtidy_checks', ['*'])
|
||||
" Set this option to manually set some options for clang-tidy.
|
||||
" This will disable compile_commands.json detection.
|
||||
call ale#Set('c_clangtidy_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#c#clangtidy#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'c_clangtidy_executable')
|
||||
endfunction
|
||||
|
||||
function! s:GetBuildDirectory(buffer) abort
|
||||
" Don't include build directory for header files, as compile_commands.json
|
||||
" files don't consider headers to be translation units, and provide no
|
||||
" commands for compiling header files.
|
||||
if expand('#' . a:buffer) =~# '\v\.(h|hpp)$'
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:build_dir = ale#Var(a:buffer, 'c_build_dir')
|
||||
|
||||
" c_build_dir has the priority if defined
|
||||
if !empty(l:build_dir)
|
||||
return l:build_dir
|
||||
endif
|
||||
|
||||
return ale#c#FindCompileCommands(a:buffer)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#clangtidy#GetCommand(buffer) abort
|
||||
let l:checks = join(ale#Var(a:buffer, 'c_clangtidy_checks'), ',')
|
||||
let l:build_dir = s:GetBuildDirectory(a:buffer)
|
||||
|
||||
" Get the extra options if we couldn't find a build directory.
|
||||
let l:options = empty(l:build_dir)
|
||||
\ ? ale#Var(a:buffer, 'c_clangtidy_options')
|
||||
\ : ''
|
||||
|
||||
return ale#Escape(ale_linters#c#clangtidy#GetExecutable(a:buffer))
|
||||
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
|
||||
\ . ' %s'
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
\ . (!empty(l:options) ? ' -- ' . l:options : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'clangtidy',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable_callback': 'ale_linters#c#clangtidy#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#c#clangtidy#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
@@ -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',
|
||||
\})
|
||||
@@ -24,9 +24,9 @@ function! ale_linters#cpp#clangcheck#GetCommand(buffer) abort
|
||||
" detected.
|
||||
return ale#Escape(ale_linters#cpp#clangcheck#GetExecutable(a:buffer))
|
||||
\ . ' -analyze %s'
|
||||
\ . (empty(l:build_dir) ? ' -extra-arg -Xclang -extra-arg -analyzer-output=text' : '')
|
||||
\ . (!empty(l:user_options) ? ' ' . l:user_options : '')
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
\ . (empty(l:build_dir) ? ' -extra-arg -Xanalyzer -extra-arg -analyzer-output=text' : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
81
ale_linters/cs/mcsc.vim
Normal file
81
ale_linters/cs/mcsc.vim
Normal file
@@ -0,0 +1,81 @@
|
||||
call ale#Set('cs_mcsc_options', '')
|
||||
call ale#Set('cs_mcsc_source', '')
|
||||
call ale#Set('cs_mcsc_assembly_path', [])
|
||||
call ale#Set('cs_mcsc_assemblies', [])
|
||||
|
||||
function! s:GetWorkingDirectory(buffer) abort
|
||||
let l:working_directory = ale#Var(a:buffer, 'cs_mcsc_source')
|
||||
|
||||
if !empty(l:working_directory)
|
||||
return l:working_directory
|
||||
endif
|
||||
|
||||
return fnamemodify(bufname(a:buffer), ':p:h')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cs#mcsc#GetCommand(buffer) abort
|
||||
" Pass assembly paths via the -lib: parameter.
|
||||
let l:path_list = ale#Var(a:buffer, 'cs_mcsc_assembly_path')
|
||||
|
||||
let l:lib_option = !empty(l:path_list)
|
||||
\ ? '-lib:' . join(map(copy(l:path_list), 'ale#Escape(v:val)'), ',')
|
||||
\ : ''
|
||||
|
||||
" Pass paths to DLL files via the -r: parameter.
|
||||
let l:assembly_list = ale#Var(a:buffer, 'cs_mcsc_assemblies')
|
||||
|
||||
let l:r_option = !empty(l:assembly_list)
|
||||
\ ? '-r:' . join(map(copy(l:assembly_list), 'ale#Escape(v:val)'), ',')
|
||||
\ : ''
|
||||
|
||||
" register temporary module target file with ale
|
||||
let l:out = tempname()
|
||||
call ale#engine#ManageFile(a:buffer, l:out)
|
||||
|
||||
" 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:lib_option
|
||||
\ . ' ' . l:r_option
|
||||
\ . ' -out:' . l:out
|
||||
\ . ' -t:module'
|
||||
\ . ' -recurse:' . ale#Escape('*.cs')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cs#mcsc#Handle(buffer, lines) abort
|
||||
" Look for lines like the following.
|
||||
"
|
||||
" Tests.cs(12,29): error CSXXXX: ; expected
|
||||
"
|
||||
" NOTE: pattern also captures file name as linter compiles all
|
||||
" files within the source tree rooted at the specified source
|
||||
" path and not just the file loaded in the buffer
|
||||
let l:pattern = '^\v(.+\.cs)\((\d+),(\d+)\)\: ([^ ]+) ([^ ]+): (.+)$'
|
||||
let l:output = []
|
||||
|
||||
let l:dir = s:GetWorkingDirectory(a:buffer)
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
||||
\ 'code': l:match[5],
|
||||
\ 'text': l:match[6],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cs',{
|
||||
\ 'name': 'mcsc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'mcs',
|
||||
\ 'command_callback': 'ale_linters#cs#mcsc#GetCommand',
|
||||
\ 'callback': 'ale_linters#cs#mcsc#Handle',
|
||||
\ 'lint_file': 1
|
||||
\})
|
||||
56
ale_linters/cuda/nvcc.vim
Normal file
56
ale_linters/cuda/nvcc.vim
Normal file
@@ -0,0 +1,56 @@
|
||||
" Author: blahgeek <i@blahgeek.com>
|
||||
" Description: NVCC linter for cuda files
|
||||
|
||||
call ale#Set('cuda_nvcc_executable', 'nvcc')
|
||||
call ale#Set('cuda_nvcc_options', '-std=c++11')
|
||||
|
||||
function! ale_linters#cuda#nvcc#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cuda_nvcc_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cuda#nvcc#GetCommand(buffer) abort
|
||||
" Unused: use ale#util#nul_file
|
||||
" let l:output_file = tempname() . '.ii'
|
||||
" call ale#engine#ManageFile(a:buffer, l:output_file)
|
||||
|
||||
return ale#Escape(ale_linters#cuda#nvcc#GetExecutable(a:buffer))
|
||||
\ . ' -cuda '
|
||||
\ . ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer))
|
||||
\ . ale#Var(a:buffer, 'cuda_nvcc_options') . ' %s'
|
||||
\ . ' -o ' . g:ale#util#nul_file
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cuda#nvcc#HandleNVCCFormat(buffer, lines) abort
|
||||
" Look for lines like the following.
|
||||
"
|
||||
" test.cu(8): error: argument of type "void *" is incompatible with parameter of type "int *"
|
||||
let l:pattern = '\v^([^:\(\)]+):?\(?(\d+)\)?:(\d+)?:?\s*\w*\s*(error|warning): (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
|
||||
let l:item = {
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'type': l:match[4] =~# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[5],
|
||||
\ 'filename': fnamemodify(l:match[1], ':p'),
|
||||
\}
|
||||
|
||||
if !empty(l:match[3])
|
||||
let l:item.col = str2nr(l:match[3])
|
||||
endif
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cuda', {
|
||||
\ 'name': 'nvcc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': 'ale_linters#cuda#nvcc#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#cuda#nvcc#GetCommand',
|
||||
\ 'callback': 'ale_linters#cuda#nvcc#HandleNVCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
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',
|
||||
\})
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
" Author: buffalocoder - https://github.com/buffalocoder
|
||||
" Author: buffalocoder - https://github.com/buffalocoder, soywod - https://github.com/soywod
|
||||
" Description: Elm linting in Ale. Closely follows the Syntastic checker in https://github.com/ElmCast/elm-vim.
|
||||
|
||||
call ale#Set('elm_make_executable', 'elm-make')
|
||||
call ale#Set('elm_make_use_global', 0)
|
||||
|
||||
function! ale_linters#elm#make#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'elm_make', [
|
||||
\ 'node_modules/.bin/elm-make',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
let l:is_windows = has('win32')
|
||||
@@ -52,6 +61,7 @@ endfunction
|
||||
" If it doesn't, then this will fail when imports are needed.
|
||||
function! ale_linters#elm#make#GetCommand(buffer) abort
|
||||
let l:elm_package = ale#path#FindNearestFile(a:buffer, 'elm-package.json')
|
||||
let l:elm_exe = ale_linters#elm#make#GetExecutable(a:buffer)
|
||||
if empty(l:elm_package)
|
||||
let l:dir_set_cmd = ''
|
||||
else
|
||||
@@ -61,16 +71,18 @@ function! ale_linters#elm#make#GetCommand(buffer) abort
|
||||
|
||||
" The elm-make compiler, at the time of this writing, uses '/dev/null' as
|
||||
" a sort of flag to tell the compiler not to generate an output file,
|
||||
" which is why this is hard coded here.
|
||||
" which is why this is hard coded here. It does not use NUL on Windows.
|
||||
" Source: https://github.com/elm-lang/elm-make/blob/master/src/Flags.hs
|
||||
let l:elm_cmd = 'elm-make --report=json --output='.ale#Escape('/dev/null')
|
||||
let l:elm_cmd = ale#Escape(l:elm_exe)
|
||||
\ . ' --report=json'
|
||||
\ . ' --output=/dev/null'
|
||||
|
||||
return l:dir_set_cmd . ' ' . l:elm_cmd . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elm', {
|
||||
\ 'name': 'make',
|
||||
\ 'executable': 'elm-make',
|
||||
\ 'executable_callback': 'ale_linters#elm#make#GetExecutable',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'command_callback': 'ale_linters#elm#make#GetCommand',
|
||||
\ 'callback': 'ale_linters#elm#make#Handle'
|
||||
|
||||
@@ -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',
|
||||
\})
|
||||
|
||||
46
ale_linters/glsl/glslang.vim
Normal file
46
ale_linters/glsl/glslang.vim
Normal file
@@ -0,0 +1,46 @@
|
||||
" Author: Sven-Hendrik Haase <svenstaro@gmail.com>
|
||||
" Description: glslang-based linter for glsl files
|
||||
"
|
||||
" TODO: Once https://github.com/KhronosGroup/glslang/pull/1047 is accepted,
|
||||
" we can use stdin.
|
||||
|
||||
let g:ale_glsl_glslang_executable =
|
||||
\ get(g:, 'ale_glsl_glslang_executable', 'glslangValidator')
|
||||
|
||||
let g:ale_glsl_glslang_options = get(g:, 'ale_glsl_glslang_options', '')
|
||||
|
||||
function! ale_linters#glsl#glslang#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'glsl_glslang_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#glsl#glslang#GetCommand(buffer) abort
|
||||
return ale_linters#glsl#glslang#GetExecutable(a:buffer)
|
||||
\ . ' ' . ale#Var(a:buffer, 'glsl_glslang_options')
|
||||
\ . ' ' . '-C %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#glsl#glslang#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
"
|
||||
" ERROR: 0:5: 'foo' : undeclared identifier
|
||||
let l:pattern = '^\(.\+\): \(\d\+\):\(\d\+\): \(.\+\)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[3]),
|
||||
\ 'col': str2nr(l:match[2]),
|
||||
\ 'text': l:match[4],
|
||||
\ 'type': l:match[1] is# 'ERROR' ? 'E' : 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('glsl', {
|
||||
\ 'name': 'glslang',
|
||||
\ 'executable_callback': 'ale_linters#glsl#glslang#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#glsl#glslang#GetCommand',
|
||||
\ 'callback': 'ale_linters#glsl#glslang#Handle',
|
||||
\})
|
||||
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,6 +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',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
||||
@@ -4,6 +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',
|
||||
\ '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,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
call ale#Set('haskell_stack_build_options', '--fast')
|
||||
|
||||
function ale_linters#haskell#stack_build#GetCommand(buffer) abort
|
||||
function! ale_linters#haskell#stack_build#GetCommand(buffer) abort
|
||||
let l:flags = ale#Var(a:buffer, 'haskell_stack_build_options')
|
||||
|
||||
return 'stack build ' . l:flags
|
||||
|
||||
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
|
||||
|
||||
@@ -14,6 +14,11 @@ function! ale_linters#java#javac#GetImportPaths(buffer) abort
|
||||
\ . 'mvn dependency:build-classpath'
|
||||
endif
|
||||
|
||||
let l:classpath_command = ale#gradle#BuildClasspathCommand(a:buffer)
|
||||
if !empty(l:classpath_command)
|
||||
return l:classpath_command
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
@@ -36,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)
|
||||
@@ -58,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'
|
||||
@@ -73,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
|
||||
|
||||
|
||||
@@ -14,17 +14,9 @@ endfunction
|
||||
|
||||
function! ale_linters#javascript#standard#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#javascript#standard#GetExecutable(a:buffer)
|
||||
|
||||
if ale#Has('win32') && l:executable =~? '\.js$'
|
||||
" .js files have to be executed with Node on Windows.
|
||||
let l:head = 'node ' . ale#Escape(l:executable)
|
||||
else
|
||||
let l:head = ale#Escape(l:executable)
|
||||
endif
|
||||
|
||||
let l:options = ale#Var(a:buffer, 'javascript_standard_options')
|
||||
|
||||
return l:head
|
||||
return ale#node#Executable(a:buffer, l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' --stdin %s'
|
||||
endfunction
|
||||
|
||||
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
ale_linters/llvm/llc.vim
Normal file
35
ale_linters/llvm/llc.vim
Normal file
@@ -0,0 +1,35 @@
|
||||
" Author: rhysd <https://rhysd.github.io>
|
||||
" Description: Support for checking LLVM IR with llc
|
||||
|
||||
call ale#Set('llvm_llc_executable', 'llc')
|
||||
|
||||
function! ale_linters#llvm#llc#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'llvm_llc_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#llvm#llc#GetCommand(buffer) abort
|
||||
return ale#Escape(ale_linters#llvm#llc#GetExecutable(a:buffer))
|
||||
\ . ' -filetype=null -o='
|
||||
\ . ale#Escape(g:ale#util#nul_file)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#llvm#llc#HandleErrors(buffer, lines) abort
|
||||
" Handle '{path}: {file}:{line}:{col}: error: {message}' format
|
||||
let l:pattern = '\v^[a-zA-Z]?:?[^:]+: [^:]+:(\d+):(\d+): (.+)$'
|
||||
let l:matches = ale#util#GetMatches(a:lines, l:pattern)
|
||||
|
||||
return map(l:matches, "{
|
||||
\ 'lnum': str2nr(v:val[1]),
|
||||
\ 'col': str2nr(v:val[2]),
|
||||
\ 'text': v:val[3],
|
||||
\ 'type': 'E',
|
||||
\}")
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('llvm', {
|
||||
\ 'name': 'llc',
|
||||
\ 'executable_callback': 'ale_linters#llvm#llc#GetExecutable',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command_callback': 'ale_linters#llvm#llc#GetCommand',
|
||||
\ 'callback': 'ale_linters#llvm#llc#HandleErrors',
|
||||
\})
|
||||
@@ -26,11 +26,18 @@ function! ale_linters#lua#luacheck#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
if !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
||||
\ && l:match[3] is# 'W'
|
||||
\ && index(range(611, 614), str2nr(l:match[4])) >= 0
|
||||
continue
|
||||
endif
|
||||
|
||||
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',
|
||||
\})
|
||||
28
ale_linters/markdown/remark_lint.vim
Normal file
28
ale_linters/markdown/remark_lint.vim
Normal file
@@ -0,0 +1,28 @@
|
||||
" Author rhysd https://rhysd.github.io/
|
||||
" Description: remark-lint for Markdown files
|
||||
|
||||
function! ale_linters#markdown#remark_lint#Handle(buffer, lines) abort
|
||||
" matches: ' 1:4 warning Incorrect list-item indent: add 1 space list-item-indent remark-lint'
|
||||
let l:pattern = '^ \+\(\d\+\):\(\d\+\) \(warning\|error\) \(.\+\)$'
|
||||
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,
|
||||
\ 'type': l:match[3] is# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'remark-lint',
|
||||
\ 'executable': 'remark',
|
||||
\ 'command': 'remark --no-stdout --no-color %s',
|
||||
\ 'callback': 'ale_linters#markdown#remark_lint#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\ 'output_stream': 'stderr',
|
||||
\})
|
||||
@@ -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
|
||||
@@ -14,7 +23,7 @@ function! ale_linters#php#phpmd#Handle(buffer, lines) abort
|
||||
" Matches against lines like the following:
|
||||
"
|
||||
" /path/to/some-filename.php:18 message
|
||||
let l:pattern = '^.*:\(\d\+\)\t\(.\+\)$'
|
||||
let l:pattern = '^.*:\(\d\+\)\s\+\(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
@@ -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',
|
||||
\})
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
" Set to change the ruleset
|
||||
let g:ale_php_phpstan_executable = get(g:, 'ale_php_phpstan_executable', 'phpstan')
|
||||
let g:ale_php_phpstan_level = get(g:, 'ale_php_phpstan_level', '4')
|
||||
let g:ale_php_phpstan_configuration = get(g:, 'ale_php_phpstan_configuration', '')
|
||||
|
||||
function! ale_linters#php#phpstan#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'php_phpstan_executable')
|
||||
@@ -12,10 +13,16 @@ endfunction
|
||||
function! ale_linters#php#phpstan#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#php#phpstan#GetExecutable(a:buffer)
|
||||
|
||||
let l:configuration = ale#Var(a:buffer, 'php_phpstan_configuration')
|
||||
let l:configuration_option = !empty(l:configuration)
|
||||
\ ? ' -c ' . l:configuration
|
||||
\ : ''
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . ' analyze -l'
|
||||
\ . ale#Var(a:buffer, 'php_phpstan_level')
|
||||
\ . ' --errorFormat raw'
|
||||
\ . l:configuration_option
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
|
||||
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',
|
||||
\})
|
||||
@@ -1,9 +1,14 @@
|
||||
" Author: Michel Lang <michellang@gmail.com>, w0rp <devw0rp@gmail.com>
|
||||
" Description: This file adds support for checking R code with lintr.
|
||||
|
||||
let g:ale_r_lintr_options =
|
||||
\ get(g:, 'ale_r_lintr_options', 'lintr::with_defaults()')
|
||||
" A reasonable alternative default:
|
||||
" \ get(g:, 'ale_r_lintr_options', 'lintr::with_defaults(object_usage_linter = NULL)')
|
||||
|
||||
function! ale_linters#r#lintr#GetCommand(buffer) abort
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . 'Rscript -e ' . ale#Escape('lintr::lint(commandArgs(TRUE))') . ' %t'
|
||||
\ . 'Rscript -e ' . ale#Escape('lintr::lint(commandArgs(TRUE)[1], eval(parse(text = commandArgs(TRUE)[2])))') . ' %t' . ' ' . ale#Escape(ale#Var(a:buffer, 'r_lintr_options'))
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('r', {
|
||||
|
||||
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',
|
||||
\})
|
||||
@@ -7,23 +7,19 @@ let g:ale_ruby_brakeman_options =
|
||||
function! ale_linters#ruby#brakeman#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
let l:json = ale#util#FuzzyJSONDecode(a:lines, {})
|
||||
let l:sep = has('win32') ? '\' : '/'
|
||||
" Brakeman always outputs paths relative to the Rails app root
|
||||
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
|
||||
|
||||
for l:warning in get(l:json, 'warnings', [])
|
||||
" Brakeman always outputs paths relative to the Rails app root
|
||||
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
|
||||
let l:warning_file = l:rails_root . '/' . l:warning.file
|
||||
|
||||
if !ale#path#IsBufferPath(a:buffer, l:warning_file)
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:text = l:warning.warning_type . ' ' . l:warning.message . ' (' . l:warning.confidence . ')'
|
||||
let l:line = l:warning.line != v:null ? l:warning.line : 1
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:line,
|
||||
\ 'type': 'W',
|
||||
\ 'text': l:text,
|
||||
\ 'filename': l:rails_root . l:sep . l:warning.file,
|
||||
\ 'lnum': l:line,
|
||||
\ 'type': 'W',
|
||||
\ 'text': l:text,
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
||||
@@ -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', {
|
||||
|
||||
@@ -8,10 +8,21 @@ let g:ale_scalastyle_config_loc =
|
||||
\ get(g:, 'ale_scalastyle_config_loc', '')
|
||||
|
||||
function! ale_linters#scala#scalastyle#Handle(buffer, lines) abort
|
||||
" Look for help output from scalastyle first, which indicates that no
|
||||
" configuration file was found.
|
||||
for l:line in a:lines[:10]
|
||||
if l:line =~# '-c, --config'
|
||||
return [{
|
||||
\ 'lnum': 1,
|
||||
\ 'text': '(See :help ale-scala-scalastyle)'
|
||||
\ . ' No scalastyle configuration file was found.',
|
||||
\}]
|
||||
endif
|
||||
endfor
|
||||
|
||||
" Matches patterns like the following:
|
||||
"
|
||||
" warning file=/home/blurble/Doop.scala message=Missing or badly formed ScalaDoc: Extra @param foobles line=190
|
||||
|
||||
let l:patterns = [
|
||||
\ '^\(.\+\) .\+ message=\(.\+\) line=\(\d\+\)$',
|
||||
\ '^\(.\+\) .\+ message=\(.\+\) line=\(\d\+\) column=\(\d\+\)$',
|
||||
|
||||
@@ -17,18 +17,10 @@ if !exists('g:ale_sh_shell_default_shell')
|
||||
endif
|
||||
|
||||
function! ale_linters#sh#shell#GetExecutable(buffer) abort
|
||||
let l:banglines = getbufline(a:buffer, 1)
|
||||
let l:shell_type = ale#handlers#sh#GetShellType(a:buffer)
|
||||
|
||||
" Take the shell executable from the hashbang, if we can.
|
||||
if len(l:banglines) == 1 && l:banglines[0] =~# '^#!'
|
||||
" Remove options like -e, etc.
|
||||
let l:line = substitute(l:banglines[0], '--\?[a-zA-Z0-9]\+', '', 'g')
|
||||
|
||||
for l:possible_shell in ['bash', 'tcsh', 'csh', 'zsh', 'sh']
|
||||
if l:line =~# l:possible_shell . '\s*$'
|
||||
return l:possible_shell
|
||||
endif
|
||||
endfor
|
||||
if !empty(l:shell_type)
|
||||
return l:shell_type
|
||||
endif
|
||||
|
||||
return ale#Var(a:buffer, 'sh_shell_default_shell')
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
" Description: This file adds support for using the shellcheck linter with
|
||||
" shell scripts.
|
||||
|
||||
" This global variable can be set with a string of comma-seperated error
|
||||
" This global variable can be set with a string of comma-separated error
|
||||
" codes to exclude from shellcheck. For example:
|
||||
"
|
||||
" let g:ale_sh_shellcheck_exclusions = 'SC2002,SC2004'
|
||||
@@ -19,30 +19,99 @@ function! ale_linters#sh#shellcheck#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'sh_shellcheck_executable')
|
||||
endfunction
|
||||
|
||||
function! s:GetDialectArgument() abort
|
||||
if exists('b:is_bash') && b:is_bash
|
||||
return '-s bash'
|
||||
elseif exists('b:is_sh') && b:is_sh
|
||||
return '-s sh'
|
||||
elseif exists('b:is_kornshell') && b:is_kornshell
|
||||
return '-s ksh'
|
||||
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 getbufvar(a:buffer, 'is_bash', 0)
|
||||
return 'bash'
|
||||
elseif getbufvar(a:buffer, 'is_sh', 0)
|
||||
return 'sh'
|
||||
elseif getbufvar(a:buffer, 'is_kornshell', 0)
|
||||
return 'ksh'
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#sh#shellcheck#GetCommand(buffer) abort
|
||||
let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions')
|
||||
function! ale_linters#sh#shellcheck#VersionCheck(buffer) abort
|
||||
let l:executable = ale_linters#sh#shellcheck#GetExecutable(a:buffer)
|
||||
|
||||
return ale_linters#sh#shellcheck#GetExecutable(a:buffer)
|
||||
\ . ' ' . ale#Var(a:buffer, 'sh_shellcheck_options')
|
||||
\ . ' ' . (!empty(l:exclude_option) ? '-e ' . l:exclude_option : '')
|
||||
\ . ' ' . s:GetDialectArgument() . ' -f gcc -'
|
||||
" 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#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',
|
||||
\})
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user