mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 20:54:26 +08:00
Compare commits
551 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76b5c9283d | ||
|
|
9b6d6344b2 | ||
|
|
e94aea9144 | ||
|
|
64b56f84ef | ||
|
|
72f5aae74e | ||
|
|
548c1a1007 | ||
|
|
2503eda68b | ||
|
|
8e4bac54a6 | ||
|
|
32f21751f4 | ||
|
|
ca120088c7 | ||
|
|
f6723784e6 | ||
|
|
1a157b1cd5 | ||
|
|
05bd4f591c | ||
|
|
4228c503f4 | ||
|
|
02f6fba6cb | ||
|
|
67beece06c | ||
|
|
673e36b2ef | ||
|
|
a9c5e14fc9 | ||
|
|
702b203c51 | ||
|
|
07bcbd4c06 | ||
|
|
f2c9fc403a | ||
|
|
2e1c9b0fa5 | ||
|
|
bf8aae02e8 | ||
|
|
0ac82f0a17 | ||
|
|
3ecdb52e6c | ||
|
|
bf0b2cfd84 | ||
|
|
ab9afaa2bf | ||
|
|
6b15c7c9fd | ||
|
|
d1cc1de6a5 | ||
|
|
ba7999dae0 | ||
|
|
14f3fc777f | ||
|
|
c2a0847f99 | ||
|
|
8e70dc14f2 | ||
|
|
528355e2c6 | ||
|
|
ab7ab7d6e3 | ||
|
|
0aed51565e | ||
|
|
858c1c47ae | ||
|
|
768a5e7421 | ||
|
|
3573975934 | ||
|
|
eb8bd26776 | ||
|
|
36314aeaf2 | ||
|
|
dce99faf8f | ||
|
|
d5c135cfaf | ||
|
|
5dcc77e8c8 | ||
|
|
b0bba34ea2 | ||
|
|
6547adcf2f | ||
|
|
a6cadaabef | ||
|
|
2c7d14809d | ||
|
|
dfb10f1db2 | ||
|
|
6fc3954bd3 | ||
|
|
0b4acd6453 | ||
|
|
cbb01e32b9 | ||
|
|
9cea780121 | ||
|
|
e417dafa78 | ||
|
|
944564bb8c | ||
|
|
49e68fc093 | ||
|
|
7230cbe9e4 | ||
|
|
ba6dbde906 | ||
|
|
236da06050 | ||
|
|
248901d589 | ||
|
|
10679b29c3 | ||
|
|
fbed7c15b9 | ||
|
|
447917e348 | ||
|
|
6853d2c304 | ||
|
|
b25dbd6ea5 | ||
|
|
ce2f777e33 | ||
|
|
4db5f3923d | ||
|
|
65fc4aeb1e | ||
|
|
741d86e137 | ||
|
|
5d5ba2a780 | ||
|
|
45c2d6b580 | ||
|
|
fe51866dfc | ||
|
|
c55064881d | ||
|
|
a25b55b954 | ||
|
|
3345bf20ca | ||
|
|
a03121f5b0 | ||
|
|
b4c0335ebc | ||
|
|
99afe586b3 | ||
|
|
689921d7e3 | ||
|
|
368adb5c3a | ||
|
|
49c9b689ce | ||
|
|
9238976522 | ||
|
|
c1a2d26711 | ||
|
|
925f24707f | ||
|
|
7fd7630153 | ||
|
|
0384cabd77 | ||
|
|
c6ef9e28a5 | ||
|
|
4eeb4783d3 | ||
|
|
d8dcc56af5 | ||
|
|
72449d7cb1 | ||
|
|
bdad25eefd | ||
|
|
e237add9fd | ||
|
|
6c762237ce | ||
|
|
6dab0efe19 | ||
|
|
dc72daaf1e | ||
|
|
dbf4f03607 | ||
|
|
430bff7532 | ||
|
|
ffda9077aa | ||
|
|
2643f9f119 | ||
|
|
e97dada261 | ||
|
|
e80116cee0 | ||
|
|
7682fab294 | ||
|
|
d824466230 | ||
|
|
35c831dd2c | ||
|
|
f0d76bc298 | ||
|
|
296ae92da4 | ||
|
|
11a4af2727 | ||
|
|
706dd050f2 | ||
|
|
2f009690c3 | ||
|
|
cab68cba25 | ||
|
|
c9a5d9845b | ||
|
|
7c49f5d4cc | ||
|
|
d5ccb1a7a1 | ||
|
|
8351bdbc06 | ||
|
|
abdfaaf84f | ||
|
|
54991f3082 | ||
|
|
1167616726 | ||
|
|
349b31104a | ||
|
|
a2bb45e974 | ||
|
|
e2287a42bc | ||
|
|
8afd914c6d | ||
|
|
475dd2e76a | ||
|
|
266b3a2ddf | ||
|
|
c2fdb399a7 | ||
|
|
7e0e7359c0 | ||
|
|
ceb910e78c | ||
|
|
7dbf32d0d7 | ||
|
|
20900dd12f | ||
|
|
10037c5133 | ||
|
|
d2defc8f47 | ||
|
|
0ce46fe7c8 | ||
|
|
65fe914fb8 | ||
|
|
b06b832447 | ||
|
|
8b890caa31 | ||
|
|
5aa52fc450 | ||
|
|
593dbe7556 | ||
|
|
8e33abaeab | ||
|
|
b9bb4adacd | ||
|
|
94d5fcb15a | ||
|
|
588d338342 | ||
|
|
4e40e8cb60 | ||
|
|
cc8eb05860 | ||
|
|
434283ed1a | ||
|
|
d28d7f732a | ||
|
|
4caf273d53 | ||
|
|
c7bd5cc0ba | ||
|
|
f3fa8db4cf | ||
|
|
4fc8452838 | ||
|
|
85d86620f7 | ||
|
|
10d8b4bfd7 | ||
|
|
22307ccabc | ||
|
|
5f02595ea4 | ||
|
|
9691649b65 | ||
|
|
b7c79974bb | ||
|
|
927ee79026 | ||
|
|
e7aa079982 | ||
|
|
e4f18770e0 | ||
|
|
bfc16ed2ec | ||
|
|
e24f9d263c | ||
|
|
480c8504a6 | ||
|
|
7c736579b7 | ||
|
|
7a8dbe1139 | ||
|
|
ef5b900657 | ||
|
|
4b0f3257dd | ||
|
|
6c97cd335b | ||
|
|
36f9631512 | ||
|
|
3a74d242f9 | ||
|
|
e59e57d2e4 | ||
|
|
f88f59afb8 | ||
|
|
43f24f4c01 | ||
|
|
2a88b60ff1 | ||
|
|
8e71f233da | ||
|
|
3f5cb55e73 | ||
|
|
a4220b99a6 | ||
|
|
4b9b4e3338 | ||
|
|
81b49b2dff | ||
|
|
d7f8324c3c | ||
|
|
6a5d8ba5d0 | ||
|
|
094eeb2673 | ||
|
|
fe47649a23 | ||
|
|
ab3fd2e849 | ||
|
|
c9ee3efc11 | ||
|
|
4abefc189c | ||
|
|
b9c078da20 | ||
|
|
a1be697a02 | ||
|
|
cd82740ade | ||
|
|
5de084557b | ||
|
|
82fde0ea51 | ||
|
|
2f40953e03 | ||
|
|
8ca82af4ab | ||
|
|
c467a07512 | ||
|
|
5582711680 | ||
|
|
d84d91ff35 | ||
|
|
822b19ac83 | ||
|
|
b3f6f56745 | ||
|
|
a5ac3e4e4b | ||
|
|
3ca4c7de96 | ||
|
|
ba97017380 | ||
|
|
9f3cdf8270 | ||
|
|
59b5644fb3 | ||
|
|
18bae7da2e | ||
|
|
c59204b94f | ||
|
|
3e13e10e03 | ||
|
|
2d1d6fb850 | ||
|
|
6550cdfbd0 | ||
|
|
551d53aa67 | ||
|
|
5122dc498d | ||
|
|
51729346bf | ||
|
|
297bc8553c | ||
|
|
e7d32fe376 | ||
|
|
790c614b7a | ||
|
|
d19a35485f | ||
|
|
5836d9a9a7 | ||
|
|
6f0fc965ab | ||
|
|
fae26369d4 | ||
|
|
3f3d8b0014 | ||
|
|
e969d97843 | ||
|
|
711ab99362 | ||
|
|
382e569f66 | ||
|
|
f25a543260 | ||
|
|
a4ae5ca997 | ||
|
|
f3eab445ee | ||
|
|
4bf6784d7d | ||
|
|
ca78e4c150 | ||
|
|
892fff03cc | ||
|
|
d58a18b8ed | ||
|
|
c2ceb9e085 | ||
|
|
7d6b313065 | ||
|
|
bd07d04670 | ||
|
|
3b981e22cc | ||
|
|
587360e760 | ||
|
|
3cababc83b | ||
|
|
fc072a0772 | ||
|
|
ad49846a48 | ||
|
|
1c3f0b1e19 | ||
|
|
21caf54543 | ||
|
|
b487c62130 | ||
|
|
b3ab89ac15 | ||
|
|
663d8f832f | ||
|
|
75a2dc5ff5 | ||
|
|
70fb1606ad | ||
|
|
f659d97504 | ||
|
|
be57b545b7 | ||
|
|
76df2d393b | ||
|
|
c1947d13cf | ||
|
|
fb8df75ac3 | ||
|
|
9e9e15bc87 | ||
|
|
2750c605c1 | ||
|
|
da8a0f25cc | ||
|
|
1f211dbe3e | ||
|
|
7030758da6 | ||
|
|
edc5dee226 | ||
|
|
ae88263f0f | ||
|
|
f5ddc51d85 | ||
|
|
969274ccc2 | ||
|
|
0e50a7d278 | ||
|
|
fab9e8f5ea | ||
|
|
79f18e7d87 | ||
|
|
70711022db | ||
|
|
18508f7453 | ||
|
|
6befe9e37c | ||
|
|
f578c4a792 | ||
|
|
4fa52fd98a | ||
|
|
ceeff6c723 | ||
|
|
31d328b272 | ||
|
|
7a92c3a046 | ||
|
|
b2fe1b2567 | ||
|
|
f1e80b800c | ||
|
|
9c93e79a66 | ||
|
|
b5e603bbc5 | ||
|
|
f48f306ab9 | ||
|
|
c2c6c9f491 | ||
|
|
fef3276f34 | ||
|
|
6a02c5812c | ||
|
|
c310080359 | ||
|
|
1a9c8b8d06 | ||
|
|
884109c6f4 | ||
|
|
3c4af280f0 | ||
|
|
3786322cf0 | ||
|
|
8eca101fd1 | ||
|
|
677e55df0f | ||
|
|
cca0222cf1 | ||
|
|
a18e172a96 | ||
|
|
06fe8a043f | ||
|
|
b21ca4ed4e | ||
|
|
bdbf36991d | ||
|
|
5041246c0e | ||
|
|
eac0a41ae1 | ||
|
|
843370b96f | ||
|
|
ca17b5aebd | ||
|
|
3a2286a1b8 | ||
|
|
434ff01f59 | ||
|
|
8c3c84c45e | ||
|
|
406d784f7a | ||
|
|
a7272466f7 | ||
|
|
c4afd72792 | ||
|
|
8c758e339c | ||
|
|
9e7034c6e2 | ||
|
|
b2241e991b | ||
|
|
732e8a813f | ||
|
|
ba1eb90212 | ||
|
|
903a6dc885 | ||
|
|
c49819e892 | ||
|
|
cb60a2c06e | ||
|
|
2e7050dbe2 | ||
|
|
721a850e21 | ||
|
|
7ef1d485fe | ||
|
|
14679f0bd4 | ||
|
|
0131526261 | ||
|
|
ed370667c8 | ||
|
|
c460602cbb | ||
|
|
4afa415bd9 | ||
|
|
78135103fb | ||
|
|
68b6be57f1 | ||
|
|
afd0730248 | ||
|
|
810e420510 | ||
|
|
f39e88cfa8 | ||
|
|
c0814934af | ||
|
|
0589022c76 | ||
|
|
f6bc73b749 | ||
|
|
a5ec5366c4 | ||
|
|
f9815fcdef | ||
|
|
a2f59049dc | ||
|
|
5cdd1498b4 | ||
|
|
3aa1d57b57 | ||
|
|
a995daa827 | ||
|
|
83b46f66f8 | ||
|
|
f0bd08ec11 | ||
|
|
4e082b9217 | ||
|
|
820896315d | ||
|
|
ed269b8831 | ||
|
|
355608b031 | ||
|
|
4a71638061 | ||
|
|
341ea5f367 | ||
|
|
112f71fb17 | ||
|
|
8c4846b68a | ||
|
|
3551bde012 | ||
|
|
2078255ec3 | ||
|
|
ecbb276805 | ||
|
|
c33602534e | ||
|
|
beeef28b1a | ||
|
|
03ab963d1a | ||
|
|
88192e8662 | ||
|
|
8ad85858b8 | ||
|
|
2ba2aff65e | ||
|
|
4737e09bcf | ||
|
|
14c38cdb63 | ||
|
|
81779e60bb | ||
|
|
49f7ce4f6d | ||
|
|
926cd1a953 | ||
|
|
c528ab1eaa | ||
|
|
5bda827143 | ||
|
|
d3e7d3d5e7 | ||
|
|
5de445c041 | ||
|
|
9f8c76b5b9 | ||
|
|
38d9802d12 | ||
|
|
b0190fd080 | ||
|
|
d8efd4fa73 | ||
|
|
6dfed8576e | ||
|
|
943fe9b4b0 | ||
|
|
f67cf17070 | ||
|
|
73e0f87eba | ||
|
|
bf2075cd0c | ||
|
|
db835fa0a1 | ||
|
|
325fcc25dd | ||
|
|
eb37d9c1fc | ||
|
|
df2c6df819 | ||
|
|
c3ebe7bd9e | ||
|
|
472631573e | ||
|
|
c0ac393297 | ||
|
|
da8408501c | ||
|
|
a3b7056cad | ||
|
|
a9a76241ac | ||
|
|
ccf78c40b1 | ||
|
|
0143eb6a53 | ||
|
|
6f40cdca65 | ||
|
|
9d85590421 | ||
|
|
0a14bbe78d | ||
|
|
119695bd08 | ||
|
|
744d7d789f | ||
|
|
eb410b4ee6 | ||
|
|
9a5fc6f932 | ||
|
|
d953c68ebb | ||
|
|
829f87bc6a | ||
|
|
f2fc7072b9 | ||
|
|
69ce8502a4 | ||
|
|
1da187a6e5 | ||
|
|
97131262ab | ||
|
|
32c8d02d62 | ||
|
|
ff096124c6 | ||
|
|
512b6e00d9 | ||
|
|
e8123b3d5e | ||
|
|
a1458e9c07 | ||
|
|
03bab835d9 | ||
|
|
aff56e69a9 | ||
|
|
a82ead0dc1 | ||
|
|
a9c650cd05 | ||
|
|
fd89da113d | ||
|
|
b2696b105a | ||
|
|
d7ed49f849 | ||
|
|
e4a4fcd26b | ||
|
|
cae153b3ac | ||
|
|
23f8e7ddc5 | ||
|
|
a37970facd | ||
|
|
a23173eeb2 | ||
|
|
9820899b9e | ||
|
|
ea438be5c1 | ||
|
|
831f783493 | ||
|
|
2478d7d925 | ||
|
|
1560f4ce03 | ||
|
|
d45505e135 | ||
|
|
62b492c727 | ||
|
|
41686980fd | ||
|
|
35bdd6f478 | ||
|
|
f1ac7c9f73 | ||
|
|
548ff299f4 | ||
|
|
8762a6fa66 | ||
|
|
74e7a283c0 | ||
|
|
dc8166384c | ||
|
|
0a9f9c0811 | ||
|
|
f412b4f96f | ||
|
|
3b486d3475 | ||
|
|
9191750b5b | ||
|
|
9c5f092b4f | ||
|
|
75485d53f6 | ||
|
|
2c176a234e | ||
|
|
5a0c3fd01e | ||
|
|
ed43b17201 | ||
|
|
c17123b631 | ||
|
|
c9b58136bf | ||
|
|
871c09c123 | ||
|
|
c97ad01bcb | ||
|
|
4566bd65c9 | ||
|
|
e0928d0991 | ||
|
|
2b251a2cee | ||
|
|
3e1486fc92 | ||
|
|
14aff89fb2 | ||
|
|
fcfd8d5f56 | ||
|
|
12e99489b2 | ||
|
|
9767fd8732 | ||
|
|
e46ef0ae19 | ||
|
|
55827a9493 | ||
|
|
6c0996eb9c | ||
|
|
cd6d8f2ab6 | ||
|
|
771bfe3b18 | ||
|
|
bda6df61a0 | ||
|
|
8cb9b2ba4e | ||
|
|
7e6d5292f7 | ||
|
|
8df2444ec4 | ||
|
|
4ad5c4757c | ||
|
|
54b55bb39c | ||
|
|
1ae851878a | ||
|
|
0ffef758ae | ||
|
|
3418faf054 | ||
|
|
10777d3421 | ||
|
|
f950c29035 | ||
|
|
88f4598ea2 | ||
|
|
76a03b0709 | ||
|
|
70e379cc46 | ||
|
|
25f6445c50 | ||
|
|
b5013ba54b | ||
|
|
815be12649 | ||
|
|
88c203b686 | ||
|
|
aee339f401 | ||
|
|
d5c626667e | ||
|
|
725957de6e | ||
|
|
1a749a6b43 | ||
|
|
ff8f3673eb | ||
|
|
d77e5a9308 | ||
|
|
35307c0585 | ||
|
|
bbdff82aee | ||
|
|
3a1caca907 | ||
|
|
5636626da1 | ||
|
|
f5a4e11894 | ||
|
|
66b183e1ba | ||
|
|
900b4cdff3 | ||
|
|
e03df80a09 | ||
|
|
da37989960 | ||
|
|
10bacf0996 | ||
|
|
f7e6236fe8 | ||
|
|
d700da8cb8 | ||
|
|
713a6910d4 | ||
|
|
498a9435de | ||
|
|
7669550ae2 | ||
|
|
0a3faa60f7 | ||
|
|
2e5f3899d1 | ||
|
|
ccc08d08f6 | ||
|
|
60b89abd9c | ||
|
|
ec2845eefa | ||
|
|
ca18a80e3e | ||
|
|
8d5353831e | ||
|
|
f9cbc69ce1 | ||
|
|
175db78f35 | ||
|
|
8ba5b3cb76 | ||
|
|
afa37e6855 | ||
|
|
5b8410f868 | ||
|
|
8632e6b4e0 | ||
|
|
f03fb64e51 | ||
|
|
4088347901 | ||
|
|
614a30a508 | ||
|
|
cb410927d1 | ||
|
|
f44756f347 | ||
|
|
e3a8829d67 | ||
|
|
9028d1f132 | ||
|
|
a6ca60203f | ||
|
|
629e6a3675 | ||
|
|
c4ab4855b7 | ||
|
|
8bee64d1b7 | ||
|
|
e9bbbbdf3e | ||
|
|
9a4645fc7f | ||
|
|
5fc2f8f6c0 | ||
|
|
86cc2aab71 | ||
|
|
5b56103c69 | ||
|
|
c8821fc049 | ||
|
|
1bcee7ef33 | ||
|
|
454dbbe33e | ||
|
|
aa4c669ea0 | ||
|
|
60762d5018 | ||
|
|
222d9e6908 | ||
|
|
9a019e2342 | ||
|
|
73c9a1f965 | ||
|
|
0fbf7bcc99 | ||
|
|
2bcb21f350 | ||
|
|
d6a7b0f518 | ||
|
|
b9428b7db0 | ||
|
|
95373ddab5 | ||
|
|
6e66b60b63 | ||
|
|
79552872f3 | ||
|
|
c546f47cc0 | ||
|
|
0dbf08f6d5 | ||
|
|
7481facd73 | ||
|
|
226b4ed586 | ||
|
|
36461b69d7 | ||
|
|
f94865c4ce | ||
|
|
dc99282f79 | ||
|
|
89d8f2a0bc | ||
|
|
99aebcafac | ||
|
|
cd00a18c3a | ||
|
|
e293e0b5ab | ||
|
|
f49f615ef6 | ||
|
|
216eadbcbe | ||
|
|
1e83489691 | ||
|
|
5eee70cf37 | ||
|
|
ce3d79550d | ||
|
|
c697ef05bb | ||
|
|
7a06d276c2 | ||
|
|
a2e4af1626 | ||
|
|
c34664120b | ||
|
|
a34fb0a6a7 | ||
|
|
acb209aa11 | ||
|
|
6df632218e |
3
.gitattributes
vendored
3
.gitattributes
vendored
@@ -1,7 +1,10 @@
|
||||
.* export-ignore
|
||||
/CONTRIBUTING.md export-ignore
|
||||
/Dockerfile export-ignore
|
||||
/ISSUE_TEMPLATE.md export-ignore
|
||||
/Makefile export-ignore
|
||||
/PULL_REQUEST_TEMPLATE.md export-ignore
|
||||
/README.md export-ignore
|
||||
/custom-checks export-ignore
|
||||
/img export-ignore
|
||||
/test export-ignore
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,3 +2,4 @@
|
||||
/doc/tags
|
||||
.*
|
||||
*.obj
|
||||
tags
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
sudo: required
|
||||
services:
|
||||
- docker
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
language: python
|
||||
script: |
|
||||
make test
|
||||
|
||||
170
CONTRIBUTING.md
170
CONTRIBUTING.md
@@ -1,25 +1,66 @@
|
||||
# Contributing to ALE
|
||||
|
||||
1. [Guidelines](#guidelines)
|
||||
2. [Creating Pull Requests](#pull-requests)
|
||||
3. [Creating Pull Requests](#compiling)
|
||||
2. [Creating Issues](#issues)
|
||||
3. [Creating Pull Requests](#pull-requests)
|
||||
1. [Adding a New Linter](#adding-a-new-linter)
|
||||
2. [Adding New Options](#adding-new-options)
|
||||
4. [Writing Documentation](#writing-documentation)
|
||||
1. [Documenting New Linters](#documenting-new-linters)
|
||||
2. [Editing the Online Documentation](#editing-online-documentation)
|
||||
3. [Documenting Linter Options](#documenting-linter-options)
|
||||
5. [In Case of Busses](#in-case-of-busses)
|
||||
|
||||
<a name="guidelines"></a>
|
||||
|
||||
# 1. Guidelines
|
||||
## 1. Guidelines
|
||||
|
||||
Have fun, and work on whatever floats your boat. Take It Easy :tm:.
|
||||
|
||||
Don't forget to **write documentation** for whatever it is you are doing.
|
||||
See the ["Writing Documentation"](#writing-documentation) section.
|
||||
|
||||
Remember to write Vader tests for most of the code you write. You can look at
|
||||
existing Vader tests in the `test` directory for examples.
|
||||
|
||||
When writing code, follow the [Google Vimscript Style
|
||||
Guide](https://google.github.io/styleguide/vimscriptguide.xml), and run `vint
|
||||
-s` on your files to check for most of what the guide mentions and more. If you
|
||||
install this plugin (ALE) and install [Vint](https://github.com/Kuniwak/vint), it
|
||||
will check your code while you type.
|
||||
|
||||
<a name="issues"></a>
|
||||
|
||||
## 2. Creating Issues
|
||||
|
||||
Before creating any issues, please look through the current list of issues and
|
||||
pull requests, and ensure that the issue hasn't already been reported. If an
|
||||
issue has already been reported, but you have some new insight, please add
|
||||
a comment to the existing issue.
|
||||
|
||||
Please read the FAQ in the README before creating any issues. A feature
|
||||
you desire may already exist and be documented, or the FAQ might explain
|
||||
how to solve a problem you have already.
|
||||
|
||||
Please try and describe any issues reported with as much detail as you can
|
||||
provide about your Vim version, the linter you were trying to run, your
|
||||
operating system, or any other information you think might be helpful.
|
||||
|
||||
Please describe your issue in clear, grammatically correct, and easy to
|
||||
understand English. You are more likely to see an issue resolved if others
|
||||
can understand you.
|
||||
|
||||
<a name="pull-requests"></a>
|
||||
|
||||
# 2. Creating Pull Requests
|
||||
## 3. Creating Pull Requests
|
||||
|
||||
For code you write, make sure to credit yourself at the top of files you add, and probably those you modify. You can write
|
||||
some comments at the top of your VIM files.
|
||||
For code you write, make sure to credit yourself at the top of files you add,
|
||||
and probably those you modify. You can write some comments at the top of your
|
||||
VIM files.
|
||||
|
||||
```vim
|
||||
" Author: John Smith <john.smith@gmail.com>
|
||||
" Description: This file adds support for awesomelinter to the best language ever.
|
||||
" Description: This file adds support for awesomelinter for the best language ever.
|
||||
```
|
||||
|
||||
If you want to credit multiple authors, you can comma separate them.
|
||||
@@ -28,34 +69,105 @@ If you want to credit multiple authors, you can comma separate them.
|
||||
" Author: John Smith <john.smith@gmail.com>, Jane Doe <https://jane-doe.info>
|
||||
```
|
||||
|
||||
# 2.1. Adding a New Linter
|
||||
<a name="adding-a-new-linter"></a>
|
||||
|
||||
If you add a new linter, look for existing handlers first in the [handlers.vim](plugin/ale/handlers.vim) file. One of the handlers
|
||||
there may already be able to handle your lines of output. If you find that your new linter replicates an existing error handler,
|
||||
consider pulling it up into the [handlers.vim](plugin/ale/handlers.vim) file, and use the generic handler in both places.
|
||||
### 3.i. Adding a New Linter
|
||||
|
||||
When you add a linter, make sure the language for the linter and the linter itself are present in the table in the
|
||||
[README.md](README.md) file and in the Vim [help file](doc/ale.txt). The programs and linters are sorted alphabetically in the
|
||||
table and list.
|
||||
If you add a new linter, look for existing handlers first in the
|
||||
[handlers.vim](autoload/ale/handlers.vim) file. One of the handlers there may
|
||||
already be able to handle your lines of output. If you find that your new
|
||||
linter replicates an existing error handler, consider pulling it up into the
|
||||
[handlers.vim](autoload/ale/handlers.vim) file, and use the generic handler in
|
||||
both places.
|
||||
|
||||
# 2.2. Adding New Options
|
||||
When you add a linter, make sure the language for the linter and the linter
|
||||
itself are present in the table in the [README.md](README.md) file and in the
|
||||
Vim [help file](doc/ale.txt). The programs and linters should be sorted
|
||||
alphabetically in the table and list.
|
||||
|
||||
If you add new options to the plugin, make sure to document those new options in the [README.md](README.md) file, and also
|
||||
in the [help file](doc/ale.txt). Follow the format of other options in each. Global options should appear in the README
|
||||
file, and in the relevant section in the help file, and options specific to a particular linter should go in the section
|
||||
for that linter.
|
||||
<a name="adding-new-options"></a>
|
||||
|
||||
<a name="compiling"></a>
|
||||
### 3.ii. Adding New Options
|
||||
|
||||
# 3. Compiling the Windows stdin wrapper
|
||||
If you add new options to the plugin, make sure to document those new options
|
||||
in the [README.md](README.md) file, and also in the [help file](doc/ale.txt).
|
||||
Follow the format of other options in each. Global options should appear in the
|
||||
README file, and in the relevant section in the help file. Options specific
|
||||
to a particular linter should appear in the section for that linter.
|
||||
|
||||
To compile the stdin wrapper program for Windows, when updating the D program, you will need to compile the program with
|
||||
[LDC](https://github.com/ldc-developers/ldc) in release mode. Download and install the Community edition of Visual Studio
|
||||
from [the Visual Studio website](https://www.visualstudio.com/downloads/) first before installing LDC. LDC typically comes in
|
||||
a ZIP you can just extract somewhere.
|
||||
Linter options for customizing general argument lists should be named
|
||||
`g:ale_<filetype>_<linter>_options`, so that all linters can have similar
|
||||
global variable names.
|
||||
|
||||
Make sure to compile with the 32-bit architecture flag, otherwise the EXE will not run on 32-bit machines.
|
||||
Any options for linters should be set to some default value so it is always
|
||||
easy to see what the default is with `:echo g:ale...`.
|
||||
|
||||
```
|
||||
ldc2 -m32 -Oz -release stdin_wrapper.d -of=stdin-wrapper.exe
|
||||
```
|
||||
<a name="writing-documentation"></a>
|
||||
|
||||
## 4. Writing Documentation
|
||||
|
||||
If you are adding new linters, changing the API, adding new options, etc., you
|
||||
_must_ write some documentation describing it in the `doc/ale.txt` file. New
|
||||
linters _must_ be added to the `README.md` file too, so other users can get a
|
||||
quick overview of the supported tools.
|
||||
|
||||
<a name="documenting-new-linters"></a>
|
||||
|
||||
### 4.i Documenting New Linters
|
||||
|
||||
If you add a new linter to the project, edit the table in the `README.md` file,
|
||||
and edit the list of linters at the top of the `doc/ale.txt` file. The linters
|
||||
should be sorted vertically in lexicographic (alphabetical) order by the
|
||||
programming language name or filetype, and the tools for each language should
|
||||
be sorted in lexicographic order horizontally. Sorting in this manner is a fair
|
||||
manner of presenting all of the information in an easy to scan way, without
|
||||
giving some unfair preference to any particular tool or language.
|
||||
|
||||
<a name="editing-online-documentation"></a>
|
||||
|
||||
### 4.ii Editing the Online Documentation
|
||||
|
||||
The "online documentation" file used for this project lives in `doc/ale.txt`.
|
||||
This is the file used for generating `:help` text inside Vim itself. There are
|
||||
some guidlines to follow for this file.
|
||||
|
||||
1. Keep all text within a column size of 79 characters, inclusive.
|
||||
2. Open a section with 79 `=` or `-` characters, for headings and subheadings.
|
||||
3. Sections should have a _single_ blank line before or after.
|
||||
4. Between descriptions of variables/functions/commands, use _two_ blank lines.
|
||||
5. Up-indent the description of a variable/function/command by two spaces.
|
||||
6. Place tags at the ends of lines, with the final characters on column 79.
|
||||
All of the tags should line up perfectly on the same column as you scan
|
||||
down through the document.
|
||||
7. Keep the table of contents balanced so the longest tag link ends on column
|
||||
79, and so all links line up perfectly on their first character, on the
|
||||
left.
|
||||
|
||||
<a name="documenting-linter-options"></a>
|
||||
|
||||
### 4.iii Documenting Linter Options
|
||||
|
||||
For documenting new linter options, please add a new sub-section under the
|
||||
"Linter Specific Options" section describing all of the global options added
|
||||
for each linter, and what the default values of the options are. All global
|
||||
options for linters should be set to some default value. This will allow users
|
||||
to look up the default value easily by typing `:echo g:ale_...`.
|
||||
|
||||
<a name="in-case-of-busses"></a>
|
||||
|
||||
## 5. In Case of Busses
|
||||
|
||||
Should the principal author of the ALE project and all collaborators with the
|
||||
required access needed to properly administrate the project on GitHub or any
|
||||
other website either perish or disappear, whether by tragic traffic accident
|
||||
or government adduction, etc., action should be taken to ensure that the
|
||||
project continues. If no one is left to administer the project where it is
|
||||
hosted, please fork the project and nominate someone capable to administer it.
|
||||
Preferably, in such an event, a single fork of the project will replace the
|
||||
original, and life will go on, except the life of whoever vanished, because
|
||||
then they will probably be dead.
|
||||
|
||||
Should w0rp suddenly disappear, then he was probably killed in a traffic
|
||||
accident, or the government finally decided to kill him and make it look like
|
||||
suicide. In the latter event, please subvert said government and restore
|
||||
order to the universe, and ensure peace for mankind.
|
||||
|
||||
@@ -3,11 +3,16 @@ FROM tweekmonster/vim-testbed:latest
|
||||
RUN install_vim -tag v8.0.0000 -build \
|
||||
-tag v8.0.0027 -build
|
||||
|
||||
# the clang package includes clang-tidy
|
||||
ENV PACKAGES="\
|
||||
bash \
|
||||
git \
|
||||
python=2.7.12-r0 \
|
||||
py-pip=8.1.2-r0 \
|
||||
python \
|
||||
py-pip \
|
||||
nodejs \
|
||||
gcc \
|
||||
g++ \
|
||||
clang \
|
||||
"
|
||||
RUN apk --update add $PACKAGES && \
|
||||
rm -rf /var/cache/apk/* /tmp/* /var/tmp/*
|
||||
|
||||
12
ISSUE_TEMPLATE.md
Normal file
12
ISSUE_TEMPLATE.md
Normal file
@@ -0,0 +1,12 @@
|
||||
<!--
|
||||
For bugs, paste output from your clipboard after running :ALEInfoToClipboard
|
||||
here. If that doesn't work for some reason, try running :ALEInfo and copying
|
||||
the output from that here instead. If everything is broken, run around in
|
||||
circles and scream.
|
||||
|
||||
If you are experiencing a bug where ALE is not correctly parsing the output of
|
||||
commands, set g:ale_history_log_output to 1, and run ALE again, and then
|
||||
:ALEInfo should include the full output of each command which ran.
|
||||
|
||||
Whatever the case, describe the your issue here.
|
||||
-->
|
||||
28
Makefile
28
Makefile
@@ -1,10 +1,20 @@
|
||||
IMAGE ?= w0rp/ale
|
||||
CURRENT_IMAGE_ID = 107e4efc4267
|
||||
SHELL := /usr/bin/env bash
|
||||
IMAGE ?= w0rp/ale:30a9967dbdb1
|
||||
CURRENT_IMAGE_ID = 30a9967dbdb1
|
||||
DOCKER_FLAGS = --rm -v $(PWD):/testplugin -v $(PWD)/test:/home "$(IMAGE)"
|
||||
tests = test/*.vader test/*/*.vader test/*/*/*.vader test/*/*/*/*.vader
|
||||
|
||||
test-setup:
|
||||
docker images -q w0rp/ale | grep ^$(CURRENT_IMAGE_ID) > /dev/null || \
|
||||
docker pull $(IMAGE)
|
||||
docker pull w0rp/ale
|
||||
|
||||
vader: test-setup
|
||||
@:; \
|
||||
vims=$$(docker run --rm $(IMAGE) ls /vim-build/bin | grep -E '^n?vim'); \
|
||||
if [ -z "$$vims" ]; then echo "No Vims found!"; exit 1; fi; \
|
||||
for vim in $$vims; do \
|
||||
docker run -a stderr $(DOCKER_FLAGS) $$vim '+Vader! $(tests)'; \
|
||||
done
|
||||
|
||||
test: test-setup
|
||||
@:; \
|
||||
@@ -17,7 +27,7 @@ test: test-setup
|
||||
echo "Running tests for $$vim"; \
|
||||
echo '========================================'; \
|
||||
echo; \
|
||||
docker run -a stderr $(DOCKER_FLAGS) $$vim '+Vader! test/*' || EXIT=$$?; \
|
||||
docker run -a stderr $(DOCKER_FLAGS) $$vim '+Vader! $(tests)' || EXIT=$$?; \
|
||||
done; \
|
||||
echo; \
|
||||
echo '========================================'; \
|
||||
@@ -25,8 +35,18 @@ test: test-setup
|
||||
echo '========================================'; \
|
||||
echo 'Vint warnings/errors follow:'; \
|
||||
echo; \
|
||||
set -o pipefail; \
|
||||
docker run -a stdout $(DOCKER_FLAGS) vint -s /testplugin | sed s:^/testplugin/:: || EXIT=$$?; \
|
||||
set +o pipefail; \
|
||||
echo; \
|
||||
echo '========================================'; \
|
||||
echo 'Running custom checks'; \
|
||||
echo '========================================'; \
|
||||
echo 'Custom warnings/errors follow:'; \
|
||||
echo; \
|
||||
set -o pipefail; \
|
||||
docker run -v $(PWD):/testplugin "$(IMAGE)" /testplugin/custom-checks /testplugin | sed s:^/testplugin/:: || EXIT=$$?; \
|
||||
set +o pipefail; \
|
||||
echo; \
|
||||
exit $$EXIT;
|
||||
|
||||
|
||||
17
PULL_REQUEST_TEMPLATE.md
Normal file
17
PULL_REQUEST_TEMPLATE.md
Normal file
@@ -0,0 +1,17 @@
|
||||
<!--
|
||||
When creating new pull requests, please consider the following.
|
||||
|
||||
* Read the Contributing guide linked above first.
|
||||
* If you are adding a new linter, remember to update the README.md file and
|
||||
doc/ale.txt first.
|
||||
* If you add or modify a function for converting error lines into loclist items
|
||||
that ALE can work with, please add Vader tests for them. Look at existing
|
||||
tests in the test/handler directory, etc.
|
||||
* If you add or modify a function for computing a command line string for
|
||||
running a command, please add Vader tests for that.
|
||||
* Generally try and cover anything with Vader tests, although some things just
|
||||
can't be tested with Vader, or at least they can be hard to test. Consider
|
||||
breaking up your code so that some parts can be tested, and generally open up
|
||||
a discussion about it.
|
||||
* Have fun!
|
||||
-->
|
||||
422
README.md
422
README.md
@@ -15,7 +15,31 @@ back to a filesystem.
|
||||
|
||||
In other words, this plugin allows you to lint while you type.
|
||||
|
||||
## Supported Languages and Tools
|
||||
## Table of Contents
|
||||
|
||||
1. [Supported Languages and Tools](#supported-languages)
|
||||
2. [Usage](#usage)
|
||||
3. [Installation](#installation)
|
||||
1. [Installation with Pathogen](#installation-with-pathogen)
|
||||
2. [Installation with Vundle](#installation-with-vundle)
|
||||
3. [Manual Installation](#manual-installation)
|
||||
4. [Contributing](#contributing)
|
||||
5. [FAQ](#faq)
|
||||
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)
|
||||
|
||||
<a name="supported-languages"></a>
|
||||
|
||||
## 1. Supported Languages and Tools
|
||||
|
||||
This plugin supports the following languages and tools. All available
|
||||
tools will be run in combination, so they can be complementary.
|
||||
@@ -28,44 +52,76 @@ name. That seems to be the fairest way to arrange this table.
|
||||
|
||||
| Language | Tools |
|
||||
| -------- | ----- |
|
||||
| ASM | [gcc](https://gcc.gnu.org) |
|
||||
| Ansible | [ansible-lint](https://github.com/willthames/ansible-lint) |
|
||||
| AsciiDoc | [proselint](http://proselint.com/)|
|
||||
| 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 | [gcc](https://gcc.gnu.org/) |
|
||||
| C++ (filetype cpp)| [gcc](https://gcc.gnu.org/) |
|
||||
| C | [cppcheck](http://cppcheck.sourceforge.net), [gcc](https://gcc.gnu.org/), [clang](http://clang.llvm.org/)|
|
||||
| C++ (filetype cpp) | [clang](http://clang.llvm.org/), [clangtidy](http://clang.llvm.org/extra/clang-tidy/), [cppcheck](http://cppcheck.sourceforge.net), [gcc](https://gcc.gnu.org/)|
|
||||
| C# | [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) |
|
||||
| Chef | [foodcritic](http://www.foodcritic.io/) |
|
||||
| CMake | [cmakelint](https://github.com/richq/cmake-lint) |
|
||||
| CoffeeScript | [coffee](http://coffeescript.org/), [coffeelint](https://www.npmjs.com/package/coffeelint) |
|
||||
| CSS | [csslint](http://csslint.net/) |
|
||||
| Crystal | [crystal](https://crystal-lang.org/) |
|
||||
| CSS | [csslint](http://csslint.net/), [stylelint](https://github.com/stylelint/stylelint) |
|
||||
| Cython (pyrex filetype) | [cython](http://cython.org/) |
|
||||
| D | [dmd](https://dlang.org/dmd-linux.html)^ |
|
||||
| Elixir | [credo](https://github.com/rrrene/credo) |
|
||||
| D | [dmd](https://dlang.org/dmd-linux.html) |
|
||||
| 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) |
|
||||
| Erb | [erb](https://github.com/jeremyevans/erubi) |
|
||||
| Erlang | [erlc](http://erlang.org/doc/man/erlc.html) |
|
||||
| Fortran | [gcc](https://gcc.gnu.org/) |
|
||||
| Go | [gofmt -e](https://golang.org/cmd/gofmt/), [go vet](https://golang.org/cmd/vet/), [golint](https://godoc.org/github.com/golang/lint) |
|
||||
| Haskell | [ghc](https://www.haskell.org/ghc/), [hlint](https://hackage.haskell.org/package/hlint) |
|
||||
| HTML | [HTMLHint](http://htmlhint.com/), [tidy](http://www.html-tidy.org/) |
|
||||
| JavaScript | [eslint](http://eslint.org/), [jscs](http://jscs.info/), [jshint](http://jshint.com/) |
|
||||
| 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) |
|
||||
| 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/), [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/) |
|
||||
| Java | [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/), [xo](https://github.com/sindresorhus/xo)
|
||||
| JSON | [jsonlint](http://zaa.ch/jsonlint/) |
|
||||
| Kotlin | [kotlinc](https://kotlinlang.org) 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/) |
|
||||
| Lua | [luacheck](https://github.com/mpeterv/luacheck) |
|
||||
| Markdown | [mdl](https://github.com/mivok/markdownlint), [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale) |
|
||||
| MATLAB | [mlint](https://www.mathworks.com/help/matlab/ref/mlint.html) |
|
||||
| Nim | [nim](https://nim-lang.org/docs/nimc.html) |
|
||||
| nix | [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate) |
|
||||
| nroff | [proselint](http://proselint.com/)|
|
||||
| OCaml | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-integration-ocaml-merlin` for configuration instructions
|
||||
| Perl | [perl -c](https://perl.org/), [perl-critic](https://metacpan.org/pod/Perl::Critic) |
|
||||
| PHP | [php -l](https://secure.php.net/), [phpcs](https://github.com/squizlabs/PHP_CodeSniffer) |
|
||||
| PHP | [hack](http://hacklang.org/), [php -l](https://secure.php.net/), [phpcs](https://github.com/squizlabs/PHP_CodeSniffer), [phpmd](https://phpmd.org) |
|
||||
| Pod | [proselint](http://proselint.com/)|
|
||||
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) |
|
||||
| Python | [flake8](http://flake8.pycqa.org/en/latest/) |
|
||||
| Ruby | [rubocop](https://github.com/bbatsov/rubocop) |
|
||||
| SASS | [sass-lint](https://www.npmjs.com/package/sass-lint) |
|
||||
| SCSS | [sass-lint](https://www.npmjs.com/package/sass-lint), [scss-lint](https://github.com/brigade/scss-lint) |
|
||||
| Puppet | [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) |
|
||||
| Python | [flake8](http://flake8.pycqa.org/en/latest/), [mypy](http://mypy-lang.org/), [pylint](https://www.pylint.org/) |
|
||||
| ReasonML | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-integration-reason-merlin` for configuration instructions
|
||||
| reStructuredText | [proselint](http://proselint.com/)|
|
||||
| RPM spec | [rpmlint](https://github.com/rpm-software-management/rpmlint) (disabled by default; see `:help ale-integration-spec`) |
|
||||
| Ruby | [brakeman](http://brakemanscanner.org/), [reek](https://github.com/troessner/reek), [rubocop](https://github.com/bbatsov/rubocop), [ruby](https://www.ruby-lang.org) |
|
||||
| Rust | [rustc](https://www.rust-lang.org/), cargo (see `:help ale-integration-rust` for configuration instructions) |
|
||||
| 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) |
|
||||
| Scala | [scalac](http://scala-lang.org) |
|
||||
| TypeScript | [tslint](https://github.com/palantir/tslint) |
|
||||
| Slim | [slim-lint](https://github.com/sds/slim-lint)
|
||||
| SML | [smlnj](http://www.smlnj.org/) |
|
||||
| SQL | [sqlint](https://github.com/purcell/sqlint) |
|
||||
| Swift | [swiftlint](https://swift.org/) |
|
||||
| Texinfo | [proselint](http://proselint.com/)|
|
||||
| Text^ | [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale) |
|
||||
| TypeScript | [tslint](https://github.com/palantir/tslint), 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/)|
|
||||
| YAML | [yamllint](https://yamllint.readthedocs.io/) |
|
||||
|
||||
*^ Supported only on Unix machines via a wrapper script.*
|
||||
* *^ No linters for text or Vim help filetypes are enabled by default.*
|
||||
|
||||
If you would like to see support for more languages and tools, please
|
||||
[create an issue](https://github.com/w0rp/ale/issues)
|
||||
or [create a pull request](https://github.com/w0rp/ale/pulls).
|
||||
If your tool can read from stdin or you have code to suggest which is good,
|
||||
support can be happily added for more tools.
|
||||
<a name="usage"></a>
|
||||
|
||||
## Usage
|
||||
## 2. Usage
|
||||
|
||||
Once this plugin is installed, while editing your files in supported
|
||||
languages and tools which have been correctly installed,
|
||||
@@ -74,32 +130,107 @@ programs for checking the syntax and semantics of your programs. By default,
|
||||
linters will be re-run in the background to check your syntax when you open
|
||||
new buffers or as you make edits to your files.
|
||||
|
||||
### Options
|
||||
The behaviour of linting can be configured with a variety of options,
|
||||
documented in [the Vim help file](doc/ale.txt). For more information on the
|
||||
options ALE offers, consult `:help ale-options` for global options and `:help
|
||||
ale-linter-options` for options specified to particular linters.
|
||||
|
||||
A full list of options supported for configuring this plugin in your
|
||||
vimrc file for all given linters is as follows:
|
||||
<a name="installation"></a>
|
||||
|
||||
| Option | Description | Default |
|
||||
| ------ | ----------- | ------- |
|
||||
| `g:ale_echo_cursor` | echo errors when the cursor is over them | `1` |
|
||||
| `g:ale_echo_msg_format` | string format to use for the echoed message | `'%s'` |
|
||||
| `g:ale_echo_msg_error_str` | string used for error severity in echoed message | `'Error'` |
|
||||
| `g:ale_echo_msg_warning_str` | string used for warning severity in echoed message | `'Warning'` |
|
||||
| `g:ale_lint_delay` | milliseconds to wait before linting | `200` |
|
||||
| `g:ale_linters` | a dictionary of linters to whitelist | _not set_ |
|
||||
| `g:ale_lint_on_enter` | lint when opening a file | `1` |
|
||||
| `g:ale_lint_on_save` | lint when saving a file | `0` |
|
||||
| `g:ale_lint_on_text_changed` | lint while typing | `1` |
|
||||
| `g:ale_set_loclist` | set the loclist with errors | `1` |
|
||||
| `g:ale_set_signs` | set gutter signs with error markers | `has('signs')` |
|
||||
| `g:ale_sign_column_always` | always show the sign gutter | `0` |
|
||||
| `g:ale_sign_error` | the text to use for errors in the gutter | `'>>'` |
|
||||
| `g:ale_sign_offset` | an offset for sign ids | `1000000` |
|
||||
| `g:ale_sign_warning` | the text to use for warnings in the gutter | `'--'` |
|
||||
| `g:ale_statusline_format` | string format to use in statusline flag | `['%d error(s)', '%d warning(s)', 'OK']` |
|
||||
| `g:ale_warn_about_trailing_whitespace` | enable trailing whitespace warnings for some linters | `1` |
|
||||
## 3. Installation
|
||||
|
||||
### Selecting Particular Linters
|
||||
To install this plugin, you should use one of the following methods.
|
||||
For Windows users, replace usage of the Unix `~/.vim` directory with
|
||||
`%USERPROFILE%\_vim`, or another directory if you have configured
|
||||
Vim differently. On Windows, your `~/.vimrc` file will be similarly
|
||||
stored in `%USERPROFILE%\_vimrc`.
|
||||
|
||||
<a name="installation-with-pathogen"></a>
|
||||
|
||||
### 3.i. Installation with Pathogen
|
||||
|
||||
To install this module with [Pathogen](https://github.com/tpope/vim-pathogen),
|
||||
you should clone this repository to your bundle directory, and ensure
|
||||
you have the line `execute pathogen#infect()` in your `~/.vimrc` file.
|
||||
You can run the following commands in your terminal to do so:
|
||||
|
||||
```bash
|
||||
cd ~/.vim/bundle
|
||||
git clone https://github.com/w0rp/ale.git
|
||||
```
|
||||
|
||||
<a name="installation-with-vundle"></a>
|
||||
|
||||
### 3.ii. Installation with Vundle
|
||||
|
||||
You can install this plugin using [Vundle](https://github.com/VundleVim/Vundle.vim)
|
||||
by using the path on GitHub for this repository.
|
||||
|
||||
```vim
|
||||
Plugin 'w0rp/ale'
|
||||
```
|
||||
|
||||
See the Vundle documentation for more information.
|
||||
|
||||
<a name="manual-installation"></a>
|
||||
|
||||
### 3.iii. Manual Installation
|
||||
|
||||
For installation without a package manager, you can clone this git repository
|
||||
into a bundle directory as with pathogen, and add the repository to your
|
||||
runtime path yourself. First clone the repository.
|
||||
|
||||
```bash
|
||||
cd ~/.vim/bundle
|
||||
git clone https://github.com/w0rp/ale.git
|
||||
```
|
||||
|
||||
Then, modify your `~/.vimrc` file to add this plugin to your runtime path.
|
||||
|
||||
```vim
|
||||
set nocompatible
|
||||
filetype off
|
||||
|
||||
let &runtimepath.=',~/.vim/bundle/ale'
|
||||
|
||||
filetype plugin on
|
||||
```
|
||||
|
||||
You can add the following line to generate documentation tags automatically,
|
||||
if you don't have something similar already, so you can use the `:help` command
|
||||
to consult ALE's online documentation:
|
||||
|
||||
```vim
|
||||
silent! helptags ALL
|
||||
```
|
||||
|
||||
Because the author of this plugin is a weird nerd, this is his preferred
|
||||
installation method.
|
||||
|
||||
<a name="contributing"></a>
|
||||
|
||||
## 4. Contributing
|
||||
|
||||
If you would like to see support for more languages and tools, please
|
||||
[create an issue](https://github.com/w0rp/ale/issues)
|
||||
or [create a pull request](https://github.com/w0rp/ale/pulls).
|
||||
If your tool can read from stdin or you have code to suggest which is good,
|
||||
support can be happily added for it.
|
||||
|
||||
If you are interested in the general direction of the project, check out the
|
||||
[wiki home page](https://github.com/w0rp/ale/wiki). The wiki includes a
|
||||
Roadmap for the future, and more.
|
||||
|
||||
If you'd liked to discuss the project more directly, check out the `#vim-ale` channel
|
||||
on Freenode. Web chat is available [here](https://webchat.freenode.net/?channels=vim-ale).
|
||||
|
||||
<a name="faq"></a>
|
||||
|
||||
## 5. FAQ
|
||||
|
||||
<a name="faq-disable-linters"></a>
|
||||
|
||||
### 5.i. How do I disable particular linters?
|
||||
|
||||
By default, all available tools for all supported languages will be run.
|
||||
If you want to only select a subset of the tools, simply create a
|
||||
@@ -121,15 +252,20 @@ This plugin will look for linters in the [`ale_linters`](ale_linters) directory.
|
||||
Each directory within corresponds to a particular filetype in Vim, and each file
|
||||
in each directory corresponds to the name of a particular linter.
|
||||
|
||||
### Always showing gutter
|
||||
<a name="faq-keep-signs"></a>
|
||||
|
||||
You can keep the sign gutter open at all times by setting the `g:ale_sign_column_always` to 1
|
||||
### 5.ii. How can I keep the sign gutter open?
|
||||
|
||||
You can keep the sign gutter open at all times by setting the
|
||||
`g:ale_sign_column_always` to 1
|
||||
|
||||
```vim
|
||||
let g:ale_sign_column_always = 1
|
||||
```
|
||||
|
||||
### Customize signs
|
||||
<a name="faq-change-signs"></a>
|
||||
|
||||
### 5.iii. How can I change the signs ALE uses?
|
||||
|
||||
Use these options to specify what text should be used for signs:
|
||||
|
||||
@@ -138,7 +274,18 @@ let g:ale_sign_error = '>>'
|
||||
let g:ale_sign_warning = '--'
|
||||
```
|
||||
|
||||
### Statusline
|
||||
ALE sets some background colors automatically for warnings and errors
|
||||
in the sign gutter, with the names `ALEErrorSign` and `ALEWarningSign`.
|
||||
These colors can be customised, or even removed completely:
|
||||
|
||||
```vim
|
||||
highlight clear ALEErrorSign
|
||||
highlight clear ALEWarningSign
|
||||
```
|
||||
|
||||
<a name="faq-statusline"></a>
|
||||
|
||||
### 5.iv. How can I show errors or warnings in my statusline?
|
||||
|
||||
You can use `ALEGetStatusLine()` to integrate ALE into vim statusline.
|
||||
To enable it, you should have in your `statusline` settings
|
||||
@@ -163,15 +310,16 @@ let g:ale_statusline_format = ['⨉ %d', '⚠ %d', '⬥ ok']
|
||||

|
||||

|
||||
|
||||
<a name="faq-echo-format"></a>
|
||||
|
||||
### Customize echoed message
|
||||
### 5.v. How can I change the format for echo messages?
|
||||
|
||||
There are 3 global options that allow customizing the echoed message.
|
||||
|
||||
- `g:ale_echo_msg_format` where:
|
||||
* `%s` is the error message itself
|
||||
* `%linter%` is the linter name
|
||||
* `%severity` is the severity type
|
||||
* `%s` is the error message itself
|
||||
* `%linter%` is the linter name
|
||||
* `%severity` is the severity type
|
||||
- `g:ale_echo_msg_error_str` is the string used for error severity.
|
||||
- `g:ale_echo_msg_warning_str` is the string used for warning severity.
|
||||
|
||||
@@ -187,58 +335,138 @@ Will give you:
|
||||
|
||||

|
||||
|
||||
## Installation
|
||||
<a name="faq-autocmd"></a>
|
||||
|
||||
To install this plugin, you should use one of the following methods.
|
||||
For Windows users, replace usage of the Unix `~/.vim` directory with
|
||||
`%USERPROFILE%\_vim`, or another directory if you have configured
|
||||
Vim differently. On Windows, your `~/.vimrc` file will be similarly
|
||||
stored in `%USERPROFILE%\_vimrc`.
|
||||
### 5.vi. How can I execute some code when ALE stops linting?
|
||||
|
||||
### Installation with Pathogen
|
||||
|
||||
To install this module with [Pathogen](https://github.com/tpope/vim-pathogen),
|
||||
you should clone this repository to your bundle directory, and ensure
|
||||
you have the line `execute pathogen#infect()` in your `~/.vimrc` file.
|
||||
You can run the following commands in your terminal to do so:
|
||||
|
||||
```bash
|
||||
cd ~/.vim/bundle
|
||||
git clone https://github.com/w0rp/ale.git
|
||||
```
|
||||
|
||||
### Installation with Vundle
|
||||
|
||||
You can install this plugin using [Vundle](https://github.com/VundleVim/Vundle.vim)
|
||||
by using the path on GitHub for this repository.
|
||||
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.
|
||||
|
||||
```vim
|
||||
Plugin 'w0rp/ale'
|
||||
augroup YourGroup
|
||||
autocmd!
|
||||
autocmd User ALELint call YourFunction()
|
||||
augroup END
|
||||
```
|
||||
|
||||
See the Vundle documentation for more information.
|
||||
<a name="faq-navigation"></a>
|
||||
|
||||
### Manual Installation
|
||||
### 5.vii. How can I navigate between errors quickly?
|
||||
|
||||
For installation without a package manager, you can clone this git repository
|
||||
into a bundle directory as with pathogen, and add the repository to your
|
||||
runtime path yourself. First clone the repository.
|
||||
|
||||
```bash
|
||||
cd ~/.vim/bundle
|
||||
git clone https://github.com/w0rp/ale.git
|
||||
```
|
||||
|
||||
Then, modify your `~/.vimrc` file to add this plugin to your runtime path.
|
||||
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
|
||||
for example:
|
||||
|
||||
```vim
|
||||
set nocompatible
|
||||
filetype off
|
||||
|
||||
let &runtimepath.=',~/.vim/bundle/ale'
|
||||
|
||||
filetype plugin on
|
||||
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
|
||||
nmap <silent> <C-j> <Plug>(ale_next_wrap)
|
||||
```
|
||||
|
||||
Because the author of this plugin is a weird nerd, this is his preferred
|
||||
installation method.
|
||||
For more information, consult the online documentation with
|
||||
`:help ale-navigation-commands`.
|
||||
|
||||
<a name="faq-lint-on-save"></a>
|
||||
|
||||
### 5.viii. How can I run linters only when I save files?
|
||||
|
||||
ALE offers an option `g:ale_lint_on_save` for enabling running the linters
|
||||
when files are saved. This option is enabled by default. If you only
|
||||
wish to run linters when files are saved, you can turn the other
|
||||
options off.
|
||||
|
||||
```vim
|
||||
" Write this in your vimrc file
|
||||
let g:ale_lint_on_text_changed = 'never'
|
||||
" You can disable this option too
|
||||
" if you don't want linters to run on opening a file
|
||||
let g:ale_lint_on_enter = 0
|
||||
```
|
||||
|
||||
If for whatever reason you don't wish to run linters again when you save
|
||||
files, you can set `g:ale_lint_on_save` to `0`.
|
||||
|
||||
<a name="faq-quickfix"></a>
|
||||
|
||||
### 5.ix. How can I use the quickfix list instead of the loclist?
|
||||
|
||||
The quickfix list can be enabled by turning the `g:ale_set_quickfix`
|
||||
option on. If you wish to also disable the loclist, you can disable
|
||||
the `g:ale_set_loclist` option.
|
||||
|
||||
```vim
|
||||
" Write this in your vimrc file
|
||||
let g:ale_set_loclist = 0
|
||||
let g:ale_set_quickfix = 1
|
||||
```
|
||||
|
||||
If you wish to show Vim windows for the loclist or quickfix items
|
||||
when a file contains warnings or errors, `g:ale_open_list` can be
|
||||
set to `1`. `g:ale_keep_list_window_open` can be set to `1`
|
||||
if you wish to keep the window open even after errors disappear.
|
||||
|
||||
```vim
|
||||
let g:ale_open_list = 1
|
||||
" Set this if you want to.
|
||||
" This can be useful if you are combining ALE with
|
||||
" some other plugin which sets quickfix errors, etc.
|
||||
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?
|
||||
|
||||
If you configure ALE options correctly in your vimrc file, and install
|
||||
the right tools, you can check JSX files with stylelint and eslint.
|
||||
|
||||
First, install eslint and install stylelint with
|
||||
[https://github.com/styled-components/stylelint-processor-styled-components](stylelint-processor-styled-components).
|
||||
|
||||
Supposing you have installed both tools correctly, configure your .jsx files so
|
||||
`jsx` is included in the filetype. You can use an `autocmd` for this.
|
||||
|
||||
```vim
|
||||
augroup FiletypeGroup
|
||||
autocmd!
|
||||
au BufNewFile,BufRead *.jsx set filetype=javascript.jsx
|
||||
augroup END
|
||||
```
|
||||
|
||||
Supposing the filetype has been set correctly, you can set the following
|
||||
options in your vimrc file:
|
||||
|
||||
```vim
|
||||
let g:ale_linters = {'jsx': ['stylelint', 'eslint']}
|
||||
let g:ale_linter_aliases = {'jsx': 'css'}
|
||||
```
|
||||
|
||||
ALE will alias the `jsx` filetype so it uses the `css` filetype linters, and
|
||||
use the original Array of selected linters for `jsx` from the `g:ale_linters`
|
||||
object. All available linters will be used for the filetype `javascript`, and
|
||||
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?
|
||||
|
||||
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
|
||||
are concerned about the CPU time ALE will spend, which will of course imply
|
||||
some cost to battery life, you can adjust your settings to make your CPU do
|
||||
less work.
|
||||
|
||||
First, consider increasing the delay before which ALE will run any linters
|
||||
while you type. ALE uses a timeout which is cancelled and reset every time you
|
||||
type, and this delay can be increased so linters are run less often. See
|
||||
`:help g:ale_lint_delay` for more information.
|
||||
|
||||
If you don't wish to run linters while you type, you can disable that
|
||||
behaviour. Set `g:ale_lint_on_text_changed` to `never` or `normal`. You won't
|
||||
get as frequent error checking, but ALE shouldn't block your ability to edit a
|
||||
document after you save a file, so the asynchronous nature of the plugin will
|
||||
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
|
||||
`:call ale#Lint()`.
|
||||
|
||||
37
after/plugin/ale.vim
Normal file
37
after/plugin/ale.vim
Normal file
@@ -0,0 +1,37 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Follow-up checks for the plugin: warn about conflicting plugins.
|
||||
|
||||
" A flag for ensuring that this is not run more than one time.
|
||||
if exists('g:loaded_ale_after')
|
||||
finish
|
||||
endif
|
||||
|
||||
" Set the flag so this file is not run more than one time.
|
||||
let g:loaded_ale_after = 1
|
||||
|
||||
" Check if the flag is available and set to 0 to disable checking for and
|
||||
" emitting conflicting plugin warnings.
|
||||
if exists('g:ale_emit_conflict_warnings') && !g:ale_emit_conflict_warnings
|
||||
finish
|
||||
endif
|
||||
|
||||
" Conflicting Plugins Checks
|
||||
|
||||
function! s:GetConflictingPluginWarning(plugin_name) abort
|
||||
return 'ALE conflicts with ' . a:plugin_name
|
||||
\ . '. Uninstall it, or disable this warning with '
|
||||
\ . '`let g:ale_emit_conflict_warnings = 0` in your vimrc file, '
|
||||
\ . '*before* plugins are loaded.'
|
||||
endfunction
|
||||
|
||||
if exists('g:loaded_syntastic_plugin')
|
||||
throw s:GetConflictingPluginWarning('Syntastic')
|
||||
endif
|
||||
|
||||
if exists('g:loaded_neomake')
|
||||
throw s:GetConflictingPluginWarning('Neomake')
|
||||
endif
|
||||
|
||||
if exists('g:loaded_validator_plugin')
|
||||
throw s:GetConflictingPluginWarning('Validator')
|
||||
endif
|
||||
9
ale_linters/ansible/ansible-lint.vim
Normal file
9
ale_linters/ansible/ansible-lint.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: Bjorn Neergaard <bjorn@neersighted.com>
|
||||
" Description: ansible-lint for ansible-yaml files
|
||||
|
||||
call ale#linter#Define('ansible', {
|
||||
\ 'name': 'ansible',
|
||||
\ 'executable': 'ansible',
|
||||
\ 'command': 'ansible-lint -p %t',
|
||||
\ 'callback': 'ale#handlers#python#HandlePEP8Format',
|
||||
\})
|
||||
9
ale_linters/asciidoc/proselint.vim
Normal file
9
ale_linters/asciidoc/proselint.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: Daniel M. Capella https://github.com/polyzen
|
||||
" Description: proselint for AsciiDoc files
|
||||
|
||||
call ale#linter#Define('asciidoc', {
|
||||
\ 'name': 'proselint',
|
||||
\ 'executable': 'proselint',
|
||||
\ 'command': 'proselint %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
||||
33
ale_linters/asm/gcc.vim
Normal file
33
ale_linters/asm/gcc.vim
Normal file
@@ -0,0 +1,33 @@
|
||||
" 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')
|
||||
|
||||
function! ale_linters#asm#gcc#GetCommand(buffer) abort
|
||||
return 'gcc -x assembler -fsyntax-only '
|
||||
\ . '-iquote ' . shellescape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
\ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#asm#gcc#Handle(buffer, lines) abort
|
||||
let l:pattern = '^.\+:\(\d\+\): \([^:]\+\): \(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'type': l:match[2] =~? 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('asm', {
|
||||
\ 'name': 'gcc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'gcc',
|
||||
\ 'command_callback': 'ale_linters#asm#gcc#GetCommand',
|
||||
\ 'callback': 'ale_linters#asm#gcc#Handle',
|
||||
\})
|
||||
26
ale_linters/c/clang.vim
Normal file
26
ale_linters/c/clang.vim
Normal file
@@ -0,0 +1,26 @@
|
||||
" Author: Masahiro H https://github.com/mshr-h
|
||||
" Description: clang linter for c files
|
||||
|
||||
" Set this option to change the Clang options for warnings for C.
|
||||
if !exists('g:ale_c_clang_options')
|
||||
" let g:ale_c_clang_options = '-Wall'
|
||||
" let g:ale_c_clang_options = '-std=c99 -Wall'
|
||||
" c11 compatible
|
||||
let g:ale_c_clang_options = '-std=c11 -Wall'
|
||||
endif
|
||||
|
||||
function! ale_linters#c#clang#GetCommand(buffer) abort
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
return 'clang -S -x c -fsyntax-only '
|
||||
\ . '-iquote ' . shellescape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
\ . ' ' . ale#Var(a:buffer, 'c_clang_options') . ' -'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'clang',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'clang',
|
||||
\ 'command_callback': 'ale_linters#c#clang#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\})
|
||||
34
ale_linters/c/cppcheck.vim
Normal file
34
ale_linters/c/cppcheck.vim
Normal file
@@ -0,0 +1,34 @@
|
||||
" Author: Bart Libert <bart.libert@gmail.com>
|
||||
" Description: cppcheck linter for c files
|
||||
|
||||
" Set this option to change the cppcheck options
|
||||
let g:ale_c_cppcheck_options = get(g:, 'ale_c_cppcheck_options', '--enable=style')
|
||||
|
||||
function! ale_linters#c#cppcheck#GetCommand(buffer) abort
|
||||
" Search upwards from the file for compile_commands.json.
|
||||
"
|
||||
" If we find it, we'll `cd` to where the compile_commands.json file is,
|
||||
" then use the file to set up import paths, etc.
|
||||
let l:compile_commmands_path = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
||||
|
||||
let l:cd_command = !empty(l:compile_commmands_path)
|
||||
\ ? ale#path#CdString(fnamemodify(l:compile_commmands_path, ':h'))
|
||||
\ : ''
|
||||
let l:compile_commands_option = !empty(l:compile_commmands_path)
|
||||
\ ? '--project=compile_commands.json '
|
||||
\ : ''
|
||||
|
||||
return l:cd_command
|
||||
\ . 'cppcheck -q --language=c '
|
||||
\ . l:compile_commands_option
|
||||
\ . ale#Var(a:buffer, 'c_cppcheck_options')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'cppcheck',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': 'cppcheck',
|
||||
\ 'command_callback': 'ale_linters#c#cppcheck#GetCommand',
|
||||
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
|
||||
\})
|
||||
@@ -1,23 +1,26 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: gcc linter for c files
|
||||
|
||||
if exists('g:loaded_ale_linters_c_gcc')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_c_gcc = 1
|
||||
|
||||
" Set this option to change the GCC options for warnings for C.
|
||||
if !exists('g:ale_c_gcc_options')
|
||||
let g:ale_c_gcc_options = '-Wall'
|
||||
" let g:ale_c_gcc_options = '-Wall'
|
||||
" let g:ale_c_gcc_options = '-std=c99 -Wall'
|
||||
" c11 compatible
|
||||
let g:ale_c_gcc_options = '-std=c11 -Wall'
|
||||
endif
|
||||
|
||||
function! ale_linters#c#gcc#GetCommand(buffer) abort
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
return 'gcc -S -x c -fsyntax-only '
|
||||
\ . '-iquote ' . shellescape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
\ . ' ' . ale#Var(a:buffer, 'c_gcc_options') . ' -'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'gcc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'gcc',
|
||||
\ 'command': 'gcc -S -x c -fsyntax-only '
|
||||
\ . g:ale_c_gcc_options
|
||||
\ . ' -',
|
||||
\ 'callback': 'ale#handlers#HandleGCCFormat',
|
||||
\ 'command_callback': 'ale_linters#c#gcc#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\})
|
||||
|
||||
42
ale_linters/chef/foodcritic.vim
Normal file
42
ale_linters/chef/foodcritic.vim
Normal file
@@ -0,0 +1,42 @@
|
||||
" Author: Edward Larkey <edwlarkey@mac.com>
|
||||
" Author: Jose Junior <jose.junior@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')
|
||||
|
||||
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: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,
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
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',
|
||||
\ 'command_callback': 'ale_linters#chef#foodcritic#GetCommand',
|
||||
\ 'callback': 'ale_linters#chef#foodcritic#Handle',
|
||||
\})
|
||||
24
ale_linters/cmake/cmakelint.vim
Normal file
24
ale_linters/cmake/cmakelint.vim
Normal file
@@ -0,0 +1,24 @@
|
||||
" Author: Kenneth Benzie <k.benzie83@gmail.com>
|
||||
" Description: cmakelint for cmake files
|
||||
|
||||
let g:ale_cmake_cmakelint_executable =
|
||||
\ get(g:, 'ale_cmake_cmakelint_executable', 'cmakelint')
|
||||
|
||||
let g:ale_cmake_cmakelint_options =
|
||||
\ get(g:, 'ale_cmake_cmakelint_options', '')
|
||||
|
||||
function! ale_linters#cmake#cmakelint#Executable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cmake_cmakelint_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cmake#cmakelint#Command(buffer) abort
|
||||
return ale_linters#cmake#cmakelint#Executable(a:buffer)
|
||||
\ . ' ' . ale#Var(a:buffer, 'cmake_cmakelint_options') . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cmake', {
|
||||
\ 'name': 'cmakelint',
|
||||
\ 'executable_callback': 'ale_linters#cmake#cmakelint#Executable',
|
||||
\ 'command_callback': 'ale_linters#cmake#cmakelint#Command',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
||||
@@ -1,17 +1,23 @@
|
||||
" Author: KabbAmine - https://github.com/KabbAmine
|
||||
" Description: Coffee for checking coffee files
|
||||
|
||||
if exists('g:loaded_ale_linters_coffee_coffee')
|
||||
finish
|
||||
endif
|
||||
function! ale_linters#coffee#coffee#GetExecutable(buffer) abort
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/coffee',
|
||||
\ 'coffee'
|
||||
\)
|
||||
endfunction
|
||||
|
||||
let g:loaded_ale_linters_coffee_coffee = 1
|
||||
function! ale_linters#coffee#coffee#GetCommand(buffer) abort
|
||||
return ale_linters#coffee#coffee#GetExecutable(a:buffer)
|
||||
\ . ' -cp -s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('coffee', {
|
||||
\ 'name': 'coffee',
|
||||
\ 'executable': 'coffee',
|
||||
\ 'command': 'coffee -cp -s',
|
||||
\ 'executable_callback': 'ale_linters#coffee#coffee#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#coffee#coffee#GetCommand',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale#handlers#HandleGCCFormat',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\})
|
||||
|
||||
|
||||
@@ -1,43 +1,34 @@
|
||||
" Author: Prashanth Chandra https://github.com/prashcr
|
||||
" Description: coffeelint linter for coffeescript files
|
||||
|
||||
if exists('g:loaded_ale_linters_coffee_coffeelint')
|
||||
finish
|
||||
endif
|
||||
function! ale_linters#coffee#coffeelint#GetExecutable(buffer) abort
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/coffeelint',
|
||||
\ 'coffeelint'
|
||||
\)
|
||||
endfunction
|
||||
|
||||
let g:loaded_ale_linters_coffee_coffeelint = 1
|
||||
function! ale_linters#coffee#coffeelint#GetCommand(buffer) abort
|
||||
return ale_linters#coffee#coffeelint#GetExecutable(a:buffer)
|
||||
\ . ' --stdin --reporter csv'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#coffee#coffeelint#Handle(buffer, lines)
|
||||
function! ale_linters#coffee#coffeelint#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
"
|
||||
" path,lineNumber,lineNumberEnd,level,message
|
||||
" stdin,14,,error,Throwing strings is forbidden
|
||||
"
|
||||
" Note that we currently ignore lineNumberEnd for multiline errors
|
||||
let l:pattern = 'stdin,\(\d\+\),\(\d*\),\(.\+\),\(.\+\)'
|
||||
let l:pattern = 'stdin,\(\d\+\),\(\d*\),\(.\{-1,}\),\(.\+\)'
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:line = l:match[1] + 0
|
||||
let l:column = 1
|
||||
let l:type = l:match[3] ==# 'error' ? 'E' : 'W'
|
||||
let l:text = l:match[4]
|
||||
|
||||
" vcol is needed to indicate that the column is a character
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:line,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': l:column,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type,
|
||||
\ 'nr': -1,
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'type': l:match[3] ==# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
|
||||
@@ -46,7 +37,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('coffee', {
|
||||
\ 'name': 'coffeelint',
|
||||
\ 'executable': 'coffeelint',
|
||||
\ 'command': 'coffeelint --stdin --reporter csv',
|
||||
\ 'executable_callback': 'ale_linters#coffee#coffeelint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#coffee#coffeelint#GetCommand',
|
||||
\ 'callback': 'ale_linters#coffee#coffeelint#Handle',
|
||||
\})
|
||||
|
||||
23
ale_linters/cpp/clang.vim
Normal file
23
ale_linters/cpp/clang.vim
Normal file
@@ -0,0 +1,23 @@
|
||||
" Author: Tomota Nakamura <https://github.com/tomotanakamura>
|
||||
" Description: clang linter for cpp files
|
||||
|
||||
" Set this option to change the Clang options for warnings for CPP.
|
||||
if !exists('g:ale_cpp_clang_options')
|
||||
let g:ale_cpp_clang_options = '-std=c++14 -Wall'
|
||||
endif
|
||||
|
||||
function! ale_linters#cpp#clang#GetCommand(buffer) abort
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
return 'clang++ -S -x c++ -fsyntax-only '
|
||||
\ . '-iquote ' . shellescape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
\ . ' ' . ale#Var(a:buffer, 'cpp_clang_options') . ' -'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'clang',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'clang++',
|
||||
\ 'command_callback': 'ale_linters#cpp#clang#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\})
|
||||
31
ale_linters/cpp/clangtidy.vim
Normal file
31
ale_linters/cpp/clangtidy.vim
Normal file
@@ -0,0 +1,31 @@
|
||||
" Author: vdeurzen <tim@kompiler.org>, w0rp <devw0rp@gmail.com>
|
||||
" Description: clang-tidy linter for cpp files
|
||||
|
||||
" Set this option to check the checks clang-tidy will apply.
|
||||
let g:ale_cpp_clangtidy_checks = get(g:, 'ale_cpp_clangtidy_checks', ['*'])
|
||||
|
||||
" Set this option to manually set some options for clang-tidy.
|
||||
" This will disable compile_commands.json detection.
|
||||
let g:ale_cpp_clangtidy_options = get(g:, 'ale_cpp_clangtidy_options', '')
|
||||
|
||||
function! ale_linters#cpp#clangtidy#GetCommand(buffer) abort
|
||||
let l:check_list = ale#Var(a:buffer, 'cpp_clangtidy_checks')
|
||||
let l:check_option = !empty(l:check_list)
|
||||
\ ? '-checks=' . shellescape(join(l:check_list, ',')) . ' '
|
||||
\ : ''
|
||||
let l:user_options = ale#Var(a:buffer, 'cpp_clangtidy_options')
|
||||
let l:extra_options = !empty(l:user_options)
|
||||
\ ? ' -- ' . l:user_options
|
||||
\ : ''
|
||||
|
||||
return 'clang-tidy ' . l:check_option . '%s' . l:extra_options
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'clangtidy',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': 'clang-tidy',
|
||||
\ 'command_callback': 'ale_linters#cpp#clangtidy#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
34
ale_linters/cpp/cppcheck.vim
Normal file
34
ale_linters/cpp/cppcheck.vim
Normal file
@@ -0,0 +1,34 @@
|
||||
" Author: Bart Libert <bart.libert@gmail.com>
|
||||
" Description: cppcheck linter for cpp files
|
||||
|
||||
" Set this option to change the cppcheck options
|
||||
let g:ale_cpp_cppcheck_options = get(g:, 'ale_cpp_cppcheck_options', '--enable=style')
|
||||
|
||||
function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
|
||||
" Search upwards from the file for compile_commands.json.
|
||||
"
|
||||
" If we find it, we'll `cd` to where the compile_commands.json file is,
|
||||
" then use the file to set up import paths, etc.
|
||||
let l:compile_commmands_path = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
|
||||
|
||||
let l:cd_command = !empty(l:compile_commmands_path)
|
||||
\ ? ale#path#CdString(fnamemodify(l:compile_commmands_path, ':h'))
|
||||
\ : ''
|
||||
let l:compile_commands_option = !empty(l:compile_commmands_path)
|
||||
\ ? '--project=compile_commands.json '
|
||||
\ : ''
|
||||
|
||||
return l:cd_command
|
||||
\ . 'cppcheck -q --language=c++ '
|
||||
\ . l:compile_commands_option
|
||||
\ . ale#Var(a:buffer, 'cpp_cppcheck_options')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'cppcheck',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': 'cppcheck',
|
||||
\ 'command_callback': 'ale_linters#cpp#cppcheck#GetCommand',
|
||||
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
|
||||
\})
|
||||
@@ -1,23 +1,33 @@
|
||||
" Author: geam <mdelage@student.42.fr>
|
||||
" Description: gcc linter for cpp files
|
||||
|
||||
if exists('g:loaded_ale_linters_cpp_gcc')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_cpp_gcc = 1
|
||||
|
||||
" Set this option to change the GCC options for warnings for C.
|
||||
if !exists('g:ale_cpp_gcc_options')
|
||||
let g:ale_cpp_gcc_options = '-Wall'
|
||||
let s:version = ale#handlers#gcc#ParseGCCVersion(systemlist('gcc --version'))
|
||||
|
||||
if !empty(s:version) && ale#semver#GreaterOrEqual(s:version, [4, 9, 0])
|
||||
" Use c++14 support in 4.9 and above.
|
||||
let g:ale_cpp_gcc_options = '-std=c++14 -Wall'
|
||||
else
|
||||
" Use c++1y in older versions.
|
||||
let g:ale_cpp_gcc_options = '-std=c++1y -Wall'
|
||||
endif
|
||||
|
||||
unlet! s:version
|
||||
endif
|
||||
|
||||
function! ale_linters#cpp#gcc#GetCommand(buffer) abort
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
return 'gcc -S -x c++ -fsyntax-only '
|
||||
\ . '-iquote ' . shellescape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
\ . ' ' . ale#Var(a:buffer, 'cpp_gcc_options') . ' -'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'gcc',
|
||||
\ 'name': 'g++',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'gcc',
|
||||
\ 'command': 'gcc -S -x c++ -fsyntax-only '
|
||||
\ . g:ale_cpp_gcc_options
|
||||
\ . ' -',
|
||||
\ 'callback': 'ale#handlers#HandleGCCFormat',
|
||||
\ 'executable': 'g++',
|
||||
\ 'command_callback': 'ale_linters#cpp#gcc#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\})
|
||||
|
||||
41
ale_linters/crystal/crystal.vim
Normal file
41
ale_linters/crystal/crystal.vim
Normal file
@@ -0,0 +1,41 @@
|
||||
" Author: Jordan Andree <https://github.com/jordanandree>
|
||||
" Description: This file adds support for checking Crystal with crystal build
|
||||
|
||||
function! ale_linters#crystal#crystal#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
let l:lines = join(a:lines, '')
|
||||
|
||||
if !empty(l:lines)
|
||||
let l:errors = json_decode(l:lines)
|
||||
|
||||
for l:error in l:errors
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:error.line + 0,
|
||||
\ 'col': l:error.column + 0,
|
||||
\ 'text': l:error.message,
|
||||
\ 'type': 'E',
|
||||
\})
|
||||
endfor
|
||||
endif
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#crystal#crystal#GetCommand(buffer) abort
|
||||
let l:crystal_cmd = 'crystal build -f json --no-codegen -o '
|
||||
let l:crystal_cmd .= shellescape(g:ale#util#nul_file)
|
||||
let l:crystal_cmd .= ' %s'
|
||||
|
||||
return l:crystal_cmd
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('crystal', {
|
||||
\ 'name': 'crystal',
|
||||
\ 'executable': 'crystal',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'lint_file': 1,
|
||||
\ 'command_callback': 'ale_linters#crystal#crystal#GetCommand',
|
||||
\ 'callback': 'ale_linters#crystal#crystal#Handle',
|
||||
\})
|
||||
32
ale_linters/cs/mcs.vim
Normal file
32
ale_linters/cs/mcs.vim
Normal file
@@ -0,0 +1,32 @@
|
||||
let g:ale_cs_mcs_options = get(g:, 'ale_cs_mcs_options', '')
|
||||
|
||||
function! ale_linters#cs#mcs#GetCommand(buffer) abort
|
||||
return 'mcs -unsafe --parse ' . ale#Var(a:buffer, 'cs_mcs_options') . ' %t'
|
||||
endfunction
|
||||
|
||||
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: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',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cs',{
|
||||
\ 'name': 'mcs',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'mcs',
|
||||
\ 'command_callback': 'ale_linters#cs#mcs#GetCommand',
|
||||
\ 'callback': 'ale_linters#cs#mcs#Handle',
|
||||
\})
|
||||
@@ -1,15 +1,18 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: This file adds support for checking CSS code with csslint.
|
||||
|
||||
if exists('g:loaded_ale_linters_css_csslint')
|
||||
finish
|
||||
endif
|
||||
function! ale_linters#css#csslint#GetCommand(buffer) abort
|
||||
let l:csslintrc = ale#path#FindNearestFile(a:buffer, '.csslintrc')
|
||||
let l:config_option = !empty(l:csslintrc)
|
||||
\ ? '--config=' . shellescape(l:csslintrc)
|
||||
\ : ''
|
||||
|
||||
let g:loaded_ale_linters_css_csslint = 1
|
||||
return 'csslint --format=compact ' . l:config_option . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('css', {
|
||||
\ 'name': 'csslint',
|
||||
\ 'executable': 'csslint',
|
||||
\ 'command': g:ale#util#stdin_wrapper . ' .css csslint --format=compact',
|
||||
\ 'callback': 'ale#handlers#HandleCSSLintFormat',
|
||||
\ 'command_callback': 'ale_linters#css#csslint#GetCommand',
|
||||
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
|
||||
\})
|
||||
|
||||
35
ale_linters/css/stylelint.vim
Normal file
35
ale_linters/css/stylelint.vim
Normal file
@@ -0,0 +1,35 @@
|
||||
" Author: diartyz <diartyz@gmail.com>
|
||||
|
||||
let g:ale_css_stylelint_executable =
|
||||
\ get(g:, 'ale_css_stylelint_executable', 'stylelint')
|
||||
|
||||
let g:ale_css_stylelint_options =
|
||||
\ get(g:, 'ale_css_stylelint_options', '')
|
||||
|
||||
let g:ale_css_stylelint_use_global =
|
||||
\ get(g:, 'ale_css_stylelint_use_global', 0)
|
||||
|
||||
function! ale_linters#css#stylelint#GetExecutable(buffer) abort
|
||||
if ale#Var(a:buffer, 'css_stylelint_use_global')
|
||||
return ale#Var(a:buffer, 'css_stylelint_executable')
|
||||
endif
|
||||
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\ ale#Var(a:buffer, 'css_stylelint_executable')
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#css#stylelint#GetCommand(buffer) abort
|
||||
return ale_linters#css#stylelint#GetExecutable(a:buffer)
|
||||
\ . ' ' . ale#Var(a:buffer, 'css_stylelint_options')
|
||||
\ . ' --stdin-filename %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('css', {
|
||||
\ 'name': 'stylelint',
|
||||
\ 'executable_callback': 'ale_linters#css#stylelint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#css#stylelint#GetCommand',
|
||||
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
|
||||
\})
|
||||
@@ -1,60 +1,67 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: "dmd for D files"
|
||||
|
||||
if exists('g:loaded_ale_linters_d_dmd')
|
||||
finish
|
||||
endif
|
||||
function! s:FindDUBConfig(buffer) abort
|
||||
" Find a DUB configuration file in ancestor paths.
|
||||
" The most DUB-specific names will be tried first.
|
||||
for l:possible_filename in ['dub.sdl', 'dub.json', 'package.json']
|
||||
let l:dub_file = ale#path#FindNearestFile(a:buffer, l:possible_filename)
|
||||
|
||||
let g:loaded_ale_linters_d_dmd = 1
|
||||
|
||||
" A function for finding the dmd-wrapper script in the Vim runtime paths
|
||||
function! s:FindWrapperScript()
|
||||
for l:parent in split(&runtimepath, ',')
|
||||
" Expand the path to deal with ~ issues.
|
||||
let l:path = expand(l:parent . '/' . 'dmd-wrapper')
|
||||
|
||||
if filereadable(l:path)
|
||||
return l:path
|
||||
if !empty(l:dub_file)
|
||||
return l:dub_file
|
||||
endif
|
||||
endfor
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#d#dmd#GetCommand(buffer)
|
||||
let l:wrapper_script = s:FindWrapperScript()
|
||||
function! ale_linters#d#dmd#DUBCommand(buffer) abort
|
||||
" If we can't run dub, then skip this command.
|
||||
if !executable('dub')
|
||||
" Returning an empty string skips to the DMD command.
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:command = l:wrapper_script . ' -o- -vcolumns -c'
|
||||
let l:dub_file = s:FindDUBConfig(a:buffer)
|
||||
|
||||
return l:command
|
||||
if empty(l:dub_file)
|
||||
return ''
|
||||
endif
|
||||
|
||||
" To support older dub versions, we just change the directory to
|
||||
" the directory where we found the dub config, and then run `dub describe`
|
||||
" from that directory.
|
||||
return 'cd ' . shellescape(fnamemodify(l:dub_file, ':h'))
|
||||
\ . ' && dub describe --import-paths'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#d#dmd#Handle(buffer, lines)
|
||||
function! ale_linters#d#dmd#DMDCommand(buffer, dub_output) abort
|
||||
let l:import_list = []
|
||||
|
||||
" Build a list of import paths generated from DUB, if available.
|
||||
for l:line in a:dub_output
|
||||
if !empty(l:line)
|
||||
" The arguments must be '-Ifilename', not '-I filename'
|
||||
call add(l:import_list, '-I' . shellescape(l:line))
|
||||
endif
|
||||
endfor
|
||||
|
||||
return 'dmd '. join(l:import_list) . ' -o- -vcolumns -c %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#d#dmd#Handle(buffer, lines) abort
|
||||
" Matches patterns lines like the following:
|
||||
"
|
||||
" /tmp/tmp.qclsa7qLP7/file.d(1): Error: function declaration without return type. (Note that constructors are always named 'this')
|
||||
" /tmp/tmp.G1L5xIizvB.d(8,8): Error: module weak_reference is in file 'dstruct/weak_reference.d' which cannot be read
|
||||
let l:pattern = '^[^(]\+(\([0-9]\+\),\([0-9]\+\)): \([^:]\+\): \(.\+\)'
|
||||
let l:pattern = '^[^(]\+(\([0-9]\+\)\,\?\([0-9]*\)): \([^:]\+\): \(.\+\)'
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
break
|
||||
endif
|
||||
|
||||
let l:line = l:match[1] + 0
|
||||
let l:column = l:match[2] + 0
|
||||
let l:type = l:match[3]
|
||||
let l:text = l:match[4]
|
||||
|
||||
" vcol is Needed to indicate that the column is a character.
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'bufnr': bufnr('%'),
|
||||
\ 'lnum': l:line,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': l:column,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type ==# 'Warning' ? 'W' : 'E',
|
||||
\ 'nr': -1,
|
||||
\ 'lnum': l:match[1],
|
||||
\ 'col': l:match[2],
|
||||
\ 'type': l:match[3] ==# 'Warning' ? 'W' : 'E',
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
|
||||
@@ -63,8 +70,10 @@ endfunction
|
||||
|
||||
call ale#linter#Define('d', {
|
||||
\ 'name': 'dmd',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'dmd',
|
||||
\ 'command_callback': 'ale_linters#d#dmd#GetCommand',
|
||||
\ 'command_chain': [
|
||||
\ {'callback': 'ale_linters#d#dmd#DUBCommand', 'output_stream': 'stdout'},
|
||||
\ {'callback': 'ale_linters#d#dmd#DMDCommand', 'output_stream': 'stderr'},
|
||||
\ ],
|
||||
\ 'callback': 'ale_linters#d#dmd#Handle',
|
||||
\})
|
||||
|
||||
37
ale_linters/dockerfile/hadolint.vim
Normal file
37
ale_linters/dockerfile/hadolint.vim
Normal file
@@ -0,0 +1,37 @@
|
||||
" Author: hauleth - https://github.com/hauleth
|
||||
|
||||
function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" stdin:19: F: Pipe chain should start with a raw value.
|
||||
let l:pattern = '\v^/dev/stdin:?(\d+)? (\S+) (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:lnum = 0
|
||||
|
||||
if l:match[1] !=# ''
|
||||
let l:lnum = l:match[1] + 0
|
||||
endif
|
||||
|
||||
let l:type = 'W'
|
||||
let l:text = l:match[3]
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:lnum,
|
||||
\ 'col': 0,
|
||||
\ 'type': l:type,
|
||||
\ 'text': l:text,
|
||||
\ 'nr': l:match[2],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('dockerfile', {
|
||||
\ 'name': 'hadolint',
|
||||
\ 'executable': 'hadolint',
|
||||
\ 'command': 'hadolint -',
|
||||
\ 'callback': 'ale_linters#dockerfile#hadolint#Handle',
|
||||
\})
|
||||
@@ -1,51 +1,37 @@
|
||||
" Author: hauleth - https://github.com/haulethe
|
||||
" Author: hauleth - https://github.com/hauleth
|
||||
|
||||
if exists('g:loaded_ale_linters_elixir_credo')
|
||||
finish
|
||||
endif
|
||||
function! ale_linters#elixir#credo#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" lib/filename.ex:19:7: F: Pipe chain should start with a raw value.
|
||||
let l:pattern = '\v:(\d+):?(\d+)?: (.): (.+)$'
|
||||
let l:output = []
|
||||
|
||||
let g:loaded_ale_linters_elixir_credo = 1
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:type = l:match[3]
|
||||
let l:text = l:match[4]
|
||||
|
||||
function! ale_linters#elixir#credo#Handle(buffer, lines)
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" stdin:19: F: Pipe chain should start with a raw value.
|
||||
let l:pattern = '\v^stdin:(\d+):?(\d+)?: (.): (.+)$'
|
||||
let l:output = []
|
||||
if l:type ==# 'C'
|
||||
let l:type = 'E'
|
||||
elseif l:type ==# 'R'
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'type': l:type,
|
||||
\ 'text': l:text,
|
||||
\})
|
||||
endfor
|
||||
|
||||
if len(l:match) == 0
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:type = l:match[3]
|
||||
let l:text = l:match[4]
|
||||
|
||||
if l:type ==# 'C'
|
||||
let l:type = 'E'
|
||||
elseif l:type ==# 'R'
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
" vcol is Needed to indicate that the column is a character.
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'type': l:type,
|
||||
\ 'text': l:text,
|
||||
\ 'nr': -1,
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elixir', {
|
||||
\ 'name': 'credo',
|
||||
\ 'executable': 'mix',
|
||||
\ 'command': 'mix credo suggest --format=flycheck --read-from-stdin',
|
||||
\ 'callback': 'ale_linters#elixir#credo#Handle' })
|
||||
\ 'name': 'credo',
|
||||
\ 'executable': 'mix',
|
||||
\ 'command': 'mix credo suggest --format=flycheck --read-from-stdin %s',
|
||||
\ 'callback': 'ale_linters#elixir#credo#Handle',
|
||||
\})
|
||||
|
||||
38
ale_linters/elixir/dogma.vim
Normal file
38
ale_linters/elixir/dogma.vim
Normal file
@@ -0,0 +1,38 @@
|
||||
" Author: archseer - https://github.com/archSeer
|
||||
|
||||
function! ale_linters#elixir#dogma#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" lib/filename.ex:19:7: F: Pipe chain should start with a raw value.
|
||||
let l:pattern = '\v:(\d+):?(\d+)?: (.): (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:type = l:match[3]
|
||||
let l:text = l:match[4]
|
||||
|
||||
if l:type ==# 'C'
|
||||
let l:type = 'E'
|
||||
elseif l:type ==# 'R'
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'type': l:type,
|
||||
\ 'text': l:text,
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elixir', {
|
||||
\ 'name': 'dogma',
|
||||
\ 'executable': 'mix',
|
||||
\ 'command': 'mix dogma %s --format=flycheck',
|
||||
\ 'lint_file': 1,
|
||||
\ 'callback': 'ale_linters#elixir#dogma#Handle',
|
||||
\})
|
||||
64
ale_linters/elm/make.vim
Normal file
64
ale_linters/elm/make.vim
Normal file
@@ -0,0 +1,64 @@
|
||||
" Author: buffalocoder - https://github.com/buffalocoder
|
||||
" Description: Elm linting in Ale. Closely follows the Syntastic checker in https://github.com/ElmCast/elm-vim.
|
||||
|
||||
function! ale_linters#elm#make#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
let l:is_windows = has('win32')
|
||||
let l:temp_dir = l:is_windows ? $TMP : $TMPDIR
|
||||
for l:line in a:lines
|
||||
if l:line[0] ==# '['
|
||||
let l:errors = json_decode(l:line)
|
||||
|
||||
for l:error in l:errors
|
||||
" Check if file is from the temp directory.
|
||||
" Filters out any errors not related to the buffer.
|
||||
if l:is_windows
|
||||
let l:file_is_buffer = l:error.file[0:len(l:temp_dir) - 1] ==? l:temp_dir
|
||||
else
|
||||
let l:file_is_buffer = l:error.file[0:len(l:temp_dir) - 1] ==# l:temp_dir
|
||||
endif
|
||||
|
||||
if l:file_is_buffer
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:error.region.start.line,
|
||||
\ 'col': l:error.region.start.column,
|
||||
\ 'type': (l:error.type ==? 'error') ? 'E' : 'W',
|
||||
\ 'text': l:error.overview,
|
||||
\ 'detail': l:error.overview . "\n\n" . l:error.details
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
" Return the command to execute the linter in the projects directory.
|
||||
" 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')
|
||||
if empty(l:elm_package)
|
||||
let l:dir_set_cmd = ''
|
||||
else
|
||||
let l:root_dir = fnamemodify(l:elm_package, ':p:h')
|
||||
let l:dir_set_cmd = 'cd ' . shellescape(l:root_dir) . ' && '
|
||||
endif
|
||||
|
||||
" 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.
|
||||
" Source: https://github.com/elm-lang/elm-make/blob/master/src/Flags.hs
|
||||
let l:elm_cmd = 'elm-make --report=json --output='.shellescape('/dev/null')
|
||||
|
||||
return l:dir_set_cmd . ' ' . l:elm_cmd . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elm', {
|
||||
\ 'name': 'make',
|
||||
\ 'executable': 'elm-make',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'command_callback': 'ale_linters#elm#make#GetCommand',
|
||||
\ 'callback': 'ale_linters#elm#make#Handle'
|
||||
\})
|
||||
96
ale_linters/erlang/erlc.vim
Normal file
96
ale_linters/erlang/erlc.vim
Normal file
@@ -0,0 +1,96 @@
|
||||
" Author: Magnus Ottenklinger - https://github.com/evnu
|
||||
|
||||
let g:ale_erlang_erlc_options = get(g:, 'ale_erlang_erlc_options', '')
|
||||
|
||||
function! ale_linters#erlang#erlc#GetCommand(buffer) abort
|
||||
let l:output_file = tempname()
|
||||
call ale#engine#ManageFile(a:buffer, l:output_file)
|
||||
|
||||
return 'erlc -o ' . shellescape(l:output_file)
|
||||
\ . ' ' . ale#Var(a:buffer, 'erlang_erlc_options')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#erlang#erlc#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
"
|
||||
" 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: )?(.+)$'
|
||||
|
||||
" parse_transforms are a special case. The error message does not indicate a location:
|
||||
" error.erl: undefined parse transform 'some_parse_transform'
|
||||
let l:pattern_parse_transform = '\v(undefined parse transform .*)$'
|
||||
let l:output = []
|
||||
|
||||
let l:pattern_no_module_definition = '\v(no module definition)$'
|
||||
let l:pattern_unused = '\v(.* is unused)$'
|
||||
|
||||
let l:is_hrl = fnamemodify(bufname(a:buffer), ':e') ==# 'hrl'
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
" Determine if the output indicates an error. We distinguish between two cases:
|
||||
"
|
||||
" 1) normal errors match l:pattern
|
||||
" 2) parse_transform errors match l:pattern_parse_transform
|
||||
"
|
||||
" If none of the patterns above match, the line can be ignored
|
||||
if len(l:match) == 0 " not a 'normal' warning or error
|
||||
let l:match_parse_transform = matchlist(l:line, l:pattern_parse_transform)
|
||||
|
||||
if len(l:match_parse_transform) == 0 " also not a parse_transform error
|
||||
continue
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': 0,
|
||||
\ 'col': 0,
|
||||
\ 'type': 'E',
|
||||
\ 'text': l:match_parse_transform[0],
|
||||
\})
|
||||
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:line = l:match[2]
|
||||
let l:warning_or_text = l:match[3]
|
||||
let l:text = l:match[4]
|
||||
|
||||
" If this file is a header .hrl, ignore the following expected messages:
|
||||
" - 'no module definition'
|
||||
" - 'X is unused'
|
||||
if l:is_hrl && (
|
||||
\ match(l:text, l:pattern_no_module_definition) != -1
|
||||
\ || match(l:text, l:pattern_unused) != -1
|
||||
\)
|
||||
continue
|
||||
endif
|
||||
|
||||
if !empty(l:warning_or_text)
|
||||
let l:type = 'W'
|
||||
else
|
||||
let l:type = 'E'
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:line,
|
||||
\ 'col': 0,
|
||||
\ 'type': l:type,
|
||||
\ 'text': l:text,
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('erlang', {
|
||||
\ 'name': 'erlc',
|
||||
\ 'executable': 'erlc',
|
||||
\ 'command_callback': 'ale_linters#erlang#erlc#GetCommand',
|
||||
\ 'callback': 'ale_linters#erlang#erlc#Handle',
|
||||
\})
|
||||
11
ale_linters/eruby/erubylint.vim
Normal file
11
ale_linters/eruby/erubylint.vim
Normal file
@@ -0,0 +1,11 @@
|
||||
" 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',
|
||||
\})
|
||||
|
||||
@@ -1,24 +1,27 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: gcc for Fortran files
|
||||
|
||||
if exists('g:loaded_ale_linters_fortran_gcc')
|
||||
finish
|
||||
" This option can be set to 0 to use -ffixed-form
|
||||
if !exists('g:ale_fortran_gcc_use_free_form')
|
||||
let g:ale_fortran_gcc_use_free_form = 1
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_fortran_gcc = 1
|
||||
if !exists('g:ale_fortran_gcc_executable')
|
||||
let g:ale_fortran_gcc_executable = 'gcc'
|
||||
endif
|
||||
|
||||
" Set this option to change the GCC options for warnings for Fortran.
|
||||
if !exists('g:ale_fortran_gcc_options')
|
||||
let g:ale_fortran_gcc_options = '-Wall'
|
||||
endif
|
||||
|
||||
function! ale_linters#fortran#gcc#Handle(buffer, lines)
|
||||
function! ale_linters#fortran#gcc#Handle(buffer, lines) abort
|
||||
" We have to match a starting line and a later ending line together,
|
||||
" like so.
|
||||
"
|
||||
" :21.34:
|
||||
" Error: Expected comma in I/O list at (1)
|
||||
let l:line_marker_pattern = '^:\(\d\+\)\.\(\d\+\):$'
|
||||
let l:line_marker_pattern = ':\(\d\+\)[.:]\=\(\d\+\)\=:\=$'
|
||||
let l:message_pattern = '^\(Error\|Warning\): \(.\+\)$'
|
||||
let l:looking_for_message = 0
|
||||
let l:last_loclist_obj = {}
|
||||
@@ -47,9 +50,7 @@ function! ale_linters#fortran#gcc#Handle(buffer, lines)
|
||||
let l:last_loclist_obj = {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'nr': -1,
|
||||
\}
|
||||
|
||||
" Start looking for the message and error type.
|
||||
@@ -60,12 +61,26 @@ function! ale_linters#fortran#gcc#Handle(buffer, lines)
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#fortran#gcc#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'fortran_gcc_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#fortran#gcc#GetCommand(buffer) abort
|
||||
let l:layout_option = ale#Var(a:buffer, 'fortran_gcc_use_free_form')
|
||||
\ ? '-ffree-form'
|
||||
\ : '-ffixed-form'
|
||||
|
||||
return ale_linters#fortran#gcc#GetExecutable(a:buffer)
|
||||
\ . ' -S -x f95 -fsyntax-only '
|
||||
\ . l:layout_option . ' '
|
||||
\ . ale#Var(a:buffer, 'fortran_gcc_options') . ' '
|
||||
\ . '-'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('fortran', {
|
||||
\ 'name': 'gcc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'gcc',
|
||||
\ 'command': 'gcc -S -x f95 -fsyntax-only -ffree-form '
|
||||
\ . g:ale_fortran_gcc_options
|
||||
\ . ' -',
|
||||
\ 'executable_callback': 'ale_linters#fortran#gcc#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#fortran#gcc#GetCommand',
|
||||
\ 'callback': 'ale_linters#fortran#gcc#Handle',
|
||||
\})
|
||||
|
||||
70
ale_linters/go/gobuild.vim
Normal file
70
ale_linters/go/gobuild.vim
Normal file
@@ -0,0 +1,70 @@
|
||||
" Author: Joshua Rubin <joshua@rubixconsulting.com>, Ben Reedy <https://github.com/breed808>
|
||||
" Description: go build for Go files
|
||||
|
||||
" inspired by work from dzhou121 <dzhou121@gmail.com>
|
||||
|
||||
function! ale_linters#go#gobuild#GoEnv(buffer) abort
|
||||
if exists('s:go_env')
|
||||
return ''
|
||||
endif
|
||||
|
||||
return 'go env GOPATH GOROOT'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gobuild#GetCommand(buffer, goenv_output) abort
|
||||
if !exists('s:go_env')
|
||||
let s:go_env = {
|
||||
\ 'GOPATH': a:goenv_output[0],
|
||||
\ 'GOROOT': a:goenv_output[1],
|
||||
\}
|
||||
endif
|
||||
|
||||
" Run go test in local directory with relative path
|
||||
return 'GOPATH=' . s:go_env.GOPATH
|
||||
\ . ' cd ' . fnamemodify(bufname(a:buffer), ':.:h')
|
||||
\ . ' && go test -c -o /dev/null ./'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gobuild#GetMatches(lines) abort
|
||||
" Matches patterns like the following:
|
||||
"
|
||||
" file.go:27: missing argument for Printf("%s"): format reads arg 2, have only 1 args
|
||||
" file.go:53:10: if block ends with a return statement, so drop this else and outdent its block (move short variable declaration to its own line if necessary)
|
||||
" file.go:5:2: expected declaration, found 'STRING' "log"
|
||||
|
||||
" go test returns relative paths so use tail of filename as part of pattern matcher
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:? (.+)$'
|
||||
|
||||
return ale#util#GetMatches(a:lines, l:pattern)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gobuild#Handler(buffer, lines) abort
|
||||
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, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[4],
|
||||
\ 'type': 'E',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'go build',
|
||||
\ 'executable': 'go',
|
||||
\ 'command_chain': [
|
||||
\ {'callback': 'ale_linters#go#gobuild#GoEnv', 'output_stream': 'stdout'},
|
||||
\ {'callback': 'ale_linters#go#gobuild#GetCommand', 'output_stream': 'stderr'},
|
||||
\ ],
|
||||
\ 'callback': 'ale_linters#go#gobuild#Handler',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
@@ -1,17 +1,10 @@
|
||||
" Author: neersighted <bjorn@neersighted.com>
|
||||
" Description: gofmt for Go files
|
||||
|
||||
if exists('g:loaded_ale_linters_go_gofmt')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_go_gofmt = 1
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'gofmt',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'gofmt',
|
||||
\ 'command': g:ale#util#stdin_wrapper . ' .go gofmt -e',
|
||||
\ 'callback': 'ale#handlers#HandleUnixFormatAsError',
|
||||
\ 'command': 'gofmt -e %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsError',
|
||||
\})
|
||||
|
||||
|
||||
@@ -1,15 +1,9 @@
|
||||
" Author: neersighted <bjorn@neersighted.com>
|
||||
" Description: golint for Go files
|
||||
|
||||
if exists('g:loaded_ale_linters_go_golint')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_go_golint = 1
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'golint',
|
||||
\ 'executable': 'golint',
|
||||
\ 'command': g:ale#util#stdin_wrapper . ' .go golint',
|
||||
\ 'callback': 'ale#handlers#HandleUnixFormatAsWarning',
|
||||
\ 'command': 'golint %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
||||
|
||||
46
ale_linters/go/gometalinter.vim
Normal file
46
ale_linters/go/gometalinter.vim
Normal file
@@ -0,0 +1,46 @@
|
||||
" Author: Ben Reedy <https://github.com/breed808>
|
||||
" Description: Adds support for the gometalinter suite for Go files
|
||||
|
||||
if !exists('g:ale_go_gometalinter_options')
|
||||
let g:ale_go_gometalinter_options = ''
|
||||
endif
|
||||
|
||||
function! ale_linters#go#gometalinter#GetCommand(buffer) abort
|
||||
return 'gometalinter '
|
||||
\ . ale#Var(a:buffer, 'go_gometalinter_options')
|
||||
\ . ' ' . shellescape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gometalinter#GetMatches(lines) abort
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:?:?(warning|error):?\s\*?(.+)$'
|
||||
|
||||
return ale#util#GetMatches(a:lines, l:pattern)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gometalinter#Handler(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale_linters#go#gometalinter#GetMatches(a:lines)
|
||||
" Omit errors from files other than the one currently open
|
||||
if !ale#path#IsBufferPath(a:buffer, l:match[1])
|
||||
continue
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': tolower(l:match[4]) ==# 'warning' ? 'W' : 'E',
|
||||
\ 'text': l:match[5],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'gometalinter',
|
||||
\ 'executable': 'gometalinter',
|
||||
\ 'command_callback': 'ale_linters#go#gometalinter#GetCommand',
|
||||
\ 'callback': 'ale_linters#go#gometalinter#Handler',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
9
ale_linters/go/gosimple.vim
Normal file
9
ale_linters/go/gosimple.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: Ben Reedy <https://github.com/breed808>
|
||||
" Description: gosimple for Go files
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'gosimple',
|
||||
\ 'executable': 'gosimple',
|
||||
\ 'command': 'gosimple %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
||||
@@ -1,17 +1,10 @@
|
||||
" Author: neersighted <bjorn@neersighted.com>
|
||||
" Description: go vet for Go files
|
||||
|
||||
if exists('g:loaded_ale_linters_go_govet')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_go_govet = 1
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'go vet',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'go',
|
||||
\ 'command': g:ale#util#stdin_wrapper . ' .go go vet',
|
||||
\ 'callback': 'ale#handlers#HandleUnixFormatAsError',
|
||||
\ 'command': 'go vet %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsError',
|
||||
\})
|
||||
|
||||
|
||||
9
ale_linters/go/staticcheck.vim
Normal file
9
ale_linters/go/staticcheck.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: Ben Reedy <https://github.com/breed808>
|
||||
" Description: staticcheck for Go files
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'staticcheck',
|
||||
\ 'executable': 'staticcheck',
|
||||
\ 'command': 'staticcheck %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
||||
26
ale_linters/haml/hamllint.vim
Normal file
26
ale_linters/haml/hamllint.vim
Normal file
@@ -0,0 +1,26 @@
|
||||
" Author: Patrick Lewis - https://github.com/patricklewis
|
||||
" Description: haml-lint for Haml files
|
||||
|
||||
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.
|
||||
let l:pattern = '\v^.*:(\d+) \[([EW])\] (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'type': l:match[2],
|
||||
\ 'text': l:match[3]
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('haml', {
|
||||
\ 'name': 'hamllint',
|
||||
\ 'executable': 'haml-lint',
|
||||
\ 'command': 'haml-lint %t',
|
||||
\ 'callback': 'ale_linters#haml#hamllint#Handle'
|
||||
\})
|
||||
65
ale_linters/handlebars/embertemplatelint.vim
Normal file
65
ale_linters/handlebars/embertemplatelint.vim
Normal file
@@ -0,0 +1,65 @@
|
||||
" Author: Adrian Zalewski <aazalewski@hotmail.com>
|
||||
" Description: Ember-template-lint for checking Handlebars files
|
||||
|
||||
let g:ale_handlebars_embertemplatelint_executable =
|
||||
\ get(g:, 'ale_handlebars_embertemplatelint_executable', 'ember-template-lint')
|
||||
|
||||
let g:ale_handlebars_embertemplatelint_use_global =
|
||||
\ get(g:, 'ale_handlebars_embertemplatelint_use_global', 0)
|
||||
|
||||
function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort
|
||||
if ale#Var(a:buffer, 'handlebars_embertemplatelint_use_global')
|
||||
return ale#Var(a:buffer, 'handlebars_embertemplatelint_executable')
|
||||
endif
|
||||
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/ember-template-lint',
|
||||
\ ale#Var(a:buffer, 'handlebars_embertemplatelint_executable')
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#handlebars#embertemplatelint#GetCommand(buffer) abort
|
||||
return ale_linters#handlebars#embertemplatelint#GetExecutable(a:buffer)
|
||||
\ . ' --json %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#handlebars#embertemplatelint#Handle(buffer, lines) abort
|
||||
if len(a:lines) == 0
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:output = []
|
||||
|
||||
let l:input_json = json_decode(join(a:lines, ''))
|
||||
let l:file_errors = values(l:input_json)[0]
|
||||
|
||||
for l:error in l:file_errors
|
||||
if has_key(l:error, 'fatal')
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': 1,
|
||||
\ 'col': 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,
|
||||
\ 'type': l:error.severity == 1 ? 'W' : 'E',
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('handlebars', {
|
||||
\ 'name': 'ember-template-lint',
|
||||
\ 'executable_callback': 'ale_linters#handlebars#embertemplatelint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#handlebars#embertemplatelint#GetCommand',
|
||||
\ 'callback': 'ale_linters#handlebars#embertemplatelint#Handle',
|
||||
\})
|
||||
@@ -1,24 +1,18 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: ghc for Haskell files
|
||||
|
||||
if exists('g:loaded_ale_linters_haskell_ghc')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_haskell_ghc = 1
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'ghc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'ghc',
|
||||
\ 'command': g:ale#util#stdin_wrapper . ' .hs ghc -fno-code -v0',
|
||||
\ 'callback': 'ale#handlers#HandleUnixFormatAsError',
|
||||
\ 'command': 'ghc -fno-code -v0 %t',
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'stack-ghc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'stack',
|
||||
\ 'command': g:ale#util#stdin_wrapper . ' .hs stack ghc -- -fno-code -v0',
|
||||
\ 'callback': 'ale#handlers#HandleUnixFormatAsError',
|
||||
\ 'command': 'stack ghc -- -fno-code -v0 %t',
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
||||
|
||||
9
ale_linters/haskell/hdevtools.vim
Normal file
9
ale_linters/haskell/hdevtools.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: rob-b
|
||||
" Description: hdevtools for Haskell files
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'hdevtools',
|
||||
\ 'executable': 'hdevtools',
|
||||
\ 'command': 'hdevtools check -g -Wall -p %s %t',
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
||||
@@ -1,25 +1,17 @@
|
||||
" Author: jparoz <jesse.paroz@gmail.com>
|
||||
" Description: hlint for Haskell files
|
||||
|
||||
if exists('g:loaded_ale_linters_haskell_hlint')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_haskell_hlint = 1
|
||||
|
||||
function! ale_linters#haskell#hlint#Handle(buffer, lines)
|
||||
function! ale_linters#haskell#hlint#Handle(buffer, lines) abort
|
||||
let l:errors = json_decode(join(a:lines, ''))
|
||||
|
||||
let l:output = []
|
||||
|
||||
for l:error in l:errors
|
||||
" vcol is Needed to indicate that the column is a character.
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:error.startLine + 0,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': l:error.startColumn + 0,
|
||||
\ 'text': l:error.severity . ': ' . l:error.hint,
|
||||
\ 'text': l:error.severity . ': ' . l:error.hint . '. Found: ' . l:error.from . ' Why not: ' . l:error.to,
|
||||
\ 'type': l:error.severity ==# 'Error' ? 'E' : 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
9
ale_linters/help/proselint.vim
Normal file
9
ale_linters/help/proselint.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: Daniel M. Capella https://github.com/polyzen
|
||||
" Description: proselint for Vim help files
|
||||
|
||||
call ale#linter#Define('help', {
|
||||
\ 'name': 'proselint',
|
||||
\ 'executable': 'proselint',
|
||||
\ 'command': 'proselint %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
||||
@@ -1,15 +1,32 @@
|
||||
" Author: KabbAmine <amine.kabb@gmail.com>
|
||||
" Author: KabbAmine <amine.kabb@gmail.com>, deathmaz <00maz1987@gmail.com>, diartyz <diartyz@gmail.com>
|
||||
" Description: HTMLHint for checking html files
|
||||
|
||||
if exists('g:loaded_ale_linters_html_htmlhint')
|
||||
finish
|
||||
endif
|
||||
" CLI options
|
||||
let g:ale_html_htmlhint_options = get(g:, 'ale_html_htmlhint_options', '--format=unix')
|
||||
let g:ale_html_htmlhint_executable = get(g:, 'ale_html_htmlhint_executable', 'htmlhint')
|
||||
let g:ale_html_htmlhint_use_global = get(g:, 'ale_html_htmlhint_use_global', 0)
|
||||
|
||||
let g:loaded_ale_linters_html_htmlhint = 1
|
||||
function! ale_linters#html#htmlhint#GetExecutable(buffer) abort
|
||||
if ale#Var(a:buffer, 'html_htmlhint_use_global')
|
||||
return ale#Var(a:buffer, 'html_htmlhint_executable')
|
||||
endif
|
||||
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/htmlhint',
|
||||
\ ale#Var(a:buffer, 'html_htmlhint_executable')
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#html#htmlhint#GetCommand(buffer) abort
|
||||
return ale_linters#html#htmlhint#GetExecutable(a:buffer)
|
||||
\ . ' ' . ale#Var(a:buffer, 'html_htmlhint_options')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('html', {
|
||||
\ 'name': 'htmlhint',
|
||||
\ 'executable': 'htmlhint',
|
||||
\ 'command': 'htmlhint --format=unix stdin',
|
||||
\ 'callback': 'ale#handlers#HandleUnixFormatAsError',
|
||||
\ 'executable_callback': 'ale_linters#html#htmlhint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#html#htmlhint#GetCommand',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsError',
|
||||
\})
|
||||
|
||||
9
ale_linters/html/proselint.vim
Normal file
9
ale_linters/html/proselint.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: Daniel M. Capella https://github.com/polyzen
|
||||
" Description: proselint for HTML files
|
||||
|
||||
call ale#linter#Define('html', {
|
||||
\ 'name': 'proselint',
|
||||
\ 'executable': 'proselint',
|
||||
\ 'command': 'proselint %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
||||
@@ -1,15 +1,11 @@
|
||||
" Author: KabbAmine <amine.kabb@gmail.com>
|
||||
" Description: This file adds support for checking HTML code with tidy.
|
||||
|
||||
if exists('g:loaded_ale_linters_html_tidy')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_html_tidy = 1
|
||||
|
||||
" CLI options
|
||||
let g:ale_html_tidy_executable = get(g:, 'ale_html_tidy_executable', 'tidy')
|
||||
let g:ale_html_tidy_args = get(g:, 'ale_html_tidy_args', '-q -e -language en')
|
||||
" Look for the old _args variable first.
|
||||
let s:default_options = get(g:, 'ale_html_tidy_args', '-q -e -language en')
|
||||
let g:ale_html_tidy_options = get(g:, 'ale_html_tidy_options', s:default_options)
|
||||
|
||||
function! ale_linters#html#tidy#GetCommand(buffer) abort
|
||||
" Specify file encoding in options
|
||||
@@ -30,10 +26,14 @@ function! ale_linters#html#tidy#GetCommand(buffer) abort
|
||||
\ }, &fileencoding, '-utf8')
|
||||
|
||||
return printf('%s %s %s -',
|
||||
\ g:ale_html_tidy_executable,
|
||||
\ g:ale_html_tidy_args,
|
||||
\ ale#Var(a:buffer, 'html_tidy_executable'),
|
||||
\ ale#Var(a:buffer, 'html_tidy_options'),
|
||||
\ l:file_encoding
|
||||
\ )
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#html#tidy#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'html_tidy_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#html#tidy#Handle(buffer, lines) abort
|
||||
@@ -43,27 +43,17 @@ function! ale_linters#html#tidy#Handle(buffer, lines) abort
|
||||
let l:pattern = '^line \(\d\+\) column \(\d\+\) - \(Warning\|Error\): \(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
continue
|
||||
endif
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:line = l:match[1] + 0
|
||||
let l:col = l:match[2] + 0
|
||||
let l:type = l:match[3] ==# 'Error' ? 'E' : 'W'
|
||||
let l:text = l:match[4]
|
||||
|
||||
" vcol is Needed to indicate that the column is a character.
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:line,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': l:col,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type,
|
||||
\ 'nr': -1,
|
||||
\})
|
||||
endfor
|
||||
|
||||
@@ -72,7 +62,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('html', {
|
||||
\ 'name': 'tidy',
|
||||
\ 'executable': g:ale_html_tidy_executable,
|
||||
\ 'executable_callback': 'ale_linters#html#tidy#GetExecutable',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command_callback': 'ale_linters#html#tidy#GetCommand',
|
||||
\ 'callback': 'ale_linters#html#tidy#Handle',
|
||||
|
||||
117
ale_linters/java/javac.vim
Normal file
117
ale_linters/java/javac.vim
Normal file
@@ -0,0 +1,117 @@
|
||||
" Author: farenjihn <farenjihn@gmail.com>, w0rp <devw0rp@gmail.com>
|
||||
" Description: Lints java files using javac
|
||||
|
||||
let s:classpath_sep = has('unix') ? ':' : ';'
|
||||
|
||||
let g:ale_java_javac_options = get(g:, 'ale_java_javac_options', '')
|
||||
let g:ale_java_javac_classpath = get(g:, 'ale_java_javac_classpath', '')
|
||||
|
||||
" Detect if the javac command just shows an annoying popup for Mac OSX.
|
||||
if has('macunix')
|
||||
function s:GetIsJavacAnAppStoreStub() abort
|
||||
let l:path = resolve(systemlist('which javac')[0])
|
||||
|
||||
for l:line in readfile(l:path)
|
||||
" This string is present inside the executable for the popup.
|
||||
if l:line =~? 'No Java runtime present'
|
||||
return 1
|
||||
endif
|
||||
endfor
|
||||
|
||||
return 0
|
||||
endfunction
|
||||
|
||||
let s:is_javac_an_app_store_stub = s:GetIsJavacAnAppStoreStub()
|
||||
delfunction s:GetIsJavacAnAppStoreStub
|
||||
else
|
||||
let s:is_javac_an_app_store_stub = 0
|
||||
endif
|
||||
|
||||
function! ale_linters#java#javac#GetImportPaths(buffer) abort
|
||||
let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml')
|
||||
|
||||
if !empty(l:pom_path) && executable('mvn')
|
||||
return ale#path#CdString(fnamemodify(l:pom_path, ':h'))
|
||||
\ . 'mvn dependency:build-classpath'
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! s:BuildClassPathOption(buffer, import_paths) abort
|
||||
" Filter out lines like [INFO], etc.
|
||||
let l:class_paths = filter(a:import_paths[:], 'v:val !~# ''[''')
|
||||
call extend(
|
||||
\ l:class_paths,
|
||||
\ split(ale#Var(a:buffer, 'java_javac_classpath'), s:classpath_sep),
|
||||
\)
|
||||
|
||||
return !empty(l:class_paths)
|
||||
\ ? '-cp ' . shellescape(join(l:class_paths, s:classpath_sep))
|
||||
\ : ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort
|
||||
" If running the command will just show a popup, then don't run it.
|
||||
if s:is_javac_an_app_store_stub
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:cp_option = s:BuildClassPathOption(a:buffer, a:import_paths)
|
||||
let l:sp_option = ''
|
||||
|
||||
" Find the src directory, for files in this project.
|
||||
let l:src_dir = ale#path#FindNearestDirectory(a:buffer, 'src/main/java')
|
||||
|
||||
if !empty(l:src_dir)
|
||||
let l:sp_option = '-sourcepath ' . shellescape(l:src_dir)
|
||||
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'
|
||||
\ . ' ' . l:cp_option
|
||||
\ . ' ' . l:sp_option
|
||||
\ . ' -d ' . shellescape(l:class_file_directory)
|
||||
\ . ' ' . ale#Var(a:buffer, 'java_javac_options')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#java#javac#Handle(buffer, lines) abort
|
||||
" Look for lines like the following.
|
||||
"
|
||||
" Main.java:13: warning: [deprecation] donaught() in Testclass has been deprecated
|
||||
" Main.java:16: error: ';' expected
|
||||
|
||||
let l:pattern = '\v^.*:(\d+): (.+):(.+)$'
|
||||
let l:symbol_pattern = '\v^ +symbol: *(class|method) +([^ ]+)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, [l:pattern, l:symbol_pattern])
|
||||
if empty(l:match[3])
|
||||
" Add symbols to 'cannot find symbol' errors.
|
||||
if l:output[-1].text ==# 'error: cannot find symbol'
|
||||
let l:output[-1].text .= ': ' . l:match[2]
|
||||
endif
|
||||
else
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'text': l:match[2] . ':' . l:match[3],
|
||||
\ 'type': l:match[2] ==# 'error' ? 'E' : 'W',
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('java', {
|
||||
\ 'name': 'javac',
|
||||
\ 'executable': 'javac',
|
||||
\ 'command_chain': [
|
||||
\ {'callback': 'ale_linters#java#javac#GetImportPaths', 'output_stream': 'stdout'},
|
||||
\ {'callback': 'ale_linters#java#javac#GetCommand', 'output_stream': 'stderr'},
|
||||
\ ],
|
||||
\ 'callback': 'ale_linters#java#javac#Handle',
|
||||
\})
|
||||
@@ -1,48 +1,88 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: eslint for JavaScript files
|
||||
|
||||
if exists('g:loaded_ale_linters_javascript_eslint')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_javascript_eslint = 1
|
||||
|
||||
let g:ale_javascript_eslint_executable =
|
||||
\ get(g:, 'ale_javascript_eslint_executable', 'eslint')
|
||||
|
||||
function! ale_linters#javascript#eslint#Handle(buffer, lines)
|
||||
let g:ale_javascript_eslint_options =
|
||||
\ get(g:, 'ale_javascript_eslint_options', '')
|
||||
|
||||
let g:ale_javascript_eslint_use_global =
|
||||
\ get(g:, 'ale_javascript_eslint_use_global', 0)
|
||||
|
||||
function! ale_linters#javascript#eslint#GetExecutable(buffer) abort
|
||||
if ale#Var(a:buffer, 'javascript_eslint_use_global')
|
||||
return ale#Var(a:buffer, 'javascript_eslint_executable')
|
||||
endif
|
||||
|
||||
" Look for the kinds of paths that create-react-app generates first.
|
||||
let l:executable = ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/eslint/bin/eslint.js',
|
||||
\ ''
|
||||
\)
|
||||
|
||||
if !empty(l:executable)
|
||||
return l:executable
|
||||
endif
|
||||
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/eslint',
|
||||
\ ale#Var(a:buffer, 'javascript_eslint_executable')
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#eslint#GetCommand(buffer) abort
|
||||
return shellescape(ale_linters#javascript#eslint#GetExecutable(a:buffer))
|
||||
\ . ' ' . ale#Var(a:buffer, 'javascript_eslint_options')
|
||||
\ . ' -f unix --stdin --stdin-filename %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#eslint#Handle(buffer, lines) abort
|
||||
let l:config_error_pattern = '\v^ESLint couldn''t find a configuration file'
|
||||
\ . '|^Cannot read config file'
|
||||
\ . '|^.*Configuration for rule .* is invalid'
|
||||
|
||||
" Look for a message in the first few lines which indicates that
|
||||
" a configuration file couldn't be found.
|
||||
for l:line in a:lines[:10]
|
||||
if len(matchlist(l:line, l:config_error_pattern)) > 0
|
||||
return [{
|
||||
\ 'lnum': 1,
|
||||
\ 'text': 'eslint configuration error (type :ALEDetail for more information)',
|
||||
\ 'detail': join(a:lines, "\n"),
|
||||
\}]
|
||||
endif
|
||||
endfor
|
||||
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" /path/to/some-filename.js:47:14: Missing trailing comma. [Warning/comma-dangle]
|
||||
" /path/to/some-filename.js:56:41: Missing semicolon. [Error/semi]
|
||||
let l:pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) \[\(.\+\)\]$'
|
||||
" This second pattern matches lines like the following:
|
||||
"
|
||||
" /path/to/some-filename.js:13:3: Parsing error: Unexpected token
|
||||
let l:parsing_pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
continue
|
||||
endif
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, [l:pattern, l:parsing_pattern])
|
||||
let l:type = 'Error'
|
||||
let l:text = l:match[3]
|
||||
let l:marker = l:match[4]
|
||||
let l:marker_parts = split(l:marker, '/')
|
||||
let l:type = l:marker_parts[0]
|
||||
|
||||
if len(l:marker_parts) == 2
|
||||
let l:text = l:text . ' (' . l:marker_parts[1] . ')'
|
||||
" Take the error type from the output if available.
|
||||
if !empty(l:match[4])
|
||||
let l:type = split(l:match[4], '/')[0]
|
||||
let l:text .= ' [' . l:match[4] . ']'
|
||||
endif
|
||||
|
||||
" vcol is Needed to indicate that the column is a character.
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type ==# 'Warning' ? 'W' : 'E',
|
||||
\ 'nr': -1,
|
||||
\})
|
||||
endfor
|
||||
|
||||
@@ -51,7 +91,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('javascript', {
|
||||
\ 'name': 'eslint',
|
||||
\ 'executable': g:ale_javascript_eslint_executable,
|
||||
\ 'command': g:ale_javascript_eslint_executable . ' -f unix --stdin --stdin-filename %s',
|
||||
\ 'executable_callback': 'ale_linters#javascript#eslint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#javascript#eslint#GetCommand',
|
||||
\ 'callback': 'ale_linters#javascript#eslint#Handle',
|
||||
\})
|
||||
|
||||
86
ale_linters/javascript/flow.vim
Normal file
86
ale_linters/javascript/flow.vim
Normal file
@@ -0,0 +1,86 @@
|
||||
" Author: Zach Perrault -- @zperrault
|
||||
" Description: FlowType checking for JavaScript files
|
||||
|
||||
let g:ale_javascript_flow_executable =
|
||||
\ get(g:, 'ale_javascript_flow_executable', 'flow')
|
||||
|
||||
let g:ale_javascript_flow_use_global =
|
||||
\ get(g:, 'ale_javascript_flow_use_global', 0)
|
||||
|
||||
function! ale_linters#javascript#flow#GetExecutable(buffer) abort
|
||||
if ale#Var(a:buffer, 'javascript_flow_use_global')
|
||||
return ale#Var(a:buffer, 'javascript_flow_executable')
|
||||
endif
|
||||
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/flow',
|
||||
\ ale#Var(a:buffer, 'javascript_flow_executable')
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#flow#GetCommand(buffer) abort
|
||||
let l:flow_config = ale#path#FindNearestFile(a:buffer, '.flowconfig')
|
||||
|
||||
if empty(l:flow_config)
|
||||
" Don't run Flow if we can't find a .flowconfig file.
|
||||
return ''
|
||||
endif
|
||||
|
||||
return shellescape(ale_linters#javascript#flow#GetExecutable(a:buffer))
|
||||
\ . ' check-contents --respect-pragma --json --from ale %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#flow#Handle(buffer, lines) abort
|
||||
let l:str = join(a:lines, '')
|
||||
|
||||
if l:str ==# ''
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:flow_output = json_decode(l:str)
|
||||
let l:output = []
|
||||
|
||||
for l:error in get(l:flow_output, 'errors', [])
|
||||
" Each error is broken up into parts
|
||||
let l:text = ''
|
||||
let l:line = 0
|
||||
let l:col = 0
|
||||
|
||||
for l:message in l:error.message
|
||||
" Comments have no line of column information, so we skip them.
|
||||
" In certain cases, `l:message.loc.source` points to a different path
|
||||
" than the buffer one, thus we skip this loc information too.
|
||||
if has_key(l:message, 'loc') && l:line ==# 0 && l:message.loc.source ==# expand('#' . a:buffer . ':p')
|
||||
let l:line = l:message.loc.start.line + 0
|
||||
let l:col = l:message.loc.start.column + 0
|
||||
endif
|
||||
|
||||
if l:text ==# ''
|
||||
let l:text = l:message.descr . ':'
|
||||
else
|
||||
let l:text = l:text . ' ' . l:message.descr
|
||||
endif
|
||||
endfor
|
||||
|
||||
if has_key(l:error, 'operation')
|
||||
let l:text = l:text . ' See also: ' . l:error.operation.descr
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:line,
|
||||
\ 'col': l:col,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:error.level ==# 'error' ? 'E' : 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('javascript', {
|
||||
\ 'name': 'flow',
|
||||
\ 'executable_callback': 'ale_linters#javascript#flow#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#javascript#flow#GetCommand',
|
||||
\ 'callback': 'ale_linters#javascript#flow#Handle',
|
||||
\})
|
||||
@@ -1,15 +1,9 @@
|
||||
" Author: Chris Kyrouac - https://github.com/fijshion
|
||||
" Description: jscs for JavaScript files
|
||||
|
||||
if exists('g:loaded_ale_linters_javascript_jscs')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_javascript_jscs = 1
|
||||
|
||||
call ale#linter#Define('javascript', {
|
||||
\ 'name': 'jscs',
|
||||
\ 'executable': 'jscs',
|
||||
\ 'command': 'jscs -r unix -n -',
|
||||
\ 'callback': 'ale#handlers#HandleUnixFormatAsError',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsError',
|
||||
\})
|
||||
|
||||
@@ -1,29 +1,37 @@
|
||||
" Author: Chris Kyrouac - https://github.com/fijshion
|
||||
" Description: JSHint for Javascript files
|
||||
|
||||
if exists('g:loaded_ale_linters_javascript_jshint')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_javascript_jshint = 1
|
||||
|
||||
let g:ale_javascript_jshint_executable =
|
||||
\ get(g:, 'ale_javascript_jshint_executable', 'jshint')
|
||||
|
||||
function! ale_linters#javascript#jshint#GetCommand(buffer)
|
||||
" Set this to the location of the jshint configuration file to
|
||||
" use a fixed location for .jshintrc
|
||||
if exists('g:ale_jshint_config_loc')
|
||||
let l:jshint_config = g:ale_jshint_config_loc
|
||||
else
|
||||
" Look for the JSHint config in parent directories.
|
||||
let l:jshint_config = ale#util#FindNearestFile(a:buffer, '.jshintrc')
|
||||
let g:ale_javascript_jshint_use_global =
|
||||
\ get(g:, 'ale_javascript_jshint_use_global', 0)
|
||||
|
||||
function! ale_linters#javascript#jshint#GetExecutable(buffer) abort
|
||||
if ale#Var(a:buffer, 'javascript_jshint_use_global')
|
||||
return ale#Var(a:buffer, 'javascript_jshint_executable')
|
||||
endif
|
||||
|
||||
let l:command = g:ale_javascript_jshint_executable . ' --reporter unix'
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/jshint',
|
||||
\ ale#Var(a:buffer, 'javascript_jshint_executable')
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#jshint#GetCommand(buffer) abort
|
||||
" Search for a local JShint config locaation, and default to a global one.
|
||||
let l:jshint_config = ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ '.jshintrc',
|
||||
\ get(g:, 'ale_jshint_config_loc', '')
|
||||
\)
|
||||
|
||||
let l:command = shellescape(ale_linters#javascript#jshint#GetExecutable(a:buffer))
|
||||
let l:command .= ' --reporter unix --extract auto'
|
||||
|
||||
if !empty(l:jshint_config)
|
||||
let l:command .= ' --config ' . fnameescape(l:jshint_config)
|
||||
let l:command .= ' --config ' . shellescape(l:jshint_config)
|
||||
endif
|
||||
|
||||
let l:command .= ' -'
|
||||
@@ -33,7 +41,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('javascript', {
|
||||
\ 'name': 'jshint',
|
||||
\ 'executable': g:ale_javascript_jshint_executable,
|
||||
\ 'executable_callback': 'ale_linters#javascript#jshint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#javascript#jshint#GetCommand',
|
||||
\ 'callback': 'ale#handlers#HandleUnixFormatAsError',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsError',
|
||||
\})
|
||||
|
||||
62
ale_linters/javascript/standard.vim
Normal file
62
ale_linters/javascript/standard.vim
Normal file
@@ -0,0 +1,62 @@
|
||||
" Author: Ahmed El Gabri <@ahmedelgabri>
|
||||
" Description: standardjs for JavaScript files
|
||||
|
||||
let g:ale_javascript_standard_executable =
|
||||
\ get(g:, 'ale_javascript_standard_executable', 'standard')
|
||||
|
||||
let g:ale_javascript_standard_options =
|
||||
\ get(g:, 'ale_javascript_standard_options', '')
|
||||
|
||||
let g:ale_javascript_standard_use_global =
|
||||
\ get(g:, 'ale_javascript_standard_use_global', 0)
|
||||
|
||||
function! ale_linters#javascript#standard#GetExecutable(buffer) abort
|
||||
if ale#Var(a:buffer, 'javascript_standard_use_global')
|
||||
return ale#Var(a:buffer, 'javascript_standard_executable')
|
||||
endif
|
||||
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/standard',
|
||||
\ ale#Var(a:buffer, 'javascript_standard_executable')
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#standard#GetCommand(buffer) abort
|
||||
return shellescape(ale_linters#javascript#standard#GetExecutable(a:buffer))
|
||||
\ . ' ' . ale#Var(a:buffer, 'javascript_standard_options')
|
||||
\ . ' --stdin %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#standard#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" /path/to/some-filename.js:47:14: Strings must use singlequote.
|
||||
" /path/to/some-filename.js:56:41: Expected indentation of 2 spaces but found 4.
|
||||
" /path/to/some-filename.js:13:3: Parsing error: Unexpected token
|
||||
let l:pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:type = 'Error'
|
||||
let l:text = l:match[3]
|
||||
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:text,
|
||||
\ 'type': 'E',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('javascript', {
|
||||
\ 'name': 'standard',
|
||||
\ 'executable_callback': 'ale_linters#javascript#standard#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#javascript#standard#GetCommand',
|
||||
\ 'callback': 'ale_linters#javascript#standard#Handle',
|
||||
\})
|
||||
|
||||
41
ale_linters/javascript/xo.vim
Normal file
41
ale_linters/javascript/xo.vim
Normal file
@@ -0,0 +1,41 @@
|
||||
" Author: Daniel Lupu <lupu.daniel.f@gmail.com>
|
||||
" Description: xo for JavaScript files
|
||||
|
||||
let g:ale_javascript_xo_executable =
|
||||
\ get(g:, 'ale_javascript_xo_executable', 'xo')
|
||||
|
||||
let g:ale_javascript_xo_options =
|
||||
\ get(g:, 'ale_javascript_xo_options', '')
|
||||
|
||||
let g:ale_javascript_xo_use_global =
|
||||
\ get(g:, 'ale_javascript_xo_use_global', 0)
|
||||
|
||||
function! ale_linters#javascript#xo#GetExecutable(buffer) abort
|
||||
if ale#Var(a:buffer, 'javascript_xo_use_global')
|
||||
return ale#Var(a:buffer, 'javascript_xo_executable')
|
||||
endif
|
||||
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/xo',
|
||||
\ ale#Var(a:buffer, 'javascript_xo_executable')
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#xo#GetCommand(buffer) abort
|
||||
return shellescape(ale_linters#javascript#xo#GetExecutable(a:buffer))
|
||||
\ . ' ' . ale#Var(a:buffer, 'javascript_xo_options')
|
||||
\ . ' --reporter unix --stdin --stdin-filename %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#xo#Handle(buffer, lines) abort
|
||||
" xo uses eslint and the output format is the same
|
||||
return ale_linters#javascript#eslint#Handle(a:buffer, a:lines)
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('javascript', {
|
||||
\ 'name': 'xo',
|
||||
\ 'executable_callback': 'ale_linters#javascript#xo#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#javascript#xo#GetCommand',
|
||||
\ 'callback': 'ale_linters#javascript#xo#Handle',
|
||||
\})
|
||||
@@ -1,34 +1,17 @@
|
||||
" Author: KabbAmine <amine.kabb@gmail.com>
|
||||
|
||||
if exists('g:loaded_ale_linters_json_jsonlint')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_json_jsonlint = 1
|
||||
|
||||
function! ale_linters#json#jsonlint#Handle(buffer, lines)
|
||||
function! ale_linters#json#jsonlint#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
" line 2, col 15, found: 'STRING' - expected: 'EOF', '}', ',', ']'.
|
||||
|
||||
let l:pattern = '^line \(\d\+\), col \(\d*\), \(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
continue
|
||||
endif
|
||||
|
||||
" vcol is needed to indicate that the column is a character
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[3],
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
||||
116
ale_linters/kotlin/kotlinc.vim
Normal file
116
ale_linters/kotlin/kotlinc.vim
Normal file
@@ -0,0 +1,116 @@
|
||||
" Author: Francis Agyapong <francisgyapong2@gmail.com>
|
||||
" Description: A linter for the Kotlin programming language that uses kotlinc
|
||||
|
||||
let g:ale_kotlin_kotlinc_options = get(g:, 'ale_kotlin_kotlinc_options', '')
|
||||
let g:ale_kotlin_kotlinc_enable_config = get(g:, 'ale_kotlin_kotlinc_enable_config', 0)
|
||||
let g:ale_kotlin_kotlinc_config_file = get(g:, 'ale_kotlin_kotlinc_config_file', '.ale_kotlinc_config')
|
||||
let g:ale_kotlin_kotlinc_classpath = get(g:, 'ale_kotlin_kotlinc_classpath', '')
|
||||
let g:ale_kotlin_kotlinc_sourcepath = get(g:, 'ale_kotlin_kotlinc_sourcepath', '')
|
||||
let g:ale_kotlin_kotlinc_use_module_file = get(g:, 'ale_kotlin_kotlinc_use_module_file', 0)
|
||||
let g:ale_kotlin_kotlinc_module_filename = get(g:, 'ale_kotlin_kotlinc_module_filename', 'module.xml')
|
||||
|
||||
function! ale_linters#kotlin#kotlinc#GetCommand(buffer) abort
|
||||
let l:kotlinc_opts = ale#Var(a:buffer, 'kotlin_kotlinc_options')
|
||||
let l:command = 'kotlinc '
|
||||
|
||||
" If the config file is enabled and readable, source it
|
||||
if ale#Var(a:buffer, 'kotlin_kotlinc_enable_config')
|
||||
if filereadable(expand(ale#Var(a:buffer, 'kotlin_kotlinc_config_file'), 1))
|
||||
execute 'source ' . shellescape(expand(ale#Var(a:buffer, 'kotlin_kotlinc_config_file'), 1))
|
||||
endif
|
||||
endif
|
||||
|
||||
" If use module and module file is readable use that and return
|
||||
if ale#Var(a:buffer, 'kotlin_kotlinc_use_module_file')
|
||||
let l:module_filename = shellescape(expand(ale#Var(a:buffer, 'kotlin_kotlinc_module_filename'), 1))
|
||||
|
||||
if filereadable(l:module_filename)
|
||||
let l:kotlinc_opts .= ' -module ' . l:module_filename
|
||||
let l:command .= 'kotlinc ' . l:kotlinc_opts
|
||||
|
||||
return l:command
|
||||
endif
|
||||
endif
|
||||
|
||||
" We only get here if not using module or the module file not readable
|
||||
if ale#Var(a:buffer, 'kotlin_kotlinc_classpath') !=# ''
|
||||
let l:kotlinc_opts .= ' -cp ' . ale#Var(a:buffer, 'kotlin_kotlinc_classpath')
|
||||
endif
|
||||
|
||||
let l:fname = ''
|
||||
|
||||
if ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath') !=# ''
|
||||
let l:fname .= expand(ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath'), 1) . ' '
|
||||
endif
|
||||
let l:fname .= shellescape(expand('#' . a:buffer . ':p'))
|
||||
let l:command .= l:kotlinc_opts . ' ' . l:fname
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
||||
function! ale_linters#kotlin#kotlinc#Handle(buffer, lines) abort
|
||||
let l:code_pattern = '^\(.*\):\([0-9]\+\):\([0-9]\+\):\s\+\(error\|warning\):\s\+\(.*\)'
|
||||
let l:general_pattern = '^\(warning\|error\|info\):\s*\(.*\)'
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:code_pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:file = l:match[1]
|
||||
let l:line = l:match[2] + 0
|
||||
let l:column = l:match[3] + 0
|
||||
let l:type = l:match[4]
|
||||
let l:text = l:match[5]
|
||||
|
||||
let l:buf_abspath = fnamemodify(l:file, ':p')
|
||||
let l:curbuf_abspath = expand('#' . a:buffer . ':p')
|
||||
|
||||
" Skip if file is not loaded
|
||||
if l:buf_abspath !=# l:curbuf_abspath
|
||||
continue
|
||||
endif
|
||||
let l:type_marker_str = l:type ==# 'warning' ? 'W' : 'E'
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:line,
|
||||
\ 'col': l:column,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type_marker_str,
|
||||
\})
|
||||
endfor
|
||||
|
||||
" Non-code related messages
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:general_pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:type = l:match[1]
|
||||
let l:text = l:match[2]
|
||||
|
||||
let l:type_marker_str = l:type ==# 'warning' || l:type ==# 'info' ? 'W' : 'E'
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': -1,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type_marker_str,
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('kotlin', {
|
||||
\ 'name': 'kotlinc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'kotlinc',
|
||||
\ 'command_callback': 'ale_linters#kotlin#kotlinc#GetCommand',
|
||||
\ 'callback': 'ale_linters#kotlin#kotlinc#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
@@ -1,16 +1,23 @@
|
||||
" Author: Sol Bekic https://github.com/s-ol
|
||||
" Description: luacheck linter for lua files
|
||||
|
||||
if exists('g:loaded_ale_linters_lua_luacheck')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_lua_luacheck = 1
|
||||
|
||||
let g:ale_lua_luacheck_executable =
|
||||
\ get(g:, 'ale_lua_luacheck_executable', 'luacheck')
|
||||
|
||||
function! ale_linters#lua#luacheck#Handle(buffer, lines)
|
||||
let g:ale_lua_luacheck_options =
|
||||
\ get(g:, 'ale_lua_luacheck_options', '')
|
||||
|
||||
function! ale_linters#lua#luacheck#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'lua_luacheck_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#lua#luacheck#GetCommand(buffer) abort
|
||||
return shellescape(ale_linters#lua#luacheck#GetExecutable(a:buffer))
|
||||
\ . ' ' . ale#Var(a:buffer, 'lua_luacheck_options')
|
||||
\ . ' --formatter plain --codes --filename %s -'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#lua#luacheck#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" artal.lua:159:17: (W111) shadowing definition of loop variable 'i' on line 106
|
||||
@@ -18,22 +25,12 @@ function! ale_linters#lua#luacheck#Handle(buffer, lines)
|
||||
let l:pattern = '^.*:\(\d\+\):\(\d\+\): (\([WE]\)\d\+) \(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
continue
|
||||
endif
|
||||
|
||||
" vcol is Needed to indicate that the column is a character.
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[4],
|
||||
\ 'type': l:match[3],
|
||||
\ 'nr': -1,
|
||||
\})
|
||||
endfor
|
||||
|
||||
@@ -42,7 +39,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('lua', {
|
||||
\ 'name': 'luacheck',
|
||||
\ 'executable': g:ale_lua_luacheck_executable,
|
||||
\ 'command': g:ale_lua_luacheck_executable . ' --formatter plain --codes --filename %s -',
|
||||
\ 'executable_callback': 'ale_linters#lua#luacheck#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#lua#luacheck#GetCommand',
|
||||
\ 'callback': 'ale_linters#lua#luacheck#Handle',
|
||||
\})
|
||||
|
||||
25
ale_linters/markdown/mdl.vim
Normal file
25
ale_linters/markdown/mdl.vim
Normal file
@@ -0,0 +1,25 @@
|
||||
" Author: Steve Dignam <steve@dignam.xyz>
|
||||
" Description: Support for mdl, a markdown linter
|
||||
|
||||
function! ale_linters#markdown#mdl#Handle(buffer, lines) abort
|
||||
" matches: '(stdin):173: MD004 Unordered list style'
|
||||
let l:pattern = ':\(\d*\): \(.*\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'text': l:match[2],
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'mdl',
|
||||
\ 'executable': 'mdl',
|
||||
\ 'command': 'mdl',
|
||||
\ 'callback': 'ale_linters#markdown#mdl#Handle'
|
||||
\})
|
||||
9
ale_linters/markdown/proselint.vim
Normal file
9
ale_linters/markdown/proselint.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: poohzrn https://github.com/poohzrn
|
||||
" Description: proselint for Markdown files
|
||||
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'proselint',
|
||||
\ 'executable': 'proselint',
|
||||
\ 'command': 'proselint %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
||||
9
ale_linters/markdown/vale.vim
Normal file
9
ale_linters/markdown/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('markdown', {
|
||||
\ 'name': 'vale',
|
||||
\ 'executable': 'vale',
|
||||
\ 'command': 'vale --output=line %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
||||
55
ale_linters/matlab/mlint.vim
Normal file
55
ale_linters/matlab/mlint.vim
Normal file
@@ -0,0 +1,55 @@
|
||||
" Author: awlayton <alex@layton.in>
|
||||
" Description: mlint for MATLAB files
|
||||
|
||||
let g:ale_matlab_mlint_executable =
|
||||
\ get(g:, 'ale_matlab_mlint_executable', 'mlint')
|
||||
|
||||
function! ale_linters#matlab#mlint#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'matlab_mlint_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#matlab#mlint#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#matlab#mlint#GetExecutable(a:buffer)
|
||||
|
||||
return l:executable . ' -id %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#matlab#mlint#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
"
|
||||
" L 27 (C 1): FNDEF: Terminate statement with semicolon to suppress output.
|
||||
" L 30 (C 13-15): FNDEF: A quoted string is unterminated.
|
||||
let l:pattern = '^L \(\d\+\) (C \([0-9-]\+\)): \([A-Z]\+\): \(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:lnum = l:match[1] + 0
|
||||
let l:col = l:match[2] + 0
|
||||
let l:code = l:match[3]
|
||||
let l:text = l:match[4]
|
||||
|
||||
" Suppress erroneous waring about filename
|
||||
" TODO: Enable this error when copying filename is supported
|
||||
if l:code ==# 'FNDEF'
|
||||
continue
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:lnum,
|
||||
\ 'col': l:col,
|
||||
\ 'text': l:text,
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('matlab', {
|
||||
\ 'name': 'mlint',
|
||||
\ 'executable_callback': 'ale_linters#matlab#mlint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#matlab#mlint#GetCommand',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale_linters#matlab#mlint#Handle',
|
||||
\})
|
||||
60
ale_linters/nim/nimcheck.vim
Normal file
60
ale_linters/nim/nimcheck.vim
Normal file
@@ -0,0 +1,60 @@
|
||||
" Author: Baabelfish
|
||||
" Description: Typechecking for nim files
|
||||
|
||||
function! ale_linters#nim#nimcheck#Handle(buffer, lines) abort
|
||||
let l:buffer_filename = fnamemodify(bufname(a:buffer), ':p:t')
|
||||
let l:pattern = '^\(.\+\.nim\)(\(\d\+\), \(\d\+\)) \(.\+\)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
" 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 !=# '' && l:temp_buffer_filename !=# 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'
|
||||
|
||||
" Extract error type from message of type 'Error: Some error message'
|
||||
let l:textmatch = matchlist(l:match[4], '^\(.\{-}\): .\+$')
|
||||
|
||||
if len(l:textmatch) > 0
|
||||
let l:errortype = l:textmatch[1]
|
||||
if l:errortype ==# 'Error'
|
||||
let l:type = 'E'
|
||||
endif
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:line,
|
||||
\ 'col': l:column,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type,
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
|
||||
function! ale_linters#nim#nimcheck#GetCommand(buffer) abort
|
||||
let l:directory = shellescape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
|
||||
return 'nim check --path:' . l:directory
|
||||
\ . ' --threads:on --verbosity:0 --colors:off --listFullPaths %t'
|
||||
endfunction
|
||||
|
||||
|
||||
call ale#linter#Define('nim', {
|
||||
\ 'name': 'nimcheck',
|
||||
\ 'executable': 'nim',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'command_callback': 'ale_linters#nim#nimcheck#GetCommand',
|
||||
\ 'callback': 'ale_linters#nim#nimcheck#Handle'
|
||||
\})
|
||||
26
ale_linters/nix/nix.vim
Normal file
26
ale_linters/nix/nix.vim
Normal file
@@ -0,0 +1,26 @@
|
||||
" Author: Alistair Bill <@alibabzo>
|
||||
" Description: nix-instantiate linter for nix files
|
||||
|
||||
function! ale_linters#nix#nix#Handle(buffer, lines) abort
|
||||
let l:pattern = '^\(.\+\): \(.\+\), at .*:\(\d\+\):\(\d\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[3] + 0,
|
||||
\ 'col': l:match[4] + 0,
|
||||
\ 'text': l:match[1] . ': ' . l:match[2],
|
||||
\ 'type': l:match[1] =~# '^error' ? 'E' : 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('nix', {
|
||||
\ 'name': 'nix',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'nix-instantiate',
|
||||
\ 'command': 'nix-instantiate --parse -',
|
||||
\ 'callback': 'ale_linters#nix#nix#Handle',
|
||||
\})
|
||||
9
ale_linters/nroff/proselint.vim
Normal file
9
ale_linters/nroff/proselint.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: Daniel M. Capella https://github.com/polyzen
|
||||
" Description: proselint for nroff files
|
||||
|
||||
call ale#linter#Define('nroff', {
|
||||
\ 'name': 'proselint',
|
||||
\ 'executable': 'proselint',
|
||||
\ 'command': 'proselint %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
||||
17
ale_linters/ocaml/merlin.vim
Normal file
17
ale_linters/ocaml/merlin.vim
Normal file
@@ -0,0 +1,17 @@
|
||||
" Author: Andrey Popp -- @andreypopp
|
||||
" Description: Report errors in OCaml code with Merlin
|
||||
|
||||
if !exists('g:merlin')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! ale_linters#ocaml#merlin#Handle(buffer, lines) abort
|
||||
return merlin#ErrorLocList()
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ocaml', {
|
||||
\ 'name': 'merlin',
|
||||
\ 'executable': 'ocamlmerlin',
|
||||
\ 'command': 'true',
|
||||
\ 'callback': 'ale_linters#ocaml#merlin#Handle',
|
||||
\})
|
||||
@@ -1,36 +1,35 @@
|
||||
" Author: Vincent Lequertier <https://github.com/SkySymbol>
|
||||
" Description: This file adds support for checking perl syntax
|
||||
|
||||
if exists('g:loaded_ale_linters_perl_perlcritic')
|
||||
finish
|
||||
endif
|
||||
let g:ale_perl_perl_executable =
|
||||
\ get(g:, 'ale_perl_perl_executable', 'perl')
|
||||
|
||||
let g:loaded_ale_linters_perl_perl = 1
|
||||
function! ale_linters#perl#perl#Handle(buffer, lines)
|
||||
let g:ale_perl_perl_options =
|
||||
\ get(g:, 'ale_perl_perl_options', '-X -c -Mwarnings -Ilib')
|
||||
|
||||
function! ale_linters#perl#perl#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'perl_perl_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#perl#perl#GetCommand(buffer) abort
|
||||
return ale_linters#perl#perl#GetExecutable(a:buffer)
|
||||
\ . ' ' . ale#Var(a:buffer, 'perl_perl_options')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#perl#perl#Handle(buffer, lines) abort
|
||||
let l:pattern = '\(.\+\) at \(.\+\) line \(\d\+\)'
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
continue
|
||||
endif
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:line = l:match[3]
|
||||
let l:column = 1
|
||||
let l:text = l:match[1]
|
||||
let l:type = 'E'
|
||||
|
||||
" vcol is Needed to indicate that the column is a character.
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:line,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': l:column,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type,
|
||||
\ 'nr': -1,
|
||||
\})
|
||||
endfor
|
||||
|
||||
@@ -39,8 +38,8 @@ endfunction
|
||||
|
||||
call ale#linter#Define('perl', {
|
||||
\ 'name': 'perl',
|
||||
\ 'executable': 'perl',
|
||||
\ 'executable_callback': 'ale_linters#perl#perl#GetExecutable',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'command': 'perl -X -c -Mwarnings -Ilib',
|
||||
\ 'command_callback': 'ale_linters#perl#perl#GetCommand',
|
||||
\ 'callback': 'ale_linters#perl#perl#Handle',
|
||||
\})
|
||||
|
||||
@@ -1,36 +1,14 @@
|
||||
" Author: Vincent Lequertier <https://github.com/SkySymbol>
|
||||
" Description: This file adds support for checking perl with perl critic
|
||||
|
||||
if exists('g:loaded_ale_linters_perl_perlcritic')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_perl_perlcritic = 1
|
||||
function! ale_linters#perl#perlcritic#Handle(buffer, lines)
|
||||
function! ale_linters#perl#perlcritic#Handle(buffer, lines) abort
|
||||
let l:pattern = '\(.\+\) at \(.\+\) line \(\d\+\)'
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:line = l:match[3]
|
||||
let l:column = 1
|
||||
let l:text = l:match[1]
|
||||
let l:type = 'E'
|
||||
|
||||
" vcol is Needed to indicate that the column is a character.
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:line,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': l:column,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type,
|
||||
\ 'nr': -1,
|
||||
\ 'text': l:match[1],
|
||||
\ 'lnum': l:match[3],
|
||||
\})
|
||||
endfor
|
||||
|
||||
@@ -40,7 +18,7 @@ endfunction
|
||||
call ale#linter#Define('perl', {
|
||||
\ 'name': 'perlcritic',
|
||||
\ 'executable': 'perlcritic',
|
||||
\ 'output_stream': 'sdtout',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'command': 'perlcritic --verbose 3 --nocolor',
|
||||
\ 'callback': 'ale_linters#perl#perlcritic#Handle',
|
||||
\})
|
||||
|
||||
28
ale_linters/php/hack.vim
Normal file
28
ale_linters/php/hack.vim
Normal file
@@ -0,0 +1,28 @@
|
||||
" Author: Zefei Xuan <https://github.com/zefei>
|
||||
" Description: Hack type checking (http://hacklang.org/)
|
||||
|
||||
function! ale_linters#php#hack#Handle(buffer, lines) abort
|
||||
let l:pattern = '^\(.*\):\(\d\+\):\(\d\+\),\(\d\+\): \(.\+])\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
if a:buffer != bufnr(l:match[1])
|
||||
continue
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[5],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('php', {
|
||||
\ 'name': 'hack',
|
||||
\ 'executable': 'hh_client',
|
||||
\ 'command': 'hh_client --retries 0 --retry-if-init false',
|
||||
\ 'callback': 'ale_linters#php#hack#Handle',
|
||||
\})
|
||||
@@ -1,35 +1,19 @@
|
||||
" Author: Spencer Wood <https://github.com/scwood>
|
||||
" Author: Spencer Wood <https://github.com/scwood>, Adriaan Zonnenberg <amz@adriaan.xyz>
|
||||
" Description: This file adds support for checking PHP with php-cli
|
||||
|
||||
if exists('g:loaded_ale_linters_php_php')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_php_php = 1
|
||||
|
||||
function! ale_linters#php#php#Handle(buffer, lines)
|
||||
function! ale_linters#php#php#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
"
|
||||
" Parse error: parse error in - on line 7
|
||||
let l:pattern = 'Parse error:\s\+\(.\+\) on line \(\d\+\)'
|
||||
" PHP Parse error: syntax error, unexpected ';', expecting ']' in - on line 15
|
||||
let l:pattern = '\v^%(Fatal|Parse) error:\s+(.+unexpected ''(.+)%(expecting.+)@<!''.*|.+) in - on line (\d+)'
|
||||
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
continue
|
||||
endif
|
||||
|
||||
" vcol is needed to indicate that the column is a character.
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 1,
|
||||
\ 'lnum': l:match[3] + 0,
|
||||
\ 'col': empty(l:match[2]) ? 0 : stridx(getline(l:match[3]), l:match[2]) + 1,
|
||||
\ 'text': l:match[1],
|
||||
\ 'type': 'E',
|
||||
\ 'nr': -1,
|
||||
\})
|
||||
endfor
|
||||
|
||||
@@ -39,7 +23,7 @@ endfunction
|
||||
call ale#linter#Define('php', {
|
||||
\ 'name': 'php',
|
||||
\ 'executable': 'php',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'command': 'php -l --',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'command': 'php -l -d error_reporting=E_ALL -d display_errors=1 --',
|
||||
\ 'callback': 'ale_linters#php#php#Handle',
|
||||
\})
|
||||
|
||||
@@ -1,49 +1,33 @@
|
||||
" Author: jwilliams108 <https://github.com/jwilliams108>
|
||||
" Description: phpcs for PHP files
|
||||
|
||||
if exists('g:loaded_ale_linters_php_phpcs')
|
||||
finish
|
||||
endif
|
||||
let g:ale_php_phpcs_standard = get(g:, 'ale_php_phpcs_standard', '')
|
||||
|
||||
let g:loaded_ale_linters_php_phpcs = 1
|
||||
function! ale_linters#php#phpcs#GetCommand(buffer) abort
|
||||
let l:standard = ale#Var(a:buffer, 'php_phpcs_standard')
|
||||
let l:standard_option = !empty(l:standard)
|
||||
\ ? '--standard=' . l:standard
|
||||
\ : ''
|
||||
|
||||
function! ale_linters#php#phpcs#GetCommand(buffer)
|
||||
let l:command = 'phpcs -s --report=emacs --stdin-path=%s'
|
||||
|
||||
" This option can be set to change the standard used by phpcs
|
||||
if exists('g:ale_php_phpcs_standard')
|
||||
let l:command .= ' --standard=' . g:ale_php_phpcs_standard
|
||||
endif
|
||||
|
||||
return l:command
|
||||
return 'phpcs -s --report=emacs --stdin-path=%s ' . l:standard_option
|
||||
endfunction
|
||||
|
||||
function! ale_linters#php#phpcs#Handle(buffer, lines)
|
||||
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:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
continue
|
||||
endif
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:text = l:match[4]
|
||||
let l:type = l:match[3]
|
||||
|
||||
" vcol is Needed to indicate that the column is a character.
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type ==# 'error' ? 'E' : 'W',
|
||||
\ 'nr': -1,
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
||||
36
ale_linters/php/phpmd.vim
Normal file
36
ale_linters/php/phpmd.vim
Normal file
@@ -0,0 +1,36 @@
|
||||
" Author: medains <https://github.com/medains>
|
||||
" Description: phpmd for PHP files
|
||||
|
||||
" 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#GetCommand(buffer) abort
|
||||
return 'phpmd %s text '
|
||||
\ . ale#Var(a:buffer, 'php_phpmd_ruleset')
|
||||
\ . ' --ignore-violations-on-exit %t'
|
||||
endfunction
|
||||
|
||||
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:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'text': l:match[2],
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('php', {
|
||||
\ 'name': 'phpmd',
|
||||
\ 'executable': 'phpmd',
|
||||
\ 'command_callback': 'ale_linters#php#phpmd#GetCommand',
|
||||
\ 'callback': 'ale_linters#php#phpmd#Handle',
|
||||
\})
|
||||
9
ale_linters/pod/proselint.vim
Normal file
9
ale_linters/pod/proselint.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: Daniel M. Capella https://github.com/polyzen
|
||||
" Description: proselint for Pod files
|
||||
|
||||
call ale#linter#Define('pod', {
|
||||
\ 'name': 'proselint',
|
||||
\ 'executable': 'proselint',
|
||||
\ 'command': 'proselint %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
||||
@@ -1,16 +1,10 @@
|
||||
" Author: w0rp - <devw0rp@gmail.com>
|
||||
" Description: pug-lint for checking Pug/Jade files.
|
||||
|
||||
if exists('g:loaded_ale_linters_pug_puglint')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_pug_puglint = 1
|
||||
|
||||
call ale#linter#Define('pug', {
|
||||
\ 'name': 'puglint',
|
||||
\ 'executable': 'pug-lint',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command': g:ale#util#stdin_wrapper . ' .pug pug-lint -r inline',
|
||||
\ 'callback': 'ale#handlers#HandleUnixFormatAsError',
|
||||
\ 'command': 'pug-lint -r inline %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsError',
|
||||
\})
|
||||
|
||||
27
ale_linters/puppet/puppet.vim
Normal file
27
ale_linters/puppet/puppet.vim
Normal file
@@ -0,0 +1,27 @@
|
||||
" Author: Alexander Olofsson <alexander.olofsson@liu.se>
|
||||
|
||||
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
|
||||
|
||||
let l:pattern = '^Error: .*: \(.\+\) at .\+:\(\d\+\):\(\d\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[1],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('puppet', {
|
||||
\ 'name': 'puppet',
|
||||
\ 'executable': 'puppet',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command': 'puppet parser validate --color=false %t',
|
||||
\ 'callback': 'ale_linters#puppet#puppet#Handle',
|
||||
\})
|
||||
26
ale_linters/puppet/puppetlint.vim
Normal file
26
ale_linters/puppet/puppetlint.vim
Normal file
@@ -0,0 +1,26 @@
|
||||
" Author: Alexander Olofsson <alexander.olofsson@liu.se>, Robert Flechtner <flechtner@chemmedia.de>
|
||||
" Description: puppet-lint for puppet files
|
||||
|
||||
let g:ale_puppet_puppetlint_executable =
|
||||
\ get(g:, 'ale_puppet_puppetlint_executable', 'puppet-lint')
|
||||
|
||||
let g:ale_puppet_puppetlint_options =
|
||||
\ get(g:, 'ale_puppet_puppetlint_options', '--no-autoloader_layout-check')
|
||||
|
||||
function! ale_linters#puppet#puppetlint#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'puppet_puppetlint_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#puppet#puppetlint#GetCommand(buffer) abort
|
||||
return ale_linters#puppet#puppetlint#GetExecutable(a:buffer)
|
||||
\ . ' ' . ale#Var(a:buffer, 'puppet_puppetlint_options')
|
||||
\ . ' --log-format "-:%{line}:%{column}: %{kind}: [%{check}] %{message}"'
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('puppet', {
|
||||
\ 'name': 'puppetlint',
|
||||
\ 'executable_callback': 'ale_linters#puppet#puppetlint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#puppet#puppetlint#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\})
|
||||
@@ -5,8 +5,6 @@ call ale#linter#Define('pyrex', {
|
||||
\ 'name': 'cython',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'cython',
|
||||
\ 'command': g:ale#util#stdin_wrapper
|
||||
\ . ' .pyx cython --warning-extra -o '
|
||||
\ . g:ale#util#nul_file,
|
||||
\ 'callback': 'ale#handlers#HandleUnixFormatAsError',
|
||||
\ 'command': 'cython --warning-extra -o ' . g:ale#util#nul_file . ' %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsError',
|
||||
\})
|
||||
|
||||
@@ -1,55 +1,105 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: flake8 for python files
|
||||
|
||||
if exists('g:loaded_ale_linters_python_flake8')
|
||||
finish
|
||||
endif
|
||||
let g:ale_python_flake8_executable =
|
||||
\ get(g:, 'ale_python_flake8_executable', 'flake8')
|
||||
|
||||
let g:loaded_ale_linters_python_flake8 = 1
|
||||
" Support an old setting as a fallback.
|
||||
let s:default_options = get(g:, 'ale_python_flake8_args', '')
|
||||
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)
|
||||
|
||||
function! ale_linters#python#flake8#Handle(buffer, lines)
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" stdin:6:6: E111 indentation is not a multiple of four
|
||||
let l:pattern = '^stdin:\(\d\+\):\(\d\+\): \([^ ]\+\) \(.\+\)$'
|
||||
let l:output = []
|
||||
" 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 = {}
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
function! s:UsingModule(buffer) abort
|
||||
return ale#Var(a:buffer, 'python_flake8_options') =~# ' *-m flake8'
|
||||
endfunction
|
||||
|
||||
if len(l:match) == 0
|
||||
continue
|
||||
function! ale_linters#python#flake8#GetExecutable(buffer) abort
|
||||
if !s:UsingModule(a:buffer) && !ale#Var(a:buffer, 'python_flake8_use_global')
|
||||
let l:virtualenv = ale#python#FindVirtualenv(a:buffer)
|
||||
|
||||
if !empty(l:virtualenv)
|
||||
let l:ve_flake8 = l:virtualenv . '/bin/flake8'
|
||||
|
||||
if executable(l:ve_flake8)
|
||||
return l:ve_flake8
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
let l:line = l:match[1] + 0
|
||||
let l:column = l:match[2] + 0
|
||||
let l:code = l:match[3]
|
||||
let l:text = l:code . ': ' . l:match[4]
|
||||
let l:type = l:code[0] ==# 'E' ? 'E' : 'W'
|
||||
return ale#Var(a:buffer, 'python_flake8_executable')
|
||||
endfunction
|
||||
|
||||
if (l:code ==# 'W291' || l:code ==# 'W293') && !g:ale_warn_about_trailing_whitespace
|
||||
" Skip warnings for trailing whitespace if the option is off.
|
||||
continue
|
||||
endif
|
||||
function! ale_linters#python#flake8#ClearVersionCache() abort
|
||||
let s:version_cache = {}
|
||||
endfunction
|
||||
|
||||
" vcol is Needed to indicate that the column is a character.
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:line,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': l:column,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type,
|
||||
\ 'nr': -1,
|
||||
\})
|
||||
endfor
|
||||
function! ale_linters#python#flake8#VersionCheck(buffer) abort
|
||||
let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer)
|
||||
|
||||
return l:output
|
||||
" 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)
|
||||
" Returning an empty string skips this command.
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:executable = shellescape(ale_linters#python#flake8#GetExecutable(a:buffer))
|
||||
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)
|
||||
|
||||
" 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)
|
||||
\ ? ' --stdin-display-name %s'
|
||||
\ : ''
|
||||
|
||||
let l:options = ale#Var(a:buffer, 'python_flake8_options')
|
||||
|
||||
return shellescape(ale_linters#python#flake8#GetExecutable(a:buffer))
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . l:display_name_args . ' -'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'flake8',
|
||||
\ 'executable': 'flake8',
|
||||
\ 'command': 'flake8 -',
|
||||
\ 'callback': 'ale_linters#python#flake8#Handle',
|
||||
\ 'executable_callback': 'ale_linters#python#flake8#GetExecutable',
|
||||
\ 'command_chain': [
|
||||
\ {'callback': 'ale_linters#python#flake8#VersionCheck'},
|
||||
\ {'callback': 'ale_linters#python#flake8#GetCommand'},
|
||||
\ ],
|
||||
\ 'callback': 'ale#handlers#python#HandlePEP8Format',
|
||||
\})
|
||||
|
||||
73
ale_linters/python/mypy.vim
Normal file
73
ale_linters/python/mypy.vim
Normal file
@@ -0,0 +1,73 @@
|
||||
" Author: Keith Smiley <k@keith.so>, w0rp <devw0rp@gmail.com>
|
||||
" Description: mypy support for optional python typechecking
|
||||
|
||||
let g:ale_python_mypy_executable =
|
||||
\ get(g:, 'ale_python_mypy_executable', 'mypy')
|
||||
let g:ale_python_mypy_options = get(g:, 'ale_python_mypy_options', '')
|
||||
let g:ale_python_mypy_use_global = get(g:, 'ale_python_mypy_use_global', 0)
|
||||
|
||||
function! ale_linters#python#mypy#GetExecutable(buffer) abort
|
||||
if !ale#Var(a:buffer, 'python_mypy_use_global')
|
||||
let l:virtualenv = ale#python#FindVirtualenv(a:buffer)
|
||||
|
||||
if !empty(l:virtualenv)
|
||||
let l:ve_mypy = l:virtualenv . '/bin/mypy'
|
||||
|
||||
if executable(l:ve_mypy)
|
||||
return l:ve_mypy
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
return ale#Var(a:buffer, 'python_mypy_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#mypy#GetCommand(buffer) abort
|
||||
let l:project_root = ale#python#FindProjectRoot(a:buffer)
|
||||
let l:cd_command = !empty(l:project_root)
|
||||
\ ? ale#path#CdString(l:project_root)
|
||||
\ : ''
|
||||
let l:executable = ale_linters#python#mypy#GetExecutable(a:buffer)
|
||||
|
||||
return l:cd_command
|
||||
\ . shellescape(l:executable)
|
||||
\ . ' --show-column-numbers '
|
||||
\ . ale#Var(a:buffer, 'python_mypy_options')
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#mypy#Handle(buffer, lines) abort
|
||||
" Look for lines like the following:
|
||||
"
|
||||
" file.py:4: error: No library stub file for module 'django.db'
|
||||
"
|
||||
" Lines like these should be ignored below:
|
||||
"
|
||||
" file.py:4: note: (Stub files are from https://github.com/python/typeshed)
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: (error|warning): (.+)$'
|
||||
let l:output = []
|
||||
let l:buffer_filename = expand('#' . a:buffer . ':p')
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
if l:buffer_filename[-len(l:match[1]):] !=# l:match[1]
|
||||
continue
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': l:match[4] =~# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[5],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'mypy',
|
||||
\ 'executable_callback': 'ale_linters#python#mypy#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#python#mypy#GetCommand',
|
||||
\ 'callback': 'ale_linters#python#mypy#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
74
ale_linters/python/pylint.vim
Normal file
74
ale_linters/python/pylint.vim
Normal file
@@ -0,0 +1,74 @@
|
||||
" Author: keith <k@keith.so>
|
||||
" Description: pylint for python files
|
||||
|
||||
let g:ale_python_pylint_executable =
|
||||
\ get(g:, 'ale_python_pylint_executable', 'pylint')
|
||||
|
||||
let g:ale_python_pylint_options =
|
||||
\ get(g:, 'ale_python_pylint_options', '')
|
||||
|
||||
let g:ale_python_pylint_use_global = get(g:, 'ale_python_pylint_use_global', 0)
|
||||
|
||||
function! ale_linters#python#pylint#GetExecutable(buffer) abort
|
||||
if !ale#Var(a:buffer, 'python_pylint_use_global')
|
||||
let l:virtualenv = ale#python#FindVirtualenv(a:buffer)
|
||||
|
||||
if !empty(l:virtualenv)
|
||||
let l:ve_pylint = l:virtualenv . '/bin/pylint'
|
||||
|
||||
if executable(l:ve_pylint)
|
||||
return l:ve_pylint
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
return ale#Var(a:buffer, 'python_pylint_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pylint#GetCommand(buffer) abort
|
||||
return shellescape(ale_linters#python#pylint#GetExecutable(a:buffer))
|
||||
\ . ' ' . ale#Var(a:buffer, 'python_pylint_options')
|
||||
\ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n'
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#python#pylint#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
"
|
||||
" test.py:4:4: W0101 (unreachable) Unreachable code
|
||||
let l:pattern = '\v^[^:]+:(\d+):(\d+): ([[:alnum:]]+) \((.*)\) (.*)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
"let l:failed = append(0, l:match)
|
||||
let l:code = l:match[3]
|
||||
|
||||
if (l:code ==# 'C0303')
|
||||
\ && !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
||||
" Skip warnings for trailing whitespace if the option is off.
|
||||
continue
|
||||
endif
|
||||
|
||||
if l:code ==# 'I0011'
|
||||
" Skip 'Locally disabling' message
|
||||
continue
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 1,
|
||||
\ 'text': l:code . ': ' . l:match[5],
|
||||
\ 'type': l:code[:0] ==# 'E' ? 'E' : 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('python', {
|
||||
\ 'name': 'pylint',
|
||||
\ 'executable_callback': 'ale_linters#python#pylint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#python#pylint#GetCommand',
|
||||
\ 'callback': 'ale_linters#python#pylint#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
17
ale_linters/reason/merlin.vim
Normal file
17
ale_linters/reason/merlin.vim
Normal file
@@ -0,0 +1,17 @@
|
||||
" Author: Andrey Popp -- @andreypopp
|
||||
" Description: Report errors in ReasonML code with Merlin
|
||||
|
||||
if !exists('g:merlin')
|
||||
finish
|
||||
endif
|
||||
|
||||
function! ale_linters#reason#merlin#Handle(buffer, lines) abort
|
||||
return merlin#ErrorLocList()
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('reason', {
|
||||
\ 'name': 'merlin',
|
||||
\ 'executable': 'ocamlmerlin',
|
||||
\ 'command': 'true',
|
||||
\ 'callback': 'ale_linters#reason#merlin#Handle',
|
||||
\})
|
||||
9
ale_linters/rst/proselint.vim
Normal file
9
ale_linters/rst/proselint.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: Daniel M. Capella https://github.com/polyzen
|
||||
" Description: proselint for reStructuredText files
|
||||
|
||||
call ale#linter#Define('rst', {
|
||||
\ 'name': 'proselint',
|
||||
\ 'executable': 'proselint',
|
||||
\ 'command': 'proselint %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
||||
72
ale_linters/ruby/brakeman.vim
Normal file
72
ale_linters/ruby/brakeman.vim
Normal file
@@ -0,0 +1,72 @@
|
||||
" Author: Eddie Lebow https://github.com/elebow
|
||||
" Description: Brakeman, a static analyzer for Rails security
|
||||
|
||||
let g:ale_ruby_brakeman_options =
|
||||
\ get(g:, 'ale_ruby_brakeman_options', '')
|
||||
|
||||
function! ale_linters#ruby#brakeman#Handle(buffer, lines) abort
|
||||
let l:result = json_decode(join(a:lines, ''))
|
||||
|
||||
let l:output = []
|
||||
|
||||
for l:warning in l:result.warnings
|
||||
" Brakeman always outputs paths relative to the Rails app root
|
||||
let l:rails_root = s: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,
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ruby#brakeman#GetCommand(buffer) abort
|
||||
let l:rails_root = s:FindRailsRoot(a:buffer)
|
||||
|
||||
if l:rails_root ==? ''
|
||||
return ''
|
||||
endif
|
||||
|
||||
return 'brakeman -f json -q '
|
||||
\ . ale#Var(a:buffer, 'ruby_brakeman_options')
|
||||
\ . ' -p ' . l:rails_root
|
||||
endfunction
|
||||
|
||||
function! s:FindRailsRoot(buffer) abort
|
||||
" Find the nearest dir contining "app", "db", and "config", and assume it is
|
||||
" the root of a Rails app.
|
||||
for l:name in ['app', 'config', 'db']
|
||||
let l:dir = fnamemodify(
|
||||
\ ale#path#FindNearestDirectory(a:buffer, l:name),
|
||||
\ ':h:h'
|
||||
\)
|
||||
|
||||
if l:dir !=# '.'
|
||||
\&& isdirectory(l:dir . '/app')
|
||||
\&& isdirectory(l:dir . '/config')
|
||||
\&& isdirectory(l:dir . '/db')
|
||||
return l:dir
|
||||
endif
|
||||
endfor
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ruby', {
|
||||
\ 'name': 'brakeman',
|
||||
\ 'executable': 'brakeman',
|
||||
\ 'command_callback': 'ale_linters#ruby#brakeman#GetCommand',
|
||||
\ 'callback': 'ale_linters#ruby#brakeman#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
53
ale_linters/ruby/reek.vim
Normal file
53
ale_linters/ruby/reek.vim
Normal file
@@ -0,0 +1,53 @@
|
||||
" Author: Eddie Lebow https://github.com/elebow
|
||||
" Description: Reek, a code smell detector for Ruby files
|
||||
|
||||
let g:ale_ruby_reek_show_context =
|
||||
\ get(g:, 'ale_ruby_reek_show_context', 0)
|
||||
|
||||
let g:ale_ruby_reek_show_wiki_link =
|
||||
\ get(g:, 'ale_ruby_reek_show_wiki_link', 0)
|
||||
|
||||
function! ale_linters#ruby#reek#Handle(buffer, lines) abort
|
||||
if len(a:lines) == 0
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:errors = json_decode(a:lines[0])
|
||||
|
||||
let l:output = []
|
||||
|
||||
for l:error in l:errors
|
||||
for l:location in l:error.lines
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:location,
|
||||
\ 'type': 'W',
|
||||
\ 'text': s:BuildText(a:buffer, l:error),
|
||||
\})
|
||||
endfor
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! s:BuildText(buffer, error) abort
|
||||
let l:text = a:error.smell_type . ':'
|
||||
|
||||
if ale#Var(a:buffer, 'ruby_reek_show_context')
|
||||
let l:text .= ' ' . a:error.context
|
||||
endif
|
||||
|
||||
let l:text .= ' ' . a:error.message
|
||||
|
||||
if ale#Var(a:buffer, 'ruby_reek_show_wiki_link')
|
||||
let l:text .= ' [' . a:error.wiki_link . ']'
|
||||
endif
|
||||
|
||||
return l:text
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ruby', {
|
||||
\ 'name': 'reek',
|
||||
\ 'executable': 'reek',
|
||||
\ 'command': 'reek -f json --no-progress --no-color',
|
||||
\ 'callback': 'ale_linters#ruby#reek#Handle',
|
||||
\})
|
||||
@@ -1,49 +1,44 @@
|
||||
" Author: ynonp - https://github.com/ynonp
|
||||
" Description: rubocop for Ruby files
|
||||
|
||||
if exists('g:loaded_ale_linters_ruby_rubocop')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_ruby_rubocop = 1
|
||||
|
||||
function! ale_linters#ruby#rubocop#Handle(buffer, lines)
|
||||
function! ale_linters#ruby#rubocop#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" <path>/_:47:14: 83:29: C: Prefer single-quoted strings when you don't
|
||||
" <path>:83:29: C: Prefer single-quoted strings when you don't
|
||||
" need string interpolation or special symbols.
|
||||
let l:pattern = '\v_:(\d+):(\d+): (.): (.+)'
|
||||
let l:pattern = '\v:(\d+):(\d+): (.): (.+)'
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
continue
|
||||
endif
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:text = l:match[4]
|
||||
let l:type = l:match[3]
|
||||
|
||||
" vcol is Needed to indicate that the column is a character.
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type ==# 'C' ? 'E' : 'W',
|
||||
\ 'nr': -1,
|
||||
\ 'type': index(['F', 'E'], l:type) != -1 ? 'E' : 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ruby#rubocop#GetCommand(buffer) abort
|
||||
return 'rubocop --format emacs --force-exclusion '
|
||||
\ . ale#Var(a:buffer, 'ruby_rubocop_options')
|
||||
\ . ' --stdin ' . bufname(a:buffer)
|
||||
endfunction
|
||||
|
||||
" Set this option to change Rubocop options.
|
||||
if !exists('g:ale_ruby_rubocop_options')
|
||||
" let g:ale_ruby_rubocop_options = '--lint'
|
||||
let g:ale_ruby_rubocop_options = ''
|
||||
endif
|
||||
|
||||
call ale#linter#Define('ruby', {
|
||||
\ 'name': 'rubocop',
|
||||
\ 'executable': 'rubocop',
|
||||
\ 'command': 'rubocop --format emacs --stdin _',
|
||||
\ 'command_callback': 'ale_linters#ruby#rubocop#GetCommand',
|
||||
\ 'callback': 'ale_linters#ruby#rubocop#Handle',
|
||||
\})
|
||||
|
||||
|
||||
10
ale_linters/ruby/ruby.vim
Normal file
10
ale_linters/ruby/ruby.vim
Normal file
@@ -0,0 +1,10 @@
|
||||
" Author: Brandon Roehl - https://github.com/BrandonRoehl
|
||||
" Description: Ruby MRI for Ruby files
|
||||
|
||||
call ale#linter#Define('ruby', {
|
||||
\ 'name': 'ruby',
|
||||
\ 'executable': 'ruby',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command': 'ruby -w -c -T1 %t',
|
||||
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
|
||||
\})
|
||||
31
ale_linters/rust/cargo.vim
Normal file
31
ale_linters/rust/cargo.vim
Normal file
@@ -0,0 +1,31 @@
|
||||
" 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)
|
||||
|
||||
function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort
|
||||
if ale#path#FindNearestFile(a:bufnr, 'Cargo.toml') !=# ''
|
||||
return 'cargo'
|
||||
else
|
||||
" if there is no Cargo.toml file, we don't use cargo even if it exists,
|
||||
" so we return '', because executable('') apparently always fails
|
||||
return ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale_linters#rust#cargo#GetCommand(buffer) abort
|
||||
let l:command = ale#Var(a:buffer, 'rust_cargo_use_check')
|
||||
\ ? 'check'
|
||||
\ : 'build'
|
||||
|
||||
return 'cargo ' . l:command . ' --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',
|
||||
\ 'callback': 'ale#handlers#rust#HandleRustErrors',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
27
ale_linters/rust/rustc.vim
Normal file
27
ale_linters/rust/rustc.vim
Normal file
@@ -0,0 +1,27 @@
|
||||
" Author: Daniel Schemala <istjanichtzufassen@gmail.com>
|
||||
" Description: rustc for rust files
|
||||
|
||||
function! ale_linters#rust#rustc#RustcCommand(buffer_number) 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')
|
||||
|
||||
if l:cargo_file !=# ''
|
||||
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'
|
||||
else
|
||||
let l:dependencies = ''
|
||||
endif
|
||||
|
||||
return 'rustc --error-format=json -Z no-trans ' . l:dependencies . ' -'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('rust', {
|
||||
\ 'name': 'rustc',
|
||||
\ 'executable': 'rustc',
|
||||
\ 'command_callback': 'ale_linters#rust#rustc#RustcCommand',
|
||||
\ 'callback': 'ale#handlers#rust#HandleRustErrors',
|
||||
\ 'output_stream': 'stderr',
|
||||
\})
|
||||
@@ -1,14 +1,8 @@
|
||||
" Author: KabbAmine - https://github.com/KabbAmine
|
||||
|
||||
if exists('g:loaded_ale_linters_sass_sasslint')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_sass_sasslint = 1
|
||||
|
||||
call ale#linter#Define('sass', {
|
||||
\ 'name': 'sasslint',
|
||||
\ 'executable': 'sass-lint',
|
||||
\ 'command': g:ale#util#stdin_wrapper . ' .sass sass-lint -v -q -f compact',
|
||||
\ 'callback': 'ale#handlers#HandleCSSLintFormat',
|
||||
\ 'command': 'sass-lint -v -q -f compact %t',
|
||||
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
|
||||
\})
|
||||
|
||||
31
ale_linters/sass/stylelint.vim
Normal file
31
ale_linters/sass/stylelint.vim
Normal file
@@ -0,0 +1,31 @@
|
||||
" Author: diartyz <diartyz@gmail.com>
|
||||
|
||||
let g:ale_sass_stylelint_executable =
|
||||
\ get(g:, 'ale_sass_stylelint_executable', 'stylelint')
|
||||
|
||||
let g:ale_sass_stylelint_use_global =
|
||||
\ get(g:, 'ale_sass_stylelint_use_global', 0)
|
||||
|
||||
function! ale_linters#sass#stylelint#GetExecutable(buffer) abort
|
||||
if ale#Var(a:buffer, 'sass_stylelint_use_global')
|
||||
return ale#Var(a:buffer, 'sass_stylelint_executable')
|
||||
endif
|
||||
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\ ale#Var(a:buffer, 'sass_stylelint_executable')
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#sass#stylelint#GetCommand(buffer) abort
|
||||
return ale_linters#sass#stylelint#GetExecutable(a:buffer)
|
||||
\ . ' --stdin-filename %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('sass', {
|
||||
\ 'name': 'stylelint',
|
||||
\ 'executable_callback': 'ale_linters#sass#stylelint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#sass#stylelint#GetCommand',
|
||||
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
|
||||
\})
|
||||
@@ -1,14 +1,7 @@
|
||||
" vim: set et:
|
||||
" Author: Zoltan Kalmar - https://github.com/kalmiz
|
||||
" Description: Basic scala support using scalac
|
||||
|
||||
if exists('g:loaded_ale_linters_scala_scalac')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_scala_scalac = 1
|
||||
|
||||
function! ale_linters#scala#scalac#Handle(buffer, lines)
|
||||
function! ale_linters#scala#scalac#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" /var/folders/5q/20rgxx3x1s34g3m14n5bq0x80000gn/T/vv6pSsy/0:26: error: expected class or object definition
|
||||
@@ -27,22 +20,16 @@ function! ale_linters#scala#scalac#Handle(buffer, lines)
|
||||
let l:text = l:match[3]
|
||||
let l:type = l:match[2] ==# 'error' ? 'E' : 'W'
|
||||
let l:col = 0
|
||||
|
||||
if l:ln + 1 < len(a:lines)
|
||||
let l:col = stridx(a:lines[l:ln + 1], '^')
|
||||
if l:col == -1
|
||||
let l:col = 0
|
||||
endif
|
||||
endif
|
||||
|
||||
" vcol is Needed to indicate that the column is a character.
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': l:col + 1,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type,
|
||||
\ 'nr': -1,
|
||||
\})
|
||||
endfor
|
||||
|
||||
@@ -53,6 +40,6 @@ call ale#linter#Define('scala', {
|
||||
\ 'name': 'scalac',
|
||||
\ 'executable': 'scalac',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command': g:ale#util#stdin_wrapper . ' .scala scalac -Ystop-after:parser',
|
||||
\ 'command': 'scalac -Ystop-after:parser %t',
|
||||
\ 'callback': 'ale_linters#scala#scalac#Handle',
|
||||
\})
|
||||
|
||||
@@ -1,14 +1,8 @@
|
||||
" Author: KabbAmine - https://github.com/KabbAmine
|
||||
|
||||
if exists('g:loaded_ale_linters_scss_sasslint')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_scss_sasslint = 1
|
||||
|
||||
call ale#linter#Define('scss', {
|
||||
\ 'name': 'sasslint',
|
||||
\ 'executable': 'sass-lint',
|
||||
\ 'command': g:ale#util#stdin_wrapper . ' .scss sass-lint -v -q -f compact',
|
||||
\ 'callback': 'ale#handlers#HandleCSSLintFormat',
|
||||
\ 'command': 'sass-lint -v -q -f compact %t',
|
||||
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
|
||||
\})
|
||||
|
||||
@@ -1,40 +1,25 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: This file add scsslint support for SCSS support
|
||||
|
||||
if exists('g:loaded_ale_linters_scss_scsslint')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_scss_scsslint = 1
|
||||
|
||||
function! ale_linters#scss#scsslint#Handle(buffer, lines)
|
||||
function! ale_linters#scss#scsslint#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
"
|
||||
" test.scss:2:1 [W] Indentation: Line should be indented 2 spaces, but was indented 4 spaces
|
||||
let l:pattern = '^.*:\(\d\+\):\(\d*\) \[\([^\]]\+\)\] \(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
if !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
||||
\&& l:match[4] =~# '^TrailingWhitespace'
|
||||
" Skip trailing whitespace warnings if that option is off.
|
||||
continue
|
||||
endif
|
||||
|
||||
if !g:ale_warn_about_trailing_whitespace && l:match[4] =~# '^TrailingWhitespace'
|
||||
" Skip trailing whitespace warnings if that option is on.
|
||||
continue
|
||||
endif
|
||||
|
||||
" vcol is needed to indicate that the column is a character
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[4],
|
||||
\ 'type': l:match[3] ==# 'E' ? 'E' : 'W',
|
||||
\ 'nr': -1,
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
||||
31
ale_linters/scss/stylelint.vim
Normal file
31
ale_linters/scss/stylelint.vim
Normal file
@@ -0,0 +1,31 @@
|
||||
" Author: diartyz <diartyz@gmail.com>
|
||||
|
||||
let g:ale_scss_stylelint_executable =
|
||||
\ get(g:, 'ale_scss_stylelint_executable', 'stylelint')
|
||||
|
||||
let g:ale_scss_stylelint_use_global =
|
||||
\ get(g:, 'ale_scss_stylelint_use_global', 0)
|
||||
|
||||
function! ale_linters#scss#stylelint#GetExecutable(buffer) abort
|
||||
if ale#Var(a:buffer, 'scss_stylelint_use_global')
|
||||
return ale#Var(a:buffer, 'scss_stylelint_executable')
|
||||
endif
|
||||
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\ ale#Var(a:buffer, 'scss_stylelint_executable')
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#scss#stylelint#GetCommand(buffer) abort
|
||||
return ale_linters#scss#stylelint#GetExecutable(a:buffer)
|
||||
\ . ' --stdin-filename %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('scss', {
|
||||
\ 'name': 'stylelint',
|
||||
\ 'executable_callback': 'ale_linters#scss#stylelint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#scss#stylelint#GetCommand',
|
||||
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
|
||||
\})
|
||||
@@ -1,23 +1,22 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Lints sh files using bash -n
|
||||
|
||||
if exists('g:loaded_ale_linters_sh_shell')
|
||||
finish
|
||||
" Backwards compatibility
|
||||
if exists('g:ale_linters_sh_shell_default_shell')
|
||||
let g:ale_sh_shell_default_shell = g:ale_linters_sh_shell_default_shell
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_sh_shell = 1
|
||||
|
||||
" This option can be changed to change the default shell when the shell
|
||||
" cannot be taken from the hashbang line.
|
||||
if !exists('g:ale_linters_sh_shell_default_shell')
|
||||
let g:ale_linters_sh_shell_default_shell = fnamemodify($SHELL, ':t')
|
||||
if !exists('g:ale_sh_shell_default_shell')
|
||||
let g:ale_sh_shell_default_shell = fnamemodify($SHELL, ':t')
|
||||
|
||||
if g:ale_linters_sh_shell_default_shell ==# ''
|
||||
let g:ale_linters_sh_shell_default_shell = 'bash'
|
||||
if g:ale_sh_shell_default_shell ==# '' || g:ale_sh_shell_default_shell ==# 'fish'
|
||||
let g:ale_sh_shell_default_shell = 'bash'
|
||||
endif
|
||||
endif
|
||||
|
||||
function! ale_linters#sh#shell#GetExecutable(buffer)
|
||||
function! ale_linters#sh#shell#GetExecutable(buffer) abort
|
||||
let l:banglines = getbufline(a:buffer, 1)
|
||||
|
||||
" Take the shell executable from the hashbang, if we can.
|
||||
@@ -32,42 +31,25 @@ function! ale_linters#sh#shell#GetExecutable(buffer)
|
||||
endfor
|
||||
endif
|
||||
|
||||
return g:ale_linters_sh_shell_default_shell
|
||||
return ale#Var(a:buffer, 'sh_shell_default_shell')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#sh#shell#GetCommand(buffer)
|
||||
return ale_linters#sh#shell#GetExecutable(a:buffer) . ' -n'
|
||||
function! ale_linters#sh#shell#GetCommand(buffer) abort
|
||||
return ale_linters#sh#shell#GetExecutable(a:buffer) . ' -n %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#sh#shell#Handle(buffer, lines)
|
||||
function! ale_linters#sh#shell#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" bash: line 13: syntax error near unexpected token `d'
|
||||
" sh: 11: Syntax error: "(" unexpected
|
||||
let l:pattern = '^[^:]\+: \%(\w\+ \|\)\(\d\+\): \(.\+\)'
|
||||
let l:pattern = '\v(line |: ?)(\d+): (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:line = l:match[1] + 0
|
||||
let l:column = 1
|
||||
let l:text = l:match[2]
|
||||
let l:type = 'E'
|
||||
|
||||
" vcol is Needed to indicate that the column is a character.
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:line,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': l:column,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type,
|
||||
\ 'nr': -1,
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
||||
@@ -2,29 +2,47 @@
|
||||
" Description: This file adds support for using the shellcheck linter with
|
||||
" shell scripts.
|
||||
|
||||
if exists('g:loaded_ale_linters_sh_shellcheck')
|
||||
finish
|
||||
endif
|
||||
|
||||
let g:loaded_ale_linters_sh_shellcheck = 1
|
||||
|
||||
" This global variable can be set with a string of comma-seperated error
|
||||
" codes to exclude from shellcheck. For example:
|
||||
"
|
||||
" let g:ale_linters_sh_shellcheck_exclusions = 'SC2002,SC2004'
|
||||
if !exists('g:ale_linters_sh_shellcheck_exclusions')
|
||||
let g:ale_linters_sh_shellcheck_exclusions = ''
|
||||
endif
|
||||
" let g:ale_sh_shellcheck_exclusions = 'SC2002,SC2004'
|
||||
let g:ale_sh_shellcheck_exclusions =
|
||||
\ get(g:, 'ale_sh_shellcheck_exclusions', get(g:, 'ale_linters_sh_shellcheck_exclusions', ''))
|
||||
|
||||
if g:ale_linters_sh_shellcheck_exclusions !=# ''
|
||||
let s:exclude_option = '-e ' . g:ale_linters_sh_shellcheck_exclusions
|
||||
else
|
||||
let s:exclude_option = ''
|
||||
endif
|
||||
let g:ale_sh_shellcheck_executable =
|
||||
\ get(g:, 'ale_sh_shellcheck_executable', 'shellcheck')
|
||||
|
||||
let g:ale_sh_shellcheck_options =
|
||||
\ get(g:, 'ale_sh_shellcheck_options', '')
|
||||
|
||||
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'
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! ale_linters#sh#shellcheck#GetCommand(buffer) abort
|
||||
let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions')
|
||||
|
||||
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 -'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('sh', {
|
||||
\ 'name': 'shellcheck',
|
||||
\ 'executable': 'shellcheck',
|
||||
\ 'command': 'shellcheck ' . s:exclude_option . ' -f gcc -',
|
||||
\ 'callback': 'ale#handlers#HandleGCCFormat',
|
||||
\ 'executable_callback': 'ale_linters#sh#shellcheck#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#sh#shellcheck#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\})
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user