Compare commits

...

315 Commits

Author SHA1 Message Date
w0rp
ae3b13d132 #1621 - Tolerate SetOptions calls when ALE is loaded in a weird way 2018-06-01 21:04:23 +01:00
w0rp
a8951cc802 Fix LSP message handling when the handler doesn't get strings, somehow 2018-06-01 14:49:23 +01:00
w0rp
fd49c2d207 Update the gitcommit documentation with more examples 2018-06-01 14:26:58 +01:00
w0rp
f66027c49e Handle definition responses without files 2018-06-01 14:26:51 +01:00
w0rp
10e1545630 Mention g:ale_linters_explicit in the README 2018-05-30 21:15:00 +01:00
w0rp
970b62756e Fix #1610 - Encourage the use of ftplugin files more 2018-05-30 21:10:37 +01:00
w0rp
db64571b4c Fix #1523 - Document completion_filter 2018-05-30 20:44:09 +01:00
w0rp
c8b77fd4b8 Fix a typo in the LSP linter documentation 2018-05-30 20:23:57 +01:00
w0rp
bd92616e2a Fix #1219 - Mention FindProjectRoot behavior for Python in the documentation 2018-05-30 20:09:33 +01:00
w0rp
f95bc00bd6 Clean up grammar for hover documentation a little 2018-05-30 19:44:01 +01:00
w0rp
106d439f56 Merge pull request #1589 from gagbo/balloon_doc
Documentation : document the mouseover magic
2018-05-30 19:31:41 +01:00
w0rp
3014d85325 Encourage people to use NeoVim 0.2.0 or above in the README. 2018-05-28 20:20:05 +01:00
w0rp
f84411f3f1 Remove a test for a deprecated variable that seems to trip up Travis 2018-05-28 20:08:27 +01:00
w0rp
191967cfee #1587 - Add deprecation warnings for old linter options 2018-05-28 19:52:27 +01:00
w0rp
c0a279f967 Indicate things to be removed in version 2.0 2018-05-28 19:39:49 +01:00
w0rp
f2837b5802 #1524 - Define global variables where they are needed 2018-05-28 19:19:20 +01:00
w0rp
cae194d1bd #1524 Replace ale#Set with let in the main file 2018-05-28 17:57:58 +01:00
w0rp
18509195f5 #1524 Do not try to check buffers with empty filetypes 2018-05-28 17:38:14 +01:00
w0rp
ce89d93e1c Remove a now defunct test 2018-05-28 17:11:21 +01:00
w0rp
e49e7d52bc #1524 Remove the plugin conflict warnings 2018-05-28 16:47:32 +01:00
w0rp
8a659b7cc6 Fix #1566 - Add g:ale_python_flake8_change_directory 2018-05-28 16:34:54 +01:00
w0rp
d9717147bf Close #1559 - Report errors from LSP servers in :ALEInfo 2018-05-28 16:24:15 +01:00
w0rp
3c55cb087d Close #1553 - Support some tsserver completion for strings 2018-05-28 15:16:15 +01:00
w0rp
ef1ec5341f Fix #1568 - Filter LSP completion results with the prefixes 2018-05-28 14:45:07 +01:00
w0rp
cd0dc0a227 Fix #1611 - Fix perlcritic escaping on Windows 2018-05-28 12:51:06 +01:00
w0rp
eaf35bc611 Merge pull request #1562 from haginaga/support_phan_client
Add support phan_client for php
2018-05-28 12:41:13 +01:00
haginaga
ae8dd39760 Fix an incorrect argument of ale#Var in ale_linters#php#phan#Handle 2018-05-27 22:45:43 +09:00
haginaga
feab494286 Fix code style issues and refactor to use ale#Var 2018-05-27 22:21:02 +09:00
w0rp
29a9c9a255 Merge pull request #1564 from aliou/ad-alefix-fixer-cmdline-completion
Use the command line to filter ALEFix's command line completion.
2018-05-26 21:34:29 +01:00
w0rp
6fce8ddc5a #1600 Alias vimwiki to markdown 2018-05-26 11:41:52 +01:00
w0rp
b67c9a83b2 Merge pull request #1574 from hecrj/elm-0.19
Support Elm 0.19
2018-05-26 09:19:30 +01:00
Héctor Ramón Jiménez
7fd0fd514b Fix multiline indentation 2018-05-25 22:22:47 +02:00
w0rp
51a063be31 Move the sasslint handlers to one location 2018-05-25 20:59:35 +01:00
w0rp
8d49da1f1c Merge pull request #1573 from zed0/master
Run sass-lint from the target's directory
2018-05-25 20:48:16 +01:00
w0rp
d0f579c5fc Merge pull request #1575 from tsuburin/enable_dmd_warnings
Enable warnings of dmd command
2018-05-25 19:38:40 +01:00
w0rp
d8d13ef264 Do not echo messages to the echo line for mouse movements unless the user says so 2018-05-17 16:23:29 +01:00
Gerry Agbobada
1258b032e6 Documentation : Add mention of mouseover in README 2018-05-17 11:06:37 +02:00
Gerry Agbobada
e5ad9076b3 Documentation : document the mouseover magic
This first try is focused on fitting the information in existing
paragraphs
2018-05-17 10:57:04 +02:00
Gerry Agbobada
3a3c244723 TUI / GUI tooltip with content from ALEHover (#1556)
* Guard the ballooneval settings

* Mark main objectives to do to get nice Hover

* Make tweaks to make the tooltip work - See " XXX: comments

* Guard balloon_show call

* Use return instead of finish for functions

* ale#hover#show : Add optional arguments to specify arbtirary position

This change is requested to be able to call the function with mouse
position to enable hover information in vim's balloon

* ale#ballon#Disable : Remove feature guards

* ale#balloon : Show 'ALEHover' output on balloon if no diagnostic found

* ale#hover#HandleLSPResponse : remove the check for cursor position

This check prevented the 'ALEHover in balloon' feature, since mouse
position is almost never cursor position.

* ale#balloon#MessageForPos : Change the return of balloonexpr

balloonexpr evaluation now works even without balloon_show for basic
diagnostics, leaving the balloon_show call to ale#hover#Show, which can
then feature guard the call to avoid errors

* ale#hover#Response : Feature guard balloon_show calls

* ale#hover : always display 'Hover' information in messages

Also add a small comment to warn readers the different outputs the
ale#hover#Show will write to

* {LSP,TS}Response : use only variables from the Response

It is clearer that we only rely on l:options to get the relevant data to
build the LSP Response string

* hover#ShowDetails : fix an issue where not having focus broke balloons

The issue was caused by not using a buffer-specific version of getline()
to cap the value of the column sent in the message to LSP. Therefore a
cursor on column 10 in an inactive window could send a message with
column=0, if the active window had a buffer with too few lines

* {LSP,TS}Response : Remove redundant checks for balloon_show call

With the upcoming change in ale_set_balloons default value (see Pull
Request w0rp/ale#1565), this check will be useless

* balloonexpr? : Add a flag to separate hover#Show() calls

The goal of this flag is to make `:ALEHover` calls not pop a balloon
under the cursor, since the user has probably no interest in their
cursor while typing the command

The flag is a default argument which is overridden only in ballonexpr
call of ale#hover#Show, and stays set in the hover_map until the
callback for the LSP handles it.

There are no automated tests for this feature right now, and the nature
of the addition (one optional argument in the API) should make it
transparent to existing tests.

Since the differentiation is now possible, the check for moved cursor
has been put back in ale#hover#HandleLSPResponse

* ale#hover#hover_map : Protect accesses to hover_map

Using get() is safer than trying to access directly with ., as the tests
show.

* Raise timeout to try to get Appveyor happy

* Review : Fix comments

* Review : pass the optional argument 'called_from_balloonexpr' in a Dict

This optional dictionary has documentation just before the function
using it, ale#hover#Show, and allows easier extension in the future.
2018-05-16 21:23:48 +01:00
w0rp
c1da7866d0 Fix #1584 - Make duplicate msgfmt messages easier to navigate 2018-05-15 18:01:49 +01:00
Héctor Ramón Jiménez
b071f1a795 Make Elm linter backwards compatible with Elm 0.18 2018-05-15 17:06:52 +02:00
Ben Falconer
8a1099bb59 Run sass-lint from the target's directory 2018-05-15 14:36:31 +01:00
w0rp
c23acb00e2 Merge pull request #1565 from rhysd/improve-balloon-support-detection
Improve g:ale_set_balloons default value
2018-05-15 13:16:33 +01:00
w0rp
4a76cb0dd5 Update the issue template to tell you where to find command callback tests 2018-05-15 13:14:28 +01:00
Héctor Ramón Jiménez
115952fae3 Show Elm.Kernel as location when report.path is null in a general problem 2018-05-12 20:27:33 +02:00
tsuburin
0c472c2244 Added "-wi" to the dmd command to endable warning messages. 2018-05-12 15:03:35 +09:00
Héctor Ramón Jiménez
c3f61c391b Use message as text instead of title
`title` does not contain much information which forces to use :ALEDetail most of the time
2018-05-12 04:16:14 +02:00
Héctor Ramón Jiménez
089a07c6a6 Update ale-elm doc 2018-05-11 20:14:00 +02:00
Héctor Ramón Jiménez
2f40da76e6 Test global problems and imported module errors 2018-05-11 20:07:28 +02:00
Héctor Ramón Jiménez
d40f447931 Upgrade Elm linter to support 0.19 error reports 2018-05-11 19:15:40 +02:00
rhysd
168569b8b0 Fix condition to test a balloon feature 2018-05-11 19:07:16 +09:00
rhysd
57f0454a55 Improve g:ale_set_balloons default value 2018-05-11 17:46:40 +09:00
Aliou Diallo
199fcd48ac Use the command line to filter ALEFix's command line completion. 2018-05-10 16:15:08 +02:00
w0rp
38c66d33fe Merge pull request #1563 from IngoHeimbach/fix/gcc-fatal-error
Fatal GCC errors are handled as errors not warnings
2018-05-09 09:14:38 +01:00
Ingo Heimbach
5fe74c7dc8 Fatal GCC errors are handled as errors not warnings 2018-05-09 09:01:41 +02:00
w0rp
f7ecf3f47a Merge pull request #1555 from BobuSumisu/nasm-linter
Added NASM assembly linter
2018-05-08 19:02:17 +01:00
w0rp
7541a40859 #852 Update the REAME to mention %...code...% 2018-05-08 18:32:18 +01:00
w0rp
9023987fe0 Merge pull request #1552 from a-marquez/master
Add XO fixer
2018-05-08 17:53:12 +01:00
haginaga
230656e678 Fix to follow the Google VimScript Style Guide 2018-05-08 23:47:35 +09:00
haginaga
ffa6fd4bed Fix to follow the Google VimScript Style Guide 2018-05-08 23:35:14 +09:00
haginaga
eb3ab87569 Modify to be able to use phan_client without g:ale_php_phan_executable 2018-05-08 23:25:11 +09:00
haginaga
8cee39c614 (close w0rp/ale#1561) Add support phan_client for php 2018-05-08 14:19:47 +09:00
Øyvind Ingvaldsen
3bc07b482b Fixed handle test for Windows
Needed to add correct separator to test data.
2018-05-04 23:04:45 +02:00
Øyvind Ingvaldsen
df8c45ed55 smallfix 2018-05-04 22:33:08 +02:00
Øyvind Ingvaldsen
27144eee8c Added NASM linter
Added NASM linter (for nasm filetype).
2018-05-04 21:44:32 +02:00
w0rp
726a768464 Merge pull request #1550 from deivid-rodriguez/bundle_option_for_mdl
Add bundle option to mdl
2018-05-03 22:20:39 +01:00
w0rp
7c0219efcc #1503 Call setline() after d, in case there are folds at the end of the file 2018-05-03 22:14:29 +01:00
w0rp
6495fac820 Tell people to install prettier-eslint-cli instead 2018-05-03 19:48:15 +01:00
w0rp
e2c33f2f6c Add g:ale_completion_excluded_words for completion filtering 2018-05-03 11:17:41 +01:00
a-marquez
14dc05f36b Add XO fixer to fixers registry 2018-05-02 18:26:46 -04:00
a-marquez
12d79894a4 Add fixer definition for XO 2018-05-02 18:26:13 -04:00
w0rp
e59cd6b7c0 Make the features ALE supports clearer in the README 2018-05-02 13:38:52 +01:00
David Rodríguez
f11637b62b Add bundle option to mdl 2018-05-01 19:49:45 -03:00
Bjorn Neergaard
ae85695543 Update run-tests to make use of /usr/bin/env (#1548)
* Update run-tests to make use of /usr/bin/env

* Update run-vint

* Update run-vader-tests

* Update custom-linting-rules

* Update custom-checks

* Update check-toc

* Update check-supported-tools-tables
2018-05-01 13:18:03 +01:00
w0rp
3331f6c8f4 Merge pull request #1543 from vancluever/f-add-JobStartedAutoCmd
Add ALEJobStarted User autocommand event
2018-04-29 20:16:59 +01:00
Chris Marchesi
b81bc8d481 A couple of more doc fixes
* Update section 5.viii in the README with ALEJobStarted and re-format
the example.
* Add an extra line after documentation update to ensure consistency
with the rest of the doc.
2018-04-28 15:10:59 -07:00
Chris Marchesi
11780e1d3d Add some tests for IsCheckingBuffer
Adding a couple of tests to demonstrate how IsCheckingBuffer behaves
during specific autocommand hooks:

* At ALELintPre, no linters have actually executed yet, hence
IsCheckingBuffer should be returning false.
* ALEJobStarted, fires as early as reasonably possible after a job has
successfully started, and hence hooking into IsCheckingBuffer here
should return true.

This distinction is important when using these two events during things
like statusline refreshes, namely for "linter running" indicators.
2018-04-28 14:50:20 -07:00
Chris Marchesi
129eb96561 Fix tests by setting proper link tag in doc for ALEJobStarted 2018-04-27 22:32:21 -07:00
Chris Marchesi
9da015f74f Add test for ALEJobStarted 2018-04-27 22:00:50 -07:00
Chris Marchesi
b7996803c9 Add ALEJobStarted User autocommand event
The ALELintPre and ALELintPost autocommand events are currently being
used by lightline-ale to refresh the status line and check the linter
status for a current buffer. One of the plugin's checks looks to see if
linters are currently running, via ale#engine#IsCheckingBuffer(). This
currently only works partially in certain situations. In my particular
case, working with Go files, this only seems to function properly when a
file is initially opened. Saving a file does not correctly update the
status.

This seems to be due to the fact that ALELintPre actually runs before
any jobs are carried out, making it plausible that hooking into
ALELintPre for the purpose of checking to see if there are any currently
running linters for a buffer is unreliable as it would be prone to
pretty obvious race conditions.

This adds a new User autocommand, ALEJobStarted, that gets fired at the
start of every new job that is successfully run. This allows a better
point to hook into checking the linter status of a buffer using
ale#engine#IsCheckingBuffer() by ensuring that at least one job has
started by the time IsCheckingBuffer is run.
2018-04-27 15:40:02 -07:00
w0rp
6ab3fdc4d0 Close #1521 - Allow the language to be set with simple strings for LSP linters 2018-04-27 22:52:11 +01:00
w0rp
d1d705cc84 Merge pull request #1533 from inducer/master
flake8: Move to the buffer's directory before running flake8 command
2018-04-27 21:39:04 +01:00
w0rp
4a63a90d0d Merge pull request #1540 from maximbaz/fix-docs-ale-go
Fix typos in "lint package" options in docs/ale-go
2018-04-27 19:23:34 +01:00
Maxim Baz
04b54f5c17 Fix typos in "lint package" options in docs/ale-go 2018-04-27 19:49:33 +02:00
Andreas Kloeckner
603e61ad71 flake8: Move to the buffer's directory before running flake8 command 2018-04-26 18:53:44 -05:00
w0rp
d8d09c2048 Close #1428 Implement LSP hover-like functionality for tsserver too 2018-04-26 21:54:11 +01:00
w0rp
e6fe2d86b8 Add an American English tag for behaviour too 2018-04-24 21:56:34 +01:00
w0rp
41c0b837ae #1278 Allow linters to be defined pretty much anywhere 2018-04-24 21:48:33 +01:00
w0rp
ebbf7d0353 #1428 Show multiline hover messages, and document the new command 2018-04-24 21:03:06 +01:00
w0rp
93a046a78f #1236 Explain how to use Vim jumps 2018-04-23 21:18:58 +01:00
w0rp
7d6a303592 Move autocmd commands out of the toggle file, to improve load times 2018-04-23 10:16:48 +01:00
w0rp
ef130c4428 #1428 Start implementing LSP hover support 2018-04-22 22:00:25 +01:00
w0rp
0b3ee11546 Fix a typo 2018-04-22 20:32:39 +01:00
w0rp
286abd12d3 Add support for finding references using LSP servers or tsserver 2018-04-22 19:49:30 +01:00
w0rp
5a365e7926 Merge pull request #1517 from kfly8/perltidy-fixer
Added perltidy fixer
2018-04-22 18:02:19 +01:00
w0rp
87ad4dfbe7 Implement a preview window for selecting locations to open 2018-04-22 15:53:01 +01:00
w0rp
d8a673515a Close #1162 - Implement completion support with LSP servers 2018-04-22 12:28:19 +01:00
Kenta, Kobayashi
498be478be add perltidy fixer 2018-04-21 22:09:38 +09:00
w0rp
20241c87ef Merge pull request #1511 from elebow/add-cucumber-checker
Add `cucumber` checker for Cucumber files
2018-04-21 09:23:07 +01:00
Eddie Lebow
1e6651e0a0 Add cucumber checker for cucumber files
For now, it only detects undefined steps. The nearest `features` dir
above the buffer file is loaded, so step definitions should be found
correctly.

Tested only with Cucumber for Ruby, but it should work for any cucumber
that follows a substantially similar directory structure.
2018-04-20 22:54:29 -04:00
w0rp
63bbb38c0c Merge pull request #1510 from fenuks/issue-1471
Support passing fixers names to ALEFix as arguments
2018-04-20 21:38:11 +01:00
fenuks
6f6d35c0bd Add information that ALEFix can now accept arguments 2018-04-18 02:28:17 +02:00
fenuks
f16384f323 Add tests for ALEFix commandline parameters 2018-04-18 02:13:24 +02:00
fenuks
a591b191db Make ALEFix support arguments 2018-04-18 02:13:24 +02:00
w0rp
f9ba3d924f Fix #1507 - Add an option for disabling switching directories for pylint 2018-04-17 13:30:30 +01:00
w0rp
fb720251bf Close #1504 - Add an option for removing --respect-pragma for flow 2018-04-15 12:25:15 +01:00
w0rp
60917c9005 Revert "#1277 Try to get eslint_d to run the right version of eslint"
This reverts commit 56c7957a75.
2018-04-13 21:02:56 +01:00
w0rp
f5f3424fcf #1501 Pass the buffer number from BufWritePost on to ale#fix#Fix 2018-04-13 20:59:05 +01:00
w0rp
56c7957a75 #1277 Try to get eslint_d to run the right version of eslint 2018-04-13 20:49:03 +01:00
w0rp
a0aa9aa9b7 Fix #1495 - Fall back to /bin/sh when shell=pwsh 2018-04-12 21:01:35 +01:00
w0rp
0cd8e8630b #1497 Tolerate important ALE variables being undefined for some reason when viewing buffers like git commits 2018-04-12 20:31:45 +01:00
w0rp
3401a4e8ea Merge pull request #1498 from Eyenseo/master
Fix rust rls linter argument
2018-04-12 20:01:00 +01:00
eyenseo
6c93cded64 Fix rust rls linter toolchain argument
This removes the argument if the specified toolchain is empty.
As far as I can tell there is no +nighly (or similar) option [1] leading to
the termination of the server. But since people needed this option and
have yet to complain about it it stays the default for now.

[1] https://github.com/rust-lang-nursery/rls/blob/master/src/main.rs#L87
2018-04-12 20:42:38 +02:00
w0rp
f064ba48f5 Close #1494 - Prefer displaying higher severity problems for cursor messages, balloons, and highlights 2018-04-10 21:05:22 +01:00
w0rp
3f0e1cd05d Fix #1492 - Make pylint error parsing work on Windows 2018-04-10 15:18:16 +01:00
w0rp
9d00695249 #1486 - Default exit_code to 1, if it isn't set. 2018-04-10 09:57:21 +01:00
w0rp
da9a005c60 Fix #1490 - Rename the g++ linter to gcc, and add an alias for the old name 2018-04-10 09:31:22 +01:00
w0rp
697fd4ac75 Merge pull request #1488 from languitar/pmd
Add support for the java PMD linter
2018-04-09 19:22:14 +01:00
w0rp
719b790574 Close #542 - Add an option for disabling running locally installed executables by default 2018-04-09 19:11:20 +01:00
w0rp
3a47413286 Merge pull request #1487 from rhysd/fix-1472
pylint: Move to the buffer's directory before running pylint command
2018-04-09 18:14:42 +01:00
Johannes Wienke
49c4bfde14 Add support for the java PMD linter 2018-04-09 17:48:00 +02:00
rhysd
4903b966a7 pylint: Move to the buffer's directory before running pylint command (Fix #1472) 2018-04-09 16:43:10 +09:00
w0rp
2f2dcb8444 Close #1476 - Make the javac executable configurable 2018-04-08 20:35:06 +01:00
w0rp
7cf3ddf6c4 Close #1439 - Add an :ALEInfoToFile command 2018-04-08 19:04:07 +01:00
w0rp
1123669839 Close #1315 - Make the vint executable configurable 2018-04-08 18:10:00 +01:00
aspidiets
f9ae58849a Fix #1424 - Make the brittany fixer work 2018-04-08 17:38:43 +01:00
w0rp
91d7e81ebc Fix #605 - Support vcol: 1 for multi-byte character positions 2018-04-08 17:17:46 +01:00
Adriaan Zonnenberg
121e806423 Add g:ale_php_cs_fixer_options variable (#1477)
* Add g:ale_php_cs_fixer_options variable

* Fix test
2018-04-07 23:53:03 +02:00
w0rp
bb775e4e22 Fix #1479 - Respect g:hdevtools_options for hdevtools 2018-04-07 22:50:31 +01:00
Jack Evans
c5d3af04fc Added support for Python black fixer (#1451) 2018-04-06 11:08:25 +02:00
P M
85a2a00826 Integration of qmlfmt linting tool (#1462)
* Add first qmlfmt support

* Add GetCommand() function

- pass --error/-e option

* Add handle unittest

- fix pattern regex
- store col as integer

* Update docs

* Add command callback unit test
2018-04-05 21:09:41 +02:00
Nils Leuzinger
912f632bf5 Add fsc linter for Scala (#1452)
* Add fsc as a Scala linter

* Pull reused code into `autoload/ale/` directory

* Include fsc into the README

* Add unit test for testing the scala handler

* Add unit test for scala's fsc linter

* Rename scala unit tests for clarity

* Fix typo in README

* Fix typos in doc/ale.txt

* Fix author headline

* Put methods for fsc commands back into fsc.vim

* Move command_callback tests to correct location

* Rewrite handler test so it actually tests handler

* Clarify description of test in test_scala_handler
2018-04-05 21:04:11 +02:00
w0rp
a2acdecbc2 Merge pull request #1455 from Christian-Gibbons/flawfinder_cpp_severity_fix
Fix Flawfinder for C++
2018-04-05 15:00:08 +01:00
w0rp
8baab691e9 Merge pull request #1429 from stewy33/master
Add support for Mercury language using mmc as a linter.
2018-04-05 12:34:45 +01:00
christian-gibbons
f1d56a343e Flawfinder for C++:
Fix missing variable causing flawfinder to fail for c++
2018-03-28 14:09:03 +00:00
w0rp
95ec9bb780 #1167 Use the make -n parsing for C++ compilers, and document the new option 2018-03-27 19:24:22 +01:00
w0rp
018831d601 Merge pull request #1434 from roel0/master
Automatically determine build flags by parsing `make -n` output #1167
2018-03-27 09:55:43 +01:00
roel0
dfb3e194d7 Extended unit tests + simplified parsing algoritme #1167 2018-03-27 10:18:24 +02:00
w0rp
27c5faeafe Use the --stdin-filename option for textlint, so configuration files will be discovered better 2018-03-26 10:35:10 +01:00
w0rp
8e9ae59e5e Fix paths for running tests on Windows 2018-03-26 09:58:48 +01:00
w0rp
8b34a4bf6b Fix config and executable issues with the textlint linter 2018-03-26 09:55:18 +01:00
w0rp
45c5fe7f43 Fix a typo in the documentation 2018-03-26 09:19:58 +01:00
Stewy Slocum
8d4852a127 add documentation on mmc linter 2018-03-25 13:43:51 -04:00
Stewy Slocum
84952918cc add support for mercury language using mmc as linter 2018-03-25 13:33:24 -04:00
w0rp
164c711b3d Fix #1404 - Do not show balloons when g:ale_set_balloons is 0. Add b:ale_set_balloons 2018-03-25 12:57:08 +01:00
P M
107516c757 Add basic qmllint support (#1419)
* Add basic qmllint support

* Use temp file, remove superfluous error code key, adjust author info

* Add qmllint handler parse test
2018-03-25 11:55:59 +01:00
w0rp
d14558da32 Merge pull request #1448 from yasuhiroki/support-textlint-plaintext
Support textlint for plaintext
2018-03-24 13:19:38 +00:00
yasuhiroki
562862073f Update document for textlint 2018-03-24 16:04:47 +09:00
yasuhiroki
1d33d2cacf Support textlint for plaintext without textlintrc 2018-03-24 14:40:44 +09:00
w0rp
dbf530e87f Fix #1373 - Fix a bug with Fish errors not being handled on Linux 2018-03-23 12:17:54 +00:00
w0rp
ec5750f57b Merge pull request #1441 from adrigzr/bugfix-1207-remark-lint-ranges
Handle ranges for the remark linter #1207
2018-03-22 15:20:25 +00:00
w0rp
c525f49f09 Fit documentation to the column size in ale-cs.txt 2018-03-22 15:18:41 +00:00
w0rp
722607b866 Merge pull request #1442 from Crysikrend/master
Added the word 'find' as it was missing in docs/ale-cs.txt
2018-03-22 15:17:56 +00:00
Ashley Smith
7a87520ba5 Added the word 'find' as it was missing in docs/ale-cs.txt 2018-03-22 14:20:45 +00:00
Adrián González Rus
87217ae347 fix: Handle ranges for the remark linter #1207 2018-03-22 11:47:16 +01:00
roel0
cf62ef7b07 Fixed windows compatibility unit tests #1167 2018-03-21 20:56:29 +01:00
roel0
69237a7e57 Added additional unit tests + adapted review comments #1167 2018-03-21 20:44:35 +01:00
w0rp
0678eb1f45 Merge pull request #1409 from x1024/patch-1
Add new FAQ item for g:ale_list_window_size
2018-03-21 17:41:55 +00:00
w0rp
b769b67b2f Update the table of content for the new FAQ entry. 2018-03-21 17:41:24 +00:00
w0rp
ca2472a460 Merge pull request #1438 from lepistone/doc-timers
doc: fix misspelled feature name
2018-03-21 17:35:34 +00:00
Leonardo Pistone
f0325d7322 doc: fix misspelled feature name 2018-03-21 17:02:43 +01:00
w0rp
c0279de661 Merge pull request #1436 from bmihelac/fix-1435-msgfmt-output-stdout
fix: po msgfmt output to stdout (#1435)
2018-03-21 10:56:31 +00:00
Bojan Mihelac
763fcb8512 fix: po msgfmt output to stdout (#1435) 2018-03-21 09:21:20 +01:00
roel0
7593e20377 Fix failing unit tests for windows 2018-03-21 07:37:32 +01:00
roel0
18d0aeb1a0 * Shell commands should by called async with the help of a command chain
* The makefile parser unit test should only test the cflag parser itself
#1167
2018-03-20 21:49:31 +01:00
w0rp
64c95d4881 Merge remote-tracking branch 'tylucaskelley/master' 2018-03-20 20:27:50 +00:00
w0rp
57a93cbc04 Merge pull request #1433 from benpaxton-hf/lint-whole-package
Lint whole package for gosimple and gotype
2018-03-20 20:17:43 +00:00
Ben Paxton
6452c5e2f0 Use govet handler for gosimple, gotype, staticcheck 2018-03-20 14:19:48 +00:00
roel0
38953c4626 Clang parser shoud fallback on old method if parsing fails #1167 2018-03-20 12:37:53 +01:00
roel0
3fb7efa2c6 Added some unit tests and fixed some linting errors for automatic makefile parsing in C #1167 2018-03-20 11:56:46 +01:00
roel0
c47b5fd4b8 Automatically determine build flags by parsing 'make -n' output #1167 2018-03-19 21:56:18 +01:00
Ben Paxton
0cb3e36554 Lint whole package for gosimple and gotype
Fixes #936
2018-03-19 15:52:42 +00:00
w0rp
43e8f47e6e #1431 Normalize paths when checking for temporary paths on Windows 2018-03-18 20:39:50 +00:00
INOUE Yosuke
68b9399d4c handle multibyte string when linting text with redpen (#1416)
* handle multibyte string when linting text with redpen

* fix error when no string is provided, fix test's expect value

* remove ambiguious `==` operator
2018-03-18 18:12:47 +00:00
w0rp
434f22e44a Merge pull request #1415 from fohte/fixer-rufo
Add rufo fixer for Ruby files
2018-03-18 17:42:07 +00:00
w0rp
440502dc93 Clean up the mix format command and tests 2018-03-18 17:40:34 +00:00
w0rp
92612a9eab Merge pull request #1410 from fribmendes/frm/mix_format_options
Allow passing options to mix_format
2018-03-18 17:36:33 +00:00
Hideaki Tokida
1b1e53ef61 add textlint support for markdown (#1383) 2018-03-18 17:28:26 +00:00
w0rp
c112ee9dff Fix #1392 - Only check files on disk for gotype 2018-03-18 17:16:13 +00:00
w0rp
bdd8d2399f #416 Escape the tslint command 2018-03-18 16:48:28 +00:00
w0rp
b08fdd16b8 Merge pull request #1248 from Carpetsmoker/autocmd-fixer
Add ALEFixPre and ALEFixPost events
2018-03-18 16:37:16 +00:00
Martin Tournoij
302f69e933 Add ALEFixPre and ALEFixPost events
To run autocmd before and after every fix cycle.

Fixes #623 (`ALELintPre` was added in #1203).
2018-03-17 18:24:38 +00:00
Anthony DeDominic
92e6e4d1ba Fix awk linter and security concerns. (#1411)
* Fixed (g)awk linter

 * Made it secure, albeit less useful.
 * Added gawk handler; the cpplint one was not working?
 * Added gawk handler test.
 * added warning to gawk handler.
 * added gawk command callback test
 * added comment about --source

* added back optional commandline option
2018-03-14 17:46:57 +00:00
Hayato Kawai
7e1a9a9810 Add rufo fixer for ruby files 2018-03-11 13:33:57 +09:00
w0rp
05d39bc1a9 Merge pull request #1395 from gfontenot/gfontenot/fix-elm-format-name
Fix elm-format fixer name
2018-03-10 10:51:27 +00:00
Christian-Gibbons
b586eba4a4 Handle flawfinder severity level (#1400)
* Handle flawfinder severity level
* Reverted code allowing Flawfinder to piggyback off of gcc's format handler
* Gave Flawfinder its own format handler and made requested changes.
2018-03-10 10:44:55 +00:00
Fernando Mendes
6320ce6674 Allow passing options to mix_format 2018-03-08 15:29:10 +00:00
Gordon Fontenot
9258c73680 Fix elm-format fixer name
Support for elm-format as a fixer has existed since Sept 2017, but it's not
easy to discover because the fixer was named `format`. This breaks the
convention of the other fixers that use the full name in the registry.

I've gone ahead and fixed this discrepancy, but I left the existing registry
entry in place. We should move people towards using `elm-format` as the fixer
name, but I'd hate to break existing setups.
2018-03-08 09:19:12 -06:00
x x
1995afa855 Add new FAQ item for g:ale_list_window_size 2018-03-08 12:17:29 +02:00
w0rp
0a0535546f Add a command for stopping all LSP clients 2018-03-06 10:23:55 +00:00
w0rp
b7363bef7d Update the licence year. 2018-03-04 11:50:39 +00:00
Ty-Lucas Kelley
32091fb8ad add test for markdownlint hander 2018-03-03 19:32:32 -05:00
Ty-Lucas Kelley
c572cfd2d2 add vim README.md to readme 2018-03-03 19:17:31 -05:00
Ty-Lucas Kelley
2a575ca551 add basic support for markdownlint 2018-03-03 19:16:41 -05:00
w0rp
193a4b9336 Satisfy my own checks 2018-03-03 18:13:57 +00:00
w0rp
f476c28b29 Add deprecation warnings for old NeoVim versions and old functions 2018-03-03 17:50:09 +00:00
w0rp
08cfd5f90c Close #1379 - Increment b:ale_linted when a buffer is checked 2018-03-03 16:22:56 +00:00
w0rp
565ffa0dc5 Use the configured mdl executable, escape it in the command, and add test for it 2018-03-03 13:27:19 +00:00
w0rp
857723e7d5 Merge pull request #1377 from joshleeb/markdown-mdl-options
Add options for markdown_mdl linter
2018-03-03 13:16:27 +00:00
Olaf Alders
8a77290553 [WIP] Begin to distinguish between Perl warnings and errors (#933)
* If a Perl script compiles, there are only warnings and no errors

* Let the first Perl error or warning win.

Take the following example:

***

sub foo {
    my $thing;

***

This might have the following messages when we compile it:

Missing right curly or square bracket at warning.pl line 7, at end of
line
syntax error at warning.pl line 7, at EOF
warning.pl had compilation errors.

With the current behaviour, we just get a "syntax error" message, which
isn't all that helpful.  With this patch we get "Missing right curly or
square bracket".

* Fix variable scope and pattern matching syntax

* Use named variable to enhance clarity when matching Perl output

* Add more tests for Perl linter

* Remove unnecessary parens

* Simplify check for pattern match
2018-03-02 21:04:52 +00:00
w0rp
b6bf6ecdbc Try to fix it again 2018-03-02 20:57:55 +00:00
w0rp
540952ca8e Try to fix a test which is failing on Windows 2018-03-02 20:47:21 +00:00
w0rp
ad7ffe2875 Merge pull request #1390 from jdeniau/jd-feat-phpCsFixer
add php-cs-fixer to list of fixers
2018-03-02 20:40:31 +00:00
w0rp
2c2c7ceb1d Fix #1384 - Handle warnings and suggestions for tsserver 2018-03-02 20:33:45 +00:00
Andrew Crites
acbe527e15 Option to open lists vertically (#1381)
* Add configuration option to open lists vertically

* Add tests, clean up vertical list config

* Vertical list option cleanup

* Use is# for tests
* Order properties in documentation alphabetically
2018-03-02 20:22:29 +00:00
w0rp
2096562899 Make updating linter results slightly faster when the list is empty 2018-03-02 12:10:27 +00:00
Julien Deniau
fbbb8c17d9 add php-cs-fixer to list of fixers 2018-03-01 15:48:47 +01:00
w0rp
1d0690f6d7 Merge pull request #1387 from oalders/oalders-perl-docs
Explain in more detail why perl checks are disabled by default
2018-02-28 15:42:04 +00:00
Olaf Alders
aea5de282e Explain in more detail why perl checks are disabled by default 2018-02-28 10:26:44 -05:00
w0rp
f64db199f1 Fix a typo in the documentation 2018-02-26 17:04:54 +00:00
Josh Leeb-du Toit
7e20d9c639 Add options for markdown_mdl linter 2018-02-26 20:10:55 +11:00
w0rp
7ec684206c Merge pull request #1376 from zchee/doc-cpp-duplicate-tag
doc/cpp: fix duplicate ale_cpp_flawfinder_executable help tag
2018-02-25 15:09:52 +00:00
Koichi Shiraishi
b15706d9a9 doc/cpp: fix duplicate ale_cpp_flawfinder_executable help tag
both of 'g:' prefix.
2018-02-26 00:04:56 +09:00
w0rp
d86371cd29 Merge pull request #1375 from zchee/doc-c-duplicate-tag
doc/c: fix duplicate ale_c_flawfinder_executable help tag
2018-02-25 14:39:49 +00:00
Koichi Shiraishi
cfa3e6a924 doc/c: fix duplicate ale_c_flawfinder_executable help tag 2018-02-25 23:31:38 +09:00
Christian-Gibbons
82f8a04e18 New linter: Flawfinder (#1361)
* Flawfinder support added for C and C++

A minor modification to gcc handler was made to support flawfinder's
single-line output format that does not have a space following the
colon denoting the warning level.  gcc handler still passes its
Vader tests after this modification.

* Documentation fixes

* Revert documentation regression

* Added Flawfinder to table of contents

* Removed trailing whitespace

* Follow ALE conventions better

Added additional documentation and Vader tests
2018-02-25 14:11:04 +00:00
w0rp
478a2883a6 #1363 Make ale#engine#IsCheckingBuffer part of the public API 2018-02-25 12:57:54 +00:00
w0rp
0ddf16194d Fix #1306 - Tell users how to automatically close the loclist window in the documentation 2018-02-25 12:43:20 +00:00
w0rp
0292e5a458 Merge pull request #1371 from idbrii/fix-unity-example
Add Unity project path to Unity example in docs
2018-02-25 12:22:58 +00:00
w0rp
b6ccd60dd0 Merge pull request #1351 from svanharmelen/f-issue-936
This fixes issue #936 by linting the whole package
2018-02-25 11:54:05 +00:00
w0rp
b5209d31e8 go vet can only check files now 2018-02-25 11:53:36 +00:00
John Eikenberry
4941bd8d0e Fix #1358, fix #1369 - Lint the package on save for go vet instead 2018-02-25 11:39:45 +00:00
David Briscoe
8b304f77b7 Add Unity project path to Unity example in docs
For Ale to recognize the symbols in your project, you need to point it
at where Unity builds your assemblies. Add this path to the example.
2018-02-23 14:52:25 -08:00
Sander van Harmelen
ab5257c344 This fixes issue #936 by linting the whole package 2018-02-20 16:11:35 +01:00
w0rp
89f8d3e456 Fix #1336 - Print a friendly message when using invalid function names for fixers 2018-02-18 10:13:30 +00:00
w0rp
5915a0ee39 Escape the ponyc executable 2018-02-18 10:06:40 +00:00
w0rp
608b6dafd4 Merge pull request #1343 from kevinkjt2000/ponyc
Add Support for Ponylang
2018-02-18 09:48:35 +00:00
w0rp
5972b97223 #476 Make F401 a warning and E112 a syntax error 2018-02-18 09:44:04 +00:00
w0rp
fcb7932d7d Merge pull request #1345 from dfalling/fix-reason-help-title
Fix Reason help title in README.md
2018-02-13 18:51:33 +00:00
Dennis Falling
f979da54d4 Fix reason help reference
`ale-integration-reason-merlin` doesn't exist, changed to
`ale-reasonml-ols`
2018-02-12 22:52:39 -05:00
Kevin Tindall
716b46e10d functional pony linter 2018-02-10 13:17:53 -06:00
w0rp
a3329ef3fc Merge pull request #1333 from fennerm/master
Fix the lintr::lint_package command
2018-02-06 09:46:22 +00:00
Fenner Macrae
c2ab885384 Removed trailing whitespaces 2018-02-05 11:33:23 -08:00
Fenner Macrae
5dc884b24d Fixed lintr::lint_package command 2018-02-05 09:54:15 -08:00
w0rp
91b7a75afb Merge pull request #1332 from fennerm/master
Add lint_package support to lintr
2018-02-05 09:15:48 +00:00
Fenner Macrae
dda132c1a2 Add lint_package support to lintr 2018-02-04 10:57:52 -08:00
w0rp
33b3331b04 #1206 Add support for setting options for gobuild, and escape paths better 2018-02-04 13:55:09 +00:00
w0rp
0f822b063c Fix #1330 - Find isort configs better by changing the working directory 2018-02-04 13:16:44 +00:00
w0rp
31e0f48d62 Merge pull request #1326 from michaelquinn32/patch-1
Call lintr library before linting
2018-02-04 11:38:05 +00:00
w0rp
7c4decf804 Merge pull request #1329 from blyoa/prettier-vue
Add prettier fixer support to vue
2018-02-02 13:23:42 +00:00
Michael Quinn
b13f290390 Update formatting and tests. 2018-01-31 18:06:35 -08:00
blyoa
23db293bdf Add prettier fixer support to vue 2018-02-01 02:30:02 +09:00
w0rp
52fe924a13 Merge pull request #1308 from lorenzo/patch-1
Improving hadolint checker
2018-01-30 16:04:44 +00:00
Michael Quinn
bb095df25e Call lintr library before linting
This solves namespace issues related to the objects used to set linting options.
2018-01-29 20:18:14 -08:00
Jose Lorenzo Rodriguez
4df87eaadd Added tests for hadolint 2018-01-29 22:21:50 +01:00
w0rp
c589e3d57d Merge pull request #1322 from datanoise/master
fixed rust errors parsing
2018-01-29 13:54:50 +00:00
Kent Sibilev
863fb60695 updated rust handler test case 2018-01-28 18:35:46 -05:00
w0rp
1832240cff Merge pull request #1321 from butlerx/feature/po
add po support with proselint, writegood, msgfmt and alex
2018-01-28 12:49:18 +00:00
w0rp
65fc5d11c7 Fix #1038 - Automatically detect and use htmlhint configuration files 2018-01-28 12:44:42 +00:00
w0rp
7ef55a8615 #1303 jq isn't a Node program 2018-01-28 11:51:20 +00:00
Kent Sibilev
ea60fcea39 fixed rust errors parsing
use correct column values instead of absolute byte positions
2018-01-27 16:15:29 -05:00
butlerx
9dad25778f add po support with proselint, writegood, msgfmt and alex 2018-01-27 12:17:15 +00:00
w0rp
bc63325881 Merge pull request #1311 from butlerx/update/prettier-md
add prettier support for graphql
2018-01-26 17:30:00 +00:00
w0rp
34e6368610 #1316 Mention that the quickfix list option shouldn't be used with :cfdo 2018-01-25 14:54:39 +00:00
w0rp
dffc162dd6 Merge pull request #1313 from rhysd/fixjson-local-install
fixjson: Add support for local installation
2018-01-25 10:29:51 +00:00
rhysd
ef898fa303 fixjson: Add support for local installation 2018-01-25 07:21:25 +09:00
butlerx
be47e37bbc add prettier support for graphql 2018-01-24 15:25:25 +00:00
w0rp
9849c79ff7 Merge pull request #1157 from elebow/eruby-add-erubi-linter
[eruby] Add erubi linter
2018-01-24 10:40:57 +00:00
rhysd
b28a6ddbe4 Support fixing JSON files with fixjson 2018-01-24 10:36:31 +00:00
Rafael Rinaldi
d562d53102 Add jq as a JSON fixer 2018-01-24 10:12:29 +00:00
José Lorenzo Rodríguez
dd413a4732 Improving hadolint checker
- Displaying dockerfile parse errors instead of silently failing
- Adding error detail with link to the docs
2018-01-23 22:46:59 +01:00
Fran Casas
038789f0ed Add Elixir linter for dialyxir (#1257)
* Add Elixir linter for dialyxir

* Update doc/ale.txt with dialyxir

* Keep elixir tools alphabetically ordered in README

* Add a missing entry for dialyxir to the main documentation file.
2018-01-22 12:21:07 +00:00
w0rp
acf9c92ab4 Merge pull request #1301 from dezza/patch-2
Fix #1246 - Newer ESLint outputs to stderr
2018-01-20 14:41:09 +00:00
Christoffer Aasted
7cd25181b2 Fix #1246 - Newer ESLint outputs to stderr
I think Vader test still applies for this one.
2018-01-20 03:20:13 +01:00
w0rp
1d3b542031 Merge pull request #1266 from sharils/patch-1
Work around hot-reloading issue
2018-01-19 17:18:49 +00:00
w0rp
8675bfc4ab Merge pull request #1287 from rhysd/prettier-markdown
Enable prettier to format markdown files
2018-01-19 17:16:00 +00:00
w0rp
7b50b3ec82 Merge pull request #1272 from Codezerker/master
Add a luac linter for Lua
2018-01-19 17:10:29 +00:00
w0rp
a5ec4143d2 Fix the didSave tests so they work in NeoVim 0.1.7, and do not send the message for tsserver 2018-01-19 16:50:04 +00:00
Rafael Lerm
042dec059a Send didSave message to LSP-based linters (#1295)
* Also send didSave to LSP linters.
* Add tests for messages sent to LSP linters.
2018-01-19 16:40:55 +00:00
w0rp
eddda2f8b5 Fix a command wrapper test on Windows 2018-01-17 18:11:20 +00:00
w0rp
045c92ed65 Fix #1298 - Escape commands for PowerShell 2018-01-17 18:08:17 +00:00
Eddie Lebow
aa29c91cdc [eruby] Add erubi linter
Erubi is yet another parser for eRuby. This is the default parser in
Rails as of version 5.1. It supports some additional syntax with similar
behavior to Rails' extensions to the language, though incompatible.
Rails currently still recommends their own syntax, so GetCommand still
has to do the translation introduced in
https://github.com/w0rp/ale/pull/1114 .

Erubi does not supply an executable—It is intended to be invoked only
from within a Ruby program. In this case, a one-liner on the command
line.
2018-01-16 00:38:35 -05:00
rhysd
13c839cf16 Enable prettier to format markdown files 2018-01-15 11:28:56 +09:00
w0rp
f6af75aac4 Merge pull request #1268 from bbannier/master
Make it possible to inject flags of protoc invocation.
2018-01-12 20:43:43 +00:00
w0rp
e18aba1d7e Merge pull request #1270 from kevinkjt2000/test-ghc-options
test for ghc options
2018-01-12 12:11:33 +00:00
w0rp
5005871644 Merge pull request #1256 from jonatanolofsson/master
Fix #1255: Move extra clang-check args to before user options
2018-01-12 12:09:30 +00:00
w0rp
65fa901ef0 Merge pull request #1275 from ipetkov/cargo-features
Teach ALE about cargo features and add some configuration options
2018-01-12 12:04:26 +00:00
w0rp
ba1540a545 Show only the master status for AppVeyor 2018-01-12 08:55:31 +00:00
Ivan Petkov
2ef45ab745 Teach ALE about cargo features and add some configuration options
* When working on rust/cargo projects of varying sizes, it may be useful
to either build all possible features (i.e. lint all possible
conditionally compiled code), or even turn off other features for a
quicker edit-lint cycle (e.g. for large projects with large build times)
* Added a g:ale_rust_cargo_default_feature_behavior flag for instructing
cargo to not build any features at all (via `--no-default-features`),
building default features (via no extra flags), or building all possible
features (via `--all-features`)
* Also added a g:ale_rust_cargo_include_features flag for including
arbitrary features to be checked by cargo. When coupled with
g:ale_rust_cargo_default_feature_behavior this allows for full
customization of what features are checked and which ones are ignored
2018-01-11 19:24:44 -08:00
w0rp
adba2bd919 Allow syntax errors for mypy to be ignored 2018-01-11 16:43:10 +00:00
sharils
29acafdaf4 Work around hot-reloading issue
See https://github.com/phoenixframework/phoenix/issues/1165 for more detail
2018-01-10 20:53:02 +08:00
jiangzhi.xie
547716eabb Fix the doc style for ale-lua 2018-01-08 23:39:04 +08:00
jiangzhi.xie
112fcf7dd5 Add a luac linter for Lua 2018-01-08 23:32:02 +08:00
w0rp
68d4a2216c Fix a syntax error in a test 2018-01-08 13:28:01 +00:00
Kevin Tindall
ff388bbcd5 test for ghc options 2018-01-07 11:41:06 -06:00
Benjamin Bannier
b5a5cdf920 Make it possible to inject flags of protoc invocation.
Typically proto files depend on and make use of proto definitions in
other files. When invoking protoc user can supply paths to inspect for
dependencies.

This patch makes it possible to configure flags passed to protoc. This
makes it e.g., possible to change include paths of the linter's protoc
invocation.
2018-01-07 17:56:56 +01:00
Benjamin Bannier
eecbacb742 Removed unneeded SetDirectory call in proto handler test.
The test already handled arbitrary paths reasonably well, but setting
the directory interfered via leakage with others tests for some reason.

This patch removes the call to `SetDirectory` in the fixture setup and
the subsequent cleanup in the teardown as they are not required.
2018-01-07 17:54:21 +01:00
w0rp
f1747901cc Merge pull request #1262 from rhysd/avoid-old-tidy
html: Avoid old tidy on macOS
2018-01-07 16:02:49 +00:00
Jelte Fennema
b6d1c41925 Go: Add gotype support (#1099) 2018-01-07 12:11:01 +00:00
w0rp
c9d66b861b Show more ALE variables in ALEInfo 2018-01-07 12:01:20 +00:00
rhysd
7a1a534305 Explain /usr/bin/tidy is ignored on macOS and how to install the latest tidy 2018-01-06 20:00:36 +09:00
rhysd
401b964e9c html: Avoid old tidy on macOS
On macOS, Apple's command line toolchain installs very old `tidy`
command (It was released on 31 Oct 2006). It does not consider new specs
such as HTML5 so we should avoid it.
2018-01-03 01:50:31 +09:00
Jonatan Olofsson
ff8d4c5286 Fix #1255: Move extra clang-check args to before user options 2018-01-02 16:09:38 +01:00
w0rp
5285b0b332 Merge pull request #1260 from kevinkjt2000/add-ghc-options
haskell_ghc_options are now added to the ghc command
2018-01-02 14:05:40 +00:00
w0rp
e98a3899da Merge pull request #1254 from bkhl/master
Don't use temporary file for rustfmt fixer
2018-01-02 13:36:20 +00:00
w0rp
80342b119a Merge pull request #1252 from nthapaliya/fish-shell-linter
Fish shell linter
2018-01-02 13:32:59 +00:00
w0rp
d9a3722e06 Merge branch 'add-fountain-proselint-support' 2018-01-02 13:23:00 +00:00
w0rp
1e34210f9a Fix some bad indentation 2018-01-02 13:22:40 +00:00
Kevin Tindall
681c35169f add ghc entry to the ToC 2018-01-01 22:33:43 -06:00
Kevin Tindall
d8f71c46da haskell_ghc_options are now added to the ghc command 2018-01-01 22:21:21 -06:00
Björn Lindström
b0eaddadc9 Don't use temporary file for rustfmt fixer
rustfmt normally acts on a file in place, and applies configuration
from rustfmt.toml files according to the path of the file.

Using a temporary file for rustfmt breaks this functionality, so
removing the '%t' from the rustfmt command.
2017-12-27 23:12:57 +07:00
Niraj Thapaliya
3b0c67e42c Add handler test 2017-12-26 14:10:28 -06:00
Niraj Thapaliya
c90b45c559 Edit README and help 2017-12-26 14:10:28 -06:00
Niraj Thapaliya
e2d3dca486 Support for fish file linting 2017-12-26 12:25:17 -06:00
w0rp
c165c7c5d1 Fix #1251 - Handle an empty list in the line callback when NeoVim crashes 2017-12-26 18:15:59 +00:00
w0rp
48cae6afc4 Merge pull request #1250 from yaryabu/patch-1
Fix c# documentation variable typo
2017-12-26 18:09:38 +00:00
Yaroslav Ryabukha
0548cf9177 Fix c# documentation variable typo 2017-12-25 16:40:25 +03:00
Jansen Mitchell
4d4d2d8122 Add four spaces, not tabs. 2017-12-20 22:53:03 -06:00
Jansen Mitchell
2c9c5dec1e Add Fountain with proselint info to ale.txt. Add Fountain online documentation. 2017-12-20 12:39:10 -06:00
w0rp
e43e7065da Fix #1115 - Add support for wrapping all commands with an option 2017-12-20 12:20:38 +00:00
w0rp
2495744fc3 Fix the gitlint test 2017-12-20 10:49:23 +00:00
w0rp
87ffc9b55c Make the error codes configurable for gitlint 2017-12-20 10:46:08 +00:00
Nick Diego Yamane
d4b43d23f4 Add support for linting git commit message files (#1233) 2017-12-20 10:10:07 +00:00
Jansen Mitchell
537d162ee7 Add Fountain and linter support information to README. 2017-12-19 21:57:25 -06:00
Jansen Mitchell
4b56b91ac8 Add support for Fountain with proselint. 2017-12-19 20:27:12 -06:00
366 changed files with 9317 additions and 1197 deletions

7
.gitignore vendored
View File

@@ -1,6 +1,7 @@
/init.vim
/doc/tags
.*
!.editorconfig !.editorconfig
*.obj *.obj
.*
/doc/tags
/init.vim
/test/ale-info-test-file
tags tags

View File

@@ -1,4 +1,4 @@
Copyright (c) 2016-2017, w0rp <devw0rp@gmail.com> Copyright (c) 2016-2018, w0rp <devw0rp@gmail.com>
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without

View File

@@ -12,7 +12,8 @@ READ THIS: Before creating a pull request, please consider the following first.
that ALE can work with, please add Vader tests for them. Look at existing that ALE can work with, please add Vader tests for them. Look at existing
tests in the test/handler directory, etc. tests in the test/handler directory, etc.
* If you add or modify a function for computing a command line string for * If you add or modify a function for computing a command line string for
running a command, please add Vader tests for that. running a command, please add Vader tests for that. Look at existing
tests in the test/command_callback directory, etc.
* Generally try and cover anything with Vader tests, although some things just * 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 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 breaking up your code so that some parts can be tested, and generally open up

212
README.md
View File

@@ -1,10 +1,10 @@
# Asynchronous Lint Engine [![Travis CI Build Status](https://travis-ci.org/w0rp/ale.svg?branch=master)](https://travis-ci.org/w0rp/ale) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/w0rp/ale?svg=true)](https://ci.appveyor.com/project/w0rp/ale) # Asynchronous Lint Engine [![Travis CI Build Status](https://travis-ci.org/w0rp/ale.svg?branch=master)](https://travis-ci.org/w0rp/ale) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/r0ef1xu8xjmik58d/branch/master?svg=true)](https://ci.appveyor.com/project/w0rp/ale)
![ALE Logo by Mark Grealish - https://www.bhalash.com/](img/logo.jpg?raw=true) ![ALE Logo by Mark Grealish - https://www.bhalash.com/](img/logo.jpg?raw=true)
ALE (Asynchronous Lint Engine) is a plugin for providing linting in NeoVim ALE (Asynchronous Lint Engine) is a plugin for providing linting in NeoVim
and Vim 8 while you edit your text files. 0.2.0+ and Vim 8 while you edit your text files.
![linting example](img/example.gif?raw=true) ![linting example](img/example.gif?raw=true)
@@ -16,8 +16,18 @@ back to a filesystem.
In other words, this plugin allows you to lint while you type. In other words, this plugin allows you to lint while you type.
In addition to linting support, ALE offers some support for fixing code with ALE offers support for fixing code with command line tools in a non-blocking
formatting tools, and some Language Server Protocol and `tsserver` features. manner with the `:ALEFix` feature, supporting tools in many languages, like
`prettier`, `eslint`, `autopep8`, and more.
ALE acts as a "language client" to support a variety of Language Server Protocol
features, including:
* Diagnostics (via Language Server Protocol linters)
* Go To Definition (`:ALEGoToDefinition`)
* Completion (`let g:ale_completion_enabled = 1`)
* Finding references (`:ALEFindReferences`)
* Hover information (`:ALEHover`)
## Table of Contents ## Table of Contents
@@ -27,6 +37,8 @@ formatting tools, and some Language Server Protocol and `tsserver` features.
2. [Fixing](#usage-fixing) 2. [Fixing](#usage-fixing)
3. [Completion](#usage-completion) 3. [Completion](#usage-completion)
4. [Go To Definition](#usage-go-to-definition) 4. [Go To Definition](#usage-go-to-definition)
5. [Find References](#usage-find-references)
6. [Hovering](#usage-hover)
3. [Installation](#installation) 3. [Installation](#installation)
1. [Installation with Vim package management](#standard-installation) 1. [Installation with Vim package management](#standard-installation)
2. [Installation with Pathogen](#installation-with-pathogen) 2. [Installation with Pathogen](#installation-with-pathogen)
@@ -48,6 +60,7 @@ formatting tools, and some Language Server Protocol and `tsserver` features.
13. [Will this plugin eat all of my laptop battery power?](#faq-my-battery-is-sad) 13. [Will this plugin eat all of my laptop battery power?](#faq-my-battery-is-sad)
14. [How can I configure my C or C++ project?](#faq-c-configuration) 14. [How can I configure my C or C++ project?](#faq-c-configuration)
15. [How can I configure ALE differently for different buffers?](#faq-buffer-configuration) 15. [How can I configure ALE differently for different buffers?](#faq-buffer-configuration)
16. [How can I configure the height of the list in which ALE displays errors?](#faq-list-window-height)
<a name="supported-languages"></a> <a name="supported-languages"></a>
@@ -79,8 +92,8 @@ formatting.
| Awk | [gawk](https://www.gnu.org/software/gawk/)| | Awk | [gawk](https://www.gnu.org/software/gawk/)|
| Bash | shell [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set), [shellcheck](https://www.shellcheck.net/), [shfmt](https://github.com/mvdan/sh) | | Bash | shell [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set), [shellcheck](https://www.shellcheck.net/), [shfmt](https://github.com/mvdan/sh) |
| Bourne Shell | shell [-n flag](http://linux.die.net/man/1/sh), [shellcheck](https://www.shellcheck.net/), [shfmt](https://github.com/mvdan/sh) | | Bourne Shell | shell [-n flag](http://linux.die.net/man/1/sh), [shellcheck](https://www.shellcheck.net/), [shfmt](https://github.com/mvdan/sh) |
| C | [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint), [gcc](https://gcc.gnu.org/), [clang](http://clang.llvm.org/), [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html)| | C | [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint), [clang](http://clang.llvm.org/), [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html), [flawfinder](https://www.dwheeler.com/flawfinder/), [gcc](https://gcc.gnu.org/) |
| C++ (filetype cpp) | [clang](http://clang.llvm.org/), [clangcheck](http://clang.llvm.org/docs/ClangCheck.html) !!, [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html), [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint) !!, [gcc](https://gcc.gnu.org/) | | C++ (filetype cpp) | [clang](http://clang.llvm.org/), [clangcheck](http://clang.llvm.org/docs/ClangCheck.html) !!, [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html), [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint) !!, [flawfinder](https://www.dwheeler.com/flawfinder/), [gcc](https://gcc.gnu.org/) |
| CUDA | [nvcc](http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html) | | CUDA | [nvcc](http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html) |
| C# | [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) see:`help ale-cs-mcs` for details, [mcsc](http://www.mono-project.com/docs/about-mono/languages/csharp/) !! see:`help ale-cs-mcsc` for details and configuration| | C# | [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) see:`help ale-cs-mcs` for details, [mcsc](http://www.mono-project.com/docs/about-mono/languages/csharp/) !! see:`help ale-cs-mcsc` for details and configuration|
| Chef | [foodcritic](http://www.foodcritic.io/) | | Chef | [foodcritic](http://www.foodcritic.io/) |
@@ -89,60 +102,69 @@ formatting.
| CoffeeScript | [coffee](http://coffeescript.org/), [coffeelint](https://www.npmjs.com/package/coffeelint) | | CoffeeScript | [coffee](http://coffeescript.org/), [coffeelint](https://www.npmjs.com/package/coffeelint) |
| Crystal | [crystal](https://crystal-lang.org/) !! | | Crystal | [crystal](https://crystal-lang.org/) !! |
| CSS | [csslint](http://csslint.net/), [prettier](https://github.com/prettier/prettier), [stylelint](https://github.com/stylelint/stylelint) | | CSS | [csslint](http://csslint.net/), [prettier](https://github.com/prettier/prettier), [stylelint](https://github.com/stylelint/stylelint) |
| Cucumber | [cucumber](https://cucumber.io/) |
| Cython (pyrex filetype) | [cython](http://cython.org/) | | Cython (pyrex filetype) | [cython](http://cython.org/) |
| D | [dmd](https://dlang.org/dmd-linux.html) | | D | [dmd](https://dlang.org/dmd-linux.html) |
| Dafny | [dafny](https://rise4fun.com/Dafny) !! | | Dafny | [dafny](https://rise4fun.com/Dafny) !! |
| Dart | [dartanalyzer](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) !!, [language_server](https://github.com/natebosch/dart_language_server) | | Dart | [dartanalyzer](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) !!, [language_server](https://github.com/natebosch/dart_language_server) |
| Dockerfile | [hadolint](https://github.com/lukasmartinelli/hadolint) | | Dockerfile | [hadolint](https://github.com/hadolint/hadolint) |
| Elixir | [credo](https://github.com/rrrene/credo), [dogma](https://github.com/lpil/dogma) !! | | Elixir | [credo](https://github.com/rrrene/credo), [dialyxir](https://github.com/jeremyjh/dialyxir), [dogma](https://github.com/lpil/dogma) !!|
| Elm | [elm-format](https://github.com/avh4/elm-format), [elm-make](https://github.com/elm-lang/elm-make) | | Elm | [elm-format](https://github.com/avh4/elm-format), [elm-make](https://github.com/elm-lang/elm-make) |
| Erb | [erb](https://github.com/jeremyevans/erubi), [erubis](https://github.com/kwatch/erubis) | | Erb | [erb](https://apidock.com/ruby/ERB), [erubi](https://github.com/jeremyevans/erubi), [erubis](https://github.com/kwatch/erubis) |
| Erlang | [erlc](http://erlang.org/doc/man/erlc.html), [SyntaxErl](https://github.com/ten0s/syntaxerl) | | Erlang | [erlc](http://erlang.org/doc/man/erlc.html), [SyntaxErl](https://github.com/ten0s/syntaxerl) |
| Fish | fish [-n flag](https://linux.die.net/man/1/fish)
| Fortran | [gcc](https://gcc.gnu.org/) | | Fortran | [gcc](https://gcc.gnu.org/) |
| Fountain | [proselint](http://proselint.com/) |
| FusionScript | [fusion-lint](https://github.com/RyanSquared/fusionscript) | | FusionScript | [fusion-lint](https://github.com/RyanSquared/fusionscript) |
| Git Commit Messages | [gitlint](https://github.com/jorisroovers/gitlint) |
| GLSL | [glslang](https://github.com/KhronosGroup/glslang), [glslls](https://github.com/svenstaro/glsl-language-server) | | GLSL | [glslang](https://github.com/KhronosGroup/glslang), [glslls](https://github.com/svenstaro/glsl-language-server) |
| Go | [gofmt](https://golang.org/cmd/gofmt/), [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports), [go vet](https://golang.org/cmd/vet/), [golint](https://godoc.org/github.com/golang/lint), [gometalinter](https://github.com/alecthomas/gometalinter) !!, [go build](https://golang.org/cmd/go/) !!, [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple) !!, [staticcheck](https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck) !! | | Go | [gofmt](https://golang.org/cmd/gofmt/), [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports), [go vet](https://golang.org/cmd/vet/) !!, [golint](https://godoc.org/github.com/golang/lint), [gotype](https://godoc.org/golang.org/x/tools/cmd/gotype) !!, [gometalinter](https://github.com/alecthomas/gometalinter) !!, [go build](https://golang.org/cmd/go/) !!, [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple) !!, [staticcheck](https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck) !! |
| GraphQL | [eslint](http://eslint.org/), [gqlint](https://github.com/happylinks/gqlint) | | GraphQL | [eslint](http://eslint.org/), [gqlint](https://github.com/happylinks/gqlint), [prettier](https://github.com/prettier/prettier) |
| Haml | [haml-lint](https://github.com/brigade/haml-lint) | | Haml | [haml-lint](https://github.com/brigade/haml-lint) |
| Handlebars | [ember-template-lint](https://github.com/rwjblue/ember-template-lint) | | Handlebars | [ember-template-lint](https://github.com/rwjblue/ember-template-lint) |
| Haskell | [brittany](https://github.com/lspitzner/brittany), [ghc](https://www.haskell.org/ghc/), [stack-ghc](https://haskellstack.org/), [stack-build](https://haskellstack.org/) !!, [ghc-mod](https://github.com/DanielG/ghc-mod), [stack-ghc-mod](https://github.com/DanielG/ghc-mod), [hlint](https://hackage.haskell.org/package/hlint), [hdevtools](https://hackage.haskell.org/package/hdevtools), [hfmt](https://github.com/danstiner/hfmt) | | Haskell | [brittany](https://github.com/lspitzner/brittany), [ghc](https://www.haskell.org/ghc/), [stack-ghc](https://haskellstack.org/), [stack-build](https://haskellstack.org/) !!, [ghc-mod](https://github.com/DanielG/ghc-mod), [stack-ghc-mod](https://github.com/DanielG/ghc-mod), [hlint](https://hackage.haskell.org/package/hlint), [hdevtools](https://hackage.haskell.org/package/hdevtools), [hfmt](https://github.com/danstiner/hfmt) |
| HTML | [alex](https://github.com/wooorm/alex) !!, [HTMLHint](http://htmlhint.com/), [proselint](http://proselint.com/), [tidy](http://www.html-tidy.org/), [write-good](https://github.com/btford/write-good) | | HTML | [alex](https://github.com/wooorm/alex) !!, [HTMLHint](http://htmlhint.com/), [proselint](http://proselint.com/), [tidy](http://www.html-tidy.org/), [write-good](https://github.com/btford/write-good) |
| Idris | [idris](http://www.idris-lang.org/) | | Idris | [idris](http://www.idris-lang.org/) |
| Java | [checkstyle](http://checkstyle.sourceforge.net), [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html), [google-java-format](https://github.com/google/google-java-format) | | Java | [checkstyle](http://checkstyle.sourceforge.net), [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html), [google-java-format](https://github.com/google/google-java-format), [PMD](https://pmd.github.io/) |
| JavaScript | [eslint](http://eslint.org/), [flow](https://flowtype.org/), [jscs](http://jscs.info/), [jshint](http://jshint.com/), [prettier](https://github.com/prettier/prettier), [prettier-eslint](https://github.com/prettier/prettier-eslint), [prettier-standard](https://github.com/sheerun/prettier-standard), [standard](http://standardjs.com/), [xo](https://github.com/sindresorhus/xo) | JavaScript | [eslint](http://eslint.org/), [flow](https://flowtype.org/), [jscs](http://jscs.info/), [jshint](http://jshint.com/), [prettier](https://github.com/prettier/prettier), [prettier-eslint](https://github.com/prettier/prettier-eslint-cli), [prettier-standard](https://github.com/sheerun/prettier-standard), [standard](http://standardjs.com/), [xo](https://github.com/sindresorhus/xo)
| JSON | [jsonlint](http://zaa.ch/jsonlint/), [prettier](https://github.com/prettier/prettier) | | JSON | [fixjson](https://github.com/rhysd/fixjson), [jsonlint](http://zaa.ch/jsonlint/), [jq](https://stedolan.github.io/jq/), [prettier](https://github.com/prettier/prettier) |
| Kotlin | [kotlinc](https://kotlinlang.org) !!, [ktlint](https://ktlint.github.io) !! see `:help ale-integration-kotlin` for configuration instructions | | Kotlin | [kotlinc](https://kotlinlang.org) !!, [ktlint](https://ktlint.github.io) !! see `:help ale-integration-kotlin` for configuration instructions |
| LaTeX | [alex](https://github.com/wooorm/alex) !!, [chktex](http://www.nongnu.org/chktex/), [lacheck](https://www.ctan.org/pkg/lacheck), [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) | | LaTeX | [alex](https://github.com/wooorm/alex) !!, [chktex](http://www.nongnu.org/chktex/), [lacheck](https://www.ctan.org/pkg/lacheck), [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
| Less | [lessc](https://www.npmjs.com/package/less), [prettier](https://github.com/prettier/prettier), [stylelint](https://github.com/stylelint/stylelint) | | Less | [lessc](https://www.npmjs.com/package/less), [prettier](https://github.com/prettier/prettier), [stylelint](https://github.com/stylelint/stylelint) |
| LLVM | [llc](https://llvm.org/docs/CommandGuide/llc.html) | | LLVM | [llc](https://llvm.org/docs/CommandGuide/llc.html) |
| Lua | [luacheck](https://github.com/mpeterv/luacheck) | | Lua | [luac](https://www.lua.org/manual/5.1/luac.html), [luacheck](https://github.com/mpeterv/luacheck) |
| Mail | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale) | | Mail | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale) |
| Make | [checkmake](https://github.com/mrtazz/checkmake) | | Make | [checkmake](https://github.com/mrtazz/checkmake) |
| Markdown | [alex](https://github.com/wooorm/alex) !!, [mdl](https://github.com/mivok/markdownlint), [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [remark-lint](https://github.com/wooorm/remark-lint) !!, [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) | | Markdown | [alex](https://github.com/wooorm/alex) !!, [markdownlint](https://github.com/DavidAnson/markdownlint) !!, [mdl](https://github.com/mivok/markdownlint), [prettier](https://github.com/prettier/prettier), [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [remark-lint](https://github.com/wooorm/remark-lint) !!, [textlint](https://textlint.github.io/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
| MATLAB | [mlint](https://www.mathworks.com/help/matlab/ref/mlint.html) | | MATLAB | [mlint](https://www.mathworks.com/help/matlab/ref/mlint.html) |
| Mercury | [mmc](http://mercurylang.org) !! |
| NASM | [nasm](https://www.nasm.us/) !! |
| Nim | [nim check](https://nim-lang.org/docs/nimc.html) !! | | Nim | [nim check](https://nim-lang.org/docs/nimc.html) !! |
| nix | [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate) | | nix | [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate) |
| nroff | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good)| | nroff | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good)|
| Objective-C | [clang](http://clang.llvm.org/) | | Objective-C | [clang](http://clang.llvm.org/) |
| Objective-C++ | [clang](http://clang.llvm.org/) | | Objective-C++ | [clang](http://clang.llvm.org/) |
| OCaml | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-ocaml-merlin` for configuration instructions, [ols](https://github.com/freebroccolo/ocaml-language-server) | | OCaml | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-ocaml-merlin` for configuration instructions, [ols](https://github.com/freebroccolo/ocaml-language-server) |
| Perl | [perl -c](https://perl.org/), [perl-critic](https://metacpan.org/pod/Perl::Critic) | | Perl | [perl -c](https://perl.org/), [perl-critic](https://metacpan.org/pod/Perl::Critic), [perltidy](https://metacpan.org/pod/distribution/Perl-Tidy/bin/perltidy) |
| PHP | [hack](http://hacklang.org/), [hackfmt](https://github.com/facebook/flow/tree/master/hack/hackfmt), [langserver](https://github.com/felixfbecker/php-language-server), [phan](https://github.com/phan/phan) see `:help ale-php-phan` to instructions, [php -l](https://secure.php.net/), [phpcs](https://github.com/squizlabs/PHP_CodeSniffer), [phpmd](https://phpmd.org), [phpstan](https://github.com/phpstan/phpstan), [phpcbf](https://github.com/squizlabs/PHP_CodeSniffer) | | PHP | [hack](http://hacklang.org/), [hackfmt](https://github.com/facebook/flow/tree/master/hack/hackfmt), [langserver](https://github.com/felixfbecker/php-language-server), [phan](https://github.com/phan/phan) see `:help ale-php-phan` to instructions, [php -l](https://secure.php.net/), [phpcs](https://github.com/squizlabs/PHP_CodeSniffer), [phpmd](https://phpmd.org), [phpstan](https://github.com/phpstan/phpstan), [phpcbf](https://github.com/squizlabs/PHP_CodeSniffer), [php-cs-fixer](http://cs.sensiolabs.org/) |
| PO | [alex](https://github.com/wooorm/alex) !!, [msgfmt](https://www.gnu.org/software/gettext/manual/html_node/msgfmt-Invocation.html), [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
| Pod | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) | | Pod | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
| Pony | [ponyc](https://github.com/ponylang/ponyc) |
| proto | [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint) | | proto | [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint) |
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) | | Pug | [pug-lint](https://github.com/pugjs/pug-lint) |
| Puppet | [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) | | Puppet | [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) |
| Python | [autopep8](https://github.com/hhatto/autopep8), [flake8](http://flake8.pycqa.org/en/latest/), [isort](https://github.com/timothycrosley/isort), [mypy](http://mypy-lang.org/), [prospector](http://github.com/landscapeio/prospector), [pycodestyle](https://github.com/PyCQA/pycodestyle), [pyls](https://github.com/palantir/python-language-server), [pylint](https://www.pylint.org/) !!, [yapf](https://github.com/google/yapf) | | Python | [autopep8](https://github.com/hhatto/autopep8), [black](https://github.com/ambv/black), [flake8](http://flake8.pycqa.org/en/latest/), [isort](https://github.com/timothycrosley/isort), [mypy](http://mypy-lang.org/), [prospector](http://github.com/landscapeio/prospector), [pycodestyle](https://github.com/PyCQA/pycodestyle), [pyls](https://github.com/palantir/python-language-server), [pylint](https://www.pylint.org/) !!, [yapf](https://github.com/google/yapf) |
| QML | [qmlfmt](https://github.com/jesperhh/qmlfmt), [qmllint](https://github.com/qt/qtdeclarative/tree/5.11/tools/qmllint) |
| R | [lintr](https://github.com/jimhester/lintr) | | R | [lintr](https://github.com/jimhester/lintr) |
| ReasonML | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-integration-reason-merlin` for configuration instructions, [ols](https://github.com/freebroccolo/ocaml-language-server), [refmt](https://github.com/reasonml/reason-cli) | | ReasonML | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-reasonml-ols` for configuration instructions, [ols](https://github.com/freebroccolo/ocaml-language-server), [refmt](https://github.com/reasonml/reason-cli) |
| reStructuredText | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [rstcheck](https://github.com/myint/rstcheck), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) | | reStructuredText | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [rstcheck](https://github.com/myint/rstcheck), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
| Re:VIEW | [redpen](http://redpen.cc/) | | Re:VIEW | [redpen](http://redpen.cc/) |
| RPM spec | [rpmlint](https://github.com/rpm-software-management/rpmlint) (disabled by default; see `:help ale-integration-spec`) | | RPM spec | [rpmlint](https://github.com/rpm-software-management/rpmlint) (disabled by default; see `:help ale-integration-spec`) |
| Ruby | [brakeman](http://brakemanscanner.org/) !!, [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) !!, [reek](https://github.com/troessner/reek), [rubocop](https://github.com/bbatsov/rubocop), [ruby](https://www.ruby-lang.org) | | Ruby | [brakeman](http://brakemanscanner.org/) !!, [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) !!, [reek](https://github.com/troessner/reek), [rubocop](https://github.com/bbatsov/rubocop), [ruby](https://www.ruby-lang.org), [rufo](https://github.com/ruby-formatter/rufo) |
| Rust | cargo !! (see `:help ale-integration-rust` for configuration instructions), [rls](https://github.com/rust-lang-nursery/rls), [rustc](https://www.rust-lang.org/), [rustfmt](https://github.com/rust-lang-nursery/rustfmt) | | Rust | cargo !! (see `:help ale-integration-rust` for configuration instructions), [rls](https://github.com/rust-lang-nursery/rls), [rustc](https://www.rust-lang.org/), [rustfmt](https://github.com/rust-lang-nursery/rustfmt) |
| SASS | [sass-lint](https://www.npmjs.com/package/sass-lint), [stylelint](https://github.com/stylelint/stylelint) | | SASS | [sass-lint](https://www.npmjs.com/package/sass-lint), [stylelint](https://github.com/stylelint/stylelint) |
| SCSS | [prettier](https://github.com/prettier/prettier), [sass-lint](https://www.npmjs.com/package/sass-lint), [scss-lint](https://github.com/brigade/scss-lint), [stylelint](https://github.com/stylelint/stylelint) | | SCSS | [prettier](https://github.com/prettier/prettier), [sass-lint](https://www.npmjs.com/package/sass-lint), [scss-lint](https://github.com/brigade/scss-lint), [stylelint](https://github.com/stylelint/stylelint) |
| Scala | [scalac](http://scala-lang.org), [scalastyle](http://www.scalastyle.org) | | Scala | [fsc](https://www.scala-lang.org/old/sites/default/files/linuxsoft_archives/docu/files/tools/fsc.html), [scalac](http://scala-lang.org), [scalastyle](http://www.scalastyle.org) |
| Slim | [slim-lint](https://github.com/sds/slim-lint) | | Slim | [slim-lint](https://github.com/sds/slim-lint) |
| SML | [smlnj](http://www.smlnj.org/) | | SML | [smlnj](http://www.smlnj.org/) |
| Solidity | [solhint](https://github.com/protofire/solhint), [solium](https://github.com/duaraghav8/Solium) | | Solidity | [solhint](https://github.com/protofire/solhint), [solium](https://github.com/duaraghav8/Solium) |
@@ -152,12 +174,13 @@ formatting.
| Tcl | [nagelfar](http://nagelfar.sourceforge.net) !! | | Tcl | [nagelfar](http://nagelfar.sourceforge.net) !! |
| Terraform | [tflint](https://github.com/wata727/tflint) | | Terraform | [tflint](https://github.com/wata727/tflint) |
| Texinfo | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good)| | Texinfo | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good)|
| Text^ | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good), [redpen](http://redpen.cc/) | | Text^ | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [textlint](https://textlint.github.io/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
| Thrift | [thrift](http://thrift.apache.org/) | | Thrift | [thrift](http://thrift.apache.org/) |
| TypeScript | [eslint](http://eslint.org/), [prettier](https://github.com/prettier/prettier), [tslint](https://github.com/palantir/tslint), tsserver, typecheck | | TypeScript | [eslint](http://eslint.org/), [prettier](https://github.com/prettier/prettier), [tslint](https://github.com/palantir/tslint), tsserver, typecheck |
| Verilog | [iverilog](https://github.com/steveicarus/iverilog), [verilator](http://www.veripool.org/projects/verilator/wiki/Intro) | | Verilog | [iverilog](https://github.com/steveicarus/iverilog), [verilator](http://www.veripool.org/projects/verilator/wiki/Intro) |
| Vim | [vint](https://github.com/Kuniwak/vint) | | Vim | [vint](https://github.com/Kuniwak/vint) |
| Vim help^ | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) | | Vim help^ | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
| Vue | [prettier](https://github.com/prettier/prettier) |
| XHTML | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) | | XHTML | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
| XML | [xmllint](http://xmlsoft.org/xmllint.html) | | XML | [xmllint](http://xmlsoft.org/xmllint.html) |
| YAML | [swaglint](https://github.com/byCedric/swaglint), [yamllint](https://yamllint.readthedocs.io/) | | YAML | [swaglint](https://github.com/byCedric/swaglint), [yamllint](https://yamllint.readthedocs.io/) |
@@ -187,24 +210,42 @@ ale-linter-options` for options specified to particular linters.
### 2.ii Fixing ### 2.ii Fixing
ALE can fix files with the `ALEFix` command. Functions need to be configured ALE can fix files with the `ALEFix` command. Functions need to be configured
for different filetypes with the `g:ale_fixers` variable. For example, the either in each buffer with a `b:ale_fixers`, or globally with `g:ale_fixers`.
following code can be used to fix JavaScript code with ESLint:
The recommended way to configure fixers is to define a List in an ftplugin file.
```vim ```vim
" Put this in vimrc or a plugin file of your own. " In ~/.vim/ftplugin/javascript.vim, or somewhere similar.
" After this is configured, :ALEFix will try and fix your JS code with ESLint.
" Fix files with prettier, and then ESLint.
let b:ale_fixers = ['prettier', 'eslint']
" Equivalent to the above.
let b:ale_fixers = {'javascript': ['prettier', 'eslint']}
```
You can also configure your fixers from vimrc using `g:ale_fixers`, before
or after ALE has been loaded.
```vim
" In ~/.vim/vimrc, or somewhere similar.
let g:ale_fixers = { let g:ale_fixers = {
\ 'javascript': ['eslint'], \ 'javascript': ['eslint'],
\} \}
```
" Set this setting in vimrc if you want to fix files automatically on save. If you want to automatically fix files when you save them, you need to turn
" This is off by default. a setting on in vimrc.
```vim
" Set this variable to 1 to fix files when you save them.
let g:ale_fix_on_save = 1 let g:ale_fix_on_save = 1
``` ```
The `:ALEFixSuggest` command will suggest some supported tools for fixing code, The `:ALEFixSuggest` command will suggest some supported tools for fixing code.
but fixers can be also implemented with functions, including lambda functions Both `g:ale_fixers` and `b:ale_fixers` can also accept functions, including
too. See `:help ale-fix` for detailed information. lambda functions, as fixers, for fixing files with custom tools.
See `:help ale-fix` for complete information on how to fix files with ALE.
<a name="usage-completion"></a> <a name="usage-completion"></a>
@@ -212,9 +253,7 @@ too. See `:help ale-fix` for detailed information.
ALE offers some support for completion via hijacking of omnicompletion while you ALE offers some support for completion via hijacking of omnicompletion while you
type. All of ALE's completion information must come from Language Server type. All of ALE's completion information must come from Language Server
Protocol linters, or similar protocols. At the moment, completion is only Protocol linters, or from `tsserver` for TypeSript.
supported for TypeScript code with `tsserver`, when `tsserver` is enabled. You
can enable completion like so:
```vim ```vim
" Enable completion where available. " Enable completion where available.
@@ -228,10 +267,34 @@ See `:help ale-completion` for more information.
### 2.iv Go To Definition ### 2.iv Go To Definition
ALE supports jumping to the definition of words under your cursor with the ALE supports jumping to the definition of words under your cursor with the
`:ALEGoToDefinition` command using any enabled LSP linters and `tsserver`. `:ALEGoToDefinition` command using any enabled Language Server Protocol linters
and `tsserver`.
See `:help ale-go-to-definition` for more information. See `:help ale-go-to-definition` for more information.
<a name="usage-find-references"></a>
### 2.v Find References
ALE supports finding references for words under your cursor with the
`:ALEFindReferences` command using any enabled Language Server Protocol linters
and `tsserver`.
See `:help ale-find-references` for more information.
<a name="usage-hover"></a>
### 2.vi Hovering
ALE supports "hover" information for printing brief information about symbols at
the cursor taken from Language Server Protocol linters and `tsserver` with the
`ALEHover` command.
On vim/gvim with `balloon` support you can see the information in a tooltip
that appears under the mouse when you mouseover a symbol.
See `:help ale-hover` for more information.
<a name="installation"></a> <a name="installation"></a>
## 3. Installation ## 3. Installation
@@ -340,12 +403,28 @@ on Freenode. Web chat is available [here](https://webchat.freenode.net/?channels
### 5.i. How do I disable particular linters? ### 5.i. How do I disable particular linters?
By default, all available tools for all supported languages will be run. By default, all available tools for all supported languages will be run. If you
If you want to only select a subset of the tools, simply create a want to only select a subset of the tools, you can define `b:ale_linters` for a
`g:ale_linters` dictionary in your vimrc file mapping filetypes single buffer, or `g:ale_linters` globally.
to lists of linters to run.
The recommended way to configure linters is to define a List in an ftplugin
file.
```vim ```vim
" In ~/.vim/ftplugin/javascript.vim, or somewhere similar.
" Enable ESLint only for JavaScript.
let b:ale_linters = ['eslint']
" Equivalent to the above.
let b:ale_linters = {'javascript': ['eslint']}
```
You can also declare which linters you want to run in your vimrc file, before or
after ALE has been loaded.
```vim
" In ~/.vim/vimrc, or somewhere similar.
let g:ale_linters = { let g:ale_linters = {
\ 'javascript': ['eslint'], \ 'javascript': ['eslint'],
\} \}
@@ -356,6 +435,14 @@ be run for those languages, just as when the dictionary is not defined.
Running many linters should not typically obstruct editing in Vim, Running many linters should not typically obstruct editing in Vim,
as they will all be executed in separate processes simultaneously. as they will all be executed in separate processes simultaneously.
If you don't want ALE to run anything other than what you've explicitly asked
for, you can set `g:ale_linters_explicit` to `1`.
```vim
" Only run linters named in ale_linters settings.
let g:ale_linters_explicit = 1
```
This plugin will look for linters in the [`ale_linters`](ale_linters) directory. This plugin will look for linters in the [`ale_linters`](ale_linters) directory.
Each directory within corresponds to a particular filetype in Vim, and each file Each directory within corresponds to a particular filetype in Vim, and each file
in each directory corresponds to the name of a particular linter. in each directory corresponds to the name of a particular linter.
@@ -474,6 +561,8 @@ There are 3 global options that allow customizing the echoed message.
- `g:ale_echo_msg_format` where: - `g:ale_echo_msg_format` where:
* `%s` is the error message itself * `%s` is the error message itself
* `%...code...%` is an optional error code, and most characters can be
written between the `%` characters.
* `%linter%` is the linter name * `%linter%` is the linter name
* `%severity` is the severity type * `%severity` is the severity type
- `g:ale_echo_msg_error_str` is the string used for error severity. - `g:ale_echo_msg_error_str` is the string used for error severity.
@@ -491,20 +580,28 @@ Will give you:
![Echoed message](img/echo.png) ![Echoed message](img/echo.png)
See `:help g:ale_echo_msg_format` for more information.
<a name="faq-autocmd"></a> <a name="faq-autocmd"></a>
### 5.viii. How can I execute some code when ALE starts or stops linting? ### 5.viii. How can I execute some code when ALE starts or stops linting?
ALE runs its own [autocmd](http://vimdoc.sourceforge.net/htmldoc/autocmd.html) ALE runs its own [autocmd](http://vimdoc.sourceforge.net/htmldoc/autocmd.html)
events whenever has a linter is started and has been successfully executed and events when a lint or fix cycle are started and stopped. There is also an event
processed. These events can be used to call arbitrary functions before and after that runs when a linter job has been successfully started. These events can be
ALE stops linting. used to call arbitrary functions during these respective parts of the ALE's
operation.
```vim ```vim
augroup YourGroup augroup YourGroup
autocmd! autocmd!
autocmd User ALELintPre call YourFunction() autocmd User ALELintPre call YourFunction()
autocmd User ALELintPost call YourFunction() autocmd User ALELintPost call YourFunction()
autocmd User ALEJobStarted call YourFunction()
autocmd User ALEFixPre call YourFunction()
autocmd User ALEFixPost call YourFunction()
augroup END augroup END
``` ```
@@ -571,6 +668,9 @@ let g:ale_open_list = 1
let g:ale_keep_list_window_open = 1 let g:ale_keep_list_window_open = 1
``` ```
You can also set `let g:ale_list_vertical = 1` to open the windows vertically
instead of the default horizontally.
<a name="faq-jsx-stylelint-eslint"></a> <a name="faq-jsx-stylelint-eslint"></a>
### 5.xii. How can I check JSX files with both stylelint and eslint? ### 5.xii. How can I check JSX files with both stylelint and eslint?
@@ -592,9 +692,18 @@ augroup END
``` ```
Supposing the filetype has been set correctly, you can set the following Supposing the filetype has been set correctly, you can set the following
options in your vimrc file: options in a jsx.vim ftplugin file.
```vim ```vim
" In ~/.vim/ftplugin/jsx.vim, or somewhere similar.
let b:ale_linters = ['stylelint', 'eslint']
let b:ale_linter_aliases = ['css']
```
Or if you want, you can configure the linters from your vimrc file.
```vim
" In ~/.vim/vimrc, or somewhere similar.
let g:ale_linters = {'jsx': ['stylelint', 'eslint']} let g:ale_linters = {'jsx': ['stylelint', 'eslint']}
let g:ale_linter_aliases = {'jsx': 'css'} let g:ale_linter_aliases = {'jsx': 'css'}
``` ```
@@ -689,3 +798,14 @@ let g:ale_pattern_options_enabled = 1
``` ```
Buffer-local variables for settings always override the global settings. Buffer-local variables for settings always override the global settings.
<a name="faq-list-window-height"></a>
### 5.xvi. How can I configure the height of the list in which ALE displays errors?
To set a default height for the error list, use the `g:ale_list_window_size` variable.
```vim
" Show 5 lines of errors (default: 10)
let g:ale_list_window_size = 5
```

View File

@@ -1,37 +0,0 @@
" 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

View File

@@ -12,7 +12,11 @@ function! ale_linters#awk#gawk#GetExecutable(buffer) abort
endfunction endfunction
function! ale_linters#awk#gawk#GetCommand(buffer) abort function! ale_linters#awk#gawk#GetCommand(buffer) abort
" note the --source 'BEGIN ...' is to prevent
" gawk from attempting to execute the body of the script
" it is linting.
return ale_linters#awk#gawk#GetExecutable(a:buffer) return ale_linters#awk#gawk#GetExecutable(a:buffer)
\ . " --source 'BEGIN { exit } END { exit 1 }'"
\ . ' ' . ale#Var(a:buffer, 'awk_gawk_options') \ . ' ' . ale#Var(a:buffer, 'awk_gawk_options')
\ . ' ' . '-f %t --lint /dev/null' \ . ' ' . '-f %t --lint /dev/null'
endfunction endfunction
@@ -21,6 +25,6 @@ call ale#linter#Define('awk', {
\ 'name': 'gawk', \ 'name': 'gawk',
\ 'executable_callback': 'ale_linters#awk#gawk#GetExecutable', \ 'executable_callback': 'ale_linters#awk#gawk#GetExecutable',
\ 'command_callback': 'ale_linters#awk#gawk#GetCommand', \ 'command_callback': 'ale_linters#awk#gawk#GetCommand',
\ 'callback': 'ale#handlers#cpplint#HandleCppLintFormat', \ 'callback': 'ale#handlers#gawk#HandleGawkFormat',
\ 'output_stream': 'both' \ 'output_stream': 'both'
\}) \})

View File

@@ -8,15 +8,15 @@ function! ale_linters#c#clang#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'c_clang_executable') return ale#Var(a:buffer, 'c_clang_executable')
endfunction endfunction
function! ale_linters#c#clang#GetCommand(buffer) abort function! ale_linters#c#clang#GetCommand(buffer, output) abort
let l:paths = ale#c#FindLocalHeaderPaths(a:buffer) let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
" -iquote with the directory the file is in makes #include work for " -iquote with the directory the file is in makes #include work for
" headers in the same directory. " headers in the same directory.
return ale#Escape(ale_linters#c#clang#GetExecutable(a:buffer)) return ale#Escape(ale_linters#c#clang#GetExecutable(a:buffer))
\ . ' -S -x c -fsyntax-only ' \ . ' -S -x c -fsyntax-only '
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' ' \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
\ . ale#c#IncludeOptions(l:paths) \ . l:cflags
\ . ale#Var(a:buffer, 'c_clang_options') . ' -' \ . ale#Var(a:buffer, 'c_clang_options') . ' -'
endfunction endfunction
@@ -24,6 +24,9 @@ call ale#linter#Define('c', {
\ 'name': 'clang', \ 'name': 'clang',
\ 'output_stream': 'stderr', \ 'output_stream': 'stderr',
\ 'executable_callback': 'ale_linters#c#clang#GetExecutable', \ 'executable_callback': 'ale_linters#c#clang#GetExecutable',
\ 'command_callback': 'ale_linters#c#clang#GetCommand', \ 'command_chain': [
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
\ {'callback': 'ale_linters#c#clang#GetCommand'}
\ ],
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat', \ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
\}) \})

View File

@@ -0,0 +1,31 @@
" Author: Christian Gibbons <cgibbons@gmu.edu>
" Description: flawfinder linter for c files
call ale#Set('c_flawfinder_executable', 'flawfinder')
call ale#Set('c_flawfinder_options', '')
call ale#Set('c_flawfinder_minlevel', 1)
call ale#Set('c_flawfinder_error_severity', 6)
function! ale_linters#c#flawfinder#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'c_flawfinder_executable')
endfunction
function! ale_linters#c#flawfinder#GetCommand(buffer) abort
" Set the minimum vulnerability level for flawfinder to bother with
let l:minlevel = ' --minlevel=' . ale#Var(a:buffer, 'c_flawfinder_minlevel')
return ale#Escape(ale_linters#c#flawfinder#GetExecutable(a:buffer))
\ . ' -CDQS'
\ . ale#Var(a:buffer, 'c_flawfinder_options')
\ . l:minlevel
\ . ' %t'
endfunction
call ale#linter#Define('c', {
\ 'name': 'flawfinder',
\ 'output_stream': 'stdout',
\ 'executable_callback': 'ale_linters#c#flawfinder#GetExecutable',
\ 'command_callback': 'ale_linters#c#flawfinder#GetCommand',
\ 'callback': 'ale#handlers#flawfinder#HandleFlawfinderFormat',
\})

View File

@@ -8,15 +8,15 @@ function! ale_linters#c#gcc#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'c_gcc_executable') return ale#Var(a:buffer, 'c_gcc_executable')
endfunction endfunction
function! ale_linters#c#gcc#GetCommand(buffer) abort function! ale_linters#c#gcc#GetCommand(buffer, output) abort
let l:paths = ale#c#FindLocalHeaderPaths(a:buffer) let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
" -iquote with the directory the file is in makes #include work for " -iquote with the directory the file is in makes #include work for
" headers in the same directory. " headers in the same directory.
return ale#Escape(ale_linters#c#gcc#GetExecutable(a:buffer)) return ale#Escape(ale_linters#c#gcc#GetExecutable(a:buffer))
\ . ' -S -x c -fsyntax-only ' \ . ' -S -x c -fsyntax-only '
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' ' \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
\ . ale#c#IncludeOptions(l:paths) \ . l:cflags
\ . ale#Var(a:buffer, 'c_gcc_options') . ' -' \ . ale#Var(a:buffer, 'c_gcc_options') . ' -'
endfunction endfunction
@@ -24,6 +24,9 @@ call ale#linter#Define('c', {
\ 'name': 'gcc', \ 'name': 'gcc',
\ 'output_stream': 'stderr', \ 'output_stream': 'stderr',
\ 'executable_callback': 'ale_linters#c#gcc#GetExecutable', \ 'executable_callback': 'ale_linters#c#gcc#GetExecutable',
\ 'command_callback': 'ale_linters#c#gcc#GetCommand', \ 'command_chain': [
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
\ {'callback': 'ale_linters#c#gcc#GetCommand'}
\ ],
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat', \ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
\}) \})

View File

@@ -8,15 +8,15 @@ function! ale_linters#cpp#clang#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'cpp_clang_executable') return ale#Var(a:buffer, 'cpp_clang_executable')
endfunction endfunction
function! ale_linters#cpp#clang#GetCommand(buffer) abort function! ale_linters#cpp#clang#GetCommand(buffer, output) abort
let l:paths = ale#c#FindLocalHeaderPaths(a:buffer) let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
" -iquote with the directory the file is in makes #include work for " -iquote with the directory the file is in makes #include work for
" headers in the same directory. " headers in the same directory.
return ale#Escape(ale_linters#cpp#clang#GetExecutable(a:buffer)) return ale#Escape(ale_linters#cpp#clang#GetExecutable(a:buffer))
\ . ' -S -x c++ -fsyntax-only ' \ . ' -S -x c++ -fsyntax-only '
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' ' \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
\ . ale#c#IncludeOptions(l:paths) \ . l:cflags
\ . ale#Var(a:buffer, 'cpp_clang_options') . ' -' \ . ale#Var(a:buffer, 'cpp_clang_options') . ' -'
endfunction endfunction
@@ -24,6 +24,9 @@ call ale#linter#Define('cpp', {
\ 'name': 'clang', \ 'name': 'clang',
\ 'output_stream': 'stderr', \ 'output_stream': 'stderr',
\ 'executable_callback': 'ale_linters#cpp#clang#GetExecutable', \ 'executable_callback': 'ale_linters#cpp#clang#GetExecutable',
\ 'command_callback': 'ale_linters#cpp#clang#GetCommand', \ 'command_chain': [
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
\ {'callback': 'ale_linters#cpp#clang#GetCommand'},
\ ],
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat', \ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
\}) \})

View File

@@ -24,9 +24,9 @@ function! ale_linters#cpp#clangcheck#GetCommand(buffer) abort
" detected. " detected.
return ale#Escape(ale_linters#cpp#clangcheck#GetExecutable(a:buffer)) return ale#Escape(ale_linters#cpp#clangcheck#GetExecutable(a:buffer))
\ . ' -analyze %s' \ . ' -analyze %s'
\ . (empty(l:build_dir) ? ' -extra-arg -Xclang -extra-arg -analyzer-output=text' : '')
\ . (!empty(l:user_options) ? ' ' . l:user_options : '') \ . (!empty(l:user_options) ? ' ' . l:user_options : '')
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '') \ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
\ . (empty(l:build_dir) ? ' -extra-arg -Xanalyzer -extra-arg -analyzer-output=text' : '')
endfunction endfunction
call ale#linter#Define('cpp', { call ale#linter#Define('cpp', {

View File

@@ -0,0 +1,31 @@
" Author: Christian Gibbons <cgibbons@gmu.edu>
" Description: flawfinder linter for c++ files
call ale#Set('cpp_flawfinder_executable', 'flawfinder')
call ale#Set('cpp_flawfinder_options', '')
call ale#Set('cpp_flawfinder_minlevel', 1)
call ale#Set('c_flawfinder_error_severity', 6)
function! ale_linters#cpp#flawfinder#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'cpp_flawfinder_executable')
endfunction
function! ale_linters#cpp#flawfinder#GetCommand(buffer) abort
" Set the minimum vulnerability level for flawfinder to bother with
let l:minlevel = ' --minlevel=' . ale#Var(a:buffer, 'cpp_flawfinder_minlevel')
return ale#Escape(ale_linters#cpp#flawfinder#GetExecutable(a:buffer))
\ . ' -CDQS'
\ . ale#Var(a:buffer, 'cpp_flawfinder_options')
\ . l:minlevel
\ . ' %t'
endfunction
call ale#linter#Define('cpp', {
\ 'name': 'flawfinder',
\ 'output_stream': 'stdout',
\ 'executable_callback': 'ale_linters#cpp#flawfinder#GetExecutable',
\ 'command_callback': 'ale_linters#cpp#flawfinder#GetCommand',
\ 'callback': 'ale#handlers#flawfinder#HandleFlawfinderFormat',
\})

View File

@@ -8,22 +8,26 @@ function! ale_linters#cpp#gcc#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'cpp_gcc_executable') return ale#Var(a:buffer, 'cpp_gcc_executable')
endfunction endfunction
function! ale_linters#cpp#gcc#GetCommand(buffer) abort function! ale_linters#cpp#gcc#GetCommand(buffer, output) abort
let l:paths = ale#c#FindLocalHeaderPaths(a:buffer) let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
" -iquote with the directory the file is in makes #include work for " -iquote with the directory the file is in makes #include work for
" headers in the same directory. " headers in the same directory.
return ale#Escape(ale_linters#cpp#gcc#GetExecutable(a:buffer)) return ale#Escape(ale_linters#cpp#gcc#GetExecutable(a:buffer))
\ . ' -S -x c++ -fsyntax-only ' \ . ' -S -x c++ -fsyntax-only '
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' ' \ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
\ . ale#c#IncludeOptions(l:paths) \ . l:cflags
\ . ale#Var(a:buffer, 'cpp_gcc_options') . ' -' \ . ale#Var(a:buffer, 'cpp_gcc_options') . ' -'
endfunction endfunction
call ale#linter#Define('cpp', { call ale#linter#Define('cpp', {
\ 'name': 'g++', \ 'name': 'gcc',
\ 'aliases': ['g++'],
\ 'output_stream': 'stderr', \ 'output_stream': 'stderr',
\ 'executable_callback': 'ale_linters#cpp#gcc#GetExecutable', \ 'executable_callback': 'ale_linters#cpp#gcc#GetExecutable',
\ 'command_callback': 'ale_linters#cpp#gcc#GetCommand', \ 'command_chain': [
\ {'callback': 'ale#c#GetMakeCommand', 'output_stream': 'stdout'},
\ {'callback': 'ale_linters#cpp#gcc#GetCommand'},
\ ],
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat', \ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
\}) \})

View File

@@ -10,7 +10,7 @@ function! s:GetWorkingDirectory(buffer) abort
return l:working_directory return l:working_directory
endif endif
return fnamemodify(bufname(a:buffer), ':p:h') return expand('#' . a:buffer . ':p:h')
endfunction endfunction
function! ale_linters#cs#mcsc#GetCommand(buffer) abort function! ale_linters#cs#mcsc#GetCommand(buffer) abort

View File

@@ -2,7 +2,7 @@
call ale#Set('css_stylelint_executable', 'stylelint') call ale#Set('css_stylelint_executable', 'stylelint')
call ale#Set('css_stylelint_options', '') call ale#Set('css_stylelint_options', '')
call ale#Set('css_stylelint_use_global', 0) call ale#Set('css_stylelint_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#css#stylelint#GetExecutable(buffer) abort function! ale_linters#css#stylelint#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'css_stylelint', [ return ale#node#FindExecutable(a:buffer, 'css_stylelint', [

View File

@@ -0,0 +1,45 @@
" Author: Eddie Lebow https://github.com/elebow
" Description: Cucumber, a BDD test tool
function! ale_linters#cucumber#cucumber#GetCommand(buffer) abort
let l:features_dir = ale#path#FindNearestDirectory(a:buffer, 'features')
if !empty(l:features_dir)
let l:features_arg = '-r ' . ale#Escape(l:features_dir)
else
let l:features_arg = ''
endif
return 'cucumber --dry-run --quiet --strict --format=json '
\ . l:features_arg . ' %t'
endfunction
function! ale_linters#cucumber#cucumber#Handle(buffer, lines) abort
try
let l:json = ale#util#FuzzyJSONDecode(a:lines, {})[0]
catch
return []
endtry
let l:output = []
for l:element in get(l:json, 'elements', [])
for l:step in l:element['steps']
if l:step['result']['status'] is# 'undefined'
call add(l:output, {
\ 'lnum': l:step['line'],
\ 'code': 'E',
\ 'text': 'Undefined step'
\})
endif
endfor
endfor
return l:output
endfunction
call ale#linter#Define('cucumber', {
\ 'name': 'cucumber',
\ 'executable': 'cucumber',
\ 'command_callback': 'ale_linters#cucumber#cucumber#GetCommand',
\ 'callback': 'ale_linters#cucumber#cucumber#Handle'
\})

View File

@@ -46,7 +46,7 @@ function! ale_linters#d#dmd#DMDCommand(buffer, dub_output) abort
endif endif
endfor endfor
return 'dmd '. join(l:import_list) . ' -o- -vcolumns -c %t' return 'dmd '. join(l:import_list) . ' -o- -wi -vcolumns -c %t'
endfunction endfunction
function! ale_linters#d#dmd#Handle(buffer, lines) abort function! ale_linters#d#dmd#Handle(buffer, lines) abort

View File

@@ -7,10 +7,6 @@ function! ale_linters#dart#language_server#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'dart_language_server_executable') return ale#Var(a:buffer, 'dart_language_server_executable')
endfunction endfunction
function! ale_linters#dart#language_server#GetLanguage(buffer) abort
return 'dart'
endfunction
function! ale_linters#dart#language_server#GetProjectRoot(buffer) abort function! ale_linters#dart#language_server#GetProjectRoot(buffer) abort
" Note: pub only looks for pubspec.yaml, there's no point in adding " Note: pub only looks for pubspec.yaml, there's no point in adding
" support for pubspec.yml " support for pubspec.yml
@@ -24,7 +20,6 @@ call ale#linter#Define('dart', {
\ 'lsp': 'stdio', \ 'lsp': 'stdio',
\ 'executable_callback': 'ale_linters#dart#language_server#GetExecutable', \ 'executable_callback': 'ale_linters#dart#language_server#GetExecutable',
\ 'command_callback': 'ale_linters#dart#language_server#GetExecutable', \ 'command_callback': 'ale_linters#dart#language_server#GetExecutable',
\ 'language_callback': 'ale_linters#dart#language_server#GetLanguage', \ 'language': 'dart',
\ 'project_root_callback': 'ale_linters#dart#language_server#GetProjectRoot', \ 'project_root_callback': 'ale_linters#dart#language_server#GetProjectRoot',
\}) \})

View File

@@ -2,31 +2,51 @@
" always, yes, never " always, yes, never
call ale#Set('dockerfile_hadolint_use_docker', 'never') call ale#Set('dockerfile_hadolint_use_docker', 'never')
call ale#Set('dockerfile_hadolint_docker_image', 'lukasmartinelli/hadolint') call ale#Set('dockerfile_hadolint_docker_image', 'hadolint/hadolint')
function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
" Matches patterns line the following: " Matches patterns line the following:
" "
" stdin:19: F: Pipe chain should start with a raw value. " /dev/stdin:19 DL3001 Pipe chain should start with a raw value.
let l:pattern = '\v^/dev/stdin:?(\d+)? (\S+) (.+)$' " /dev/stdin:19:3 unexpected thing
let l:pattern = '\v^/dev/stdin:(\d+):?(\d+)? ((DL|SC)(\d+) )?(.+)$'
let l:output = [] let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern) for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:lnum = 0 let l:lnum = 0
let l:colnum = 0
if l:match[1] isnot# '' if l:match[1] isnot# ''
let l:lnum = l:match[1] + 0 let l:lnum = l:match[1] + 0
endif endif
if l:match[2] isnot# ''
let l:colnum = l:match[2] + 0
endif
let l:type = 'W' let l:type = 'W'
let l:text = l:match[3] let l:text = l:match[6]
let l:detail = l:match[6]
let l:domain = 'https://github.com/hadolint/hadolint/wiki/'
if l:match[4] is# 'SC'
let l:domain = 'https://github.com/koalaman/shellcheck/wiki/'
endif
if l:match[5] isnot# ''
let l:code = l:match[4] . l:match[5]
let l:link = ' ( ' . l:domain . l:code . ' )'
let l:detail = l:code . l:link . "\n\n" . l:detail
else
let l:type = 'E'
endif
call add(l:output, { call add(l:output, {
\ 'lnum': l:lnum, \ 'lnum': l:lnum,
\ 'col': 0, \ 'col': l:colnum,
\ 'type': l:type, \ 'type': l:type,
\ 'text': l:text, \ 'text': l:text,
\ 'nr': l:match[2], \ 'detail': l:detail
\}) \})
endfor endfor

View File

@@ -32,6 +32,6 @@ endfunction
call ale#linter#Define('elixir', { call ale#linter#Define('elixir', {
\ 'name': 'credo', \ 'name': 'credo',
\ 'executable': 'mix', \ 'executable': 'mix',
\ 'command': 'mix credo suggest --format=flycheck --read-from-stdin %s', \ 'command': 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s',
\ 'callback': 'ale_linters#elixir#credo#Handle', \ 'callback': 'ale_linters#elixir#credo#Handle',
\}) \})

View File

@@ -0,0 +1,34 @@
" Author: Fran C. - https://github.com/franciscoj
" Description: Add dialyzer support for elixir through dialyxir
" https://github.com/jeremyjh/dialyxir
function! ale_linters#elixir#dialyxir#Handle(buffer, lines) abort
" Matches patterns line the following:
"
" lib/filename.ex:19: Function fname/1 has no local return
let l:pattern = '\v(.+):(\d+): (.+)$'
let l:output = []
let l:type = 'W'
for l:match in ale#util#GetMatches(a:lines, l:pattern)
if bufname(a:buffer) == l:match[1]
call add(l:output, {
\ 'bufnr': a:buffer,
\ 'lnum': l:match[2] + 0,
\ 'col': 0,
\ 'type': l:type,
\ 'text': l:match[3],
\})
endif
endfor
return l:output
endfunction
call ale#linter#Define('elixir', {
\ 'name': 'dialyxir',
\ 'executable': 'mix',
\ 'command': 'mix dialyzer',
\ 'callback': 'ale_linters#elixir#dialyxir#Handle',
\})

View File

@@ -32,7 +32,7 @@ endfunction
call ale#linter#Define('elixir', { call ale#linter#Define('elixir', {
\ 'name': 'dogma', \ 'name': 'dogma',
\ 'executable': 'mix', \ 'executable': 'mix',
\ 'command': 'mix dogma %s --format=flycheck', \ 'command': 'mix help dogma && mix dogma %s --format=flycheck',
\ 'lint_file': 1, \ 'lint_file': 1,
\ 'callback': 'ale_linters#elixir#dogma#Handle', \ 'callback': 'ale_linters#elixir#dogma#Handle',
\}) \})

View File

@@ -1,45 +1,26 @@
" Author: buffalocoder - https://github.com/buffalocoder, soywod - https://github.com/soywod " Author: buffalocoder - https://github.com/buffalocoder, soywod - https://github.com/soywod, hecrj - https://github.com/hecrj
" Description: Elm linting in Ale. Closely follows the Syntastic checker in https://github.com/ElmCast/elm-vim. " Description: Elm linting in Ale. Closely follows the Syntastic checker in https://github.com/ElmCast/elm-vim.
call ale#Set('elm_make_executable', 'elm-make') call ale#Set('elm_make_executable', 'elm')
call ale#Set('elm_make_use_global', 0) call ale#Set('elm_make_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#elm#make#GetExecutable(buffer) abort function! ale_linters#elm#make#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'elm_make', [ return ale#node#FindExecutable(a:buffer, 'elm_make', [
\ 'node_modules/.bin/elm-make', \ 'node_modules/.bin/elm',
\]) \])
endfunction endfunction
function! ale_linters#elm#make#Handle(buffer, lines) abort function! ale_linters#elm#make#Handle(buffer, lines) abort
let l:output = [] let l:output = []
let l:is_windows = has('win32')
let l:temp_dir = l:is_windows ? $TMP : $TMPDIR
let l:unparsed_lines = [] let l:unparsed_lines = []
for l:line in a:lines for l:line in a:lines
if l:line[0] is# '[' if l:line[0] is# '{'
let l:errors = json_decode(l:line) " Elm 0.19
call ale_linters#elm#make#HandleElm019Line(l:line, l:output)
for l:error in l:errors elseif l:line[0] is# '['
" Check if file is from the temp directory. " Elm 0.18
" Filters out any errors not related to the buffer. call ale_linters#elm#make#HandleElm018Line(l:line, l:output)
if l:is_windows
let l:file_is_buffer = l:error.file[0:len(l:temp_dir) - 1] is? l:temp_dir
else
let l:file_is_buffer = l:error.file[0:len(l:temp_dir) - 1] is# l:temp_dir
endif
if l:file_is_buffer
call add(l:output, {
\ 'lnum': l:error.region.start.line,
\ 'col': l:error.region.start.column,
\ 'end_lnum': l:error.region.end.line,
\ 'end_col': l:error.region.end.column,
\ 'type': (l:error.type is? 'error') ? 'E' : 'W',
\ 'text': l:error.overview,
\ 'detail': l:error.overview . "\n\n" . l:error.details
\})
endif
endfor
elseif l:line isnot# 'Successfully generated /dev/null' elseif l:line isnot# 'Successfully generated /dev/null'
call add(l:unparsed_lines, l:line) call add(l:unparsed_lines, l:line)
endif endif
@@ -57,23 +38,142 @@ function! ale_linters#elm#make#Handle(buffer, lines) abort
return l:output return l:output
endfunction endfunction
function! ale_linters#elm#make#HandleElm019Line(line, output) abort
let l:report = json_decode(a:line)
if l:report.type is? 'error'
" General problem
let l:details = ale_linters#elm#make#ParseMessage(l:report.message)
if empty(l:report.path)
let l:report.path = 'Elm'
endif
if ale_linters#elm#make#FileIsBuffer(l:report.path)
call add(a:output, {
\ 'lnum': 1,
\ 'type': 'E',
\ 'text': l:details,
\})
else
call add(a:output, {
\ 'lnum': 1,
\ 'type': 'E',
\ 'text': l:report.path .' - '. l:details,
\ 'detail': l:report.path ." ----------\n\n". l:details,
\})
endif
else
" Compilation errors
for l:error in l:report.errors
let l:file_is_buffer = ale_linters#elm#make#FileIsBuffer(l:error.path)
for l:problem in l:error.problems
let l:details = ale_linters#elm#make#ParseMessage(l:problem.message)
if l:file_is_buffer
" Buffer module has problems
call add(a:output, {
\ 'lnum': l:problem.region.start.line,
\ 'col': l:problem.region.start.column,
\ 'end_lnum': l:problem.region.end.line,
\ 'end_col': l:problem.region.end.column,
\ 'type': 'E',
\ 'text': l:details,
\})
else
" Imported module has problems
let l:location = l:error.path .':'. l:problem.region.start.line
call add(a:output, {
\ 'lnum': 1,
\ 'type': 'E',
\ 'text': l:location .' - '. l:details,
\ 'detail': l:location ." ----------\n\n". l:details,
\})
endif
endfor
endfor
endif
endfunction
function! ale_linters#elm#make#HandleElm018Line(line, output) abort
let l:errors = json_decode(a:line)
for l:error in l:errors
let l:file_is_buffer = ale_linters#elm#make#FileIsBuffer(l:error.file)
if l:file_is_buffer
" Current buffer has problems
call add(a:output, {
\ 'lnum': l:error.region.start.line,
\ 'col': l:error.region.start.column,
\ 'end_lnum': l:error.region.end.line,
\ 'end_col': l:error.region.end.column,
\ 'type': (l:error.type is? 'error') ? 'E' : 'W',
\ 'text': l:error.overview,
\ 'detail': l:error.overview . "\n\n" . l:error.details
\})
elseif l:error.type is? 'error'
" Imported module has errors
let l:location = l:error.file .':'. l:error.region.start.line
call add(a:output, {
\ 'lnum': 1,
\ 'type': 'E',
\ 'text': l:location .' - '. l:error.overview,
\ 'detail': l:location ." ----------\n\n". l:error.overview . "\n\n" . l:error.details
\})
endif
endfor
endfunction
function! ale_linters#elm#make#FileIsBuffer(path) abort
let l:is_windows = has('win32')
let l:temp_dir = l:is_windows ? $TMP : $TMPDIR
if has('win32')
return a:path[0:len(l:temp_dir) - 1] is? l:temp_dir
else
return a:path[0:len(l:temp_dir) - 1] is# l:temp_dir
endif
endfunction
function! ale_linters#elm#make#ParseMessage(message) abort
return join(map(copy(a:message), 'ale_linters#elm#make#ParseMessageItem(v:val)'), '')
endfunction
function! ale_linters#elm#make#ParseMessageItem(item) abort
if type(a:item) == type('')
return a:item
else
return a:item.string
endif
endfunction
" Return the command to execute the linter in the projects directory. " Return the command to execute the linter in the projects directory.
" If it doesn't, then this will fail when imports are needed. " If it doesn't, then this will fail when imports are needed.
function! ale_linters#elm#make#GetCommand(buffer) abort function! ale_linters#elm#make#GetCommand(buffer) abort
let l:elm_package = ale#path#FindNearestFile(a:buffer, 'elm-package.json') let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm.json')
let l:elm_exe = ale_linters#elm#make#GetExecutable(a:buffer) let l:elm_exe = ale_linters#elm#make#GetExecutable(a:buffer)
if empty(l:elm_package)
if empty(l:elm_json)
" Fallback to Elm 0.18
let l:elm_json = ale#path#FindNearestFile(a:buffer, 'elm-package.json')
endif
if empty(l:elm_json)
let l:dir_set_cmd = '' let l:dir_set_cmd = ''
else else
let l:root_dir = fnamemodify(l:elm_package, ':p:h') let l:root_dir = fnamemodify(l:elm_json, ':p:h')
let l:dir_set_cmd = 'cd ' . ale#Escape(l:root_dir) . ' && ' let l:dir_set_cmd = 'cd ' . ale#Escape(l:root_dir) . ' && '
endif endif
" The elm-make compiler, at the time of this writing, uses '/dev/null' as " The elm compiler, at the time of this writing, uses '/dev/null' as
" a sort of flag to tell the compiler not to generate an output file, " a sort of flag to tell the compiler not to generate an output file,
" which is why this is hard coded here. It does not use NUL on Windows. " which is why this is hard coded here.
" Source: https://github.com/elm-lang/elm-make/blob/master/src/Flags.hs " Source: https://github.com/elm-lang/elm-compiler/blob/19d5a769b30ec0b2fc4475985abb4cd94cd1d6c3/builder/src/Generate/Output.hs#L253
let l:elm_cmd = ale#Escape(l:elm_exe) let l:elm_cmd = ale#Escape(l:elm_exe)
\ . ' make'
\ . ' --report=json' \ . ' --report=json'
\ . ' --output=/dev/null' \ . ' --output=/dev/null'

View File

@@ -0,0 +1,35 @@
" Author: Eddie Lebow https://github.com/elebow
" Description: eruby checker using `erubi`
function! ale_linters#eruby#erubi#CheckErubi(buffer) abort
return 'ruby -r erubi/capture_end -e ' . ale#Escape('""')
endfunction
function! ale_linters#eruby#erubi#GetCommand(buffer, check_erubi_output) abort
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
if (!empty(a:check_erubi_output))
" The empty command in CheckErubi returns nothing if erubi runs and
" emits an error if erubi is not present
return ''
endif
if empty(l:rails_root)
return 'ruby -r erubi/capture_end -e ' . ale#Escape('puts Erubi::CaptureEndEngine.new($stdin.read).src') . '< %t | ruby -c'
endif
" Rails-flavored eRuby does not comply with the standard as understood by
" Erubi, so we'll have to do some substitution. This does not reduce the
" effectiveness of the linter---the translated code is still evaluated.
return 'ruby -r erubi/capture_end -e ' . ale#Escape('puts Erubi::CaptureEndEngine.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c'
endfunction
call ale#linter#Define('eruby', {
\ 'name': 'erubi',
\ 'executable': 'ruby',
\ 'command_chain': [
\ {'callback': 'ale_linters#eruby#erubi#CheckErubi'},
\ {'callback': 'ale_linters#eruby#erubi#GetCommand', 'output_stream': 'stderr'},
\ ],
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
\})

67
ale_linters/fish/fish.vim Normal file
View File

@@ -0,0 +1,67 @@
" Author: Niraj Thapaliya - https://github.com/nthapaliya
" Description: Lints fish files using fish -n
function! ale_linters#fish#fish#Handle(buffer, lines) abort
" Matches patterns such as:
"
" home/.config/fish/functions/foo.fish (line 1): Missing end to balance this function definition
" function foo
" ^
"
" OR, patterns such as:
"
" Unsupported use of '||'. In fish, please use 'COMMAND; or COMMAND'.
" /tmp/vLz620o/258/test.fish (line 2): if set -q SSH_CLIENT || set -q SSH_TTY
" ^
"
" fish -n can return errors in either format.
let l:pattern = '^\(.* (line \(\d\+\)): \)\(.*\)$'
let l:column_pattern = '^ *\^'
let l:output = []
let l:column_offset = 0
let l:last_line_with_message = ''
for l:line in a:lines
" Look for error lines first.
let l:match = matchlist(l:line, l:pattern)
if !empty(l:match)
if !empty(l:last_line_with_message)
let l:text = l:last_line_with_message
else
let l:text = l:match[3]
endif
let l:column_offset = len(l:match[1])
let l:last_line_with_message = ''
call add(l:output, {
\ 'col': 0,
\ 'lnum': str2nr(l:match[2]),
\ 'text': l:text,
\})
else
" Look for column markers like ' ^' second.
" The column index will be set according to how long the line is.
let l:column_match = matchstr(l:line, l:column_pattern)
if !empty(l:column_match) && !empty(l:output)
let l:output[-1].col = len(l:column_match) - l:column_offset
let l:last_line_with_message = ''
else
let l:last_line_with_message = l:line
let l:column_offset = 0
endif
endif
endfor
return l:output
endfunction
call ale#linter#Define('fish', {
\ 'name': 'fish',
\ 'output_stream': 'stderr',
\ 'executable': 'fish',
\ 'command': 'fish -n %t',
\ 'callback': 'ale_linters#fish#fish#Handle',
\})

View File

@@ -0,0 +1,9 @@
" Author: Jansen Mitchell https://github.com/JansenMitchell
" Description: proselint for Fountain files
call ale#linter#Define('fountain', {
\ 'name': 'proselint',
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})

View File

@@ -0,0 +1,52 @@
" Author: Nick Yamane <nick.diego@gmail.com>
" Description: gitlint for git commit message files
let g:ale_gitcommit_gitlint_executable =
\ get(g:, 'ale_gitcommit_gitlint_executable', 'gitlint')
let g:ale_gitcommit_gitlint_options = get(g:, 'ale_gitcommit_gitlint_options', '')
let g:ale_gitcommit_gitlint_use_global = get(g:, 'ale_gitcommit_gitlint_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#gitcommit#gitlint#GetExecutable(buffer) abort
return ale#python#FindExecutable(a:buffer, 'gitcommit_gitlint', ['gitlint'])
endfunction
function! ale_linters#gitcommit#gitlint#GetCommand(buffer) abort
let l:options = ale#Var(a:buffer, 'gitcommit_gitlint_options')
let l:executable = ale_linters#gitcommit#gitlint#GetExecutable(a:buffer)
return ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' lint'
endfunction
function! ale_linters#gitcommit#gitlint#Handle(buffer, lines) abort
" Matches patterns line the following:
let l:pattern = '\v^(\d+): (\w+) (.*)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:code = l:match[2]
let l:item = {
\ 'lnum': l:match[1] + 0,
\ 'text': l:match[3],
\ 'code': l:code,
\ 'type': 'E',
\}
call add(l:output, l:item)
endfor
return l:output
endfunction
call ale#linter#Define('gitcommit', {
\ 'name': 'gitlint',
\ 'output_stream': 'stderr',
\ 'executable_callback': 'ale_linters#gitcommit#gitlint#GetExecutable',
\ 'command_callback': 'ale_linters#gitcommit#gitlint#GetCommand',
\ 'callback': 'ale_linters#gitcommit#gitlint#Handle',
\})

View File

@@ -18,10 +18,6 @@ function! ale_linters#glsl#glslls#GetCommand(buffer) abort
return ale#Escape(l:executable) . l:logfile_args . ' --stdin' return ale#Escape(l:executable) . l:logfile_args . ' --stdin'
endfunction endfunction
function! ale_linters#glsl#glslls#GetLanguage(buffer) abort
return 'glsl'
endfunction
function! ale_linters#glsl#glslls#GetProjectRoot(buffer) abort function! ale_linters#glsl#glslls#GetProjectRoot(buffer) abort
let l:project_root = ale#c#FindProjectRoot(a:buffer) let l:project_root = ale#c#FindProjectRoot(a:buffer)
@@ -33,6 +29,6 @@ call ale#linter#Define('glsl', {
\ 'lsp': 'stdio', \ 'lsp': 'stdio',
\ 'executable_callback': 'ale_linters#glsl#glslls#GetExecutable', \ 'executable_callback': 'ale_linters#glsl#glslls#GetExecutable',
\ 'command_callback': 'ale_linters#glsl#glslls#GetCommand', \ 'command_callback': 'ale_linters#glsl#glslls#GetCommand',
\ 'language_callback': 'ale_linters#glsl#glslls#GetLanguage', \ 'language': 'glsl',
\ 'project_root_callback': 'ale_linters#glsl#glslls#GetProjectRoot', \ 'project_root_callback': 'ale_linters#glsl#glslls#GetProjectRoot',
\}) \})

View File

@@ -1,9 +1,14 @@
" Author: Joshua Rubin <joshua@rubixconsulting.com>, Ben Reedy <https://github.com/breed808>, " Author: Joshua Rubin <joshua@rubixconsulting.com>, Ben Reedy <https://github.com/breed808>,
" Jeff Willette <jrwillette88@gmail.com> " Jeff Willette <jrwillette88@gmail.com>
" Description: go build for Go files " Description: go build for Go files
" inspired by work from dzhou121 <dzhou121@gmail.com> " inspired by work from dzhou121 <dzhou121@gmail.com>
call ale#Set('go_gobuild_options', '')
function! ale_linters#go#gobuild#ResetEnv() abort
unlet! s:go_env
endfunction
function! ale_linters#go#gobuild#GoEnv(buffer) abort function! ale_linters#go#gobuild#GoEnv(buffer) abort
if exists('s:go_env') if exists('s:go_env')
return '' return ''
@@ -13,6 +18,8 @@ function! ale_linters#go#gobuild#GoEnv(buffer) abort
endfunction endfunction
function! ale_linters#go#gobuild#GetCommand(buffer, goenv_output) abort function! ale_linters#go#gobuild#GetCommand(buffer, goenv_output) abort
let l:options = ale#Var(a:buffer, 'go_gobuild_options')
if !exists('s:go_env') if !exists('s:go_env')
let s:go_env = { let s:go_env = {
\ 'GOPATH': a:goenv_output[0], \ 'GOPATH': a:goenv_output[0],
@@ -20,10 +27,16 @@ function! ale_linters#go#gobuild#GetCommand(buffer, goenv_output) abort
\} \}
endif endif
let l:gopath_env_command = has('win32')
\ ? 'set GOPATH=' . ale#Escape(s:go_env.GOPATH) . ' && '
\ : 'GOPATH=' . ale#Escape(s:go_env.GOPATH) . ' '
" Run go test in local directory with relative path " Run go test in local directory with relative path
return 'GOPATH=' . s:go_env.GOPATH return l:gopath_env_command
\ . ' cd ' . fnamemodify(bufname(a:buffer), ':.:h') \ . ale#path#BufferCdString(a:buffer)
\ . ' && go test -c -o /dev/null ./' \ . 'go test'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' -c -o /dev/null ./'
endfunction endfunction
function! ale_linters#go#gobuild#GetMatches(lines) abort function! ale_linters#go#gobuild#GetMatches(lines) abort

View File

@@ -1,11 +1,15 @@
" Author: Ben Reedy <https://github.com/breed808> " Author: Ben Reedy <https://github.com/breed808>
" Description: gosimple for Go files " Description: gosimple for Go files
function! ale_linters#go#gosimple#GetCommand(buffer) abort
return ale#path#BufferCdString(a:buffer) . ' gosimple .'
endfunction
call ale#linter#Define('go', { call ale#linter#Define('go', {
\ 'name': 'gosimple', \ 'name': 'gosimple',
\ 'executable': 'gosimple', \ 'executable': 'gosimple',
\ 'command': 'gosimple %s', \ 'command_callback': 'ale_linters#go#gosimple#GetCommand',
\ 'callback': 'ale#handlers#unix#HandleAsWarning', \ 'callback': 'ale#handlers#go#Handler',
\ 'output_stream': 'both', \ 'output_stream': 'both',
\ 'lint_file': 1, \ 'lint_file': 1,
\}) \})

20
ale_linters/go/gotype.vim Normal file
View File

@@ -0,0 +1,20 @@
" Author: Jelte Fennema <github-public@jeltef.nl>
" Description: gotype for Go files
function! ale_linters#go#gotype#GetCommand(buffer) abort
if expand('#' . a:buffer . ':p') =~# '_test\.go$'
return
endif
return ale#path#BufferCdString(a:buffer) . ' gotype .'
endfunction
call ale#linter#Define('go', {
\ 'name': 'gotype',
\ 'output_stream': 'stderr',
\ 'executable': 'gotype',
\ 'command_callback': 'ale_linters#go#gotype#GetCommand',
\ 'callback': 'ale#handlers#go#Handler',
\ 'lint_file': 1,
\})

View File

@@ -1,10 +1,18 @@
" Author: neersighted <bjorn@neersighted.com> " Author: neersighted <bjorn@neersighted.com>
" Description: go vet for Go files " Description: go vet for Go files
"
" Author: John Eikenberry <jae@zhar.net>
" Description: updated to work with go1.10
function! ale_linters#go#govet#GetCommand(buffer) abort
return ale#path#BufferCdString(a:buffer) . ' go vet .'
endfunction
call ale#linter#Define('go', { call ale#linter#Define('go', {
\ 'name': 'go vet', \ 'name': 'go vet',
\ 'output_stream': 'stderr', \ 'output_stream': 'stderr',
\ 'executable': 'go', \ 'executable': 'go',
\ 'command': 'go vet %t', \ 'command_callback': 'ale_linters#go#govet#GetCommand',
\ 'callback': 'ale#handlers#unix#HandleAsError', \ 'callback': 'ale#handlers#go#Handler',
\ 'lint_file': 1,
\}) \})

View File

@@ -1,11 +1,33 @@
" Author: Ben Reedy <https://github.com/breed808> " Author: Ben Reedy <https://github.com/breed808>
" Description: staticcheck for Go files " Description: staticcheck for Go files
call ale#Set('go_staticcheck_options', '')
call ale#Set('go_staticcheck_lint_package', 0)
function! ale_linters#go#staticcheck#GetCommand(buffer) abort
let l:filename = expand('#' . a:buffer . ':t')
let l:options = ale#Var(a:buffer, 'go_staticcheck_options')
let l:lint_package = ale#Var(a:buffer, 'go_staticcheck_lint_package')
" BufferCdString is used so that we can be sure the paths output from
" staticcheck can be calculated to absolute paths in the Handler
if l:lint_package
return ale#path#BufferCdString(a:buffer)
\ . 'staticcheck'
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
endif
return ale#path#BufferCdString(a:buffer)
\ . 'staticcheck'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' ' . ale#Escape(l:filename)
endfunction
call ale#linter#Define('go', { call ale#linter#Define('go', {
\ 'name': 'staticcheck', \ 'name': 'staticcheck',
\ 'executable': 'staticcheck', \ 'executable': 'staticcheck',
\ 'command': 'staticcheck %s', \ 'command_callback': 'ale_linters#go#staticcheck#GetCommand',
\ 'callback': 'ale#handlers#unix#HandleAsWarning', \ 'callback': 'ale#handlers#go#Handler',
\ 'output_stream': 'both', \ 'output_stream': 'both',
\ 'lint_file': 1, \ 'lint_file': 1,
\}) \})

View File

@@ -2,7 +2,7 @@
" Description: Ember-template-lint for checking Handlebars files " Description: Ember-template-lint for checking Handlebars files
call ale#Set('handlebars_embertemplatelint_executable', 'ember-template-lint') call ale#Set('handlebars_embertemplatelint_executable', 'ember-template-lint')
call ale#Set('handlebars_embertemplatelint_use_global', 0) call ale#Set('handlebars_embertemplatelint_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort function! ale_linters#handlebars#embertemplatelint#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'handlebars_embertemplatelint', [ return ale#node#FindExecutable(a:buffer, 'handlebars_embertemplatelint', [

View File

@@ -1,10 +1,18 @@
" Author: w0rp <devw0rp@gmail.com> " Author: w0rp <devw0rp@gmail.com>
" Description: ghc for Haskell files " Description: ghc for Haskell files
call ale#Set('haskell_ghc_options', '-fno-code -v0')
function! ale_linters#haskell#ghc#GetCommand(buffer) abort
return 'ghc '
\ . ale#Var(a:buffer, 'haskell_ghc_options')
\ . ' %t'
endfunction
call ale#linter#Define('haskell', { call ale#linter#Define('haskell', {
\ 'name': 'ghc', \ 'name': 'ghc',
\ 'output_stream': 'stderr', \ 'output_stream': 'stderr',
\ 'executable': 'ghc', \ 'executable': 'ghc',
\ 'command': 'ghc -fno-code -v0 %t', \ 'command_callback': 'ale_linters#haskell#ghc#GetCommand',
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat', \ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
\}) \})

View File

@@ -2,7 +2,7 @@
" Description: hdevtools for Haskell files " Description: hdevtools for Haskell files
call ale#Set('haskell_hdevtools_executable', 'hdevtools') call ale#Set('haskell_hdevtools_executable', 'hdevtools')
call ale#Set('haskell_hdevtools_options', '-g -Wall') call ale#Set('haskell_hdevtools_options', get(g:, 'hdevtools_options', '-g -Wall'))
function! ale_linters#haskell#hdevtools#GetExecutable(buffer) abort function! ale_linters#haskell#hdevtools#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'haskell_hdevtools_executable') return ale#Var(a:buffer, 'haskell_hdevtools_executable')

View File

@@ -1,9 +1,9 @@
" Author: KabbAmine <amine.kabb@gmail.com>, deathmaz <00maz1987@gmail.com>, diartyz <diartyz@gmail.com> " Author: KabbAmine <amine.kabb@gmail.com>, deathmaz <00maz1987@gmail.com>, diartyz <diartyz@gmail.com>
" Description: HTMLHint for checking html files " Description: HTMLHint for checking html files
call ale#Set('html_htmlhint_options', '--format=unix') call ale#Set('html_htmlhint_options', '')
call ale#Set('html_htmlhint_executable', 'htmlhint') call ale#Set('html_htmlhint_executable', 'htmlhint')
call ale#Set('html_htmlhint_use_global', 0) call ale#Set('html_htmlhint_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#html#htmlhint#GetExecutable(buffer) abort function! ale_linters#html#htmlhint#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'html_htmlhint', [ return ale#node#FindExecutable(a:buffer, 'html_htmlhint', [
@@ -12,9 +12,22 @@ function! ale_linters#html#htmlhint#GetExecutable(buffer) abort
endfunction endfunction
function! ale_linters#html#htmlhint#GetCommand(buffer) abort function! ale_linters#html#htmlhint#GetCommand(buffer) abort
return ale_linters#html#htmlhint#GetExecutable(a:buffer) let l:options = ale#Var(a:buffer, 'html_htmlhint_options')
\ . ' ' . ale#Var(a:buffer, 'html_htmlhint_options') let l:config = l:options !~# '--config'
\ . ' %t' \ ? ale#path#FindNearestFile(a:buffer, '.htmlhintrc')
\ : ''
if !empty(l:config)
let l:options .= ' --config ' . ale#Escape(l:config)
endif
if !empty(l:options)
let l:options = substitute(l:options, '--format=unix', '', '')
endif
return ale#Escape(ale_linters#html#htmlhint#GetExecutable(a:buffer))
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' --format=unix %t'
endfunction endfunction
call ale#linter#Define('html', { call ale#linter#Define('html', {

View File

@@ -3,11 +3,19 @@
" CLI options " CLI options
let g:ale_html_tidy_executable = get(g:, 'ale_html_tidy_executable', 'tidy') let g:ale_html_tidy_executable = get(g:, 'ale_html_tidy_executable', 'tidy')
" remove in 2.0
" Look for the old _args variable first. " Look for the old _args variable first.
let s:deprecation_warning_echoed = 0
let s:default_options = get(g:, 'ale_html_tidy_args', '-q -e -language en') 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) let g:ale_html_tidy_options = get(g:, 'ale_html_tidy_options', s:default_options)
function! ale_linters#html#tidy#GetCommand(buffer) abort function! ale_linters#html#tidy#GetCommand(buffer) abort
" remove in 2.0
if exists('g:ale_html_tidy_args') && !s:deprecation_warning_echoed
execute 'echom ''Rename your g:ale_html_tidy_args setting to g:ale_html_tidy_options instead. Support for this will removed in ALE 2.0.'''
let s:deprecation_warning_echoed = 1
endif
" Specify file encoding in options " Specify file encoding in options
" (Idea taken from https://github.com/scrooloose/syntastic/blob/master/syntax_checkers/html/tidy.vim) " (Idea taken from https://github.com/scrooloose/syntastic/blob/master/syntax_checkers/html/tidy.vim)
let l:file_encoding = get({ let l:file_encoding = get({
@@ -25,8 +33,16 @@ function! ale_linters#html#tidy#GetCommand(buffer) abort
\ 'utf-8': '-utf8', \ 'utf-8': '-utf8',
\ }, &fileencoding, '-utf8') \ }, &fileencoding, '-utf8')
" On macOS, old tidy (released on 31 Oct 2006) is installed. It does not
" consider HTML5 so we should avoid it.
let l:executable = ale#Var(a:buffer, 'html_tidy_executable')
if has('mac') && l:executable is# 'tidy' && exists('*exepath')
\ && exepath(l:executable) is# '/usr/bin/tidy'
return ''
endif
return printf('%s %s %s -', return printf('%s %s %s -',
\ ale#Var(a:buffer, 'html_tidy_executable'), \ l:executable,
\ ale#Var(a:buffer, 'html_tidy_options'), \ ale#Var(a:buffer, 'html_tidy_options'),
\ l:file_encoding \ l:file_encoding
\) \)

View File

@@ -3,8 +3,9 @@
let s:classpath_sep = has('unix') ? ':' : ';' let s:classpath_sep = has('unix') ? ':' : ';'
let g:ale_java_javac_options = get(g:, 'ale_java_javac_options', '') call ale#Set('java_javac_executable', 'javac')
let g:ale_java_javac_classpath = get(g:, 'ale_java_javac_classpath', '') call ale#Set('java_javac_options', '')
call ale#Set('java_javac_classpath', '')
function! ale_linters#java#javac#GetImportPaths(buffer) abort function! ale_linters#java#javac#GetImportPaths(buffer) abort
let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml') let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml')
@@ -35,6 +36,10 @@ function! s:BuildClassPathOption(buffer, import_paths) abort
\ : '' \ : ''
endfunction endfunction
function! ale_linters#java#javac#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'java_javac_executable')
endfunction
function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort
let l:cp_option = s:BuildClassPathOption(a:buffer, a:import_paths) let l:cp_option = s:BuildClassPathOption(a:buffer, a:import_paths)
let l:sp_option = '' let l:sp_option = ''
@@ -72,11 +77,13 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort
" Create .class files in a temporary directory, which we will delete later. " Create .class files in a temporary directory, which we will delete later.
let l:class_file_directory = ale#engine#CreateDirectory(a:buffer) let l:class_file_directory = ale#engine#CreateDirectory(a:buffer)
let l:executable = ale_linters#java#javac#GetExecutable(a:buffer)
" Always run javac from the directory the file is in, so we can resolve " Always run javac from the directory the file is in, so we can resolve
" relative paths correctly. " relative paths correctly.
return ale#path#BufferCdString(a:buffer) return ale#path#BufferCdString(a:buffer)
\ . 'javac -Xlint' \ . ale#Escape(l:executable)
\ . ' -Xlint'
\ . ' ' . l:cp_option \ . ' ' . l:cp_option
\ . ' ' . l:sp_option \ . ' ' . l:sp_option
\ . ' -d ' . ale#Escape(l:class_file_directory) \ . ' -d ' . ale#Escape(l:class_file_directory)
@@ -119,7 +126,7 @@ endfunction
call ale#linter#Define('java', { call ale#linter#Define('java', {
\ 'name': 'javac', \ 'name': 'javac',
\ 'executable': 'javac', \ 'executable_callback': 'ale_linters#java#javac#GetExecutable',
\ 'command_chain': [ \ 'command_chain': [
\ {'callback': 'ale_linters#java#javac#GetImportPaths', 'output_stream': 'stdout'}, \ {'callback': 'ale_linters#java#javac#GetImportPaths', 'output_stream': 'stdout'},
\ {'callback': 'ale_linters#java#javac#GetCommand', 'output_stream': 'stderr'}, \ {'callback': 'ale_linters#java#javac#GetCommand', 'output_stream': 'stderr'},

36
ale_linters/java/pmd.vim Normal file
View File

@@ -0,0 +1,36 @@
" Author: Johannes Wienke <languitar@semipol.de>
" Description: PMD for Java files
function! ale_linters#java#pmd#Handle(buffer, lines) abort
let l:pattern = '"\(\d\+\)",".\+","\(.\+\)","\(\d\+\)","\(\d\+\)","\(.\+\)","\(.\+\)","\(.\+\)"$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'type': 'W',
\ 'lnum': l:match[4] + 0,
\ 'text': l:match[5],
\ 'code': l:match[6] . ' - ' . l:match[7],
\})
endfor
return l:output
endfunction
function! ale_linters#java#pmd#GetCommand(buffer) abort
return 'pmd '
\ . ale#Var(a:buffer, 'java_pmd_options')
\ . ' -f csv'
\ . ' -d %t'
endfunction
if !exists('g:ale_java_pmd_options')
let g:ale_java_pmd_options = '-R category/java/bestpractices.xml'
endif
call ale#linter#Define('java', {
\ 'name': 'pmd',
\ 'executable': 'pmd',
\ 'command_callback': 'ale_linters#java#pmd#GetCommand',
\ 'callback': 'ale_linters#java#pmd#Handle',
\})

View File

@@ -3,6 +3,7 @@
call ale#linter#Define('javascript', { call ale#linter#Define('javascript', {
\ 'name': 'eslint', \ 'name': 'eslint',
\ 'output_stream': 'both',
\ 'executable_callback': 'ale#handlers#eslint#GetExecutable', \ 'executable_callback': 'ale#handlers#eslint#GetExecutable',
\ 'command_callback': 'ale#handlers#eslint#GetCommand', \ 'command_callback': 'ale#handlers#eslint#GetCommand',
\ 'callback': 'ale#handlers#eslint#Handle', \ 'callback': 'ale#handlers#eslint#Handle',

View File

@@ -4,7 +4,8 @@
call ale#Set('javascript_flow_executable', 'flow') call ale#Set('javascript_flow_executable', 'flow')
call ale#Set('javascript_flow_use_home_config', 0) call ale#Set('javascript_flow_use_home_config', 0)
call ale#Set('javascript_flow_use_global', 0) call ale#Set('javascript_flow_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('javascript_flow_use_respect_pragma', 1)
function! ale_linters#javascript#flow#GetExecutable(buffer) abort function! ale_linters#javascript#flow#GetExecutable(buffer) abort
let l:flow_config = ale#path#FindNearestFile(a:buffer, '.flowconfig') let l:flow_config = ale#path#FindNearestFile(a:buffer, '.flowconfig')
@@ -47,8 +48,8 @@ function! ale_linters#javascript#flow#GetCommand(buffer, version_lines) abort
" If we can parse the version number, then only use --respect-pragma " If we can parse the version number, then only use --respect-pragma
" if the version is >= 0.36.0, which added the argument. " if the version is >= 0.36.0, which added the argument.
let l:use_respect_pragma = empty(l:version) let l:use_respect_pragma = ale#Var(a:buffer, 'javascript_flow_use_respect_pragma')
\ || ale#semver#GTE(l:version, [0, 36]) \ && (empty(l:version) || ale#semver#GTE(l:version, [0, 36]))
return ale#Escape(l:executable) return ale#Escape(l:executable)
\ . ' check-contents' \ . ' check-contents'

View File

@@ -2,7 +2,7 @@
" Description: jscs for JavaScript files " Description: jscs for JavaScript files
call ale#Set('javascript_jscs_executable', 'jscs') call ale#Set('javascript_jscs_executable', 'jscs')
call ale#Set('javascript_jscs_use_global', 0) call ale#Set('javascript_jscs_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#javascript#jscs#GetExecutable(buffer) abort function! ale_linters#javascript#jscs#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'javascript_jscs', [ return ale#node#FindExecutable(a:buffer, 'javascript_jscs', [

View File

@@ -2,7 +2,7 @@
" Description: JSHint for Javascript files " Description: JSHint for Javascript files
call ale#Set('javascript_jshint_executable', 'jshint') call ale#Set('javascript_jshint_executable', 'jshint')
call ale#Set('javascript_jshint_use_global', 0) call ale#Set('javascript_jshint_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#javascript#jshint#GetExecutable(buffer) abort function! ale_linters#javascript#jshint#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'javascript_jshint', [ return ale#node#FindExecutable(a:buffer, 'javascript_jshint', [

View File

@@ -2,7 +2,7 @@
" Description: standardjs for JavaScript files " Description: standardjs for JavaScript files
call ale#Set('javascript_standard_executable', 'standard') call ale#Set('javascript_standard_executable', 'standard')
call ale#Set('javascript_standard_use_global', 0) call ale#Set('javascript_standard_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('javascript_standard_options', '') call ale#Set('javascript_standard_options', '')
function! ale_linters#javascript#standard#GetExecutable(buffer) abort function! ale_linters#javascript#standard#GetExecutable(buffer) abort

View File

@@ -2,7 +2,7 @@
" Description: xo for JavaScript files " Description: xo for JavaScript files
call ale#Set('javascript_xo_executable', 'xo') call ale#Set('javascript_xo_executable', 'xo')
call ale#Set('javascript_xo_use_global', 0) call ale#Set('javascript_xo_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('javascript_xo_options', '') call ale#Set('javascript_xo_options', '')
function! ale_linters#javascript#xo#GetExecutable(buffer) abort function! ale_linters#javascript#xo#GetExecutable(buffer) abort

View File

@@ -3,7 +3,7 @@
call ale#Set('less_lessc_executable', 'lessc') call ale#Set('less_lessc_executable', 'lessc')
call ale#Set('less_lessc_options', '') call ale#Set('less_lessc_options', '')
call ale#Set('less_lessc_use_global', 0) call ale#Set('less_lessc_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#less#lessc#GetExecutable(buffer) abort function! ale_linters#less#lessc#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'less_lessc', [ return ale#node#FindExecutable(a:buffer, 'less_lessc', [

View File

@@ -2,7 +2,7 @@
call ale#Set('less_stylelint_executable', 'stylelint') call ale#Set('less_stylelint_executable', 'stylelint')
call ale#Set('less_stylelint_options', '') call ale#Set('less_stylelint_options', '')
call ale#Set('less_stylelint_use_global', 0) call ale#Set('less_stylelint_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#less#stylelint#GetExecutable(buffer) abort function! ale_linters#less#stylelint#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'less_stylelint', [ return ale#node#FindExecutable(a:buffer, 'less_stylelint', [

40
ale_linters/lua/luac.vim Normal file
View File

@@ -0,0 +1,40 @@
" Author: Jon Xie https://github.com/xiejiangzhi
" Description: luac linter for lua files
call ale#Set('lua_luac_executable', 'luac')
function! ale_linters#lua#luac#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'lua_luac_executable')
endfunction
function! ale_linters#lua#luac#GetCommand(buffer) abort
let l:executable = ale_linters#lua#luac#GetExecutable(a:buffer)
return ale#Escape(l:executable) . ' -p - '
endfunction
function! ale_linters#lua#luac#Handle(buffer, lines) abort
" Matches patterns line the following:
"
" luac: stdin:5: '=' expected near ')'
" luac: stdin:8: ')' expected (to close '(' at line 6) near '123'
let l:pattern = '\v^.*:(\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': 'E',
\ 'text': l:match[2],
\})
endfor
return l:output
endfunction
call ale#linter#Define('lua', {
\ 'name': 'luac',
\ 'executable_callback': 'ale_linters#lua#luac#GetExecutable',
\ 'command_callback': 'ale_linters#lua#luac#GetCommand',
\ 'output_stream': 'stderr',
\ 'callback': 'ale_linters#lua#luac#Handle',
\})

View File

@@ -0,0 +1,11 @@
" Author: Ty-Lucas Kelley <tylucaskelley@gmail.com>
" Description: Adds support for markdownlint
call ale#linter#Define('markdown', {
\ 'name': 'markdownlint',
\ 'executable': 'markdownlint',
\ 'lint_file': 1,
\ 'output_stream': 'both',
\ 'command': 'markdownlint %s',
\ 'callback': 'ale#handlers#markdownlint#Handle'
\ })

View File

@@ -1,5 +1,24 @@
" Author: Steve Dignam <steve@dignam.xyz> " Author: Steve Dignam <steve@dignam.xyz>, Josh Leeb-du Toit <joshleeb.com>
" Description: Support for mdl, a markdown linter " Description: Support for mdl, a markdown linter.
call ale#Set('markdown_mdl_executable', 'mdl')
call ale#Set('markdown_mdl_options', '')
function! ale_linters#markdown#mdl#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'markdown_mdl_executable')
endfunction
function! ale_linters#markdown#mdl#GetCommand(buffer) abort
let l:executable = ale_linters#markdown#mdl#GetExecutable(a:buffer)
let l:exec_args = l:executable =~? 'bundle$'
\ ? ' exec mdl'
\ : ''
let l:options = ale#Var(a:buffer, 'markdown_mdl_options')
return ale#Escape(l:executable) . l:exec_args
\ . (!empty(l:options) ? ' ' . l:options : '')
endfunction
function! ale_linters#markdown#mdl#Handle(buffer, lines) abort function! ale_linters#markdown#mdl#Handle(buffer, lines) abort
" matches: '(stdin):173: MD004 Unordered list style' " matches: '(stdin):173: MD004 Unordered list style'
@@ -19,7 +38,7 @@ endfunction
call ale#linter#Define('markdown', { call ale#linter#Define('markdown', {
\ 'name': 'mdl', \ 'name': 'mdl',
\ 'executable': 'mdl', \ 'executable_callback': 'ale_linters#markdown#mdl#GetExecutable',
\ 'command': 'mdl', \ 'command_callback': 'ale_linters#markdown#mdl#GetCommand',
\ 'callback': 'ale_linters#markdown#mdl#Handle' \ 'callback': 'ale_linters#markdown#mdl#Handle'
\}) \})

View File

@@ -1,18 +1,24 @@
" Author rhysd https://rhysd.github.io/ " Author rhysd https://rhysd.github.io/, Dirk Roorda (dirkroorda), Adrián González Rus (@adrigzr)
" Description: remark-lint for Markdown files " Description: remark-lint for Markdown files
function! ale_linters#markdown#remark_lint#Handle(buffer, lines) abort function! ale_linters#markdown#remark_lint#Handle(buffer, lines) abort
" matches: ' 1:4 warning Incorrect list-item indent: add 1 space list-item-indent remark-lint' " matches: ' 1:4 warning Incorrect list-item indent: add 1 space list-item-indent remark-lint'
let l:pattern = '^ \+\(\d\+\):\(\d\+\) \(warning\|error\) \(.\+\)$' " matches: ' 18:71-19:1 error Missing new line after list item list-item-spacing remark-lint',
let l:pattern = '^ \+\(\d\+\):\(\d\+\)\(-\(\d\+\):\(\d\+\)\)\? \(warning\|error\) \(.\+\)$'
let l:output = [] let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern) for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, { let l:item = {
\ 'lnum': l:match[1] + 0, \ 'lnum': l:match[1] + 0,
\ 'col': l:match[2] + 0, \ 'col': l:match[2] + 0,
\ 'type': l:match[3] is# 'error' ? 'E' : 'W', \ 'type': l:match[6] is# 'error' ? 'E' : 'W',
\ 'text': l:match[4], \ 'text': l:match[7],
\}) \}
if l:match[3] isnot# ''
let l:item.end_lnum = l:match[4] + 0
let l:item.end_col = l:match[5] + 0
endif
call add(l:output, l:item)
endfor endfor
return l:output return l:output

View File

@@ -0,0 +1,9 @@
" Author: tokida https://rouger.info, Yasuhiro Kiyota <yasuhiroki.duck@gmail.com>
" Description: textlint, a proofreading tool (https://textlint.github.io/)
call ale#linter#Define('markdown', {
\ 'name': 'textlint',
\ 'executable_callback': 'ale#handlers#textlint#GetExecutable',
\ 'command_callback': 'ale#handlers#textlint#GetCommand',
\ 'callback': 'ale#handlers#textlint#HandleTextlintOutput',
\})

View File

@@ -0,0 +1,45 @@
" Author: stewy33 <slocumstewy@gmail.com>
" Description: Lints mercury files using mmc
call ale#Set('mercury_mmc_executable', 'mmc')
call ale#Set('mercury_mmc_options', '--make --output-compile-error-lines 100')
function! ale_linters#mercury#mmc#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'mercury_mmc_executable')
endfunction
function! ale_linters#mercury#mmc#GetCommand(buffer) abort
let l:module_name = expand('#' . a:buffer . ':t:r')
return ale#path#BufferCdString(a:buffer)
\ . ale_linters#mercury#mmc#GetExecutable(a:buffer)
\ . ' --errorcheck-only '
\ . ale#Var(a:buffer, 'mercury_mmc_options')
\ . ' ' . l:module_name
endfunction
function! ale_linters#mercury#mmc#Handle(buffer, lines) abort
" output format
" <filename>:<line>: <issue type>: <message>
let l:pattern = '\v^\w+\.m:(\d+):\s+([W|w]arning|.*[E|e]rror.*): (.*)'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, {
\ 'lnum': substitute(l:match[1], '\v^0*', '', '') + 0,
\ 'type': l:match[2][0] =~? 'W' ? 'W' : 'E',
\ 'text': l:match[2] . ': ' . l:match[3]
\})
endfor
return l:output
endfunction
call ale#linter#Define('mercury', {
\ 'name': 'mmc',
\ 'output_stream': 'stderr',
\ 'executable_callback': 'ale_linters#mercury#mmc#GetExecutable',
\ 'command_callback': 'ale_linters#mercury#mmc#GetCommand',
\ 'callback': 'ale_linters#mercury#mmc#Handle',
\ 'lint_file': 1,
\})

50
ale_linters/nasm/nasm.vim Normal file
View File

@@ -0,0 +1,50 @@
" Author: Oyvind Ingvaldsen <oyvind.ingvaldsen@gmail.com>
" Description: NASM linter for asmsyntax nasm.
call ale#Set('nasm_nasm_executable', 'nasm')
call ale#Set('nasm_nasm_options', '')
function! ale_linters#nasm#nasm#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'nasm_nasm_executable')
endfunction
function! ale_linters#nasm#nasm#GetOptions(buffer) abort
return ale#Var(a:buffer, 'nasm_nasm_options')
endfunction
function! ale_linters#nasm#nasm#GetCommand(buffer) abort
" Note that NASM require a trailing slash to the -I option.
let l:executable = ale#Escape(ale_linters#nasm#nasm#GetExecutable(a:buffer))
let l:separator = has('win32') ? '\' : '/'
let l:path = ale#Escape(fnamemodify(bufname(a:buffer), ':p:h') . l:separator)
let l:options = ale_linters#nasm#nasm#GetOptions(a:buffer)
return l:executable
\ . ' -X gnu'
\ . ' -I ' . l:path
\ . ' ' . l:options
\ . ' %s'
endfunction
function! ale_linters#nasm#nasm#Handle(buffer, lines) abort
" Note that we treat 'fatal' as errors.
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\|fatal' ? 'E' : 'W',
\ 'text': l:match[3],
\})
endfor
return l:output
endfunction
call ale#linter#Define('nasm', {
\ 'name': 'nasm',
\ 'executable': 'nasm',
\ 'output_stream': 'stderr',
\ 'lint_file': 1,
\ 'command_callback': 'ale_linters#nasm#nasm#GetCommand',
\ 'callback': 'ale_linters#nasm#nasm#Handle',
\})

View File

@@ -2,7 +2,7 @@
" Description: A language server for OCaml " Description: A language server for OCaml
call ale#Set('ocaml_ols_executable', 'ocaml-language-server') call ale#Set('ocaml_ols_executable', 'ocaml-language-server')
call ale#Set('ocaml_ols_use_global', 0) call ale#Set('ocaml_ols_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#linter#Define('ocaml', { call ale#linter#Define('ocaml', {
\ 'name': 'ols', \ 'name': 'ols',

View File

@@ -27,12 +27,20 @@ function! ale_linters#perl#perl#Handle(buffer, lines) abort
let l:output = [] let l:output = []
let l:basename = expand('#' . a:buffer . ':t') let l:basename = expand('#' . a:buffer . ':t')
let l:type = 'E'
if a:lines[-1] =~# 'syntax OK'
let l:type = 'W'
endif
let l:seen = {}
for l:match in ale#util#GetMatches(a:lines, l:pattern) for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:line = l:match[3] let l:line = l:match[3]
let l:file = l:match[2]
let l:text = l:match[1] let l:text = l:match[1]
let l:type = 'E'
if ale#path#IsBufferPath(a:buffer, l:match[2]) if ale#path#IsBufferPath(a:buffer, l:file)
\ && !has_key(l:seen,l:line)
\ && ( \ && (
\ l:text isnot# 'BEGIN failed--compilation aborted' \ l:text isnot# 'BEGIN failed--compilation aborted'
\ || empty(l:output) \ || empty(l:output)
@@ -43,6 +51,8 @@ function! ale_linters#perl#perl#Handle(buffer, lines) abort
\ 'text': l:text, \ 'text': l:text,
\ 'type': l:type, \ 'type': l:type,
\}) \})
let l:seen[l:line] = 1
endif endif
endfor endfor

View File

@@ -18,9 +18,9 @@ function! ale_linters#perl#perlcritic#GetExecutable(buffer) abort
endfunction endfunction
function! ale_linters#perl#perlcritic#GetProfile(buffer) abort function! ale_linters#perl#perlcritic#GetProfile(buffer) abort
" first see if we've been overridden " first see if we've been overridden
let l:profile = ale#Var(a:buffer, 'perl_perlcritic_profile') let l:profile = ale#Var(a:buffer, 'perl_perlcritic_profile')
if l:profile is? '' if l:profile is? ''
return '' return ''
endif endif
@@ -31,6 +31,7 @@ endfunction
function! ale_linters#perl#perlcritic#GetCommand(buffer) abort function! ale_linters#perl#perlcritic#GetCommand(buffer) abort
let l:critic_verbosity = '%l:%c %m\n' let l:critic_verbosity = '%l:%c %m\n'
if ale#Var(a:buffer, 'perl_perlcritic_showrules') if ale#Var(a:buffer, 'perl_perlcritic_showrules')
let l:critic_verbosity = '%l:%c %m [%p]\n' let l:critic_verbosity = '%l:%c %m [%p]\n'
endif endif
@@ -38,17 +39,11 @@ function! ale_linters#perl#perlcritic#GetCommand(buffer) abort
let l:profile = ale_linters#perl#perlcritic#GetProfile(a:buffer) let l:profile = ale_linters#perl#perlcritic#GetProfile(a:buffer)
let l:options = ale#Var(a:buffer, 'perl_perlcritic_options') let l:options = ale#Var(a:buffer, 'perl_perlcritic_options')
let l:command = ale#Escape(ale_linters#perl#perlcritic#GetExecutable(a:buffer)) return ale#Escape(ale_linters#perl#perlcritic#GetExecutable(a:buffer))
\ . " --verbose '". l:critic_verbosity . "' --nocolor" \ . ' --verbose ' . ale#Escape(l:critic_verbosity)
\ . ' --nocolor'
if l:profile isnot? '' \ . (!empty(l:profile) ? ' --profile ' . ale#Escape(l:profile) : '')
let l:command .= ' --profile ' . ale#Escape(l:profile) \ . (!empty(l:options) ? ' ' . l:options : '')
endif
if l:options isnot? ''
let l:command .= ' ' . l:options
endif
return l:command
endfunction endfunction

View File

@@ -2,7 +2,7 @@
" Description: PHP Language server integration for ALE " Description: PHP Language server integration for ALE
call ale#Set('php_langserver_executable', 'php-language-server.php') call ale#Set('php_langserver_executable', 'php-language-server.php')
call ale#Set('php_langserver_use_global', 0) call ale#Set('php_langserver_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#php#langserver#GetExecutable(buffer) abort function! ale_linters#php#langserver#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'php_langserver', [ return ale#node#FindExecutable(a:buffer, 'php_langserver', [
@@ -14,10 +14,6 @@ function! ale_linters#php#langserver#GetCommand(buffer) abort
return 'php ' . ale#Escape(ale_linters#php#langserver#GetExecutable(a:buffer)) return 'php ' . ale#Escape(ale_linters#php#langserver#GetExecutable(a:buffer))
endfunction endfunction
function! ale_linters#php#langserver#GetLanguage(buffer) abort
return 'php'
endfunction
function! ale_linters#php#langserver#GetProjectRoot(buffer) abort function! ale_linters#php#langserver#GetProjectRoot(buffer) abort
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git') let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
@@ -29,6 +25,6 @@ call ale#linter#Define('php', {
\ 'lsp': 'stdio', \ 'lsp': 'stdio',
\ 'executable_callback': 'ale_linters#php#langserver#GetExecutable', \ 'executable_callback': 'ale_linters#php#langserver#GetExecutable',
\ 'command_callback': 'ale_linters#php#langserver#GetCommand', \ 'command_callback': 'ale_linters#php#langserver#GetCommand',
\ 'language_callback': 'ale_linters#php#langserver#GetLanguage', \ 'language': 'php',
\ 'project_root_callback': 'ale_linters#php#langserver#GetProjectRoot', \ 'project_root_callback': 'ale_linters#php#langserver#GetProjectRoot',
\}) \})

View File

@@ -1,28 +1,65 @@
" Author: diegoholiveira <https://github.com/diegoholiveira> " Author: diegoholiveira <https://github.com/diegoholiveira>, haginaga <https://github.com/haginaga>
" Description: static analyzer for PHP " Description: static analyzer for PHP
" Define the minimum severity " Define the minimum severity
let g:ale_php_phan_minimum_severity = get(g:, 'ale_php_phan_minimum_severity', 0) let g:ale_php_phan_minimum_severity = get(g:, 'ale_php_phan_minimum_severity', 0)
let g:ale_php_phan_executable = get(g:, 'ale_php_phan_executable', 'phan')
let g:ale_php_phan_use_client = get(g:, 'ale_php_phan_use_client', 0)
function! ale_linters#php#phan#GetExecutable(buffer) abort
let l:executable = ale#Var(a:buffer, 'php_phan_executable')
if ale#Var(a:buffer, 'php_phan_use_client') == 1 && l:executable is# 'phan'
let l:executable = 'phan_client'
endif
return l:executable
endfunction
function! ale_linters#php#phan#GetCommand(buffer) abort function! ale_linters#php#phan#GetCommand(buffer) abort
return 'phan -y ' if ale#Var(a:buffer, 'php_phan_use_client') == 1
\ . ale#Var(a:buffer, 'php_phan_minimum_severity') let l:args = '-l '
\ . ' %s' \ . ' %s'
else
let l:args = '-y '
\ . ale#Var(a:buffer, 'php_phan_minimum_severity')
\ . ' %s'
endif
let l:executable = ale_linters#php#phan#GetExecutable(a:buffer)
return ale#Escape(l:executable) . ' ' . l:args
endfunction endfunction
function! ale_linters#php#phan#Handle(buffer, lines) abort function! ale_linters#php#phan#Handle(buffer, lines) abort
" Matches against lines like the following: " Matches against lines like the following:
" if ale#Var(a:buffer, 'php_phan_use_client') == 1
" /path/to/some-filename.php:18 ERRORTYPE message " Phan error: ERRORTYPE: message in /path/to/some-filename.php on line nnn
let l:pattern = '^.*:\(\d\+\)\s\(\w\+\)\s\(.\+\)$' let l:pattern = '^Phan error: \(\w\+\): \(.\+\) in \(.\+\) on line \(\d\+\)$'
else
" /path/to/some-filename.php:18 ERRORTYPE message
let l:pattern = '^.*:\(\d\+\)\s\(\w\+\)\s\(.\+\)$'
endif
let l:output = [] let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern) for l:match in ale#util#GetMatches(a:lines, l:pattern)
call add(l:output, { if ale#Var(a:buffer, 'php_phan_use_client') == 1
\ 'lnum': l:match[1] + 0, let l:dict = {
\ 'text': l:match[3], \ 'lnum': l:match[4] + 0,
\ 'type': 'W', \ 'text': l:match[2],
\}) \ 'type': 'W',
\}
else
let l:dict = {
\ 'lnum': l:match[1] + 0,
\ 'text': l:match[3],
\ 'type': 'W',
\}
endif
call add(l:output, l:dict)
endfor endfor
return l:output return l:output
@@ -30,7 +67,7 @@ endfunction
call ale#linter#Define('php', { call ale#linter#Define('php', {
\ 'name': 'phan', \ 'name': 'phan',
\ 'executable': 'phan', \ 'executable_callback': 'ale_linters#php#phan#GetExecutable',
\ 'command_callback': 'ale_linters#php#phan#GetCommand', \ 'command_callback': 'ale_linters#php#phan#GetCommand',
\ 'callback': 'ale_linters#php#phan#Handle', \ 'callback': 'ale_linters#php#phan#Handle',
\}) \})

View File

@@ -4,7 +4,7 @@
let g:ale_php_phpcs_standard = get(g:, 'ale_php_phpcs_standard', '') let g:ale_php_phpcs_standard = get(g:, 'ale_php_phpcs_standard', '')
call ale#Set('php_phpcs_executable', 'phpcs') call ale#Set('php_phpcs_executable', 'phpcs')
call ale#Set('php_phpcs_use_global', 0) call ale#Set('php_phpcs_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#php#phpcs#GetExecutable(buffer) abort function! ale_linters#php#phpcs#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'php_phpcs', [ return ale#node#FindExecutable(a:buffer, 'php_phpcs', [

11
ale_linters/po/alex.vim Normal file
View File

@@ -0,0 +1,11 @@
" Author: Cian Butler https://github.com/butlerx
" Description: alex for PO files
call ale#linter#Define('po', {
\ 'name': 'alex',
\ 'executable': 'alex',
\ 'command': 'alex %s -t',
\ 'output_stream': 'stderr',
\ 'callback': 'ale#handlers#alex#Handle',
\ 'lint_file': 1,
\})

30
ale_linters/po/msgfmt.vim Normal file
View File

@@ -0,0 +1,30 @@
" Author: Cian Butler https://github.com/butlerx
" Description: msgfmt for PO files
function! ale_linters#po#msgfmt#Handle(buffer, lines) abort
let l:results = ale#handlers#unix#HandleAsWarning(a:buffer, a:lines)
let l:index = 0
for l:item in l:results
if l:index > 0 && l:item.text =~? 'this is the location of the first definition'
let l:last_item = l:results[l:index - 1]
if l:last_item.text =~? 'duplicate message definition'
let l:last_item.text = 'duplicate of message at line ' . l:item.lnum
let l:item.text = 'first location of duplicate of message at line ' . l:last_item.lnum
endif
endif
let l:index += 1
endfor
return l:results
endfunction
call ale#linter#Define('po', {
\ 'name': 'msgfmt',
\ 'executable': 'msgfmt',
\ 'output_stream': 'stderr',
\ 'command': 'msgfmt --statistics --output-file=- %t',
\ 'callback': 'ale_linters#po#msgfmt#Handle',
\})

View File

@@ -0,0 +1,9 @@
" Author: Cian Butler https://github.com/butlerx
" Description: proselint for PO files
call ale#linter#Define('po', {
\ 'name': 'proselint',
\ 'executable': 'proselint',
\ 'command': 'proselint %t',
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
\})

View File

@@ -0,0 +1,9 @@
" Author: Cian Butler https://github.com/butlerx
" Description: write-good for PO files
call ale#linter#Define('po', {
\ 'name': 'write-good',
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
\ 'callback': 'ale#handlers#writegood#Handle',
\})

View File

@@ -0,0 +1,21 @@
" Description: ponyc linter for pony files
call ale#Set('pony_ponyc_executable', 'ponyc')
call ale#Set('pony_ponyc_options', '--pass paint')
function! ale_linters#pony#ponyc#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'pony_ponyc_executable')
endfunction
function! ale_linters#pony#ponyc#GetCommand(buffer) abort
return ale#Escape(ale_linters#pony#ponyc#GetExecutable(a:buffer))
\ . ' ' . ale#Var(a:buffer, 'pony_ponyc_options')
endfunction
call ale#linter#Define('pony', {
\ 'name': 'ponyc',
\ 'output_stream': 'stderr',
\ 'executable_callback': 'ale_linters#pony#ponyc#GetExecutable',
\ 'command_callback': 'ale_linters#pony#ponyc#GetCommand',
\ 'callback': 'ale#handlers#pony#HandlePonycFormat',
\})

View File

@@ -1,12 +1,20 @@
" Author: Jeff Willette <jrwillette88@gmail.com> " Author: Jeff Willette <jrwillette88@gmail.com>
" Description: run the protoc-gen-lint plugin for the protoc binary " Description: run the protoc-gen-lint plugin for the protoc binary
call ale#Set('proto_protoc_gen_lint_options', '')
function! ale_linters#proto#protoc_gen_lint#GetCommand(buffer) abort function! ale_linters#proto#protoc_gen_lint#GetCommand(buffer) abort
let l:dirname = expand('#' . a:buffer . ':p:h') let l:dirname = expand('#' . a:buffer . ':p:h')
return 'protoc' let l:options = ['-I ' . ale#Escape(l:dirname)]
\ . ' -I ' . ale#Escape(l:dirname)
\ . ' --lint_out=. ' . '%s' if !empty(ale#Var(a:buffer, 'proto_protoc_gen_lint_options'))
let l:options += [ale#Var(a:buffer, 'proto_protoc_gen_lint_options')]
endif
let l:options += ['--lint_out=. ' . '%s']
return 'protoc' . ' ' . join(l:options)
endfunction endfunction
call ale#linter#Define('proto', { call ale#linter#Define('proto', {

View File

@@ -3,7 +3,7 @@
call ale#Set('pug_puglint_options', '') call ale#Set('pug_puglint_options', '')
call ale#Set('pug_puglint_executable', 'pug-lint') call ale#Set('pug_puglint_executable', 'pug-lint')
call ale#Set('pug_puglint_use_global', 0) call ale#Set('pug_puglint_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#pug#puglint#GetExecutable(buffer) abort function! ale_linters#pug#puglint#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'pug_puglint', [ return ale#node#FindExecutable(a:buffer, 'pug_puglint', [

View File

@@ -1,14 +1,15 @@
" Author: w0rp <devw0rp@gmail.com> " Author: w0rp <devw0rp@gmail.com>
" Description: flake8 for python files " Description: flake8 for python files
let g:ale_python_flake8_executable = " remove in 2.0
\ get(g:, 'ale_python_flake8_executable', 'flake8')
" Support an old setting as a fallback. " Support an old setting as a fallback.
let s:deprecation_warning_echoed = 0
let s:default_options = get(g:, 'ale_python_flake8_args', '') 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) call ale#Set('python_flake8_executable', 'flake8')
let g:ale_python_flake8_use_global = get(g:, 'ale_python_flake8_use_global', 0) call ale#Set('python_flake8_options', s:default_options)
call ale#Set('python_flake8_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('python_flake8_change_directory', 1)
function! s:UsingModule(buffer) abort function! s:UsingModule(buffer) abort
return ale#Var(a:buffer, 'python_flake8_options') =~# ' *-m flake8' return ale#Var(a:buffer, 'python_flake8_options') =~# ' *-m flake8'
@@ -39,6 +40,15 @@ function! ale_linters#python#flake8#VersionCheck(buffer) abort
endfunction endfunction
function! ale_linters#python#flake8#GetCommand(buffer, version_output) abort function! ale_linters#python#flake8#GetCommand(buffer, version_output) abort
" remove in 2.0
if exists('g:ale_python_flake8_args') && !s:deprecation_warning_echoed
execute 'echom ''Rename your g:ale_python_flake8_args setting to g:ale_python_flake8_options instead. Support for this will removed in ALE 2.0.'''
let s:deprecation_warning_echoed = 1
endif
let l:cd_string = ale#Var(a:buffer, 'python_flake8_change_directory')
\ ? ale#path#BufferCdString(a:buffer)
\ : ''
let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer) let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer)
let l:version = ale#semver#GetVersion(l:executable, a:version_output) let l:version = ale#semver#GetVersion(l:executable, a:version_output)
@@ -50,7 +60,8 @@ function! ale_linters#python#flake8#GetCommand(buffer, version_output) abort
let l:options = ale#Var(a:buffer, 'python_flake8_options') let l:options = ale#Var(a:buffer, 'python_flake8_options')
return ale#Escape(l:executable) return l:cd_string
\ . ale#Escape(l:executable)
\ . (!empty(l:options) ? ' ' . l:options : '') \ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' --format=default' \ . ' --format=default'
\ . l:display_name_args . ' -' \ . l:display_name_args . ' -'
@@ -105,11 +116,16 @@ function! ale_linters#python#flake8#Handle(buffer, lines) abort
\ 'type': 'W', \ 'type': 'W',
\} \}
if l:code[:0] is# 'F' || l:code is# 'E999' if l:code[:0] is# 'F'
let l:item.type = 'E' if l:code isnot# 'F401'
let l:item.type = 'E'
endif
elseif l:code[:0] is# 'E' elseif l:code[:0] is# 'E'
let l:item.type = 'E' let l:item.type = 'E'
let l:item.sub_type = 'style'
if l:code isnot# 'E999' && l:code isnot# 'E112'
let l:item.sub_type = 'style'
endif
elseif l:code[:0] is# 'W' elseif l:code[:0] is# 'W'
let l:item.sub_type = 'style' let l:item.sub_type = 'style'
endif endif

View File

@@ -1,10 +1,10 @@
" Author: Keith Smiley <k@keith.so>, w0rp <devw0rp@gmail.com> " Author: Keith Smiley <k@keith.so>, w0rp <devw0rp@gmail.com>
" Description: mypy support for optional python typechecking " Description: mypy support for optional python typechecking
let g:ale_python_mypy_executable = call ale#Set('python_mypy_executable', 'mypy')
\ get(g:, 'ale_python_mypy_executable', 'mypy') call ale#Set('python_mypy_ignore_invalid_syntax', 0)
let g:ale_python_mypy_options = get(g:, 'ale_python_mypy_options', '') call ale#Set('python_mypy_options', '')
let g:ale_python_mypy_use_global = get(g:, 'ale_python_mypy_use_global', 0) call ale#Set('python_mypy_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#python#mypy#GetExecutable(buffer) abort function! ale_linters#python#mypy#GetExecutable(buffer) abort
return ale#python#FindExecutable(a:buffer, 'python_mypy', ['mypy']) return ale#python#FindExecutable(a:buffer, 'python_mypy', ['mypy'])
@@ -45,6 +45,12 @@ function! ale_linters#python#mypy#Handle(buffer, lines) abort
let l:output = [] let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern) for l:match in ale#util#GetMatches(a:lines, l:pattern)
" Skip invalid syntax errors if the option is on.
if l:match[5] is# 'invalid syntax'
\&& ale#Var(a:buffer, 'python_mypy_ignore_invalid_syntax')
continue
endif
call add(l:output, { call add(l:output, {
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]), \ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
\ 'lnum': l:match[2] + 0, \ 'lnum': l:match[2] + 0,

View File

@@ -7,7 +7,7 @@ let g:ale_python_prospector_executable =
let g:ale_python_prospector_options = let g:ale_python_prospector_options =
\ get(g:, 'ale_python_prospector_options', '') \ get(g:, 'ale_python_prospector_options', '')
let g:ale_python_prospector_use_global = get(g:, 'ale_python_prospector_use_global', 0) let g:ale_python_prospector_use_global = get(g:, 'ale_python_prospector_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#python#prospector#GetExecutable(buffer) abort function! ale_linters#python#prospector#GetExecutable(buffer) abort
return ale#python#FindExecutable(a:buffer, 'python_prospector', ['prospector']) return ale#python#FindExecutable(a:buffer, 'python_prospector', ['prospector'])

View File

@@ -3,7 +3,7 @@
call ale#Set('python_pycodestyle_executable', 'pycodestyle') call ale#Set('python_pycodestyle_executable', 'pycodestyle')
call ale#Set('python_pycodestyle_options', '') call ale#Set('python_pycodestyle_options', '')
call ale#Set('python_pycodestyle_use_global', 0) call ale#Set('python_pycodestyle_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#python#pycodestyle#GetExecutable(buffer) abort function! ale_linters#python#pycodestyle#GetExecutable(buffer) abort
return ale#python#FindExecutable(a:buffer, 'python_pycodestyle', ['pycodestyle']) return ale#python#FindExecutable(a:buffer, 'python_pycodestyle', ['pycodestyle'])
@@ -44,8 +44,8 @@ function! ale_linters#python#pycodestyle#Handle(buffer, lines) abort
\ 'code': l:match[4], \ 'code': l:match[4],
\} \}
" E999 is not a style error, it's a syntax error. " E999 and E112 are syntax errors.
if l:match[4] is# 'E999' if l:match[4] is# 'E999' || l:match[4] is# 'E112'
unlet l:item.sub_type unlet l:item.sub_type
endif endif

View File

@@ -2,7 +2,7 @@
" Description: pyflakes for python files " Description: pyflakes for python files
call ale#Set('python_pyflakes_executable', 'pyflakes') call ale#Set('python_pyflakes_executable', 'pyflakes')
call ale#Set('python_pyflakes_use_global', 0) call ale#Set('python_pyflakes_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#python#pyflakes#GetExecutable(buffer) abort function! ale_linters#python#pyflakes#GetExecutable(buffer) abort
return ale#python#FindExecutable(a:buffer, 'python_pyflakes', ['pyflakes']) return ale#python#FindExecutable(a:buffer, 'python_pyflakes', ['pyflakes'])

View File

@@ -1,20 +1,22 @@
" Author: keith <k@keith.so> " Author: keith <k@keith.so>
" Description: pylint for python files " Description: pylint for python files
let g:ale_python_pylint_executable = call ale#Set('python_pylint_executable', 'pylint')
\ get(g:, 'ale_python_pylint_executable', 'pylint') call ale#Set('python_pylint_options', '')
call ale#Set('python_pylint_use_global', get(g:, 'ale_use_global_executables', 0))
let g:ale_python_pylint_options = call ale#Set('python_pylint_change_directory', 1)
\ 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 function! ale_linters#python#pylint#GetExecutable(buffer) abort
return ale#python#FindExecutable(a:buffer, 'python_pylint', ['pylint']) return ale#python#FindExecutable(a:buffer, 'python_pylint', ['pylint'])
endfunction endfunction
function! ale_linters#python#pylint#GetCommand(buffer) abort function! ale_linters#python#pylint#GetCommand(buffer) abort
return ale#Escape(ale_linters#python#pylint#GetExecutable(a:buffer)) let l:cd_string = ale#Var(a:buffer, 'python_pylint_change_directory')
\ ? ale#path#BufferCdString(a:buffer)
\ : ''
return l:cd_string
\ . ale#Escape(ale_linters#python#pylint#GetExecutable(a:buffer))
\ . ' ' . ale#Var(a:buffer, 'python_pylint_options') \ . ' ' . ale#Var(a:buffer, 'python_pylint_options')
\ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n' \ . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n'
\ . ' %s' \ . ' %s'
@@ -24,7 +26,7 @@ function! ale_linters#python#pylint#Handle(buffer, lines) abort
" Matches patterns like the following: " Matches patterns like the following:
" "
" test.py:4:4: W0101 (unreachable) Unreachable code " test.py:4:4: W0101 (unreachable) Unreachable code
let l:pattern = '\v^[^:]+:(\d+):(\d+): ([[:alnum:]]+) \(([^(]*)\) (.*)$' let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+): ([[:alnum:]]+) \(([^(]*)\) (.*)$'
let l:output = [] let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern) for l:match in ale#util#GetMatches(a:lines, l:pattern)

View File

@@ -2,7 +2,7 @@
" Description: A language server for Python " Description: A language server for Python
call ale#Set('python_pyls_executable', 'pyls') call ale#Set('python_pyls_executable', 'pyls')
call ale#Set('python_pyls_use_global', 0) call ale#Set('python_pyls_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#python#pyls#GetExecutable(buffer) abort function! ale_linters#python#pyls#GetExecutable(buffer) abort
return ale#python#FindExecutable(a:buffer, 'python_pyls', ['pyls']) return ale#python#FindExecutable(a:buffer, 'python_pyls', ['pyls'])
@@ -14,15 +14,12 @@ function! ale_linters#python#pyls#GetCommand(buffer) abort
return ale#Escape(l:executable) return ale#Escape(l:executable)
endfunction endfunction
function! ale_linters#python#pyls#GetLanguage(buffer) abort
return 'python'
endfunction
call ale#linter#Define('python', { call ale#linter#Define('python', {
\ 'name': 'pyls', \ 'name': 'pyls',
\ 'lsp': 'stdio', \ 'lsp': 'stdio',
\ 'executable_callback': 'ale_linters#python#pyls#GetExecutable', \ 'executable_callback': 'ale_linters#python#pyls#GetExecutable',
\ 'command_callback': 'ale_linters#python#pyls#GetCommand', \ 'command_callback': 'ale_linters#python#pyls#GetCommand',
\ 'language_callback': 'ale_linters#python#pyls#GetLanguage', \ 'language': 'python',
\ 'project_root_callback': 'ale#python#FindProjectRoot', \ 'project_root_callback': 'ale#python#FindProjectRoot',
\ 'completion_filter': 'ale#completion#python#CompletionItemFilter',
\}) \})

View File

@@ -0,0 +1,40 @@
" Author: pylipp (www.github.com/pylipp)
" Description: qmlfmt for QML files
let g:ale_qml_qmlfmt_executable = get(g:, 'ale_qml_qmlfmt_executable', 'qmlfmt')
function! ale_linters#qml#qmlfmt#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'qml_qmlfmt_executable')
endfunction
function! ale_linters#qml#qmlfmt#GetCommand(buffer) abort
return ale#Escape(ale_linters#qml#qmlfmt#GetExecutable(a:buffer))
\ . ' -e'
endfunction
" Find lines like
" Error:11:1: Expected token `}'
function! ale_linters#qml#qmlfmt#Handle(buffer, lines) abort
let l:pattern = '\v^(Error|Warning):(\d+):(\d+): (.+)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:item = {
\ 'lnum': l:match[2] + 0,
\ 'col': l:match[3] + 0,
\ 'text': l:match[4],
\ 'type': l:match[1] is# 'Warning' ? 'W' : 'E',
\}
call add(l:output, l:item)
endfor
return l:output
endfunction
call ale#linter#Define('qml', {
\ 'name': 'qmlfmt',
\ 'output_stream': 'stderr',
\ 'executable_callback': 'ale_linters#qml#qmlfmt#GetExecutable',
\ 'command_callback': 'ale_linters#qml#qmlfmt#GetCommand',
\ 'callback': 'ale_linters#qml#qmlfmt#Handle',
\})

View File

@@ -0,0 +1,29 @@
" Author: pylipp (www.github.com/pylipp)
" Description: qmllint for QML files
" Find lines like
" /home/foo_user42/code-base/qml/Screen.qml:11 : Expected token `}'
function! ale_linters#qml#qmllint#Handle(buffer, lines) abort
let l:pattern = '\v^[/_-a-zA-z0-9\. ]+:(\d+) : (.*)$'
let l:output = []
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:item = {
\ 'lnum': l:match[1] + 0,
\ 'col': 0,
\ 'text': l:match[2],
\ 'type': 'E',
\}
call add(l:output, l:item)
endfor
return l:output
endfunction
call ale#linter#Define('qml', {
\ 'name': 'qmllint',
\ 'output_stream': 'stderr',
\ 'executable': 'qmllint',
\ 'command': 'qmllint %t',
\ 'callback': 'ale_linters#qml#qmllint#Handle',
\})

View File

@@ -1,14 +1,29 @@
" Author: Michel Lang <michellang@gmail.com>, w0rp <devw0rp@gmail.com> " Author: Michel Lang <michellang@gmail.com>, w0rp <devw0rp@gmail.com>,
" Fenner Macrae <fmacrae.dev@gmail.com>
" Description: This file adds support for checking R code with lintr. " Description: This file adds support for checking R code with lintr.
let g:ale_r_lintr_options = let g:ale_r_lintr_options = get(g:, 'ale_r_lintr_options', 'with_defaults()')
\ get(g:, 'ale_r_lintr_options', 'lintr::with_defaults()')
" A reasonable alternative default: " A reasonable alternative default:
" \ get(g:, 'ale_r_lintr_options', 'lintr::with_defaults(object_usage_linter = NULL)') " get(g:, 'ale_r_lintr_options', 'with_defaults(object_usage_linter = NULL)')
let g:ale_r_lintr_lint_package = get(g:, 'ale_r_lintr_lint_package', 0)
function! ale_linters#r#lintr#GetCommand(buffer) abort function! ale_linters#r#lintr#GetCommand(buffer) abort
if ale#Var(a:buffer, 'r_lintr_lint_package')
let l:lint_cmd = 'lint_package(cache = FALSE, linters = '
\ . ale#Var(a:buffer, 'r_lintr_options') . ')'
else
let l:lint_cmd = 'lint(cache = FALSE, commandArgs(TRUE), '
\ . ale#Var(a:buffer, 'r_lintr_options') . ')'
endif
let l:cmd_string = 'suppressPackageStartupMessages(library(lintr));'
\ . l:lint_cmd
return ale#path#BufferCdString(a:buffer) return ale#path#BufferCdString(a:buffer)
\ . 'Rscript -e ' . ale#Escape('lintr::lint(commandArgs(TRUE)[1], eval(parse(text = commandArgs(TRUE)[2])))') . ' %t' . ' ' . ale#Escape(ale#Var(a:buffer, 'r_lintr_options')) \ . 'Rscript -e '
\ . ale#Escape(l:cmd_string) . ' %t'
endfunction endfunction
call ale#linter#Define('r', { call ale#linter#Define('r', {

View File

@@ -2,7 +2,7 @@
" Description: A language server for Reason " Description: A language server for Reason
call ale#Set('reason_ols_executable', 'ocaml-language-server') call ale#Set('reason_ols_executable', 'ocaml-language-server')
call ale#Set('reason_ols_use_global', 0) call ale#Set('reason_ols_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#linter#Define('reason', { call ale#linter#Define('reason', {
\ 'name': 'ols', \ 'name': 'ols',

View File

@@ -1,8 +1,11 @@
" Author: Daniel Schemala <istjanichtzufassen@gmail.com> " Author: Daniel Schemala <istjanichtzufassen@gmail.com>,
" Ivan Petkov <ivanppetkov@gmail.com>
" Description: rustc invoked by cargo for rust files " Description: rustc invoked by cargo for rust files
call ale#Set('rust_cargo_use_check', 1) call ale#Set('rust_cargo_use_check', 1)
call ale#Set('rust_cargo_check_all_targets', 0) call ale#Set('rust_cargo_check_all_targets', 0)
call ale#Set('rust_cargo_default_feature_behavior', 'default')
call ale#Set('rust_cargo_include_features', '')
function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort
if ale#path#FindNearestFile(a:bufnr, 'Cargo.toml') isnot# '' if ale#path#FindNearestFile(a:bufnr, 'Cargo.toml') isnot# ''
@@ -29,10 +32,27 @@ function! ale_linters#rust#cargo#GetCommand(buffer, version_output) abort
\ && ale#Var(a:buffer, 'rust_cargo_check_all_targets') \ && ale#Var(a:buffer, 'rust_cargo_check_all_targets')
\ && ale#semver#GTE(l:version, [0, 22, 0]) \ && ale#semver#GTE(l:version, [0, 22, 0])
let l:include_features = ale#Var(a:buffer, 'rust_cargo_include_features')
if !empty(l:include_features)
let l:include_features = ' --features ' . ale#Escape(l:include_features)
endif
let l:default_feature_behavior = ale#Var(a:buffer, 'rust_cargo_default_feature_behavior')
if l:default_feature_behavior is# 'all'
let l:include_features = ''
let l:default_feature = ' --all-features'
elseif l:default_feature_behavior is# 'none'
let l:default_feature = ' --no-default-features'
else
let l:default_feature = ''
endif
return 'cargo ' return 'cargo '
\ . (l:use_check ? 'check' : 'build') \ . (l:use_check ? 'check' : 'build')
\ . (l:use_all_targets ? ' --all-targets' : '') \ . (l:use_all_targets ? ' --all-targets' : '')
\ . ' --frozen --message-format=json -q' \ . ' --frozen --message-format=json -q'
\ . l:default_feature
\ . l:include_features
endfunction endfunction
call ale#linter#Define('rust', { call ale#linter#Define('rust', {

View File

@@ -12,12 +12,11 @@ function! ale_linters#rust#rls#GetCommand(buffer) abort
let l:executable = ale_linters#rust#rls#GetExecutable(a:buffer) let l:executable = ale_linters#rust#rls#GetExecutable(a:buffer)
let l:toolchain = ale#Var(a:buffer, 'rust_rls_toolchain') let l:toolchain = ale#Var(a:buffer, 'rust_rls_toolchain')
return ale#Escape(l:executable) if empty(l:toolchain)
\ . ' +' . ale#Escape(l:toolchain) return ale#Escape(l:executable)
endfunction else
return ale#Escape(l:executable) . ' +' . ale#Escape(l:toolchain)
function! ale_linters#rust#rls#GetLanguage(buffer) abort endif
return 'rust'
endfunction endfunction
function! ale_linters#rust#rls#GetProjectRoot(buffer) abort function! ale_linters#rust#rls#GetProjectRoot(buffer) abort
@@ -31,6 +30,6 @@ call ale#linter#Define('rust', {
\ 'lsp': 'stdio', \ 'lsp': 'stdio',
\ 'executable_callback': 'ale_linters#rust#rls#GetExecutable', \ 'executable_callback': 'ale_linters#rust#rls#GetExecutable',
\ 'command_callback': 'ale_linters#rust#rls#GetCommand', \ 'command_callback': 'ale_linters#rust#rls#GetCommand',
\ 'language_callback': 'ale_linters#rust#rls#GetLanguage', \ 'language': 'rust',
\ 'project_root_callback': 'ale_linters#rust#rls#GetProjectRoot', \ 'project_root_callback': 'ale_linters#rust#rls#GetProjectRoot',
\}) \})

View File

@@ -1,8 +1,9 @@
" Author: KabbAmine - https://github.com/KabbAmine " Author: KabbAmine - https://github.com/KabbAmine,
" Ben Falconer <ben@falconers.me.uk>
call ale#linter#Define('sass', { call ale#linter#Define('sass', {
\ 'name': 'sasslint', \ 'name': 'sasslint',
\ 'executable': 'sass-lint', \ 'executable': 'sass-lint',
\ 'command': 'sass-lint -v -q -f compact %t', \ 'command_callback': 'ale#handlers#sasslint#GetCommand',
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat', \ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
\}) \})

View File

@@ -1,7 +1,7 @@
" Author: diartyz <diartyz@gmail.com> " Author: diartyz <diartyz@gmail.com>
call ale#Set('sass_stylelint_executable', 'stylelint') call ale#Set('sass_stylelint_executable', 'stylelint')
call ale#Set('sass_stylelint_use_global', 0) call ale#Set('sass_stylelint_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#sass#stylelint#GetExecutable(buffer) abort function! ale_linters#sass#stylelint#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'sass_stylelint', [ return ale#node#FindExecutable(a:buffer, 'sass_stylelint', [

29
ale_linters/scala/fsc.vim Normal file
View File

@@ -0,0 +1,29 @@
" Author: Nils Leuzinger - https://github.com/PawkyPenguin
" Description: Basic scala support using fsc
"
function! ale_linters#scala#fsc#GetExecutable(buffer) abort
if index(split(getbufvar(a:buffer, '&filetype'), '\.'), 'sbt') >= 0
" Don't check sbt files
return ''
endif
return 'fsc'
endfunction
function! ale_linters#scala#fsc#GetCommand(buffer) abort
let l:executable = ale_linters#scala#fsc#GetExecutable(a:buffer)
if empty(l:executable)
return ''
endif
return ale#Escape(l:executable) . ' -Ystop-after:parser %t'
endfunction
call ale#linter#Define('scala', {
\ 'name': 'fsc',
\ 'executable_callback': 'ale_linters#scala#fsc#GetExecutable',
\ 'command_callback': 'ale_linters#scala#fsc#GetCommand',
\ 'callback': 'ale#handlers#scala#HandleScalacLintFormat',
\ 'output_stream': 'stderr',
\})

View File

@@ -4,7 +4,7 @@
function! ale_linters#scala#scalac#GetExecutable(buffer) abort function! ale_linters#scala#scalac#GetExecutable(buffer) abort
if index(split(getbufvar(a:buffer, '&filetype'), '\.'), 'sbt') >= 0 if index(split(getbufvar(a:buffer, '&filetype'), '\.'), 'sbt') >= 0
" Don't check sbt files with scalac. " Don't check sbt files
return '' return ''
endif endif
@@ -21,45 +21,10 @@ function! ale_linters#scala#scalac#GetCommand(buffer) abort
return ale#Escape(l:executable) . ' -Ystop-after:parser %t' return ale#Escape(l:executable) . ' -Ystop-after:parser %t'
endfunction endfunction
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
let l:pattern = '^.\+:\(\d\+\): \(\w\+\): \(.\+\)'
let l:output = []
let l:ln = 0
for l:line in a:lines
let l:ln = l:ln + 1
let l:match = matchlist(l:line, l:pattern)
if len(l:match) == 0
continue
endif
let l:text = l:match[3]
let l:type = l:match[2] is# 'error' ? 'E' : 'W'
let l:col = 0
if l:ln + 1 < len(a:lines)
let l:col = stridx(a:lines[l:ln + 1], '^')
endif
call add(l:output, {
\ 'lnum': l:match[1] + 0,
\ 'col': l:col + 1,
\ 'text': l:text,
\ 'type': l:type,
\})
endfor
return l:output
endfunction
call ale#linter#Define('scala', { call ale#linter#Define('scala', {
\ 'name': 'scalac', \ 'name': 'scalac',
\ 'executable_callback': 'ale_linters#scala#scalac#GetExecutable', \ 'executable_callback': 'ale_linters#scala#scalac#GetExecutable',
\ 'command_callback': 'ale_linters#scala#scalac#GetCommand', \ 'command_callback': 'ale_linters#scala#scalac#GetCommand',
\ 'callback': 'ale_linters#scala#scalac#Handle', \ 'callback': 'ale#handlers#scala#HandleScalacLintFormat',
\ 'output_stream': 'stderr', \ 'output_stream': 'stderr',
\}) \})

View File

@@ -1,8 +1,18 @@
" Author: KabbAmine - https://github.com/KabbAmine " Author: KabbAmine - https://github.com/KabbAmine, Ben Falconer
" <ben@falconers.me.uk>
function! ale_linters#scss#sasslint#GetCommand(buffer) abort
return ale#path#BufferCdString(a:buffer)
\ . ale#Escape('sass-lint')
\ . ' -v'
\ . ' -q'
\ . ' -f compact'
\ . ' %t'
endfunction
call ale#linter#Define('scss', { call ale#linter#Define('scss', {
\ 'name': 'sasslint', \ 'name': 'sasslint',
\ 'executable': 'sass-lint', \ 'executable': 'sass-lint',
\ 'command': 'sass-lint -v -q -f compact %t', \ 'command_callback': 'ale_linters#scss#sasslint#GetCommand',
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat', \ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
\}) \})

View File

@@ -1,7 +1,7 @@
" Author: diartyz <diartyz@gmail.com> " Author: diartyz <diartyz@gmail.com>
call ale#Set('scss_stylelint_executable', 'stylelint') call ale#Set('scss_stylelint_executable', 'stylelint')
call ale#Set('scss_stylelint_use_global', 0) call ale#Set('scss_stylelint_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#scss#stylelint#GetExecutable(buffer) abort function! ale_linters#scss#stylelint#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'scss_stylelint', [ return ale#node#FindExecutable(a:buffer, 'scss_stylelint', [

View File

@@ -2,7 +2,7 @@
call ale#Set('stylus_stylelint_executable', 'stylelint') call ale#Set('stylus_stylelint_executable', 'stylelint')
call ale#Set('stylus_stylelint_options', '') call ale#Set('stylus_stylelint_options', '')
call ale#Set('stylus_stylelint_use_global', 0) call ale#Set('stylus_stylelint_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#stylus#stylelint#GetExecutable(buffer) abort function! ale_linters#stylus#stylelint#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'stylus_stylelint', [ return ale#node#FindExecutable(a:buffer, 'stylus_stylelint', [

View File

@@ -0,0 +1,9 @@
" Author: Yasuhiro Kiyota <yasuhiroki.duck@gmail.com>
" Description: textlint, a proofreading tool (https://textlint.github.io/)
call ale#linter#Define('text', {
\ 'name': 'textlint',
\ 'executable_callback': 'ale#handlers#textlint#GetExecutable',
\ 'command_callback': 'ale#handlers#textlint#GetCommand',
\ 'callback': 'ale#handlers#textlint#HandleTextlintOutput',
\})

View File

@@ -4,7 +4,7 @@
call ale#Set('typescript_tslint_executable', 'tslint') call ale#Set('typescript_tslint_executable', 'tslint')
call ale#Set('typescript_tslint_config_path', '') call ale#Set('typescript_tslint_config_path', '')
call ale#Set('typescript_tslint_rules_dir', '') call ale#Set('typescript_tslint_rules_dir', '')
call ale#Set('typescript_tslint_use_global', 0) call ale#Set('typescript_tslint_use_global', get(g:, 'ale_use_global_executables', 0))
call ale#Set('typescript_tslint_ignore_empty_files', 0) call ale#Set('typescript_tslint_ignore_empty_files', 0)
function! ale_linters#typescript#tslint#GetExecutable(buffer) abort function! ale_linters#typescript#tslint#GetExecutable(buffer) abort
@@ -70,7 +70,7 @@ function! ale_linters#typescript#tslint#GetCommand(buffer) abort
\ : '' \ : ''
return ale#path#BufferCdString(a:buffer) return ale#path#BufferCdString(a:buffer)
\ . ale_linters#typescript#tslint#GetExecutable(a:buffer) \ . ale#Escape(ale_linters#typescript#tslint#GetExecutable(a:buffer))
\ . ' --format json' \ . ' --format json'
\ . l:tslint_config_option \ . l:tslint_config_option
\ . l:tslint_rules_option \ . l:tslint_rules_option

View File

@@ -3,17 +3,13 @@
call ale#Set('typescript_tsserver_executable', 'tsserver') call ale#Set('typescript_tsserver_executable', 'tsserver')
call ale#Set('typescript_tsserver_config_path', '') call ale#Set('typescript_tsserver_config_path', '')
call ale#Set('typescript_tsserver_use_global', 0) call ale#Set('typescript_tsserver_use_global', get(g:, 'ale_use_global_executables', 0))
" These functions need to be defined just to comply with the API for LSP. " These functions need to be defined just to comply with the API for LSP.
function! ale_linters#typescript#tsserver#GetProjectRoot(buffer) abort function! ale_linters#typescript#tsserver#GetProjectRoot(buffer) abort
return '' return ''
endfunction endfunction
function! ale_linters#typescript#tsserver#GetLanguage(buffer) abort
return ''
endfunction
function! ale_linters#typescript#tsserver#GetExecutable(buffer) abort function! ale_linters#typescript#tsserver#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'typescript_tsserver', [ return ale#node#FindExecutable(a:buffer, 'typescript_tsserver', [
\ 'node_modules/.bin/tsserver', \ 'node_modules/.bin/tsserver',
@@ -26,5 +22,5 @@ call ale#linter#Define('typescript', {
\ 'executable_callback': 'ale_linters#typescript#tsserver#GetExecutable', \ 'executable_callback': 'ale_linters#typescript#tsserver#GetExecutable',
\ 'command_callback': 'ale_linters#typescript#tsserver#GetExecutable', \ 'command_callback': 'ale_linters#typescript#tsserver#GetExecutable',
\ 'project_root_callback': 'ale_linters#typescript#tsserver#GetProjectRoot', \ 'project_root_callback': 'ale_linters#typescript#tsserver#GetProjectRoot',
\ 'language_callback': 'ale_linters#typescript#tsserver#GetLanguage', \ 'language': '',
\}) \})

View File

@@ -2,31 +2,38 @@
" Description: This file adds support for checking Vim code with Vint. " Description: This file adds support for checking Vim code with Vint.
" This flag can be used to change enable/disable style issues. " This flag can be used to change enable/disable style issues.
let g:ale_vim_vint_show_style_issues = call ale#Set('vim_vint_show_style_issues', 1)
\ get(g:, 'ale_vim_vint_show_style_issues', 1) call ale#Set('vim_vint_executable', 'vint')
let s:enable_neovim = has('nvim') ? ' --enable-neovim ' : '' let s:enable_neovim = has('nvim') ? ' --enable-neovim' : ''
let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {description} (see {reference})"' let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {description} (see {reference})"'
function! ale_linters#vim#vint#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'vim_vint_executable')
endfunction
function! ale_linters#vim#vint#VersionCommand(buffer) abort function! ale_linters#vim#vint#VersionCommand(buffer) abort
let l:executable = ale_linters#vim#vint#GetExecutable(a:buffer)
" Check the Vint version if we haven't checked it already. " Check the Vint version if we haven't checked it already.
return !ale#semver#HasVersion('vint') return !ale#semver#HasVersion(l:executable)
\ ? 'vint --version' \ ? ale#Escape(l:executable) . ' --version'
\ : '' \ : ''
endfunction endfunction
function! ale_linters#vim#vint#GetCommand(buffer, version_output) abort function! ale_linters#vim#vint#GetCommand(buffer, version_output) abort
let l:version = ale#semver#GetVersion('vint', a:version_output) let l:executable = ale_linters#vim#vint#GetExecutable(a:buffer)
let l:version = ale#semver#GetVersion(l:executable, a:version_output)
let l:can_use_no_color_flag = empty(l:version) let l:can_use_no_color_flag = empty(l:version)
\ || ale#semver#GTE(l:version, [0, 3, 7]) \ || ale#semver#GTE(l:version, [0, 3, 7])
let l:warning_flag = ale#Var(a:buffer, 'vim_vint_show_style_issues') ? '-s' : '-w' let l:warning_flag = ale#Var(a:buffer, 'vim_vint_show_style_issues') ? '-s' : '-w'
return 'vint ' return ale#Escape(l:executable)
\ . l:warning_flag . ' ' \ . ' ' . l:warning_flag
\ . (l:can_use_no_color_flag ? '--no-color ' : '') \ . (l:can_use_no_color_flag ? ' --no-color' : '')
\ . s:enable_neovim \ . s:enable_neovim
\ . s:format \ . ' ' . s:format
\ . ' %t' \ . ' %t'
endfunction endfunction
@@ -58,7 +65,7 @@ endfunction
call ale#linter#Define('vim', { call ale#linter#Define('vim', {
\ 'name': 'vint', \ 'name': 'vint',
\ 'executable': 'vint', \ 'executable_callback': 'ale_linters#vim#vint#GetExecutable',
\ 'command_chain': [ \ 'command_chain': [
\ {'callback': 'ale_linters#vim#vint#VersionCommand', 'output_stream': 'stderr'}, \ {'callback': 'ale_linters#vim#vint#VersionCommand', 'output_stream': 'stderr'},
\ {'callback': 'ale_linters#vim#vint#GetCommand', 'output_stream': 'stdout'}, \ {'callback': 'ale_linters#vim#vint#GetCommand', 'output_stream': 'stdout'},

View File

@@ -2,7 +2,7 @@
" Description: This file adds support for linting Swagger / OpenAPI documents using swaglint " Description: This file adds support for linting Swagger / OpenAPI documents using swaglint
call ale#Set('yaml_swaglint_executable', 'swaglint') call ale#Set('yaml_swaglint_executable', 'swaglint')
call ale#Set('yaml_swaglint_use_global', 0) call ale#Set('yaml_swaglint_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#yaml#swaglint#GetExecutable(buffer) abort function! ale_linters#yaml#swaglint#GetExecutable(buffer) abort
return ale#node#FindExecutable(a:buffer, 'yaml_swaglint', [ return ale#node#FindExecutable(a:buffer, 'yaml_swaglint', [

View File

@@ -2,6 +2,11 @@
" Description: Primary code path for the plugin " Description: Primary code path for the plugin
" Manages execution of linters when requested by autocommands " Manages execution of linters when requested by autocommands
" Strings used for severity in the echoed message
let g:ale_echo_msg_error_str = get(g:, 'ale_echo_msg_error_str', 'Error')
let g:ale_echo_msg_info_str = get(g:, 'ale_echo_msg_info_str', 'Info')
let g:ale_echo_msg_warning_str = get(g:, 'ale_echo_msg_warning_str', 'Warning')
let s:lint_timer = -1 let s:lint_timer = -1
let s:queued_buffer_number = -1 let s:queued_buffer_number = -1
let s:should_lint_file_for_buffer = {} let s:should_lint_file_for_buffer = {}
@@ -32,8 +37,8 @@ function! ale#CallWithCooldown(timestamp_key, func, arglist) abort
endfunction endfunction
" Return 1 if a file is too large for ALE to handle. " Return 1 if a file is too large for ALE to handle.
function! ale#FileTooLarge() abort function! ale#FileTooLarge(buffer) abort
let l:max = ale#Var(bufnr(''), 'maximum_file_size') let l:max = getbufvar(a:buffer, 'ale_maximum_file_size', get(g:, 'ale_maximum_file_size', 0))
return l:max > 0 ? (line2byte(line('$') + 1) > l:max) : 0 return l:max > 0 ? (line2byte(line('$') + 1) > l:max) : 0
endfunction endfunction
@@ -46,39 +51,47 @@ function! ale#ShouldDoNothing(buffer) abort
" The checks are split into separate if statements to make it possible to " The checks are split into separate if statements to make it possible to
" profile each check individually with Vim's profiling tools. " profile each check individually with Vim's profiling tools.
" Do nothing if ALE is disabled.
if !getbufvar(a:buffer, 'ale_enabled', get(g:, 'ale_enabled', 0))
return 1
endif
" Don't perform any checks when newer NeoVim versions are exiting. " Don't perform any checks when newer NeoVim versions are exiting.
if get(v:, 'exiting', v:null) isnot v:null if get(v:, 'exiting', v:null) isnot v:null
return 1 return 1
endif endif
" Do nothing for blacklisted files let l:filetype = getbufvar(a:buffer, '&filetype')
if index(g:ale_filetype_blacklist, getbufvar(a:buffer, '&filetype')) >= 0
" Do nothing when there's no filetype.
if l:filetype is# ''
return 1 return 1
endif endif
" Do nothing if running from command mode " Do nothing for blacklisted files.
if index(get(g:, 'ale_filetype_blacklist', []), l:filetype) >= 0
return 1
endif
" Do nothing if running from command mode.
if s:getcmdwintype_exists && !empty(getcmdwintype()) if s:getcmdwintype_exists && !empty(getcmdwintype())
return 1 return 1
endif endif
let l:filename = fnamemodify(bufname(a:buffer), ':t') let l:filename = fnamemodify(bufname(a:buffer), ':t')
" Do nothing for directories.
if l:filename is# '.' if l:filename is# '.'
return 1 return 1
endif endif
" Do nothing if running in the sandbox " Do nothing if running in the sandbox.
if ale#util#InSandbox() if ale#util#InSandbox()
return 1 return 1
endif endif
" Do nothing if ALE is disabled.
if !ale#Var(a:buffer, 'enabled')
return 1
endif
" Do nothing if the file is too large. " Do nothing if the file is too large.
if ale#FileTooLarge() if ale#FileTooLarge(a:buffer)
return 1 return 1
endif endif

77
autoload/ale/autocmd.vim Normal file
View File

@@ -0,0 +1,77 @@
function! ale#autocmd#InitAuGroups() abort
" This value used to be a Boolean as a Number, and is now a String.
let l:text_changed = '' . g:ale_lint_on_text_changed
augroup ALEPatternOptionsGroup
autocmd!
autocmd BufEnter,BufRead * call ale#pattern_options#SetOptions(str2nr(expand('<abuf>')))
augroup END
augroup ALERunOnTextChangedGroup
autocmd!
if g:ale_enabled
if l:text_changed is? 'always' || l:text_changed is# '1'
autocmd TextChanged,TextChangedI * call ale#Queue(g:ale_lint_delay)
elseif l:text_changed is? 'normal'
autocmd TextChanged * call ale#Queue(g:ale_lint_delay)
elseif l:text_changed is? 'insert'
autocmd TextChangedI * call ale#Queue(g:ale_lint_delay)
endif
endif
augroup END
augroup ALERunOnEnterGroup
autocmd!
if g:ale_enabled
" Handle everything that needs to happen when buffers are entered.
autocmd BufEnter * call ale#events#EnterEvent(str2nr(expand('<abuf>')))
endif
if g:ale_enabled && g:ale_lint_on_enter
autocmd BufWinEnter,BufRead * call ale#Queue(0, 'lint_file', str2nr(expand('<abuf>')))
" Track when the file is changed outside of Vim.
autocmd FileChangedShellPost * call ale#events#FileChangedEvent(str2nr(expand('<abuf>')))
endif
augroup END
augroup ALERunOnFiletypeChangeGroup
autocmd!
if g:ale_enabled && g:ale_lint_on_filetype_changed
" Only start linting if the FileType actually changes after
" opening a buffer. The FileType will fire when buffers are opened.
autocmd FileType * call ale#events#FileTypeEvent(
\ str2nr(expand('<abuf>')),
\ expand('<amatch>')
\)
endif
augroup END
augroup ALERunOnSaveGroup
autocmd!
autocmd BufWritePost * call ale#events#SaveEvent(str2nr(expand('<abuf>')))
augroup END
augroup ALERunOnInsertLeave
autocmd!
if g:ale_enabled && g:ale_lint_on_insert_leave
autocmd InsertLeave * call ale#Queue(0)
endif
augroup END
augroup ALECursorGroup
autocmd!
if g:ale_enabled && g:ale_echo_cursor
autocmd CursorMoved,CursorHold * call ale#cursor#EchoCursorWarningWithDelay()
" Look for a warning to echo as soon as we leave Insert mode.
" The script's position variable used when moving the cursor will
" not be changed here.
autocmd InsertLeave * call ale#cursor#EchoCursorWarning()
endif
augroup END
if !g:ale_enabled
augroup! ALERunOnTextChangedGroup
augroup! ALERunOnEnterGroup
augroup! ALERunOnInsertLeave
augroup! ALECursorGroup
endif
endfunction

View File

@@ -2,10 +2,31 @@
" Description: balloonexpr support for ALE. " Description: balloonexpr support for ALE.
function! ale#balloon#MessageForPos(bufnr, lnum, col) abort function! ale#balloon#MessageForPos(bufnr, lnum, col) abort
" Don't show balloons if they are disabled, or linting is disabled.
if !ale#Var(a:bufnr, 'set_balloons')
\|| !g:ale_enabled
\|| !getbufvar(a:bufnr, 'ale_enabled', 1)
return ''
endif
let l:loclist = get(g:ale_buffer_info, a:bufnr, {'loclist': []}).loclist let l:loclist = get(g:ale_buffer_info, a:bufnr, {'loclist': []}).loclist
let l:index = ale#util#BinarySearch(l:loclist, a:bufnr, a:lnum, a:col) let l:index = ale#util#BinarySearch(l:loclist, a:bufnr, a:lnum, a:col)
return l:index >= 0 ? l:loclist[l:index].text : '' " Show the diagnostics message if found, 'Hover' output otherwise
if l:index >= 0
return l:loclist[l:index].text
elseif exists('*balloon_show') || getbufvar(
\ a:bufnr,
\ 'ale_set_balloons_legacy_echo',
\ get(g:, 'ale_set_balloons_legacy_echo', 0)
\)
" Request LSP/tsserver hover information, but only if this version of
" Vim supports the balloon_show function, or if we turned a legacy
" setting on.
call ale#hover#Show(a:bufnr, a:lnum, a:col, {'called_from_balloonexpr': 1})
endif
return ''
endfunction endfunction
function! ale#balloon#Expr() abort function! ale#balloon#Expr() abort
@@ -13,9 +34,22 @@ function! ale#balloon#Expr() abort
endfunction endfunction
function! ale#balloon#Disable() abort function! ale#balloon#Disable() abort
set noballooneval set noballooneval noballoonevalterm
set balloonexpr=
endfunction endfunction
function! ale#balloon#Enable() abort function! ale#balloon#Enable() abort
set ballooneval balloonexpr=ale#balloon#Expr() if !has('balloon_eval') && !has('balloon_eval_term')
return
endif
if has('balloon_eval')
set ballooneval
endif
if has('balloon_eval_term')
set balloonevalterm
endif
set balloonexpr=ale#balloon#Expr()
endfunction endfunction

View File

@@ -1,6 +1,7 @@
" Author: gagbo <gagbobada@gmail.com>, w0rp <devw0rp@gmail.com> " Author: gagbo <gagbobada@gmail.com>, w0rp <devw0rp@gmail.com>, roel0 <postelmansroel@gmail.com>
" Description: Functions for integrating with C-family linters. " Description: Functions for integrating with C-family linters.
call ale#Set('c_parse_makefile', 0)
let s:sep = has('win32') ? '\' : '/' let s:sep = has('win32') ? '\' : '/'
function! ale#c#FindProjectRoot(buffer) abort function! ale#c#FindProjectRoot(buffer) abort
@@ -22,6 +23,88 @@ function! ale#c#FindProjectRoot(buffer) abort
return '' return ''
endfunction endfunction
function! ale#c#ParseCFlagsToList(path_prefix, cflags) abort
let l:cflags_list = []
let l:previous_options = []
for l:option in a:cflags
call add(l:previous_options, l:option)
" Check if cflag contained a '-' and should not have been splitted
let l:option_list = split(l:option, '\zs')
if l:option_list[-1] isnot# ' '
continue
endif
let l:option = join(l:previous_options, '-')
let l:previous_options = []
let l:option = '-' . substitute(l:option, '^\s*\(.\{-}\)\s*$', '\1', '')
" Fix relative paths if needed
if stridx(l:option, '-I') >= 0 &&
\ stridx(l:option, '-I' . s:sep) < 0
let l:rel_path = join(split(l:option, '\zs')[2:], '')
let l:rel_path = substitute(l:rel_path, '"', '', 'g')
let l:rel_path = substitute(l:rel_path, '''', '', 'g')
let l:option = ale#Escape('-I' . a:path_prefix .
\ s:sep . l:rel_path)
endif
" Parse the cflag
if stridx(l:option, '-I') >= 0 ||
\ stridx(l:option, '-D') >= 0
if index(l:cflags_list, l:option) < 0
call add(l:cflags_list, l:option)
endif
endif
endfor
return l:cflags_list
endfunction
function! ale#c#ParseCFlags(buffer, stdout_make) abort
if !g:ale_c_parse_makefile
return []
endif
let l:buffer_filename = expand('#' . a:buffer . ':t')
let l:cflags = []
for l:lines in split(a:stdout_make, '\\n')
if stridx(l:lines, l:buffer_filename) >= 0
let l:cflags = split(l:lines, '-')
break
endif
endfor
let l:makefile_path = ale#path#FindNearestFile(a:buffer, 'Makefile')
return ale#c#ParseCFlagsToList(fnamemodify(l:makefile_path, ':p:h'), l:cflags)
endfunction
function! ale#c#GetCFlags(buffer, output) abort
let l:cflags = ' '
if g:ale_c_parse_makefile && !empty(a:output)
let l:cflags = join(ale#c#ParseCFlags(a:buffer, join(a:output, '\n')), ' ') . ' '
endif
if l:cflags is# ' '
let l:cflags = ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer))
endif
return l:cflags
endfunction
function! ale#c#GetMakeCommand(buffer) abort
if g:ale_c_parse_makefile
let l:makefile_path = ale#path#FindNearestFile(a:buffer, 'Makefile')
if !empty(l:makefile_path)
return 'cd '. fnamemodify(l:makefile_path, ':p:h') . ' && make -n'
endif
endif
return ''
endfunction
" Given a buffer number, search for a project root, and output a List " Given a buffer number, search for a project root, and output a List
" of directories to include based on some heuristics. " of directories to include based on some heuristics.
" "

View File

@@ -1,6 +1,10 @@
" Author: w0rp <devw0rp@gmail.com> " Author: w0rp <devw0rp@gmail.com>
" Description: Completion support for LSP linters " Description: Completion support for LSP linters
let g:ale_completion_delay = get(g:, 'ale_completion_delay', 100)
let g:ale_completion_excluded_words = get(g:, 'ale_completion_excluded_words', [])
let g:ale_completion_max_suggestions = get(g:, 'ale_completion_max_suggestions', 50)
let s:timer_id = -1 let s:timer_id = -1
let s:last_done_pos = [] let s:last_done_pos = []
@@ -28,6 +32,8 @@ let s:LSP_COMPLETION_REFERENCE_KIND = 18
" the insert cursor is. If one of these matches, we'll check for completions. " the insert cursor is. If one of these matches, we'll check for completions.
let s:should_complete_map = { let s:should_complete_map = {
\ '<default>': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$', \ '<default>': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$',
\ 'typescript': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|''$|"$',
\ 'rust': '\v[a-zA-Z$_][a-zA-Z$_0-9]*$|\.$|::$',
\} \}
" Regular expressions for finding the start column to replace with completion. " Regular expressions for finding the start column to replace with completion.
@@ -38,6 +44,8 @@ let s:omni_start_map = {
" A map of exact characters for triggering LSP completions. " A map of exact characters for triggering LSP completions.
let s:trigger_character_map = { let s:trigger_character_map = {
\ '<default>': ['.'], \ '<default>': ['.'],
\ 'typescript': ['.', '''', '"'],
\ 'rust': ['.', '::'],
\} \}
function! s:GetFiletypeValue(map, filetype) abort function! s:GetFiletypeValue(map, filetype) abort
@@ -74,33 +82,49 @@ function! ale#completion#GetTriggerCharacter(filetype, prefix) abort
return '' return ''
endfunction endfunction
function! ale#completion#Filter(suggestions, prefix) abort function! ale#completion#Filter(buffer, suggestions, prefix) abort
let l:excluded_words = ale#Var(a:buffer, 'completion_excluded_words')
" For completing... " For completing...
" foo. " foo.
" ^ " ^
" We need to include all of the given suggestions. " We need to include all of the given suggestions.
if a:prefix is# '.' if a:prefix is# '.'
return a:suggestions let l:filtered_suggestions = a:suggestions
else
let l:filtered_suggestions = []
" Filter suggestions down to those starting with the prefix we used for
" finding suggestions in the first place.
"
" Some completion tools will include suggestions which don't even start
" with the characters we have already typed.
for l:item in a:suggestions
" A List of String values or a List of completion item Dictionaries
" is accepted here.
let l:word = type(l:item) == type('') ? l:item : l:item.word
" Add suggestions if the suggestion starts with a case-insensitive
" match for the prefix.
if l:word[: len(a:prefix) - 1] is? a:prefix
call add(l:filtered_suggestions, l:item)
endif
endfor
endif endif
let l:filtered_suggestions = [] if !empty(l:excluded_words)
" Copy the List if needed. We don't want to modify the argument.
" Filter suggestions down to those starting with the prefix we used for " We shouldn't make a copy if we don't need to.
" finding suggestions in the first place. if l:filtered_suggestions is a:suggestions
" let l:filtered_suggestions = copy(a:suggestions)
" Some completion tools will include suggestions which don't even start
" with the characters we have already typed.
for l:item in a:suggestions
" A List of String values or a List of completion item Dictionaries
" is accepted here.
let l:word = type(l:item) == type('') ? l:item : l:item.word
" Add suggestions if the suggestion starts with a case-insensitive
" match for the prefix.
if l:word[: len(a:prefix) - 1] is? a:prefix
call add(l:filtered_suggestions, l:item)
endif endif
endfor
" Remove suggestions with words in the exclusion List.
call filter(
\ l:filtered_suggestions,
\ 'index(l:excluded_words, type(v:val) is type('''') ? v:val : v:val.word) < 0',
\)
endif
return l:filtered_suggestions return l:filtered_suggestions
endfunction endfunction
@@ -178,7 +202,9 @@ function! ale#completion#ParseTSServerCompletions(response) abort
endfunction endfunction
function! ale#completion#ParseTSServerCompletionEntryDetails(response) abort function! ale#completion#ParseTSServerCompletionEntryDetails(response) abort
let l:buffer = bufnr('')
let l:results = [] let l:results = []
let l:names_with_details = []
for l:suggestion in a:response.body for l:suggestion in a:response.body
let l:displayParts = [] let l:displayParts = []
@@ -212,10 +238,44 @@ function! ale#completion#ParseTSServerCompletionEntryDetails(response) abort
\}) \})
endfor endfor
let l:names = getbufvar(l:buffer, 'ale_tsserver_completion_names', [])
if !empty(l:names) && len(l:names) != len(l:results)
let l:names_with_details = map(copy(l:results), 'v:val.word')
let l:missing_names = filter(
\ copy(l:names),
\ 'index(l:names_with_details, v:val) < 0',
\)
for l:name in l:missing_names
call add(l:results, {
\ 'word': l:name,
\ 'kind': 'v',
\ 'icase': 1,
\ 'menu': '',
\ 'info': '',
\})
endfor
endif
return l:results return l:results
endfunction endfunction
function! ale#completion#NullFilter(buffer, item) abort
return 1
endfunction
function! ale#completion#ParseLSPCompletions(response) abort function! ale#completion#ParseLSPCompletions(response) abort
let l:buffer = bufnr('')
let l:info = get(b:, 'ale_completion_info', {})
let l:Filter = get(l:info, 'completion_filter', v:null)
if l:Filter is v:null
let l:Filter = function('ale#completion#NullFilter')
else
let l:Filter = ale#util#GetFunction(l:Filter)
endif
let l:item_list = [] let l:item_list = []
if type(get(a:response, 'result')) is type([]) if type(get(a:response, 'result')) is type([])
@@ -228,6 +288,16 @@ function! ale#completion#ParseLSPCompletions(response) abort
let l:results = [] let l:results = []
for l:item in l:item_list for l:item in l:item_list
if !call(l:Filter, [l:buffer, l:item])
continue
endif
let l:word = matchstr(l:item.label, '\v^[^(]+')
if empty(l:word)
continue
endif
" See :help complete-items for Vim completion kinds " See :help complete-items for Vim completion kinds
if l:item.kind is s:LSP_COMPLETION_METHOD_KIND if l:item.kind is s:LSP_COMPLETION_METHOD_KIND
let l:kind = 'm' let l:kind = 'm'
@@ -244,14 +314,18 @@ function! ale#completion#ParseLSPCompletions(response) abort
endif endif
call add(l:results, { call add(l:results, {
\ 'word': l:item.label, \ 'word': l:word,
\ 'kind': l:kind, \ 'kind': l:kind,
\ 'icase': 1, \ 'icase': 1,
\ 'menu': l:item.detail, \ 'menu': l:item.detail,
\ 'info': l:item.documentation, \ 'info': get(l:item, 'documentation', ''),
\}) \})
endfor endfor
if has_key(l:info, 'prefix')
return ale#completion#Filter(l:buffer, l:results, l:info.prefix)
endif
return l:results return l:results
endfunction endfunction
@@ -264,19 +338,25 @@ function! ale#completion#HandleTSServerResponse(conn_id, response) abort
return return
endif endif
let l:buffer = bufnr('')
let l:command = get(a:response, 'command', '') let l:command = get(a:response, 'command', '')
if l:command is# 'completions' if l:command is# 'completions'
let l:names = ale#completion#Filter( let l:names = ale#completion#Filter(
\ l:buffer,
\ ale#completion#ParseTSServerCompletions(a:response), \ ale#completion#ParseTSServerCompletions(a:response),
\ b:ale_completion_info.prefix, \ b:ale_completion_info.prefix,
\)[: g:ale_completion_max_suggestions - 1] \)[: g:ale_completion_max_suggestions - 1]
" We need to remember some names for tsserver, as it doesn't send
" details back for everything we send.
call setbufvar(l:buffer, 'ale_tsserver_completion_names', l:names)
if !empty(l:names) if !empty(l:names)
let b:ale_completion_info.request_id = ale#lsp#Send( let b:ale_completion_info.request_id = ale#lsp#Send(
\ b:ale_completion_info.conn_id, \ b:ale_completion_info.conn_id,
\ ale#lsp#tsserver_message#CompletionEntryDetails( \ ale#lsp#tsserver_message#CompletionEntryDetails(
\ bufnr(''), \ l:buffer,
\ b:ale_completion_info.line, \ b:ale_completion_info.line,
\ b:ale_completion_info.column, \ b:ale_completion_info.column,
\ l:names, \ l:names,
@@ -349,6 +429,10 @@ function! s:GetLSPCompletions(linter) abort
if l:request_id if l:request_id
let b:ale_completion_info.conn_id = l:id let b:ale_completion_info.conn_id = l:id
let b:ale_completion_info.request_id = l:request_id let b:ale_completion_info.request_id = l:request_id
if has_key(a:linter, 'completion_filter')
let b:ale_completion_info.completion_filter = a:linter.completion_filter
endif
endif endif
endfunction endfunction
@@ -378,10 +462,7 @@ function! ale#completion#GetCompletions() abort
for l:linter in ale#linter#Get(&filetype) for l:linter in ale#linter#Get(&filetype)
if !empty(l:linter.lsp) if !empty(l:linter.lsp)
if l:linter.lsp is# 'tsserver' call s:GetLSPCompletions(l:linter)
\|| get(g:, 'ale_completion_experimental_lsp_support', 0)
call s:GetLSPCompletions(l:linter)
endif
endif endif
endfor endfor
endfunction endfunction

View File

@@ -0,0 +1,3 @@
function! ale#completion#python#CompletionItemFilter(buffer, item) abort
return a:item.label !~# '\v^__[a-z_]+__'
endfunction

View File

@@ -1,6 +1,11 @@
" Author: w0rp <devw0rp@gmail.com> " Author: w0rp <devw0rp@gmail.com>
" Description: Echoes lint message for the current line, if any " Description: Echoes lint message for the current line, if any
" Controls the milliseconds delay before echoing a message.
let g:ale_echo_delay = get(g:, 'ale_echo_delay', 10)
" A string format for the echoed message.
let g:ale_echo_msg_format = get(g:, 'ale_echo_msg_format', '%code: %%s')
let s:cursor_timer = -1 let s:cursor_timer = -1
let s:last_pos = [0, 0, 0] let s:last_pos = [0, 0, 0]

Some files were not shown because too many files have changed in this diff Show More