Compare commits
13 commits
Author | SHA1 | Date | |
---|---|---|---|
|
cedc3e1a1f | ||
|
30aef6b19a | ||
|
bd0f31147e | ||
|
74f2afbe2e | ||
|
d438f8f268 | ||
|
2f2af4315b | ||
|
a040878ebc | ||
|
a72c1edfcc | ||
|
acda19776a | ||
|
e9a1cd600a | ||
|
0819c4cd56 | ||
|
448600fe4f | ||
|
bb1f413bf3 |
790 changed files with 4598 additions and 28259 deletions
|
@ -1,40 +0,0 @@
|
|||
---
|
||||
# Disabling building for AppVeyor. We are just testing things.
|
||||
build: false
|
||||
clone_depth: 10
|
||||
# Use the directory C:\testplugin so test directories will mostly work.
|
||||
clone_folder: C:\testplugin
|
||||
|
||||
# Cache the vim and vader directories between builds.
|
||||
cache:
|
||||
- C:\vim -> .appveyor.yml
|
||||
- C:\vader -> .appveyor.yml
|
||||
|
||||
init:
|
||||
# Stop git from changing newlines
|
||||
- git config --global core.autocrlf input
|
||||
|
||||
install:
|
||||
# Download and unpack Vim
|
||||
- ps: >-
|
||||
if (!(Test-Path -Path C:\vim)){
|
||||
Add-Type -A System.IO.Compression.FileSystem
|
||||
Invoke-WebRequest ftp://ftp.vim.org/pub/vim/pc/vim80-586w32.zip `
|
||||
-OutFile C:\vim.zip
|
||||
[IO.Compression.ZipFile]::ExtractToDirectory('C:\vim.zip', 'C:\vim')
|
||||
Invoke-WebRequest ftp://ftp.vim.org/pub/vim/pc/vim80-586rt.zip `
|
||||
-OutFile C:\rt.zip
|
||||
[IO.Compression.ZipFile]::ExtractToDirectory('C:\rt.zip', 'C:\vim')
|
||||
}
|
||||
# Clone Vader and check out the commit we want
|
||||
- ps: >-
|
||||
if (!(Test-Path -Path C:\vader)){
|
||||
git clone https://github.com/junegunn/vader.vim C:\vader 2> $null
|
||||
cd C:\vader
|
||||
git checkout -qf c6243dd81c98350df4dec608fa972df98fa2a3af 2> $null
|
||||
}
|
||||
|
||||
test_script:
|
||||
- cd C:\testplugin
|
||||
- 'C:\vim\vim\vim80\vim.exe -u test\vimrc "+Vader!
|
||||
test/*.vader test/*/*.vader test/*/*/*.vader test/*/*/*.vader"'
|
|
@ -1,14 +0,0 @@
|
|||
# EditorConfig is awesome: http://EditorConfig.org
|
||||
|
||||
# Top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Match and apply these rules for all file
|
||||
# types you open in your code editor
|
||||
[*]
|
||||
# Unix-style newlines
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
2
.gitattributes
vendored
2
.gitattributes
vendored
|
@ -6,7 +6,7 @@
|
|||
/Makefile export-ignore
|
||||
/PULL_REQUEST_TEMPLATE.md export-ignore
|
||||
/README.md export-ignore
|
||||
/custom-checks export-ignore
|
||||
/img export-ignore
|
||||
/run-tests export-ignore
|
||||
/run-tests.bat export-ignore
|
||||
/test export-ignore
|
||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,6 +1,5 @@
|
|||
/init.vim
|
||||
/doc/tags
|
||||
.*
|
||||
!.editorconfig
|
||||
*.obj
|
||||
tags
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
sudo: required
|
||||
services:
|
||||
- docker
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
language: python
|
||||
script: |
|
||||
./run-tests
|
||||
|
|
|
@ -74,10 +74,10 @@ If you want to credit multiple authors, you can comma separate them.
|
|||
### 3.i. Adding a New Linter
|
||||
|
||||
If you add a new linter, look for existing handlers first in the
|
||||
[handlers](autoload/ale/handlers) directory. One of the handlers there may
|
||||
[handlers.vim](autoload/ale/handlers.vim) file. One of the handlers there may
|
||||
already be able to handle your lines of output. If you find that your new
|
||||
linter replicates an existing error handler, consider pulling it up into the
|
||||
[handlers](autoload/ale/handlers) directory, and use the generic handler in
|
||||
[handlers.vim](autoload/ale/handlers.vim) file, and use the generic handler in
|
||||
both places.
|
||||
|
||||
When you add a linter, make sure the language for the linter and the linter
|
||||
|
@ -129,7 +129,7 @@ giving some unfair preference to any particular tool or language.
|
|||
|
||||
The "online documentation" file used for this project lives in `doc/ale.txt`.
|
||||
This is the file used for generating `:help` text inside Vim itself. There are
|
||||
some guidelines to follow for this file.
|
||||
some guidlines to follow for this file.
|
||||
|
||||
1. Keep all text within a column size of 79 characters, inclusive.
|
||||
2. Open a section with 79 `=` or `-` characters, for headings and subheadings.
|
||||
|
@ -160,7 +160,7 @@ to look up the default value easily by typing `:echo g:ale_...`.
|
|||
Should the principal author of the ALE project and all collaborators with the
|
||||
required access needed to properly administrate the project on GitHub or any
|
||||
other website either perish or disappear, whether by tragic traffic accident
|
||||
or government abduction, etc., action should be taken to ensure that the
|
||||
or government adduction, etc., action should be taken to ensure that the
|
||||
project continues. If no one is left to administer the project where it is
|
||||
hosted, please fork the project and nominate someone capable to administer it.
|
||||
Preferably, in such an event, a single fork of the project will replace the
|
||||
|
|
|
@ -1,28 +1,12 @@
|
|||
<!--
|
||||
This is a template for bug reports. If you want to request a new feature,
|
||||
you can clear this entire form field and write a short description of what
|
||||
you want.
|
||||
READ THIS FIRST: If you are experiencing any bug whatsoever dealing with
|
||||
the output of linters, please use `let g:ale_history_log_output = 1` before
|
||||
pasting output. It will capture the output of commands that are run.
|
||||
|
||||
For bugs, paste output from your clipboard after running :ALEInfoToClipboard
|
||||
here. If that doesn't work for some reason, try running :ALEInfo and copying
|
||||
the output from that here instead. If everything is broken, run around in
|
||||
circles and scream.
|
||||
|
||||
Whatever the case, describe the your issue here.
|
||||
-->
|
||||
|
||||
## Information
|
||||
|
||||
**VIM version**
|
||||
|
||||
PASTE JUST THE FIRST TWO LINES OF `:version` HERE.
|
||||
|
||||
Operating System: WHAT OS WERE YOU USING?
|
||||
|
||||
### :ALEInfo
|
||||
|
||||
PASTE OUTPUT OF `:ALEInfo` HERE. YOU CAN TRY `:ALEInfoToClipboard`.
|
||||
|
||||
## What went wrong
|
||||
|
||||
WRITE WHAT WENT WRONG HERE.
|
||||
|
||||
## Reproducing the bug
|
||||
|
||||
Steps for repeating the bug:
|
||||
|
||||
1. Write a list of steps.
|
||||
2. Otherwise nobody will fix the bug.
|
||||
|
|
2
LICENSE
2
LICENSE
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2016-2018, w0rp <devw0rp@gmail.com>
|
||||
Copyright (c) 2016, w0rp <devw0rp@gmail.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
<!--
|
||||
READ THIS: Before creating a pull request, please consider the following first.
|
||||
When creating new pull requests, please consider the following.
|
||||
|
||||
* The most important thing you can do is write tests. Code without tests
|
||||
probably doesn't work, and will almost certainly stop working later on. Pull
|
||||
requests without tests probably won't be accepted, although there are some
|
||||
exceptions.
|
||||
* Read the Contributing guide linked above first.
|
||||
* If you are adding a new linter, remember to update the README.md file and
|
||||
doc/ale.txt first.
|
||||
|
|
426
README.md
426
README.md
|
@ -1,5 +1,4 @@
|
|||
# Asynchronous Lint Engine [](https://travis-ci.org/w0rp/ale) [](https://ci.appveyor.com/project/w0rp/ale)
|
||||
|
||||
# Asynchronous Lint Engine [](https://travis-ci.org/w0rp/ale)
|
||||
|
||||

|
||||
|
||||
|
@ -16,38 +15,30 @@ back to a filesystem.
|
|||
|
||||
In other words, this plugin allows you to lint while you type.
|
||||
|
||||
In addition to linting support, ALE offers some support for fixing code with
|
||||
formatting tools, and some Language Server Protocol and `tsserver` features.
|
||||
ALE also supports fixing problems with files by running commands in the
|
||||
background with a command `ALEFix`.
|
||||
|
||||
## Table of Contents
|
||||
|
||||
1. [Supported Languages and Tools](#supported-languages)
|
||||
2. [Usage](#usage)
|
||||
1. [Linting](#usage-linting)
|
||||
2. [Fixing](#usage-fixing)
|
||||
3. [Completion](#usage-completion)
|
||||
4. [Go To Definition](#usage-go-to-definition)
|
||||
3. [Installation](#installation)
|
||||
1. [Installation with Vim package management](#standard-installation)
|
||||
2. [Installation with Pathogen](#installation-with-pathogen)
|
||||
3. [Installation with Vundle](#installation-with-vundle)
|
||||
1. [Installation with Pathogen](#installation-with-pathogen)
|
||||
2. [Installation with Vundle](#installation-with-vundle)
|
||||
3. [Manual Installation](#manual-installation)
|
||||
4. [Contributing](#contributing)
|
||||
5. [FAQ](#faq)
|
||||
1. [How do I disable particular linters?](#faq-disable-linters)
|
||||
2. [How can I keep the sign gutter open?](#faq-keep-signs)
|
||||
3. [How can I change the signs ALE uses?](#faq-change-signs)
|
||||
4. [How can I change or disable the highlights ALE uses?](#faq-change-highlights)
|
||||
5. [How can I show errors or warnings in my statusline?](#faq-statusline)
|
||||
6. [How can I show errors or warnings in my lightline?](#faq-lightline)
|
||||
7. [How can I change the format for echo messages?](#faq-echo-format)
|
||||
8. [How can I execute some code when ALE starts or stops linting?](#faq-autocmd)
|
||||
9. [How can I navigate between errors quickly?](#faq-navigation)
|
||||
10. [How can I run linters only when I save files?](#faq-lint-on-save)
|
||||
11. [How can I use the quickfix list instead of the loclist?](#faq-quickfix)
|
||||
12. [How can I check JSX files with both stylelint and eslint?](#faq-jsx-stylelint-eslint)
|
||||
13. [Will this plugin eat all of my laptop battery power?](#faq-my-battery-is-sad)
|
||||
14. [How can I configure my C or C++ project?](#faq-c-configuration)
|
||||
15. [How can I configure ALE differently for different buffers?](#faq-buffer-configuration)
|
||||
4. [How can I show errors or warnings in my statusline?](#faq-statusline)
|
||||
5. [How can I change the format for echo messages?](#faq-echo-format)
|
||||
6. [How can I execute some code when ALE stops linting?](#faq-autocmd)
|
||||
7. [How can I navigate between errors quickly?](#faq-navigation)
|
||||
8. [How can I run linters only when I save files?](#faq-lint-on-save)
|
||||
9. [How can I use the quickfix list instead of the loclist?](#faq-quickfix)
|
||||
10. [How can I check JSX files with both stylelint and eslint?](#faq-jsx-stylelint-eslint)
|
||||
11. [Will this plugin eat all of my laptop battery power?](#faq-my-battery-is-sad)
|
||||
|
||||
<a name="supported-languages"></a>
|
||||
|
||||
|
@ -60,122 +51,86 @@ tools will be run in combination, so they can be complementary.
|
|||
Keep the table rows sorted alphabetically by the language name,
|
||||
and the tools in the tools column sorted alphabetically by the tool
|
||||
name. That seems to be the fairest way to arrange this table.
|
||||
|
||||
Remember to also update doc/ale.txt, which has a similar list with different
|
||||
formatting.
|
||||
-->
|
||||
|
||||
**Notes:**
|
||||
|
||||
* *^ No linters for text or Vim help filetypes are enabled by default.*
|
||||
* *!! These linters check only files on disk. See `:help ale-lint-file-linters`*
|
||||
|
||||
| Language | Tools |
|
||||
| -------- | ----- |
|
||||
| ASM | [gcc](https://gcc.gnu.org) |
|
||||
| Ansible | [ansible-lint](https://github.com/willthames/ansible-lint) |
|
||||
| API Blueprint | [drafter](https://github.com/apiaryio/drafter) |
|
||||
| AsciiDoc | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [write-good](https://github.com/btford/write-good) |
|
||||
| AsciiDoc | [proselint](http://proselint.com/)|
|
||||
| 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) |
|
||||
| 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), [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) !!, [flawfinder](https://www.dwheeler.com/flawfinder/), [gcc](https://gcc.gnu.org/) |
|
||||
| CUDA | [nvcc](http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html) |
|
||||
| C# | [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) see:`help ale-cs-mcs` for details, [mcsc](http://www.mono-project.com/docs/about-mono/languages/csharp/) !! see:`help ale-cs-mcsc` for details and configuration|
|
||||
| Bash | [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set), [shellcheck](https://www.shellcheck.net/) |
|
||||
| Bourne Shell | [-n flag](http://linux.die.net/man/1/sh), [shellcheck](https://www.shellcheck.net/) |
|
||||
| C | [cppcheck](http://cppcheck.sourceforge.net), [gcc](https://gcc.gnu.org/), [clang](http://clang.llvm.org/)|
|
||||
| C++ (filetype cpp) | [clang](http://clang.llvm.org/), [clangcheck](http://clang.llvm.org/docs/ClangCheck.html), [clangtidy](http://clang.llvm.org/extra/clang-tidy/), [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint), [gcc](https://gcc.gnu.org/)|
|
||||
| C# | [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) |
|
||||
| Chef | [foodcritic](http://www.foodcritic.io/) |
|
||||
| Clojure | [joker](https://github.com/candid82/joker) |
|
||||
| CMake | [cmakelint](https://github.com/richq/cmake-lint) |
|
||||
| CoffeeScript | [coffee](http://coffeescript.org/), [coffeelint](https://www.npmjs.com/package/coffeelint) |
|
||||
| Crystal | [crystal](https://crystal-lang.org/) !! |
|
||||
| CSS | [csslint](http://csslint.net/), [prettier](https://github.com/prettier/prettier), [stylelint](https://github.com/stylelint/stylelint) |
|
||||
| Crystal | [crystal](https://crystal-lang.org/) |
|
||||
| CSS | [csslint](http://csslint.net/), [stylelint](https://github.com/stylelint/stylelint) |
|
||||
| Cython (pyrex filetype) | [cython](http://cython.org/) |
|
||||
| D | [dmd](https://dlang.org/dmd-linux.html) |
|
||||
| Dafny | [dafny](https://rise4fun.com/Dafny) !! |
|
||||
| Dart | [dartanalyzer](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) !!, [language_server](https://github.com/natebosch/dart_language_server) |
|
||||
| Dockerfile | [hadolint](https://github.com/hadolint/hadolint) |
|
||||
| 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) |
|
||||
| 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) |
|
||||
| Fish | fish [-n flag](https://linux.die.net/man/1/fish)
|
||||
| Dockerfile | [hadolint](https://github.com/lukasmartinelli/hadolint) |
|
||||
| Elixir | [credo](https://github.com/rrrene/credo), [dogma](https://github.com/lpil/dogma) |
|
||||
| Elm | [elm-make](https://github.com/elm-lang/elm-make) |
|
||||
| Erb | [erb](https://github.com/jeremyevans/erubi) |
|
||||
| Erlang | [erlc](http://erlang.org/doc/man/erlc.html) |
|
||||
| Fortran | [gcc](https://gcc.gnu.org/) |
|
||||
| Fountain | [proselint](http://proselint.com/) |
|
||||
| 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) |
|
||||
| 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), [prettier](https://github.com/prettier/prettier) |
|
||||
| Haml | [haml-lint](https://github.com/brigade/haml-lint) |
|
||||
| Go | [gofmt -e](https://golang.org/cmd/gofmt/), [go vet](https://golang.org/cmd/vet/), [golint](https://godoc.org/github.com/golang/lint), [gometalinter](https://github.com/alecthomas/gometalinter), [go build](https://golang.org/cmd/go/), [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple), [staticcheck](https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck) |
|
||||
| Haml | [haml-lint](https://github.com/brigade/haml-lint)
|
||||
| Handlebars | [ember-template-lint](https://github.com/rwjblue/ember-template-lint) |
|
||||
| Haskell | [brittany](https://github.com/lspitzner/brittany), [ghc](https://www.haskell.org/ghc/), [stack-ghc](https://haskellstack.org/), [stack-build](https://haskellstack.org/) !!, [ghc-mod](https://github.com/DanielG/ghc-mod), [stack-ghc-mod](https://github.com/DanielG/ghc-mod), [hlint](https://hackage.haskell.org/package/hlint), [hdevtools](https://hackage.haskell.org/package/hdevtools), [hfmt](https://github.com/danstiner/hfmt) |
|
||||
| HTML | [alex](https://github.com/wooorm/alex) !!, [HTMLHint](http://htmlhint.com/), [proselint](http://proselint.com/), [tidy](http://www.html-tidy.org/), [write-good](https://github.com/btford/write-good) |
|
||||
| Idris | [idris](http://www.idris-lang.org/) |
|
||||
| Java | [checkstyle](http://checkstyle.sourceforge.net), [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html), [google-java-format](https://github.com/google/google-java-format) |
|
||||
| JavaScript | [eslint](http://eslint.org/), [flow](https://flowtype.org/), [jscs](http://jscs.info/), [jshint](http://jshint.com/), [prettier](https://github.com/prettier/prettier), [prettier-eslint](https://github.com/prettier/prettier-eslint), [prettier-standard](https://github.com/sheerun/prettier-standard), [standard](http://standardjs.com/), [xo](https://github.com/sindresorhus/xo)
|
||||
| JSON | [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 |
|
||||
| LaTeX | [alex](https://github.com/wooorm/alex) !!, [chktex](http://www.nongnu.org/chktex/), [lacheck](https://www.ctan.org/pkg/lacheck), [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
|
||||
| Less | [lessc](https://www.npmjs.com/package/less), [prettier](https://github.com/prettier/prettier), [stylelint](https://github.com/stylelint/stylelint) |
|
||||
| LLVM | [llc](https://llvm.org/docs/CommandGuide/llc.html) |
|
||||
| Lua | [luac](https://www.lua.org/manual/5.1/luac.html), [luacheck](https://github.com/mpeterv/luacheck) |
|
||||
| Mail | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale) |
|
||||
| Make | [checkmake](https://github.com/mrtazz/checkmake) |
|
||||
| Markdown | [alex](https://github.com/wooorm/alex) !!, [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) !!, [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
|
||||
| Haskell | [ghc](https://www.haskell.org/ghc/), [ghc-mod](https://github.com/DanielG/ghc-mod), [hlint](https://hackage.haskell.org/package/hlint), [hdevtools](https://hackage.haskell.org/package/hdevtools) |
|
||||
| HTML | [HTMLHint](http://htmlhint.com/), [proselint](http://proselint.com/), [tidy](http://www.html-tidy.org/) |
|
||||
| Java | [checkstyle](http://checkstyle.sourceforge.net), [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html) |
|
||||
| JavaScript | [eslint](http://eslint.org/), [jscs](http://jscs.info/), [jshint](http://jshint.com/), [flow](https://flowtype.org/), [standard](http://standardjs.com/), [prettier](https://github.com/prettier/prettier) (and `prettier-eslint`), [xo](https://github.com/sindresorhus/xo)
|
||||
| JSON | [jsonlint](http://zaa.ch/jsonlint/) |
|
||||
| Kotlin | [kotlinc](https://kotlinlang.org), [ktlint](https://ktlint.github.io) see `:help ale-integration-kotlin` for configuration instructions
|
||||
| LaTeX | [chktex](http://www.nongnu.org/chktex/), [lacheck](https://www.ctan.org/pkg/lacheck), [proselint](http://proselint.com/) |
|
||||
| Lua | [luacheck](https://github.com/mpeterv/luacheck) |
|
||||
| Markdown | [mdl](https://github.com/mivok/markdownlint), [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale) |
|
||||
| MATLAB | [mlint](https://www.mathworks.com/help/matlab/ref/mlint.html) |
|
||||
| Nim | [nim check](https://nim-lang.org/docs/nimc.html) !! |
|
||||
| Nim | [nim](https://nim-lang.org/docs/nimc.html) |
|
||||
| nix | [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate) |
|
||||
| nroff | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good)|
|
||||
| nroff | [proselint](http://proselint.com/)|
|
||||
| Objective-C | [clang](http://clang.llvm.org/) |
|
||||
| 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-integration-ocaml-merlin` for configuration instructions
|
||||
| Perl | [perl -c](https://perl.org/), [perl-critic](https://metacpan.org/pod/Perl::Critic) |
|
||||
| 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) |
|
||||
| Pony | [ponyc](https://github.com/ponylang/ponyc) |
|
||||
| proto | [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint) |
|
||||
| PHP | [hack](http://hacklang.org/), [php -l](https://secure.php.net/), [phpcs](https://github.com/squizlabs/PHP_CodeSniffer), [phpmd](https://phpmd.org) |
|
||||
| Pod | [proselint](http://proselint.com/)|
|
||||
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) |
|
||||
| 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) |
|
||||
| R | [lintr](https://github.com/jimhester/lintr) |
|
||||
| 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) |
|
||||
| Re:VIEW | [redpen](http://redpen.cc/) |
|
||||
| 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/), [pylint](https://www.pylint.org/), [yapf](https://github.com/google/yapf) |
|
||||
| ReasonML | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-integration-reason-merlin` for configuration instructions
|
||||
| reStructuredText | [proselint](http://proselint.com/)|
|
||||
| RPM spec | [rpmlint](https://github.com/rpm-software-management/rpmlint) (disabled by default; see `:help ale-integration-spec`) |
|
||||
| Ruby | [brakeman](http://brakemanscanner.org/) !!, [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) !!, [reek](https://github.com/troessner/reek), [rubocop](https://github.com/bbatsov/rubocop), [ruby](https://www.ruby-lang.org) |
|
||||
| Rust | cargo !! (see `:help ale-integration-rust` for configuration instructions), [rls](https://github.com/rust-lang-nursery/rls), [rustc](https://www.rust-lang.org/), [rustfmt](https://github.com/rust-lang-nursery/rustfmt) |
|
||||
| Ruby | [brakeman](http://brakemanscanner.org/), [reek](https://github.com/troessner/reek), [rubocop](https://github.com/bbatsov/rubocop), [ruby](https://www.ruby-lang.org) |
|
||||
| Rust | [rustc](https://www.rust-lang.org/), cargo (see `:help ale-integration-rust` for configuration instructions) |
|
||||
| SASS | [sass-lint](https://www.npmjs.com/package/sass-lint), [stylelint](https://github.com/stylelint/stylelint) |
|
||||
| SCSS | [prettier](https://github.com/prettier/prettier), [sass-lint](https://www.npmjs.com/package/sass-lint), [scss-lint](https://github.com/brigade/scss-lint), [stylelint](https://github.com/stylelint/stylelint) |
|
||||
| Scala | [scalac](http://scala-lang.org), [scalastyle](http://www.scalastyle.org) |
|
||||
| Slim | [slim-lint](https://github.com/sds/slim-lint) |
|
||||
| SCSS | [sass-lint](https://www.npmjs.com/package/sass-lint), [scss-lint](https://github.com/brigade/scss-lint), [stylelint](https://github.com/stylelint/stylelint) |
|
||||
| Scala | [scalac](http://scala-lang.org) |
|
||||
| Slim | [slim-lint](https://github.com/sds/slim-lint)
|
||||
| SML | [smlnj](http://www.smlnj.org/) |
|
||||
| Solidity | [solhint](https://github.com/protofire/solhint), [solium](https://github.com/duaraghav8/Solium) |
|
||||
| Stylus | [stylelint](https://github.com/stylelint/stylelint) |
|
||||
| SQL | [sqlint](https://github.com/purcell/sqlint) |
|
||||
| Swift | [swiftlint](https://github.com/realm/SwiftLint), [swiftformat](https://github.com/nicklockwood/SwiftFormat) |
|
||||
| Tcl | [nagelfar](http://nagelfar.sourceforge.net) !! |
|
||||
| Terraform | [tflint](https://github.com/wata727/tflint) |
|
||||
| Texinfo | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good)|
|
||||
| Text^ | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good), [redpen](http://redpen.cc/) |
|
||||
| Thrift | [thrift](http://thrift.apache.org/) |
|
||||
| TypeScript | [eslint](http://eslint.org/), [prettier](https://github.com/prettier/prettier), [tslint](https://github.com/palantir/tslint), tsserver, typecheck |
|
||||
| Swift | [swiftlint](https://swift.org/) |
|
||||
| Texinfo | [proselint](http://proselint.com/)|
|
||||
| Text^ | [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale) |
|
||||
| TypeScript | [eslint](http://eslint.org/), [tslint](https://github.com/palantir/tslint), tsserver, typecheck |
|
||||
| Verilog | [iverilog](https://github.com/steveicarus/iverilog), [verilator](http://www.veripool.org/projects/verilator/wiki/Intro) |
|
||||
| Vim | [vint](https://github.com/Kuniwak/vint) |
|
||||
| Vim help^ | [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) |
|
||||
| XML | [xmllint](http://xmlsoft.org/xmllint.html) |
|
||||
| YAML | [swaglint](https://github.com/byCedric/swaglint), [yamllint](https://yamllint.readthedocs.io/) |
|
||||
| Vim help^ | [proselint](http://proselint.com/)|
|
||||
| XHTML | [proselint](http://proselint.com/)|
|
||||
| XML | [xmllint](http://xmlsoft.org/xmllint.html/)|
|
||||
| YAML | [yamllint](https://yamllint.readthedocs.io/) |
|
||||
|
||||
* *^ No linters for text or Vim help filetypes are enabled by default.*
|
||||
|
||||
<a name="usage"></a>
|
||||
|
||||
## 2. Usage
|
||||
|
||||
<a name="usage-linting"></a>
|
||||
|
||||
### 2.i Linting
|
||||
|
||||
Once this plugin is installed, while editing your files in supported
|
||||
languages and tools which have been correctly installed,
|
||||
this plugin will send the contents of your text buffers to a variety of
|
||||
|
@ -188,55 +143,8 @@ documented in [the Vim help file](doc/ale.txt). For more information on the
|
|||
options ALE offers, consult `:help ale-options` for global options and `:help
|
||||
ale-linter-options` for options specified to particular linters.
|
||||
|
||||
<a name="usage-fixing"></a>
|
||||
|
||||
### 2.ii Fixing
|
||||
|
||||
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
|
||||
following code can be used to fix JavaScript code with ESLint:
|
||||
|
||||
```vim
|
||||
" Put this in vimrc or a plugin file of your own.
|
||||
" After this is configured, :ALEFix will try and fix your JS code with ESLint.
|
||||
let g:ale_fixers = {
|
||||
\ 'javascript': ['eslint'],
|
||||
\}
|
||||
|
||||
" Set this setting in vimrc if you want to fix files automatically on save.
|
||||
" This is off by default.
|
||||
let g:ale_fix_on_save = 1
|
||||
```
|
||||
|
||||
The `:ALEFixSuggest` command will suggest some supported tools for fixing code,
|
||||
but fixers can be also implemented with functions, including lambda functions
|
||||
too. See `:help ale-fix` for detailed information.
|
||||
|
||||
<a name="usage-completion"></a>
|
||||
|
||||
### 2.iii Completion
|
||||
|
||||
ALE offers some support for completion via hijacking of omnicompletion while you
|
||||
type. All of ALE's completion information must come from Language Server
|
||||
Protocol linters, or similar protocols. At the moment, completion is only
|
||||
supported for TypeScript code with `tsserver`, when `tsserver` is enabled. You
|
||||
can enable completion like so:
|
||||
|
||||
```vim
|
||||
" Enable completion where available.
|
||||
let g:ale_completion_enabled = 1
|
||||
```
|
||||
|
||||
See `:help ale-completion` for more information.
|
||||
|
||||
<a name="usage-go-to-definition"></a>
|
||||
|
||||
### 2.iv Go To Definition
|
||||
|
||||
ALE supports jumping to the definition of words under your cursor with the
|
||||
`:ALEGoToDefinition` command using any enabled LSP linters and `tsserver`.
|
||||
|
||||
See `:help ale-go-to-definition` for more information.
|
||||
for different filetypes with the `g:ale_fixers` variable. See `:help ale-fix`.
|
||||
|
||||
<a name="installation"></a>
|
||||
|
||||
|
@ -244,59 +152,13 @@ See `:help ale-go-to-definition` for more information.
|
|||
|
||||
To install this plugin, you should use one of the following methods.
|
||||
For Windows users, replace usage of the Unix `~/.vim` directory with
|
||||
`%USERPROFILE%\vimfiles`, or another directory if you have configured
|
||||
`%USERPROFILE%\_vim`, or another directory if you have configured
|
||||
Vim differently. On Windows, your `~/.vimrc` file will be similarly
|
||||
stored in `%USERPROFILE%\_vimrc`.
|
||||
|
||||
<a name="standard-installation"></a>
|
||||
|
||||
### 3.i. Installation with Vim package management
|
||||
|
||||
In Vim 8 and NeoVim, you can install plugins easily without needing to use
|
||||
any other tools. Simply clone the plugin into your `pack` directory.
|
||||
|
||||
#### Vim 8 on Unix
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.vim/pack/git-plugins/start
|
||||
git clone https://github.com/w0rp/ale.git ~/.vim/pack/git-plugins/start/ale
|
||||
```
|
||||
|
||||
#### NeoVim on Unix
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.local/share/nvim/site/pack/git-plugins/start
|
||||
git clone https://github.com/w0rp/ale.git ~/.local/share/nvim/site/pack/git-plugins/start/ale
|
||||
```
|
||||
|
||||
#### Vim 8 on Windows
|
||||
|
||||
```bash
|
||||
# Run these commands in the "Git for Windows" Bash terminal
|
||||
mkdir -p ~/vimfiles/pack/git-plugins/start
|
||||
git clone https://github.com/w0rp/ale.git ~/vimfiles/pack/git-plugins/start/ale
|
||||
```
|
||||
|
||||
#### Generating Vim help files
|
||||
|
||||
You can add the following line to your vimrc files to generate documentation
|
||||
tags automatically, if you don't have something similar already, so you can use
|
||||
the `:help` command to consult ALE's online documentation:
|
||||
|
||||
```vim
|
||||
" Put these lines at the very end of your vimrc file.
|
||||
|
||||
" Load all plugins now.
|
||||
" Plugins need to be added to runtimepath before helptags can be generated.
|
||||
packloadall
|
||||
" Load all of the helptags now, after plugins have been loaded.
|
||||
" All messages and errors will be ignored.
|
||||
silent! helptags ALL
|
||||
```
|
||||
|
||||
<a name="installation-with-pathogen"></a>
|
||||
|
||||
### 3.ii. Installation with Pathogen
|
||||
### 3.i. Installation with Pathogen
|
||||
|
||||
To install this module with [Pathogen](https://github.com/tpope/vim-pathogen),
|
||||
you should clone this repository to your bundle directory, and ensure
|
||||
|
@ -310,7 +172,7 @@ git clone https://github.com/w0rp/ale.git
|
|||
|
||||
<a name="installation-with-vundle"></a>
|
||||
|
||||
### 3.iii. Installation with Vundle
|
||||
### 3.ii. Installation with Vundle
|
||||
|
||||
You can install this plugin using [Vundle](https://github.com/VundleVim/Vundle.vim)
|
||||
by using the path on GitHub for this repository.
|
||||
|
@ -321,6 +183,41 @@ Plugin 'w0rp/ale'
|
|||
|
||||
See the Vundle documentation for more information.
|
||||
|
||||
<a name="manual-installation"></a>
|
||||
|
||||
### 3.iii. Manual Installation
|
||||
|
||||
For installation without a package manager, you can clone this git repository
|
||||
into a bundle directory as with pathogen, and add the repository to your
|
||||
runtime path yourself. First clone the repository.
|
||||
|
||||
```bash
|
||||
cd ~/.vim/bundle
|
||||
git clone https://github.com/w0rp/ale.git
|
||||
```
|
||||
|
||||
Then, modify your `~/.vimrc` file to add this plugin to your runtime path.
|
||||
|
||||
```vim
|
||||
set nocompatible
|
||||
filetype off
|
||||
|
||||
let &runtimepath.=',~/.vim/bundle/ale'
|
||||
|
||||
filetype plugin on
|
||||
```
|
||||
|
||||
You can add the following line to generate documentation tags automatically,
|
||||
if you don't have something similar already, so you can use the `:help` command
|
||||
to consult ALE's online documentation:
|
||||
|
||||
```vim
|
||||
silent! helptags ALL
|
||||
```
|
||||
|
||||
Because the author of this plugin is a weird nerd, this is his preferred
|
||||
installation method.
|
||||
|
||||
<a name="contributing"></a>
|
||||
|
||||
## 4. Contributing
|
||||
|
@ -397,35 +294,9 @@ highlight clear ALEErrorSign
|
|||
highlight clear ALEWarningSign
|
||||
```
|
||||
|
||||
<a name="faq-change-highlights"></a>
|
||||
|
||||
### 5.iv. How can I change or disable the highlights ALE uses?
|
||||
|
||||
ALE's highlights problems with highlight groups which link to `SpellBad`,
|
||||
`SpellCap`, `error`, and `todo` groups by default. The characters that are
|
||||
highlighted depend on the linters being used, and the information provided to
|
||||
ALE.
|
||||
|
||||
Highlighting can be disabled completely by setting `g:ale_set_highlights` to
|
||||
`0`.
|
||||
|
||||
```vim
|
||||
" Set this in your vimrc file to disabling highlighting
|
||||
let g:ale_set_highlights = 0
|
||||
```
|
||||
|
||||
You can control all of the highlights ALE uses, say if you are using a different
|
||||
color scheme which produces ugly highlights. For example:
|
||||
|
||||
```vim
|
||||
highlight ALEWarning ctermbg=DarkMagenta
|
||||
```
|
||||
|
||||
See `:help ale-highlights` for more information.
|
||||
|
||||
<a name="faq-statusline"></a>
|
||||
|
||||
### 5.v. How can I show errors or warnings in my statusline?
|
||||
### 5.iv. How can I show errors or warnings in my statusline?
|
||||
|
||||
[vim-airline](https://github.com/vim-airline/vim-airline) integrates with ALE
|
||||
for displaying error information in the status bar. If you want to see the
|
||||
|
@ -463,18 +334,9 @@ set statusline=%{LinterStatus()}
|
|||
|
||||
See `:help ale#statusline#Count()` for more information.
|
||||
|
||||
<a name="faq-lightline"></a>
|
||||
|
||||
### 5.vi. How can I show errors or warnings in my lightline?
|
||||
|
||||
[lightline](https://github.com/itchyny/lightline.vim) does not have built-in
|
||||
support for ALE, nevertheless there is a plugin that adds this functionality: [maximbaz/lightline-ale](https://github.com/maximbaz/lightline-ale).
|
||||
|
||||
For more information, check out the sources of that plugin, `:help ale#statusline#Count()` and [lightline documentation](https://github.com/itchyny/lightline.vim#advanced-configuration).
|
||||
|
||||
<a name="faq-echo-format"></a>
|
||||
|
||||
### 5.vii. How can I change the format for echo messages?
|
||||
### 5.v. How can I change the format for echo messages?
|
||||
|
||||
There are 3 global options that allow customizing the echoed message.
|
||||
|
||||
|
@ -499,24 +361,22 @@ Will give you:
|
|||
|
||||
<a name="faq-autocmd"></a>
|
||||
|
||||
### 5.viii. How can I execute some code when ALE starts or stops linting?
|
||||
### 5.vi. How can I execute some code when ALE stops linting?
|
||||
|
||||
ALE runs its own [autocmd](http://vimdoc.sourceforge.net/htmldoc/autocmd.html)
|
||||
events whenever has a linter is started and has been successfully executed and
|
||||
processed. These events can be used to call arbitrary functions before and after
|
||||
ALE stops linting.
|
||||
event whenever has a linter has been successfully executed and processed. This
|
||||
autocmd event can be used to call arbitrary functions after ALE stops linting.
|
||||
|
||||
```vim
|
||||
augroup YourGroup
|
||||
autocmd!
|
||||
autocmd User ALELintPre call YourFunction()
|
||||
autocmd User ALELintPost call YourFunction()
|
||||
autocmd User ALELint call YourFunction()
|
||||
augroup END
|
||||
```
|
||||
|
||||
<a name="faq-navigation"></a>
|
||||
|
||||
### 5.ix. How can I navigate between errors quickly?
|
||||
### 5.vii. How can I navigate between errors quickly?
|
||||
|
||||
ALE offers some commands with `<Plug>` keybinds for moving between warnings and
|
||||
errors quickly. You can map the keys Ctrl+j and Ctrl+k to moving between errors
|
||||
|
@ -532,7 +392,7 @@ For more information, consult the online documentation with
|
|||
|
||||
<a name="faq-lint-on-save"></a>
|
||||
|
||||
### 5.x. How can I run linters only when I save files?
|
||||
### 5.viii. How can I run linters only when I save files?
|
||||
|
||||
ALE offers an option `g:ale_lint_on_save` for enabling running the linters
|
||||
when files are saved. This option is enabled by default. If you only
|
||||
|
@ -552,7 +412,7 @@ files, you can set `g:ale_lint_on_save` to `0`.
|
|||
|
||||
<a name="faq-quickfix"></a>
|
||||
|
||||
### 5.xi. How can I use the quickfix list instead of the loclist?
|
||||
### 5.ix. How can I use the quickfix list instead of the loclist?
|
||||
|
||||
The quickfix list can be enabled by turning the `g:ale_set_quickfix`
|
||||
option on. If you wish to also disable the loclist, you can disable
|
||||
|
@ -577,12 +437,9 @@ let g:ale_open_list = 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>
|
||||
|
||||
### 5.xii. How can I check JSX files with both stylelint and eslint?
|
||||
### 5.x. How can I check JSX files with both stylelint and eslint?
|
||||
|
||||
If you configure ALE options correctly in your vimrc file, and install
|
||||
the right tools, you can check JSX files with stylelint and eslint.
|
||||
|
@ -615,7 +472,7 @@ no linter will be run twice for the same file.
|
|||
|
||||
<a name="faq-my-battery-is-sad"></a>
|
||||
|
||||
### 5.xiii. Will this plugin eat all of my laptop battery power?
|
||||
### 5.xi. Will this plugin eat all of my laptop battery power?
|
||||
|
||||
ALE takes advantage of the power of various tools to check your code. This of
|
||||
course means that CPU time will be used to continuously check your code. If you
|
||||
|
@ -637,64 +494,3 @@ still be an advantage.
|
|||
If you are still concerned, you can turn the automatic linting off altogether,
|
||||
including the option `g:ale_lint_on_enter`, and you can run ALE manually with
|
||||
`:ALELint`.
|
||||
|
||||
<a name="faq-c-configuration"></a>
|
||||
|
||||
### 5.xiv. How can I configure my C or C++ project?
|
||||
|
||||
The structure of C and C++ projects varies wildly from project to project, with
|
||||
many different build tools being used for building them, and many different
|
||||
formats for project configuration files. ALE can run compilers easily, but
|
||||
ALE cannot easily detect which compiler flags to use.
|
||||
|
||||
Some tools and build configurations can generate
|
||||
[compile_commands.json](https://clang.llvm.org/docs/JSONCompilationDatabase.html)
|
||||
files. The `cppcheck`, `clangcheck` and `clangtidy` linters can read these
|
||||
files for automatically determining the appropriate compiler flags to use.
|
||||
|
||||
For linting with compilers like `gcc` and `clang`, and with other tools, you
|
||||
will need to tell ALE which compiler flags to use yourself. You can use
|
||||
different options for different projects with the `g:ale_pattern_options`
|
||||
setting. Consult the documentation for that setting for more information.
|
||||
`b:ale_linters` can be used to select which tools you want to run, say if you
|
||||
want to use only `gcc` for one project, and only `clang` for another.
|
||||
|
||||
You may also configure buffer-local settings for linters with project-specific
|
||||
vimrc files. [local_vimrc](https://github.com/LucHermitte/local_vimrc) can be
|
||||
used for executing local vimrc files which can be shared in your project.
|
||||
|
||||
<a name="faq-buffer-configuration"></a>
|
||||
|
||||
### 5.xv. How can I configure ALE differently for different buffers?
|
||||
|
||||
ALE offers various ways to configure which linters or fixers are run, and
|
||||
other settings. For the majority of ALE's settings, they can either be
|
||||
configured globally with a `g:` variable prefix, or for a specific buffer
|
||||
with a `b:` variable prefix. For example, you can configure a Python ftplugin
|
||||
file like so.
|
||||
|
||||
```vim
|
||||
" In ~/.vim/ftplugin/python.vim
|
||||
|
||||
" Check Python files with flake8 and pylint.
|
||||
let b:ale_linters = ['flake8', 'pylint']
|
||||
" Fix Python files with autopep8 and yapf.
|
||||
let b:ale_fixers = ['autopep8', 'yapf']
|
||||
" Disable warnings about trailing whitespace for Python files.
|
||||
let b:ale_warn_about_trailing_whitespace = 0
|
||||
```
|
||||
|
||||
For configuring files based on regular expression patterns matched against the
|
||||
absolute path to a file, you can use `g:ale_pattern_options`.
|
||||
|
||||
```vim
|
||||
" Do not lint or fix minified files.
|
||||
let g:ale_pattern_options = {
|
||||
\ '\.min\.js$': {'ale_linters': [], 'ale_fixers': []},
|
||||
\ '\.min\.css$': {'ale_linters': [], 'ale_fixers': []},
|
||||
\}
|
||||
" If you configure g:ale_pattern_options outside of vimrc, you need this.
|
||||
let g:ale_pattern_options_enabled = 1
|
||||
```
|
||||
|
||||
Buffer-local variables for settings always override the global settings.
|
||||
|
|
|
@ -21,8 +21,8 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
|
|||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:code = l:match[4]
|
||||
|
||||
if l:code is# 'EANSIBLE0002'
|
||||
\&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
||||
if (l:code ==# 'EANSIBLE002')
|
||||
\ && !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
||||
" Skip warnings for trailing whitespace if the option is off.
|
||||
continue
|
||||
endif
|
||||
|
@ -31,9 +31,8 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
|
|||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[5],
|
||||
\ 'code': l:code,
|
||||
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
|
||||
\ 'text': l:code . ': ' . l:match[5],
|
||||
\ 'type': l:code[:0] ==# 'E' ? 'E' : 'W',
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
" Author: nametake https://nametake.github.io
|
||||
" Description: apiblueprint parser
|
||||
|
||||
function! ale_linters#apiblueprint#drafter#HandleErrors(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" warning: (3) unable to parse response signature, expected 'response [<HTTP status code>] [(<media type>)]'; line 4, column 3k - line 4, column 22
|
||||
" warning: (10) message-body asset is expected to be a pre-formatted code block, separate it by a newline and indent every of its line by 12 spaces or 3 tabs; line 30, column 5 - line 30, column 9; line 31, column 9 - line 31, column 14; line 32, column 9 - line 32, column 14
|
||||
let l:pattern = '\(^.*\): (\d\+) \(.\{-\}\); line \(\d\+\), column \(\d\+\) - line \d\+, column \d\+\(.*; line \d\+, column \d\+ - line \(\d\+\), column \(\d\+\)\)\{-\}$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines[2:], l:pattern)
|
||||
let l:item = {
|
||||
\ 'type': l:match[1] is# 'warning' ? 'W' : 'E',
|
||||
\ 'text': l:match[2],
|
||||
\ 'lnum': l:match[3] + 0,
|
||||
\ 'col': l:match[4] + 0,
|
||||
\}
|
||||
if l:match[5] isnot# ''
|
||||
let l:item.end_lnum = l:match[6] + 0
|
||||
let l:item.end_col = l:match[7] + 0
|
||||
endif
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
|
||||
call ale#linter#Define('apiblueprint', {
|
||||
\ 'name': 'drafter',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'drafter',
|
||||
\ 'command': 'drafter --use-line-num --validate %t',
|
||||
\ 'callback': 'ale_linters#apiblueprint#drafter#HandleErrors',
|
||||
\})
|
|
@ -1,11 +0,0 @@
|
|||
" Author: Johannes Wienke <languitar@semipol.de>
|
||||
" Description: alex for asciidoc files
|
||||
|
||||
call ale#linter#Define('help', {
|
||||
\ 'name': 'alex',
|
||||
\ 'executable': 'alex',
|
||||
\ 'command': 'alex %s -t',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale#handlers#alex#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
|
@ -1,9 +0,0 @@
|
|||
" Author: rhysd https://rhysd.github.io
|
||||
" Description: Redpen, a proofreading tool (http://redpen.cc)
|
||||
|
||||
call ale#linter#Define('asciidoc', {
|
||||
\ 'name': 'redpen',
|
||||
\ 'executable': 'redpen',
|
||||
\ 'command': 'redpen -f asciidoc -r json %t',
|
||||
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
|
||||
\})
|
|
@ -1,9 +0,0 @@
|
|||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for AsciiDoc files
|
||||
|
||||
call ale#linter#Define('asciidoc', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
|
@ -1,16 +1,10 @@
|
|||
" Author: Lucas Kolstad <lkolstad@uw.edu>
|
||||
" Description: gcc linter for asm files
|
||||
|
||||
call ale#Set('asm_gcc_executable', 'gcc')
|
||||
call ale#Set('asm_gcc_options', '-Wall')
|
||||
|
||||
function! ale_linters#asm#gcc#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'asm_gcc_executable')
|
||||
endfunction
|
||||
let g:ale_asm_gcc_options = get(g:, 'ale_asm_gcc_options', '-Wall')
|
||||
|
||||
function! ale_linters#asm#gcc#GetCommand(buffer) abort
|
||||
return ale#Escape(ale_linters#asm#gcc#GetExecutable(a:buffer))
|
||||
\ . ' -x assembler -fsyntax-only '
|
||||
return 'gcc -x assembler -fsyntax-only '
|
||||
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
\ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -'
|
||||
endfunction
|
||||
|
@ -33,7 +27,7 @@ endfunction
|
|||
call ale#linter#Define('asm', {
|
||||
\ 'name': 'gcc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': 'ale_linters#asm#gcc#GetExecutable',
|
||||
\ 'executable': 'gcc',
|
||||
\ 'command_callback': 'ale_linters#asm#gcc#GetCommand',
|
||||
\ 'callback': 'ale_linters#asm#gcc#Handle',
|
||||
\})
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
" Author: Masahiro H https://github.com/mshr-h
|
||||
" Description: clang linter for c files
|
||||
|
||||
call ale#Set('c_clang_executable', 'clang')
|
||||
call ale#Set('c_clang_options', '-std=c11 -Wall')
|
||||
|
||||
function! ale_linters#c#clang#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'c_clang_executable')
|
||||
endfunction
|
||||
" Set this option to change the Clang options for warnings for C.
|
||||
if !exists('g:ale_c_clang_options')
|
||||
" let g:ale_c_clang_options = '-Wall'
|
||||
" let g:ale_c_clang_options = '-std=c99 -Wall'
|
||||
" c11 compatible
|
||||
let g:ale_c_clang_options = '-std=c11 -Wall'
|
||||
endif
|
||||
|
||||
function! ale_linters#c#clang#GetCommand(buffer) abort
|
||||
let l:paths = ale#c#FindLocalHeaderPaths(a:buffer)
|
||||
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
return ale#Escape(ale_linters#c#clang#GetExecutable(a:buffer))
|
||||
\ . ' -S -x c -fsyntax-only '
|
||||
return 'clang -S -x c -fsyntax-only '
|
||||
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
|
||||
\ . ale#c#IncludeOptions(l:paths)
|
||||
\ . ale#Var(a:buffer, 'c_clang_options') . ' -'
|
||||
|
@ -23,7 +23,7 @@ endfunction
|
|||
call ale#linter#Define('c', {
|
||||
\ 'name': 'clang',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': 'ale_linters#c#clang#GetExecutable',
|
||||
\ 'executable': 'clang',
|
||||
\ 'command_callback': 'ale_linters#c#clang#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\})
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
" Author: vdeurzen <tim@kompiler.org>, w0rp <devw0rp@gmail.com>,
|
||||
" gagbo <gagbobada@gmail.com>, Andrej Radovic <r.andrej@gmail.com>
|
||||
" Description: clang-tidy linter for c files
|
||||
|
||||
call ale#Set('c_clangtidy_executable', 'clang-tidy')
|
||||
" Set this option to check the checks clang-tidy will apply.
|
||||
" The number of checks that can be applied to C files is limited in contrast to
|
||||
" C++
|
||||
"
|
||||
" Consult the check list in clang-tidy's documentation:
|
||||
" http://clang.llvm.org/extra/clang-tidy/checks/list.html
|
||||
|
||||
call ale#Set('c_clangtidy_checks', ['*'])
|
||||
" Set this option to manually set some options for clang-tidy.
|
||||
" This will disable compile_commands.json detection.
|
||||
call ale#Set('c_clangtidy_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#c#clangtidy#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'c_clangtidy_executable')
|
||||
endfunction
|
||||
|
||||
function! s:GetBuildDirectory(buffer) abort
|
||||
" Don't include build directory for header files, as compile_commands.json
|
||||
" files don't consider headers to be translation units, and provide no
|
||||
" commands for compiling header files.
|
||||
if expand('#' . a:buffer) =~# '\v\.(h|hpp)$'
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:build_dir = ale#Var(a:buffer, 'c_build_dir')
|
||||
|
||||
" c_build_dir has the priority if defined
|
||||
if !empty(l:build_dir)
|
||||
return l:build_dir
|
||||
endif
|
||||
|
||||
return ale#c#FindCompileCommands(a:buffer)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#clangtidy#GetCommand(buffer) abort
|
||||
let l:checks = join(ale#Var(a:buffer, 'c_clangtidy_checks'), ',')
|
||||
let l:build_dir = s:GetBuildDirectory(a:buffer)
|
||||
|
||||
" Get the extra options if we couldn't find a build directory.
|
||||
let l:options = empty(l:build_dir)
|
||||
\ ? ale#Var(a:buffer, 'c_clangtidy_options')
|
||||
\ : ''
|
||||
|
||||
return ale#Escape(ale_linters#c#clangtidy#GetExecutable(a:buffer))
|
||||
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
|
||||
\ . ' %s'
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
\ . (!empty(l:options) ? ' -- ' . l:options : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'clangtidy',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable_callback': 'ale_linters#c#clangtidy#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#c#clangtidy#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
|
@ -1,12 +1,8 @@
|
|||
" Author: Bart Libert <bart.libert@gmail.com>
|
||||
" Description: cppcheck linter for c files
|
||||
|
||||
call ale#Set('c_cppcheck_executable', 'cppcheck')
|
||||
call ale#Set('c_cppcheck_options', '--enable=style')
|
||||
|
||||
function! ale_linters#c#cppcheck#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'c_cppcheck_executable')
|
||||
endfunction
|
||||
" Set this option to change the cppcheck options
|
||||
let g:ale_c_cppcheck_options = get(g:, 'ale_c_cppcheck_options', '--enable=style')
|
||||
|
||||
function! ale_linters#c#cppcheck#GetCommand(buffer) abort
|
||||
" Search upwards from the file for compile_commands.json.
|
||||
|
@ -23,8 +19,7 @@ function! ale_linters#c#cppcheck#GetCommand(buffer) abort
|
|||
\ : ''
|
||||
|
||||
return l:cd_command
|
||||
\ . ale#Escape(ale_linters#c#cppcheck#GetExecutable(a:buffer))
|
||||
\ . ' -q --language=c '
|
||||
\ . 'cppcheck -q --language=c '
|
||||
\ . l:compile_commands_option
|
||||
\ . ale#Var(a:buffer, 'c_cppcheck_options')
|
||||
\ . ' %t'
|
||||
|
@ -33,7 +28,7 @@ endfunction
|
|||
call ale#linter#Define('c', {
|
||||
\ 'name': 'cppcheck',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable_callback': 'ale_linters#c#cppcheck#GetExecutable',
|
||||
\ 'executable': 'cppcheck',
|
||||
\ 'command_callback': 'ale_linters#c#cppcheck#GetCommand',
|
||||
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
|
||||
\})
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
" Author: Christian Gibbons <cgibbons@gmu.edu>
|
||||
" Description: flawfinder linter for c files
|
||||
|
||||
call ale#Set('c_flawfinder_executable', 'flawfinder')
|
||||
call ale#Set('c_flawfinder_options', '')
|
||||
call ale#Set('c_flawfinder_minlevel', 1)
|
||||
|
||||
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#gcc#HandleGCCFormat',
|
||||
\})
|
|
@ -1,20 +1,20 @@
|
|||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: gcc linter for c files
|
||||
|
||||
call ale#Set('c_gcc_executable', 'gcc')
|
||||
call ale#Set('c_gcc_options', '-std=c11 -Wall')
|
||||
|
||||
function! ale_linters#c#gcc#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'c_gcc_executable')
|
||||
endfunction
|
||||
" Set this option to change the GCC options for warnings for C.
|
||||
if !exists('g:ale_c_gcc_options')
|
||||
" let g:ale_c_gcc_options = '-Wall'
|
||||
" let g:ale_c_gcc_options = '-std=c99 -Wall'
|
||||
" c11 compatible
|
||||
let g:ale_c_gcc_options = '-std=c11 -Wall'
|
||||
endif
|
||||
|
||||
function! ale_linters#c#gcc#GetCommand(buffer) abort
|
||||
let l:paths = ale#c#FindLocalHeaderPaths(a:buffer)
|
||||
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
return ale#Escape(ale_linters#c#gcc#GetExecutable(a:buffer))
|
||||
\ . ' -S -x c -fsyntax-only '
|
||||
return 'gcc -S -x c -fsyntax-only '
|
||||
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
|
||||
\ . ale#c#IncludeOptions(l:paths)
|
||||
\ . ale#Var(a:buffer, 'c_gcc_options') . ' -'
|
||||
|
@ -23,7 +23,7 @@ endfunction
|
|||
call ale#linter#Define('c', {
|
||||
\ 'name': 'gcc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': 'ale_linters#c#gcc#GetExecutable',
|
||||
\ 'executable': 'gcc',
|
||||
\ 'command_callback': 'ale_linters#c#gcc#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\})
|
||||
|
|
|
@ -1,37 +1,24 @@
|
|||
" Author: Edward Larkey <edwlarkey@mac.com>
|
||||
" Author: Jose Junior <jose.junior@gmail.com>
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: This file adds the foodcritic linter for Chef files.
|
||||
|
||||
call ale#Set('chef_foodcritic_executable', 'foodcritic')
|
||||
call ale#Set('chef_foodcritic_options', '')
|
||||
|
||||
function! ale_linters#chef#foodcritic#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'chef_foodcritic_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#chef#foodcritic#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#chef#foodcritic#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'chef_foodcritic_options')
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . escape(l:options, '~') : '')
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
" Support options!
|
||||
let g:ale_chef_foodcritic_options = get(g:, 'ale_chef_foodcritic_options', '')
|
||||
let g:ale_chef_foodcritic_executable = get(g:, 'ale_chef_foodcritic_executable', 'foodcritic')
|
||||
|
||||
function! ale_linters#chef#foodcritic#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" FC002: Avoid string interpolation where not required: httpd.rb:13
|
||||
let l:pattern = '\v([^:]+): (.+): ([a-zA-Z]?:?[^:]+):(\d+)$'
|
||||
let l:pattern = '^\(.\+:\s.\+\):\s\(.\+\):\(\d\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:text = l:match[1]
|
||||
|
||||
call add(l:output, {
|
||||
\ 'code': l:match[1],
|
||||
\ 'text': l:match[2],
|
||||
\ 'filename': l:match[3],
|
||||
\ 'lnum': l:match[4] + 0,
|
||||
\ 'lnum': l:match[3] + 0,
|
||||
\ 'text': l:text,
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
endfor
|
||||
|
@ -39,10 +26,17 @@ function! ale_linters#chef#foodcritic#Handle(buffer, lines) abort
|
|||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#chef#foodcritic#GetCommand(buffer) abort
|
||||
return printf('%s %s %%t',
|
||||
\ ale#Var(a:buffer, 'chef_foodcritic_executable'),
|
||||
\ escape(ale#Var(a:buffer, 'chef_foodcritic_options'), '~')
|
||||
\)
|
||||
endfunction
|
||||
|
||||
|
||||
call ale#linter#Define('chef', {
|
||||
\ 'name': 'foodcritic',
|
||||
\ 'executable_callback': 'ale_linters#chef#foodcritic#GetExecutable',
|
||||
\ 'executable': 'foodcritic',
|
||||
\ 'command_callback': 'ale_linters#chef#foodcritic#GetCommand',
|
||||
\ 'callback': 'ale_linters#chef#foodcritic#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
|
|
@ -1,32 +0,0 @@
|
|||
" Author: Nic West <nicwest@mailbox.org>
|
||||
" Description: linter for clojure using joker https://github.com/candid82/joker
|
||||
|
||||
function! ale_linters#clojure#joker#HandleJokerFormat(buffer, lines) abort
|
||||
" output format
|
||||
" <filename>:<line>:<column>: <issue type>: <message>
|
||||
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+):? ((Read error|Parse error|Parse warning|Exception): ?(.+))$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:type = 'E'
|
||||
if l:match[4] is? 'Parse warning'
|
||||
let l:type = 'W'
|
||||
endif
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[3],
|
||||
\ 'type': l:type,
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('clojure', {
|
||||
\ 'name': 'joker',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'joker',
|
||||
\ 'command': 'joker --lint %t',
|
||||
\ 'callback': 'ale_linters#clojure#joker#HandleJokerFormat',
|
||||
\})
|
|
@ -27,7 +27,7 @@ function! ale_linters#coffee#coffeelint#Handle(buffer, lines) abort
|
|||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'type': l:match[3] is# 'error' ? 'E' : 'W',
|
||||
\ 'type': l:match[3] ==# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
|
|
|
@ -1,20 +1,17 @@
|
|||
" Author: Tomota Nakamura <https://github.com/tomotanakamura>
|
||||
" Description: clang linter for cpp files
|
||||
|
||||
call ale#Set('cpp_clang_executable', 'clang++')
|
||||
call ale#Set('cpp_clang_options', '-std=c++14 -Wall')
|
||||
|
||||
function! ale_linters#cpp#clang#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cpp_clang_executable')
|
||||
endfunction
|
||||
" Set this option to change the Clang options for warnings for CPP.
|
||||
if !exists('g:ale_cpp_clang_options')
|
||||
let g:ale_cpp_clang_options = '-std=c++14 -Wall'
|
||||
endif
|
||||
|
||||
function! ale_linters#cpp#clang#GetCommand(buffer) abort
|
||||
let l:paths = ale#c#FindLocalHeaderPaths(a:buffer)
|
||||
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
return ale#Escape(ale_linters#cpp#clang#GetExecutable(a:buffer))
|
||||
\ . ' -S -x c++ -fsyntax-only '
|
||||
return 'clang++ -S -x c++ -fsyntax-only '
|
||||
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
|
||||
\ . ale#c#IncludeOptions(l:paths)
|
||||
\ . ale#Var(a:buffer, 'cpp_clang_options') . ' -'
|
||||
|
@ -23,7 +20,7 @@ endfunction
|
|||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'clang',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': 'ale_linters#cpp#clang#GetExecutable',
|
||||
\ 'executable': 'clang++',
|
||||
\ 'command_callback': 'ale_linters#cpp#clang#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\})
|
||||
|
|
|
@ -1,38 +1,36 @@
|
|||
" Author: gagbo <gagbobada@gmail.com>
|
||||
" Description: clang-check linter for cpp files
|
||||
|
||||
call ale#Set('cpp_clangcheck_executable', 'clang-check')
|
||||
call ale#Set('cpp_clangcheck_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
" Set this option to manually set some options for clang-check.
|
||||
let g:ale_cpp_clangcheck_options = get(g:, 'ale_cpp_clangcheck_options', '')
|
||||
|
||||
function! ale_linters#cpp#clangcheck#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cpp_clangcheck_executable')
|
||||
endfunction
|
||||
" Set this option to manually point to the build directory for clang-tidy.
|
||||
" This will disable all the other clangtidy_options, since compilation
|
||||
" flags are contained in the json
|
||||
let g:ale_c_build_dir = get(g:, 'ale_c_build_dir', '')
|
||||
|
||||
function! ale_linters#cpp#clangcheck#GetCommand(buffer) abort
|
||||
let l:user_options = ale#Var(a:buffer, 'cpp_clangcheck_options')
|
||||
let l:extra_options = !empty(l:user_options)
|
||||
\ ? l:user_options
|
||||
\ : ''
|
||||
|
||||
" Try to find compilation database to link automatically
|
||||
let l:build_dir = ale#Var(a:buffer, 'c_build_dir')
|
||||
|
||||
if empty(l:build_dir)
|
||||
let l:build_dir = ale#c#FindCompileCommands(a:buffer)
|
||||
let l:user_build_dir = ale#Var(a:buffer, 'c_build_dir')
|
||||
if empty(l:user_build_dir)
|
||||
let l:user_build_dir = ale#c#FindCompileCommands(a:buffer)
|
||||
endif
|
||||
let l:build_options = !empty(l:user_build_dir)
|
||||
\ ? ' -p ' . ale#Escape(l:user_build_dir)
|
||||
\ : ''
|
||||
|
||||
" The extra arguments in the command are used to prevent .plist files from
|
||||
" being generated. These are only added if no build directory can be
|
||||
" detected.
|
||||
return ale#Escape(ale_linters#cpp#clangcheck#GetExecutable(a:buffer))
|
||||
\ . ' -analyze %s'
|
||||
\ . (empty(l:build_dir) ? ' -extra-arg -Xclang -extra-arg -analyzer-output=text' : '')
|
||||
\ . (!empty(l:user_options) ? ' ' . l:user_options : '')
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
return 'clang-check -analyze ' . '%s' . l:extra_options . l:build_options
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'clangcheck',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': 'ale_linters#cpp#clangcheck#GetExecutable',
|
||||
\ 'executable': 'clang-check',
|
||||
\ 'command_callback': 'ale_linters#cpp#clangcheck#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
|
|
|
@ -2,56 +2,51 @@
|
|||
" gagbo <gagbobada@gmail.com>
|
||||
" Description: clang-tidy linter for cpp files
|
||||
|
||||
call ale#Set('cpp_clangtidy_executable', 'clang-tidy')
|
||||
" Set this option to check the checks clang-tidy will apply.
|
||||
call ale#Set('cpp_clangtidy_checks', ['*'])
|
||||
let g:ale_cpp_clangtidy_checks = get(g:, 'ale_cpp_clangtidy_checks', ['*'])
|
||||
|
||||
" Set this option to manually set some options for clang-tidy.
|
||||
" This will disable compile_commands.json detection.
|
||||
call ale#Set('cpp_clangtidy_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
let g:ale_cpp_clangtidy_options = get(g:, 'ale_cpp_clangtidy_options', '')
|
||||
|
||||
function! ale_linters#cpp#clangtidy#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cpp_clangtidy_executable')
|
||||
endfunction
|
||||
" Set this option to manually point to the build directory for clang-tidy.
|
||||
" This will disable all the other clangtidy_options, since compilation
|
||||
" flags are contained in the json
|
||||
let g:ale_c_build_dir = get(g:, 'ale_c_build_dir', '')
|
||||
|
||||
function! s:GetBuildDirectory(buffer) abort
|
||||
" Don't include build directory for header files, as compile_commands.json
|
||||
" files don't consider headers to be translation units, and provide no
|
||||
" commands for compiling header files.
|
||||
if expand('#' . a:buffer) =~# '\v\.(h|hpp)$'
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:build_dir = ale#Var(a:buffer, 'c_build_dir')
|
||||
|
||||
" c_build_dir has the priority if defined
|
||||
if !empty(l:build_dir)
|
||||
return l:build_dir
|
||||
endif
|
||||
|
||||
return ale#c#FindCompileCommands(a:buffer)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cpp#clangtidy#GetCommand(buffer) abort
|
||||
let l:checks = join(ale#Var(a:buffer, 'cpp_clangtidy_checks'), ',')
|
||||
let l:build_dir = s:GetBuildDirectory(a:buffer)
|
||||
|
||||
" Get the extra options if we couldn't find a build directory.
|
||||
let l:options = empty(l:build_dir)
|
||||
\ ? ale#Var(a:buffer, 'cpp_clangtidy_options')
|
||||
let l:check_list = ale#Var(a:buffer, 'cpp_clangtidy_checks')
|
||||
let l:check_option = !empty(l:check_list)
|
||||
\ ? '-checks=' . ale#Escape(join(l:check_list, ',')) . ' '
|
||||
\ : ''
|
||||
let l:user_options = ale#Var(a:buffer, 'cpp_clangtidy_options')
|
||||
let l:user_build_dir = ale#Var(a:buffer, 'c_build_dir')
|
||||
|
||||
return ale#Escape(ale_linters#cpp#clangtidy#GetExecutable(a:buffer))
|
||||
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
|
||||
\ . ' %s'
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
\ . (!empty(l:options) ? ' -- ' . l:options : '')
|
||||
" c_build_dir has the priority if defined
|
||||
if empty(l:user_build_dir)
|
||||
let l:user_build_dir = ale#c#FindCompileCommands(a:buffer)
|
||||
endif
|
||||
|
||||
" We check again if user_builddir stayed empty after the
|
||||
" c_build_dir_names check
|
||||
" If we found the compilation database we override the value of
|
||||
" l:extra_options
|
||||
if empty(l:user_build_dir)
|
||||
let l:extra_options = !empty(l:user_options)
|
||||
\ ? ' -- ' . l:user_options
|
||||
\ : ''
|
||||
else
|
||||
let l:extra_options = ' -p ' . ale#Escape(l:user_build_dir)
|
||||
endif
|
||||
|
||||
return 'clang-tidy ' . l:check_option . '%s' . l:extra_options
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'clangtidy',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable_callback': 'ale_linters#cpp#clangtidy#GetExecutable',
|
||||
\ 'executable': 'clang-tidy',
|
||||
\ 'command_callback': 'ale_linters#cpp#clangtidy#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
" Author: Bart Libert <bart.libert@gmail.com>
|
||||
" Description: cppcheck linter for cpp files
|
||||
|
||||
call ale#Set('cpp_cppcheck_executable', 'cppcheck')
|
||||
call ale#Set('cpp_cppcheck_options', '--enable=style')
|
||||
|
||||
function! ale_linters#cpp#cppcheck#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cpp_cppcheck_executable')
|
||||
endfunction
|
||||
" Set this option to change the cppcheck options
|
||||
let g:ale_cpp_cppcheck_options = get(g:, 'ale_cpp_cppcheck_options', '--enable=style')
|
||||
|
||||
function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
|
||||
" Search upwards from the file for compile_commands.json.
|
||||
|
@ -23,8 +19,7 @@ function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
|
|||
\ : ''
|
||||
|
||||
return l:cd_command
|
||||
\ . ale#Escape(ale_linters#cpp#cppcheck#GetExecutable(a:buffer))
|
||||
\ . ' -q --language=c++ '
|
||||
\ . 'cppcheck -q --language=c++ '
|
||||
\ . l:compile_commands_option
|
||||
\ . ale#Var(a:buffer, 'cpp_cppcheck_options')
|
||||
\ . ' %t'
|
||||
|
@ -33,7 +28,7 @@ endfunction
|
|||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'cppcheck',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable_callback': 'ale_linters#cpp#cppcheck#GetExecutable',
|
||||
\ 'executable': 'cppcheck',
|
||||
\ 'command_callback': 'ale_linters#cpp#cppcheck#GetCommand',
|
||||
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
|
||||
\})
|
||||
|
|
|
@ -1,26 +1,15 @@
|
|||
" Author: Dawid Kurek https://github.com/dawikur
|
||||
" Description: cpplint for cpp files
|
||||
|
||||
call ale#Set('cpp_cpplint_executable', 'cpplint')
|
||||
call ale#Set('cpp_cpplint_options', '')
|
||||
|
||||
function! ale_linters#cpp#cpplint#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cpp_cpplint_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cpp#cpplint#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'cpp_cpplint_options')
|
||||
|
||||
return ale#Escape(ale_linters#cpp#cpplint#GetExecutable(a:buffer))
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
if !exists('g:ale_cpp_cpplint_options')
|
||||
let g:ale_cpp_cpplint_options = ''
|
||||
endif
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'cpplint',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': 'ale_linters#cpp#cpplint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#cpp#cpplint#GetCommand',
|
||||
\ 'executable': 'cpplint',
|
||||
\ 'command': 'cpplint %s',
|
||||
\ 'callback': 'ale#handlers#cpplint#HandleCppLintFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
" Author: Christian Gibbons <cgibbons@gmu.edu>
|
||||
" Description: flawfinder linter for c++ files
|
||||
|
||||
call ale#Set('cpp_flawfinder_executable', 'flawfinder')
|
||||
call ale#Set('cpp_flawfinder_options', '')
|
||||
call ale#Set('cpp_flawfinder_minlevel', 1)
|
||||
|
||||
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#gcc#HandleGCCFormat',
|
||||
\})
|
|
@ -1,20 +1,27 @@
|
|||
" Author: geam <mdelage@student.42.fr>
|
||||
" Description: gcc linter for cpp files
|
||||
"
|
||||
call ale#Set('cpp_gcc_executable', 'gcc')
|
||||
call ale#Set('cpp_gcc_options', '-std=c++14 -Wall')
|
||||
|
||||
function! ale_linters#cpp#gcc#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cpp_gcc_executable')
|
||||
endfunction
|
||||
" Set this option to change the GCC options for warnings for C.
|
||||
if !exists('g:ale_cpp_gcc_options')
|
||||
let s:version = ale#handlers#gcc#ParseGCCVersion(systemlist('gcc --version'))
|
||||
|
||||
if !empty(s:version) && ale#semver#GreaterOrEqual(s:version, [4, 9, 0])
|
||||
" Use c++14 support in 4.9 and above.
|
||||
let g:ale_cpp_gcc_options = '-std=c++14 -Wall'
|
||||
else
|
||||
" Use c++1y in older versions.
|
||||
let g:ale_cpp_gcc_options = '-std=c++1y -Wall'
|
||||
endif
|
||||
|
||||
unlet! s:version
|
||||
endif
|
||||
|
||||
function! ale_linters#cpp#gcc#GetCommand(buffer) abort
|
||||
let l:paths = ale#c#FindLocalHeaderPaths(a:buffer)
|
||||
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
return ale#Escape(ale_linters#cpp#gcc#GetExecutable(a:buffer))
|
||||
\ . ' -S -x c++ -fsyntax-only '
|
||||
return 'gcc -S -x c++ -fsyntax-only '
|
||||
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
|
||||
\ . ale#c#IncludeOptions(l:paths)
|
||||
\ . ale#Var(a:buffer, 'cpp_gcc_options') . ' -'
|
||||
|
@ -23,7 +30,7 @@ endfunction
|
|||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'g++',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': 'ale_linters#cpp#gcc#GetExecutable',
|
||||
\ 'executable': 'g++',
|
||||
\ 'command_callback': 'ale_linters#cpp#gcc#GetCommand',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\})
|
||||
|
|
|
@ -4,21 +4,31 @@
|
|||
function! ale_linters#crystal#crystal#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:error.line + 0,
|
||||
\ 'col': l:error.column + 0,
|
||||
\ 'text': l:error.message,
|
||||
\})
|
||||
endfor
|
||||
let l:lines = join(a:lines, '')
|
||||
|
||||
if !empty(l:lines)
|
||||
let l:errors = json_decode(l:lines)
|
||||
|
||||
for l:error in l:errors
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:error.line + 0,
|
||||
\ 'col': l:error.column + 0,
|
||||
\ 'text': l:error.message,
|
||||
\ 'type': 'E',
|
||||
\})
|
||||
endfor
|
||||
endif
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#crystal#crystal#GetCommand(buffer) abort
|
||||
return 'crystal build -f json --no-codegen --no-color -o '
|
||||
\ . ale#Escape(g:ale#util#nul_file)
|
||||
\ . ' %s'
|
||||
let l:crystal_cmd = 'crystal build -f json --no-codegen --no-color -o '
|
||||
let l:crystal_cmd .= ale#Escape(g:ale#util#nul_file)
|
||||
let l:crystal_cmd .= ' %s'
|
||||
|
||||
return l:crystal_cmd
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('crystal', {
|
||||
|
|
|
@ -8,16 +8,15 @@ function! ale_linters#cs#mcs#Handle(buffer, lines) abort
|
|||
" Look for lines like the following.
|
||||
"
|
||||
" Tests.cs(12,29): error CSXXXX: ; expected
|
||||
let l:pattern = '^\v(.+\.cs)\((\d+),(\d+)\)\: ([^ ]+) ([^ ]+): (.+)$'
|
||||
let l:pattern = '^.\+.cs(\(\d\+\),\(\d\+\)): \(.\+\): \(.\+\)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
||||
\ 'code': l:match[5],
|
||||
\ 'text': l:match[6],
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[3] . ': ' . l:match[4],
|
||||
\ 'type': l:match[3] =~# '^error' ? 'E' : 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
|
|
@ -1,81 +0,0 @@
|
|||
call ale#Set('cs_mcsc_options', '')
|
||||
call ale#Set('cs_mcsc_source', '')
|
||||
call ale#Set('cs_mcsc_assembly_path', [])
|
||||
call ale#Set('cs_mcsc_assemblies', [])
|
||||
|
||||
function! s:GetWorkingDirectory(buffer) abort
|
||||
let l:working_directory = ale#Var(a:buffer, 'cs_mcsc_source')
|
||||
|
||||
if !empty(l:working_directory)
|
||||
return l:working_directory
|
||||
endif
|
||||
|
||||
return expand('#' . a:buffer . ':p:h')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cs#mcsc#GetCommand(buffer) abort
|
||||
" Pass assembly paths via the -lib: parameter.
|
||||
let l:path_list = ale#Var(a:buffer, 'cs_mcsc_assembly_path')
|
||||
|
||||
let l:lib_option = !empty(l:path_list)
|
||||
\ ? '-lib:' . join(map(copy(l:path_list), 'ale#Escape(v:val)'), ',')
|
||||
\ : ''
|
||||
|
||||
" Pass paths to DLL files via the -r: parameter.
|
||||
let l:assembly_list = ale#Var(a:buffer, 'cs_mcsc_assemblies')
|
||||
|
||||
let l:r_option = !empty(l:assembly_list)
|
||||
\ ? '-r:' . join(map(copy(l:assembly_list), 'ale#Escape(v:val)'), ',')
|
||||
\ : ''
|
||||
|
||||
" register temporary module target file with ale
|
||||
let l:out = tempname()
|
||||
call ale#engine#ManageFile(a:buffer, l:out)
|
||||
|
||||
" The code is compiled as a module and the output is redirected to a
|
||||
" temporary file.
|
||||
return ale#path#CdString(s:GetWorkingDirectory(a:buffer))
|
||||
\ . 'mcs -unsafe'
|
||||
\ . ' ' . ale#Var(a:buffer, 'cs_mcsc_options')
|
||||
\ . ' ' . l:lib_option
|
||||
\ . ' ' . l:r_option
|
||||
\ . ' -out:' . l:out
|
||||
\ . ' -t:module'
|
||||
\ . ' -recurse:' . ale#Escape('*.cs')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cs#mcsc#Handle(buffer, lines) abort
|
||||
" Look for lines like the following.
|
||||
"
|
||||
" Tests.cs(12,29): error CSXXXX: ; expected
|
||||
"
|
||||
" NOTE: pattern also captures file name as linter compiles all
|
||||
" files within the source tree rooted at the specified source
|
||||
" path and not just the file loaded in the buffer
|
||||
let l:pattern = '^\v(.+\.cs)\((\d+),(\d+)\)\: ([^ ]+) ([^ ]+): (.+)$'
|
||||
let l:output = []
|
||||
|
||||
let l:dir = s:GetWorkingDirectory(a:buffer)
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
||||
\ 'code': l:match[5],
|
||||
\ 'text': l:match[6],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cs',{
|
||||
\ 'name': 'mcsc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'mcs',
|
||||
\ 'command_callback': 'ale_linters#cs#mcsc#GetCommand',
|
||||
\ 'callback': 'ale_linters#cs#mcsc#Handle',
|
||||
\ 'lint_file': 1
|
||||
\})
|
|
@ -1,56 +0,0 @@
|
|||
" Author: blahgeek <i@blahgeek.com>
|
||||
" Description: NVCC linter for cuda files
|
||||
|
||||
call ale#Set('cuda_nvcc_executable', 'nvcc')
|
||||
call ale#Set('cuda_nvcc_options', '-std=c++11')
|
||||
|
||||
function! ale_linters#cuda#nvcc#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cuda_nvcc_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cuda#nvcc#GetCommand(buffer) abort
|
||||
" Unused: use ale#util#nul_file
|
||||
" let l:output_file = tempname() . '.ii'
|
||||
" call ale#engine#ManageFile(a:buffer, l:output_file)
|
||||
|
||||
return ale#Escape(ale_linters#cuda#nvcc#GetExecutable(a:buffer))
|
||||
\ . ' -cuda '
|
||||
\ . ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer))
|
||||
\ . ale#Var(a:buffer, 'cuda_nvcc_options') . ' %s'
|
||||
\ . ' -o ' . g:ale#util#nul_file
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cuda#nvcc#HandleNVCCFormat(buffer, lines) abort
|
||||
" Look for lines like the following.
|
||||
"
|
||||
" test.cu(8): error: argument of type "void *" is incompatible with parameter of type "int *"
|
||||
let l:pattern = '\v^([^:\(\)]+):?\(?(\d+)\)?:(\d+)?:?\s*\w*\s*(error|warning): (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
|
||||
let l:item = {
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'type': l:match[4] =~# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[5],
|
||||
\ 'filename': fnamemodify(l:match[1], ':p'),
|
||||
\}
|
||||
|
||||
if !empty(l:match[3])
|
||||
let l:item.col = str2nr(l:match[3])
|
||||
endif
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cuda', {
|
||||
\ 'name': 'nvcc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable_callback': 'ale_linters#cuda#nvcc#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#cuda#nvcc#GetCommand',
|
||||
\ 'callback': 'ale_linters#cuda#nvcc#HandleNVCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
|
@ -60,7 +60,7 @@ function! ale_linters#d#dmd#Handle(buffer, lines) abort
|
|||
call add(l:output, {
|
||||
\ 'lnum': l:match[1],
|
||||
\ 'col': l:match[2],
|
||||
\ 'type': l:match[3] is# 'Warning' ? 'W' : 'E',
|
||||
\ 'type': l:match[3] ==# 'Warning' ? 'W' : 'E',
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
" Author: Taylor Blau <me@ttaylorr.com>
|
||||
|
||||
function! ale_linters#dafny#dafny#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v(.*)\((\d+),(\d+)\): (.*): (.*)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'text': l:match[5],
|
||||
\ 'type': l:match[4] =~# '^Error' ? 'E' : 'W'
|
||||
\ })
|
||||
endfor
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('dafny', {
|
||||
\ 'name': 'dafny',
|
||||
\ 'executable': 'dafny',
|
||||
\ 'command': 'dafny %s /compile:0',
|
||||
\ 'callback': 'ale_linters#dafny#dafny#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\ })
|
|
@ -1,41 +0,0 @@
|
|||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: Check Dart files with dartanalyzer
|
||||
|
||||
call ale#Set('dart_dartanalyzer_executable', 'dartanalyzer')
|
||||
|
||||
function! ale_linters#dart#dartanalyzer#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'dart_dartanalyzer_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dart#dartanalyzer#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#dart#dartanalyzer#GetExecutable(a:buffer)
|
||||
let l:path = ale#path#FindNearestFile(a:buffer, '.packages')
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . (!empty(l:path) ? ' --packages ' . ale#Escape(l:path) : '')
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dart#dartanalyzer#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^ ([a-z]+) . (.+) at (.+):(\d+):(\d+) . (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'type': l:match[1] is# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[6] . ': ' . l:match[2],
|
||||
\ 'lnum': str2nr(l:match[4]),
|
||||
\ 'col': str2nr(l:match[5]),
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('dart', {
|
||||
\ 'name': 'dartanalyzer',
|
||||
\ 'executable_callback': 'ale_linters#dart#dartanalyzer#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#dart#dartanalyzer#GetCommand',
|
||||
\ 'callback': 'ale_linters#dart#dartanalyzer#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
|
@ -1,30 +0,0 @@
|
|||
" Author: aurieh <me@aurieh.me>
|
||||
" Description: A language server for dart
|
||||
|
||||
call ale#Set('dart_language_server_executable', 'dart_language_server')
|
||||
|
||||
function! ale_linters#dart#language_server#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'dart_language_server_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dart#language_server#GetLanguage(buffer) abort
|
||||
return 'dart'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dart#language_server#GetProjectRoot(buffer) abort
|
||||
" Note: pub only looks for pubspec.yaml, there's no point in adding
|
||||
" support for pubspec.yml
|
||||
let l:pubspec = ale#path#FindNearestFile(a:buffer, 'pubspec.yaml')
|
||||
|
||||
return !empty(l:pubspec) ? fnamemodify(l:pubspec, ':h:h') : ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('dart', {
|
||||
\ 'name': 'language_server',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#dart#language_server#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#dart#language_server#GetExecutable',
|
||||
\ 'language_callback': 'ale_linters#dart#language_server#GetLanguage',
|
||||
\ 'project_root_callback': 'ale_linters#dart#language_server#GetProjectRoot',
|
||||
\})
|
||||
|
|
@ -1,97 +1,37 @@
|
|||
" Author: hauleth - https://github.com/hauleth
|
||||
|
||||
" always, yes, never
|
||||
call ale#Set('dockerfile_hadolint_use_docker', 'never')
|
||||
call ale#Set('dockerfile_hadolint_docker_image', 'hadolint/hadolint')
|
||||
|
||||
function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" /dev/stdin:19 DL3001 Pipe chain should start with a raw value.
|
||||
" /dev/stdin:19:3 unexpected thing
|
||||
let l:pattern = '\v^/dev/stdin:(\d+):?(\d+)? ((DL|SC)(\d+) )?(.+)$'
|
||||
" stdin:19: F: Pipe chain should start with a raw value.
|
||||
let l:pattern = '\v^/dev/stdin:?(\d+)? (\S+) (.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:lnum = 0
|
||||
let l:colnum = 0
|
||||
|
||||
if l:match[1] isnot# ''
|
||||
if l:match[1] !=# ''
|
||||
let l:lnum = l:match[1] + 0
|
||||
endif
|
||||
|
||||
if l:match[2] isnot# ''
|
||||
let l:colnum = l:match[2] + 0
|
||||
endif
|
||||
|
||||
let l:type = 'W'
|
||||
let l:text = l:match[6]
|
||||
let l:detail = l:match[6]
|
||||
let l:domain = 'https://github.com/hadolint/hadolint/wiki/'
|
||||
|
||||
if l:match[4] is# 'SC'
|
||||
let l:domain = 'https://github.com/koalaman/shellcheck/wiki/'
|
||||
endif
|
||||
|
||||
if l:match[5] isnot# ''
|
||||
let l:code = l:match[4] . l:match[5]
|
||||
let l:link = ' ( ' . l:domain . l:code . ' )'
|
||||
let l:detail = l:code . l:link . "\n\n" . l:detail
|
||||
else
|
||||
let l:type = 'E'
|
||||
endif
|
||||
let l:text = l:match[3]
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:lnum,
|
||||
\ 'col': l:colnum,
|
||||
\ 'col': 0,
|
||||
\ 'type': l:type,
|
||||
\ 'text': l:text,
|
||||
\ 'detail': l:detail
|
||||
\ 'nr': l:match[2],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
" This is a little different than the typical 'executable' callback. We want
|
||||
" to afford the user the chance to say always use docker, never use docker,
|
||||
" and use docker if the hadolint executable is not present on the system.
|
||||
"
|
||||
" In the case of neither docker nor hadolint executables being present, it
|
||||
" really doesn't matter which we return -- either will have the effect of
|
||||
" 'nope, can't use this linter!'.
|
||||
|
||||
function! ale_linters#dockerfile#hadolint#GetExecutable(buffer) abort
|
||||
let l:use_docker = ale#Var(a:buffer, 'dockerfile_hadolint_use_docker')
|
||||
|
||||
" check for mandatory directives
|
||||
if l:use_docker is# 'never'
|
||||
return 'hadolint'
|
||||
elseif l:use_docker is# 'always'
|
||||
return 'docker'
|
||||
endif
|
||||
|
||||
" if we reach here, we want to use 'hadolint' if present...
|
||||
if executable('hadolint')
|
||||
return 'hadolint'
|
||||
endif
|
||||
|
||||
"... and 'docker' as a fallback.
|
||||
return 'docker'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#dockerfile#hadolint#GetCommand(buffer) abort
|
||||
let l:command = ale_linters#dockerfile#hadolint#GetExecutable(a:buffer)
|
||||
if l:command is# 'docker'
|
||||
return 'docker run --rm -i ' . ale#Var(a:buffer, 'dockerfile_hadolint_docker_image')
|
||||
endif
|
||||
return 'hadolint -'
|
||||
endfunction
|
||||
|
||||
|
||||
call ale#linter#Define('dockerfile', {
|
||||
\ 'name': 'hadolint',
|
||||
\ 'executable_callback': 'ale_linters#dockerfile#hadolint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#dockerfile#hadolint#GetCommand',
|
||||
\ 'executable': 'hadolint',
|
||||
\ 'command': 'hadolint -',
|
||||
\ 'callback': 'ale_linters#dockerfile#hadolint#Handle',
|
||||
\})
|
||||
|
|
|
@ -11,9 +11,9 @@ function! ale_linters#elixir#credo#Handle(buffer, lines) abort
|
|||
let l:type = l:match[3]
|
||||
let l:text = l:match[4]
|
||||
|
||||
if l:type is# 'C'
|
||||
if l:type ==# 'C'
|
||||
let l:type = 'E'
|
||||
elseif l:type is# 'R'
|
||||
elseif l:type ==# 'R'
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
|
@ -32,6 +32,6 @@ endfunction
|
|||
call ale#linter#Define('elixir', {
|
||||
\ 'name': 'credo',
|
||||
\ 'executable': 'mix',
|
||||
\ 'command': 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s',
|
||||
\ 'command': 'mix credo suggest --format=flycheck --read-from-stdin %s',
|
||||
\ 'callback': 'ale_linters#elixir#credo#Handle',
|
||||
\})
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
" Author: Fran C. - https://github.com/franciscoj
|
||||
" Description: Add dialyzer support for elixir through dialyxir
|
||||
" https://github.com/jeremyjh/dialyxir
|
||||
|
||||
function! ale_linters#elixir#dialyxir#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" lib/filename.ex:19: Function fname/1 has no local return
|
||||
let l:pattern = '\v(.+):(\d+): (.+)$'
|
||||
let l:output = []
|
||||
let l:type = 'W'
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
if bufname(a:buffer) == l:match[1]
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': 0,
|
||||
\ 'type': l:type,
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elixir', {
|
||||
\ 'name': 'dialyxir',
|
||||
\ 'executable': 'mix',
|
||||
\ 'command': 'mix dialyzer',
|
||||
\ 'callback': 'ale_linters#elixir#dialyxir#Handle',
|
||||
\})
|
||||
|
|
@ -11,9 +11,9 @@ function! ale_linters#elixir#dogma#Handle(buffer, lines) abort
|
|||
let l:type = l:match[3]
|
||||
let l:text = l:match[4]
|
||||
|
||||
if l:type is# 'C'
|
||||
if l:type ==# 'C'
|
||||
let l:type = 'E'
|
||||
elseif l:type is# 'R'
|
||||
elseif l:type ==# 'R'
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
|
@ -32,7 +32,7 @@ endfunction
|
|||
call ale#linter#Define('elixir', {
|
||||
\ 'name': 'dogma',
|
||||
\ 'executable': 'mix',
|
||||
\ 'command': 'mix help dogma && mix dogma %s --format=flycheck',
|
||||
\ 'command': 'mix dogma %s --format=flycheck',
|
||||
\ 'lint_file': 1,
|
||||
\ 'callback': 'ale_linters#elixir#dogma#Handle',
|
||||
\})
|
||||
|
|
|
@ -1,46 +1,35 @@
|
|||
" Author: buffalocoder - https://github.com/buffalocoder, soywod - https://github.com/soywod
|
||||
" Author: buffalocoder - https://github.com/buffalocoder
|
||||
" Description: Elm linting in Ale. Closely follows the Syntastic checker in https://github.com/ElmCast/elm-vim.
|
||||
|
||||
call ale#Set('elm_make_executable', 'elm-make')
|
||||
call ale#Set('elm_make_use_global', 0)
|
||||
|
||||
function! ale_linters#elm#make#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'elm_make', [
|
||||
\ 'node_modules/.bin/elm-make',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#elm#make#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
let l:is_windows = has('win32')
|
||||
let l:temp_dir = l:is_windows ? $TMP : $TMPDIR
|
||||
let l:unparsed_lines = []
|
||||
for l:line in a:lines
|
||||
if l:line[0] is# '['
|
||||
if l:line[0] ==# '['
|
||||
let l:errors = json_decode(l:line)
|
||||
|
||||
for l:error in l:errors
|
||||
" Check if file is from the temp directory.
|
||||
" Filters out any errors not related to the buffer.
|
||||
if l:is_windows
|
||||
let l:file_is_buffer = l:error.file[0:len(l:temp_dir) - 1] is? l:temp_dir
|
||||
let l:file_is_buffer = l:error.file[0:len(l:temp_dir) - 1] ==? l:temp_dir
|
||||
else
|
||||
let l:file_is_buffer = l:error.file[0:len(l:temp_dir) - 1] is# l:temp_dir
|
||||
let l:file_is_buffer = l:error.file[0:len(l:temp_dir) - 1] ==# l:temp_dir
|
||||
endif
|
||||
|
||||
if l:file_is_buffer
|
||||
call add(l:output, {
|
||||
\ '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',
|
||||
\ 'type': (l:error.type ==? '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 !=# 'Successfully generated /dev/null'
|
||||
call add(l:unparsed_lines, l:line)
|
||||
endif
|
||||
endfor
|
||||
|
@ -61,7 +50,6 @@ endfunction
|
|||
" If it doesn't, then this will fail when imports are needed.
|
||||
function! ale_linters#elm#make#GetCommand(buffer) abort
|
||||
let l:elm_package = ale#path#FindNearestFile(a:buffer, 'elm-package.json')
|
||||
let l:elm_exe = ale_linters#elm#make#GetExecutable(a:buffer)
|
||||
if empty(l:elm_package)
|
||||
let l:dir_set_cmd = ''
|
||||
else
|
||||
|
@ -71,18 +59,16 @@ function! ale_linters#elm#make#GetCommand(buffer) abort
|
|||
|
||||
" The elm-make compiler, at the time of this writing, uses '/dev/null' as
|
||||
" a sort of flag to tell the compiler not to generate an output file,
|
||||
" which is why this is hard coded here. 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
|
||||
let l:elm_cmd = ale#Escape(l:elm_exe)
|
||||
\ . ' --report=json'
|
||||
\ . ' --output=/dev/null'
|
||||
let l:elm_cmd = 'elm-make --report=json --output='.ale#Escape('/dev/null')
|
||||
|
||||
return l:dir_set_cmd . ' ' . l:elm_cmd . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('elm', {
|
||||
\ 'name': 'make',
|
||||
\ 'executable_callback': 'ale_linters#elm#make#GetExecutable',
|
||||
\ 'executable': 'elm-make',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'command_callback': 'ale_linters#elm#make#GetCommand',
|
||||
\ 'callback': 'ale_linters#elm#make#Handle'
|
||||
|
|
|
@ -17,7 +17,7 @@ function! ale_linters#erlang#erlc#Handle(buffer, lines) abort
|
|||
" error.erl:4: variable 'B' is unbound
|
||||
" error.erl:3: Warning: function main/0 is unused
|
||||
" error.erl:4: Warning: variable 'A' is unused
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+): (Warning: )?(.+)$'
|
||||
let l:pattern = '\v^([^:]+):(\d+): (Warning: )?(.+)$'
|
||||
|
||||
" parse_transforms are a special case. The error message does not indicate a location:
|
||||
" error.erl: undefined parse transform 'some_parse_transform'
|
||||
|
@ -27,7 +27,7 @@ function! ale_linters#erlang#erlc#Handle(buffer, lines) abort
|
|||
let l:pattern_no_module_definition = '\v(no module definition)$'
|
||||
let l:pattern_unused = '\v(.* is unused)$'
|
||||
|
||||
let l:is_hrl = fnamemodify(bufname(a:buffer), ':e') is# 'hrl'
|
||||
let l:is_hrl = fnamemodify(bufname(a:buffer), ':e') ==# 'hrl'
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
|
|
@ -1,53 +0,0 @@
|
|||
" Author: Dmitri Vereshchagin <dmitri.vereshchagin@gmail.com>
|
||||
" Description: SyntaxErl linter for Erlang files
|
||||
|
||||
call ale#Set('erlang_syntaxerl_executable', 'syntaxerl')
|
||||
|
||||
|
||||
function! ale_linters#erlang#syntaxerl#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'erlang_syntaxerl_executable')
|
||||
endfunction
|
||||
|
||||
|
||||
function! ale_linters#erlang#syntaxerl#FeatureCheck(buffer) abort
|
||||
return s:GetEscapedExecutable(a:buffer) . ' -h'
|
||||
endfunction
|
||||
|
||||
|
||||
function! ale_linters#erlang#syntaxerl#GetCommand(buffer, output) abort
|
||||
let l:use_b_option = match(a:output, '\C\V-b, --base\>') > -1
|
||||
|
||||
return s:GetEscapedExecutable(a:buffer) . (l:use_b_option ? ' -b %s %t' : ' %t')
|
||||
endfunction
|
||||
|
||||
|
||||
function! ale_linters#erlang#syntaxerl#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v\C:(\d+):( warning:)? (.+)'
|
||||
let l:loclist = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:loclist, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'text': l:match[3],
|
||||
\ 'type': empty(l:match[2]) ? 'E' : 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:loclist
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:GetEscapedExecutable(buffer) abort
|
||||
return ale#Escape(ale_linters#erlang#syntaxerl#GetExecutable(a:buffer))
|
||||
endfunction
|
||||
|
||||
|
||||
call ale#linter#Define('erlang', {
|
||||
\ 'name': 'syntaxerl',
|
||||
\ 'executable_callback': 'ale_linters#erlang#syntaxerl#GetExecutable',
|
||||
\ 'command_chain': [
|
||||
\ {'callback': 'ale_linters#erlang#syntaxerl#FeatureCheck'},
|
||||
\ {'callback': 'ale_linters#erlang#syntaxerl#GetCommand'},
|
||||
\ ],
|
||||
\ 'callback': 'ale_linters#erlang#syntaxerl#Handle',
|
||||
\})
|
|
@ -1,25 +0,0 @@
|
|||
" Author: Matthias Guenther - https://wikimatze.de, Eddie Lebow https://github.com/elebow
|
||||
" Description: ERB from the Ruby standard library, for eruby/erb files
|
||||
|
||||
function! ale_linters#eruby#erb#GetCommand(buffer) abort
|
||||
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
|
||||
|
||||
if empty(l:rails_root)
|
||||
return 'erb -P -T - -x %t | ruby -c'
|
||||
endif
|
||||
|
||||
" Rails-flavored eRuby does not comply with the standard as understood by
|
||||
" ERB, so we'll have to do some substitution. This does not reduce the
|
||||
" effectiveness of the linter—the translated code is still evaluated.
|
||||
return 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('eruby', {
|
||||
\ 'name': 'erb',
|
||||
\ 'aliases': ['erubylint'],
|
||||
\ 'executable': 'erb',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command_callback': 'ale_linters#eruby#erb#GetCommand',
|
||||
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
|
||||
\})
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
" Author: Eddie Lebow https://github.com/elebow
|
||||
" Description: eruby checker using `erubi`
|
||||
|
||||
function! ale_linters#eruby#erubi#CheckErubi(buffer) abort
|
||||
return 'ruby -r erubi/capture_end -e ' . ale#Escape('""')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#eruby#erubi#GetCommand(buffer, check_erubi_output) abort
|
||||
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
|
||||
|
||||
if (!empty(a:check_erubi_output))
|
||||
" The empty command in CheckErubi returns nothing if erubi runs and
|
||||
" emits an error if erubi is not present
|
||||
return ''
|
||||
endif
|
||||
|
||||
if empty(l:rails_root)
|
||||
return 'ruby -r erubi/capture_end -e ' . ale#Escape('puts Erubi::CaptureEndEngine.new($stdin.read).src') . '< %t | ruby -c'
|
||||
endif
|
||||
|
||||
" Rails-flavored eRuby does not comply with the standard as understood by
|
||||
" Erubi, so we'll have to do some substitution. This does not reduce the
|
||||
" effectiveness of the linter---the translated code is still evaluated.
|
||||
return 'ruby -r erubi/capture_end -e ' . ale#Escape('puts Erubi::CaptureEndEngine.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('eruby', {
|
||||
\ 'name': 'erubi',
|
||||
\ 'executable': 'ruby',
|
||||
\ 'command_chain': [
|
||||
\ {'callback': 'ale_linters#eruby#erubi#CheckErubi'},
|
||||
\ {'callback': 'ale_linters#eruby#erubi#GetCommand', 'output_stream': 'stderr'},
|
||||
\ ],
|
||||
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
|
||||
\})
|
|
@ -1,23 +0,0 @@
|
|||
" Author: Jake Zimmerman <jake@zimmerman.io>, Eddie Lebow https://github.com/elebow
|
||||
" Description: eruby checker using `erubis`, instead of `erb`
|
||||
|
||||
function! ale_linters#eruby#erubis#GetCommand(buffer) abort
|
||||
let l:rails_root = ale#ruby#FindRailsRoot(a:buffer)
|
||||
|
||||
if empty(l:rails_root)
|
||||
return 'erubis -x %t | ruby -c'
|
||||
endif
|
||||
|
||||
" Rails-flavored eRuby does not comply with the standard as understood by
|
||||
" Erubis, so we'll have to do some substitution. This does not reduce the
|
||||
" effectiveness of the linter - the translated code is still evaluated.
|
||||
return 'ruby -r erubis -e ' . ale#Escape('puts Erubis::Eruby.new($stdin.read.gsub(%{<%=},%{<%})).src') . '< %t | ruby -c'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('eruby', {
|
||||
\ 'name': 'erubis',
|
||||
\ 'executable': 'erubis',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command_callback': 'ale_linters#eruby#erubis#GetCommand',
|
||||
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
|
||||
\})
|
11
ale_linters/eruby/erubylint.vim
Normal file
11
ale_linters/eruby/erubylint.vim
Normal file
|
@ -0,0 +1,11 @@
|
|||
" Author: Matthias Guenther - https://wikimatze.de
|
||||
" Description: erb-lint for eruby/erb files
|
||||
|
||||
call ale#linter#Define('eruby', {
|
||||
\ 'name': 'erubylint',
|
||||
\ 'executable': 'erb',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command': 'erb -P -x %t | ruby -c',
|
||||
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
|
||||
\})
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
" Author: Niraj Thapaliya - https://github.com/nthapaliya
|
||||
" Description: Lints fish files using fish -n
|
||||
|
||||
function! ale_linters#fish#fish#Handle(buffer, lines) abort
|
||||
" Matches patterns such as:
|
||||
"
|
||||
" home/.config/fish/functions/foo.fish (line 1): Missing end to balance this function definition
|
||||
" function foo
|
||||
" ^
|
||||
" <W> fish: Error while reading file .config/fish/functions/foo.fish
|
||||
let l:pattern = '^.* (line \(\d\+\)): \(.*\)$'
|
||||
let l:output = []
|
||||
|
||||
let l:i = 0
|
||||
while l:i < len(a:lines)
|
||||
let l:match = matchlist(a:lines[l:i], l:pattern)
|
||||
if len(l:match) && len(l:match[2])
|
||||
call add(l:output, {
|
||||
\ 'col': len(a:lines[l:i + 2]),
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'text': l:match[2],
|
||||
\})
|
||||
endif
|
||||
let l:i += 1
|
||||
endwhile
|
||||
|
||||
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',
|
||||
\})
|
|
@ -44,7 +44,7 @@ function! ale_linters#fortran#gcc#Handle(buffer, lines) abort
|
|||
|
||||
" Now we have the text, we can set it and add the error.
|
||||
let l:last_loclist_obj.text = l:match[2]
|
||||
let l:last_loclist_obj.type = l:match[1] is# 'Warning' ? 'W' : 'E'
|
||||
let l:last_loclist_obj.type = l:match[1] ==# 'Warning' ? 'W' : 'E'
|
||||
call add(l:output, l:last_loclist_obj)
|
||||
else
|
||||
let l:last_loclist_obj = {
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
" Author: Jansen Mitchell https://github.com/JansenMitchell
|
||||
" Description: proselint for Fountain files
|
||||
|
||||
call ale#linter#Define('fountain', {
|
||||
\ 'name': 'proselint',
|
||||
\ 'executable': 'proselint',
|
||||
\ 'command': 'proselint %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
|
@ -1,52 +0,0 @@
|
|||
" 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', 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',
|
||||
\})
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
" Author: Sven-Hendrik Haase <svenstaro@gmail.com>
|
||||
" Description: glslang-based linter for glsl files
|
||||
"
|
||||
" TODO: Once https://github.com/KhronosGroup/glslang/pull/1047 is accepted,
|
||||
" we can use stdin.
|
||||
|
||||
let g:ale_glsl_glslang_executable =
|
||||
\ get(g:, 'ale_glsl_glslang_executable', 'glslangValidator')
|
||||
|
||||
let g:ale_glsl_glslang_options = get(g:, 'ale_glsl_glslang_options', '')
|
||||
|
||||
function! ale_linters#glsl#glslang#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'glsl_glslang_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#glsl#glslang#GetCommand(buffer) abort
|
||||
return ale_linters#glsl#glslang#GetExecutable(a:buffer)
|
||||
\ . ' ' . ale#Var(a:buffer, 'glsl_glslang_options')
|
||||
\ . ' ' . '-C %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#glsl#glslang#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
"
|
||||
" ERROR: 0:5: 'foo' : undeclared identifier
|
||||
let l:pattern = '^\(.\+\): \(\d\+\):\(\d\+\): \(.\+\)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[3]),
|
||||
\ 'col': str2nr(l:match[2]),
|
||||
\ 'text': l:match[4],
|
||||
\ 'type': l:match[1] is# 'ERROR' ? 'E' : 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('glsl', {
|
||||
\ 'name': 'glslang',
|
||||
\ 'executable_callback': 'ale_linters#glsl#glslang#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#glsl#glslang#GetCommand',
|
||||
\ 'callback': 'ale_linters#glsl#glslang#Handle',
|
||||
\})
|
|
@ -1,38 +0,0 @@
|
|||
" Author: Sven-Hendrik Haase <svenstaro@gmail.com>
|
||||
" Description: A language server for glsl
|
||||
|
||||
call ale#Set('glsl_glslls_executable', 'glslls')
|
||||
call ale#Set('glsl_glslls_logfile', '')
|
||||
|
||||
function! ale_linters#glsl#glslls#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'glsl_glslls_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#glsl#glslls#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#glsl#glslls#GetExecutable(a:buffer)
|
||||
let l:logfile = ale#Var(a:buffer, 'glsl_glslls_logfile')
|
||||
let l:logfile_args = ''
|
||||
if l:logfile isnot# ''
|
||||
let l:logfile_args = ' --verbose -l ' . l:logfile
|
||||
endif
|
||||
return ale#Escape(l:executable) . l:logfile_args . ' --stdin'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#glsl#glslls#GetLanguage(buffer) abort
|
||||
return 'glsl'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#glsl#glslls#GetProjectRoot(buffer) abort
|
||||
let l:project_root = ale#c#FindProjectRoot(a:buffer)
|
||||
|
||||
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h:h') : ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('glsl', {
|
||||
\ 'name': 'glslls',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#glsl#glslls#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#glsl#glslls#GetCommand',
|
||||
\ 'language_callback': 'ale_linters#glsl#glslls#GetLanguage',
|
||||
\ 'project_root_callback': 'ale_linters#glsl#glslls#GetProjectRoot',
|
||||
\})
|
|
@ -1,14 +1,8 @@
|
|||
" Author: Joshua Rubin <joshua@rubixconsulting.com>, Ben Reedy <https://github.com/breed808>,
|
||||
" Jeff Willette <jrwillette88@gmail.com>
|
||||
" Author: Joshua Rubin <joshua@rubixconsulting.com>, Ben Reedy <https://github.com/breed808>
|
||||
" Description: go build for Go files
|
||||
|
||||
" inspired by work from dzhou121 <dzhou121@gmail.com>
|
||||
|
||||
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
|
||||
if exists('s:go_env')
|
||||
return ''
|
||||
|
@ -18,8 +12,6 @@ function! ale_linters#go#gobuild#GoEnv(buffer) abort
|
|||
endfunction
|
||||
|
||||
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')
|
||||
let s:go_env = {
|
||||
\ 'GOPATH': a:goenv_output[0],
|
||||
|
@ -27,16 +19,10 @@ function! ale_linters#go#gobuild#GetCommand(buffer, goenv_output) abort
|
|||
\}
|
||||
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
|
||||
return l:gopath_env_command
|
||||
\ . ale#path#BufferCdString(a:buffer)
|
||||
\ . 'go test'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' -c -o /dev/null ./'
|
||||
return 'GOPATH=' . s:go_env.GOPATH
|
||||
\ . ' cd ' . fnamemodify(bufname(a:buffer), ':.:h')
|
||||
\ . ' && go test -c -o /dev/null ./'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gobuild#GetMatches(lines) abort
|
||||
|
@ -53,12 +39,15 @@ function! ale_linters#go#gobuild#GetMatches(lines) abort
|
|||
endfunction
|
||||
|
||||
function! ale_linters#go#gobuild#Handler(buffer, lines) abort
|
||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale_linters#go#gobuild#GetMatches(a:lines)
|
||||
" Omit errors from imported go packages
|
||||
if !ale#path#IsBufferPath(a:buffer, l:match[1])
|
||||
continue
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[4],
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'golint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': 'golint',
|
||||
\ 'command': 'golint %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
|
|
|
@ -1,32 +1,16 @@
|
|||
" Author: Ben Reedy <https://github.com/breed808>, Jeff Willette <jrwillette88@gmail.com>
|
||||
" Author: Ben Reedy <https://github.com/breed808>
|
||||
" Description: Adds support for the gometalinter suite for Go files
|
||||
|
||||
call ale#Set('go_gometalinter_options', '')
|
||||
call ale#Set('go_gometalinter_executable', 'gometalinter')
|
||||
call ale#Set('go_gometalinter_lint_package', 0)
|
||||
|
||||
function! ale_linters#go#gometalinter#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'go_gometalinter_executable')
|
||||
endfunction
|
||||
if !exists('g:ale_go_gometalinter_options')
|
||||
let g:ale_go_gometalinter_options = ''
|
||||
endif
|
||||
|
||||
function! ale_linters#go#gometalinter#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#go#gometalinter#GetExecutable(a:buffer)
|
||||
let l:filename = expand('#' . a:buffer . ':t')
|
||||
let l:options = ale#Var(a:buffer, 'go_gometalinter_options')
|
||||
let l:lint_package = ale#Var(a:buffer, 'go_gometalinter_lint_package')
|
||||
let l:filename = expand('#' . a:buffer . ':p')
|
||||
|
||||
" BufferCdString is used so that we can be sure the paths output from gometalinter can
|
||||
" be calculated to absolute paths in the Handler
|
||||
if l:lint_package
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#Escape(l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||
endif
|
||||
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . ale#Escape(l:executable)
|
||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(l:filename))
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||
return 'gometalinter --include=''^' . l:filename . '.*$'' '
|
||||
\ . ale#Var(a:buffer, 'go_gometalinter_options')
|
||||
\ . ' ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||
endfunction
|
||||
|
||||
function! ale_linters#go#gometalinter#GetMatches(lines) abort
|
||||
|
@ -36,16 +20,13 @@ function! ale_linters#go#gometalinter#GetMatches(lines) abort
|
|||
endfunction
|
||||
|
||||
function! ale_linters#go#gometalinter#Handler(buffer, lines) abort
|
||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale_linters#go#gometalinter#GetMatches(a:lines)
|
||||
" l:match[1] will already be an absolute path, output from gometalinter
|
||||
call add(l:output, {
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': tolower(l:match[4]) is# 'warning' ? 'W' : 'E',
|
||||
\ 'type': tolower(l:match[4]) ==# 'warning' ? 'W' : 'E',
|
||||
\ 'text': l:match[5],
|
||||
\})
|
||||
endfor
|
||||
|
@ -55,7 +36,7 @@ endfunction
|
|||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'gometalinter',
|
||||
\ 'executable_callback': 'ale_linters#go#gometalinter#GetExecutable',
|
||||
\ 'executable': 'gometalinter',
|
||||
\ 'command_callback': 'ale_linters#go#gometalinter#GetCommand',
|
||||
\ 'callback': 'ale_linters#go#gometalinter#Handler',
|
||||
\ 'lint_file': 1,
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
call ale#linter#Define('go', {
|
||||
\ 'name': 'gosimple',
|
||||
\ 'executable': 'gosimple',
|
||||
\ 'command': 'gosimple %s',
|
||||
\ 'command': 'gosimple %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
" Author: Jelte Fennema <github-public@jeltef.nl>
|
||||
" Description: gotype for Go files
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'gotype',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'gotype',
|
||||
\ 'command_callback': 'ale_linters#go#gotype#GetCommand',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsError',
|
||||
\})
|
||||
|
||||
"\ 'command':
|
||||
function! ale_linters#go#gotype#GetCommand(buffer) abort
|
||||
let l:cur_file = expand('#' . a:buffer . ':p')
|
||||
if l:cur_file =~# '_test\.go$'
|
||||
return
|
||||
endif
|
||||
|
||||
let l:module_files = globpath(expand('#' . a:buffer . ':p:h'), '*.go', 0, 1)
|
||||
let l:other_module_files = filter(l:module_files, 'v:val isnot# ' . ale#util#EscapeVim(l:cur_file) . ' && v:val !~# "_test\.go$"')
|
||||
return 'gotype %t ' . join(map(l:other_module_files, 'ale#Escape(v:val)'))
|
||||
|
||||
endfunction
|
|
@ -1,35 +1,10 @@
|
|||
" Author: neersighted <bjorn@neersighted.com>
|
||||
" 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
|
||||
|
||||
function! ale_linters#go#govet#Handler(buffer, lines) abort
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?:? ?(.+)$'
|
||||
let l:output = []
|
||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[4],
|
||||
\ 'type': 'E',
|
||||
\})
|
||||
endfor
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'go vet',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'go',
|
||||
\ 'command_callback': 'ale_linters#go#govet#GetCommand',
|
||||
\ 'callback': 'ale_linters#go#govet#Handler',
|
||||
\ 'lint_file': 1,
|
||||
\ 'command': 'go vet %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsError',
|
||||
\})
|
||||
|
|
|
@ -1,33 +1,9 @@
|
|||
" Author: Ben Reedy <https://github.com/breed808>
|
||||
" Description: staticcheck for Go files
|
||||
|
||||
call ale#Set('go_staticcheck_options', '')
|
||||
call ale#Set('go_staticcheck_lint_package', 0)
|
||||
|
||||
function! ale_linters#go#staticcheck#GetCommand(buffer) abort
|
||||
let l:filename = expand('#' . a:buffer . ':t')
|
||||
let l:options = ale#Var(a:buffer, 'go_staticcheck_options')
|
||||
let l:lint_package = ale#Var(a:buffer, 'go_staticcheck_lint_package')
|
||||
|
||||
" BufferCdString is used so that we can be sure the paths output from
|
||||
" staticcheck can be calculated to absolute paths in the Handler
|
||||
if l:lint_package
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . 'staticcheck'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
||||
endif
|
||||
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . 'staticcheck'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' ' . ale#Escape(l:filename)
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('go', {
|
||||
\ 'name': 'staticcheck',
|
||||
\ 'executable': 'staticcheck',
|
||||
\ 'command_callback': 'ale_linters#go#staticcheck#GetCommand',
|
||||
\ 'command': 'staticcheck %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
" Author: Benjie Gillam <code@benjiegillam.com>
|
||||
" Description: eslint for GraphQL files
|
||||
|
||||
call ale#linter#Define('graphql', {
|
||||
\ 'name': 'eslint',
|
||||
\ 'executable_callback': 'ale#handlers#eslint#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#eslint#GetCommand',
|
||||
\ 'callback': 'ale#handlers#eslint#Handle',
|
||||
\})
|
|
@ -1,9 +0,0 @@
|
|||
" Author: Michiel Westerbeek <happylinks@gmail.com>
|
||||
" Description: Linter for GraphQL Schemas
|
||||
|
||||
call ale#linter#Define('graphql', {
|
||||
\ 'name': 'gqlint',
|
||||
\ 'executable': 'gqlint',
|
||||
\ 'command': 'gqlint --reporter=simple %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
|
@ -1,31 +1,6 @@
|
|||
" Author: Patrick Lewis - https://github.com/patricklewis, thenoseman - https://github.com/thenoseman
|
||||
" Author: Patrick Lewis - https://github.com/patricklewis
|
||||
" Description: haml-lint for Haml files
|
||||
|
||||
function! ale_linters#haml#hamllint#GetCommand(buffer) abort
|
||||
let l:prefix = ''
|
||||
|
||||
let l:rubocop_config_file_path = ale#path#FindNearestFile(a:buffer, '.rubocop.yml')
|
||||
let l:hamllint_config_file_path = ale#path#FindNearestFile(a:buffer, '.haml-lint.yml')
|
||||
|
||||
" Set HAML_LINT_RUBOCOP_CONF variable as it is needed for haml-lint to
|
||||
" pick up the rubocop config.
|
||||
"
|
||||
" See https://github.com/brigade/haml-lint/blob/master/lib/haml_lint/linter/rubocop.rb#L89
|
||||
" HamlLint::Linter::RuboCop#rubocop_flags
|
||||
if !empty(l:rubocop_config_file_path)
|
||||
if ale#Has('win32')
|
||||
let l:prefix = 'set HAML_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config_file_path) . ' &&'
|
||||
else
|
||||
let l:prefix = 'HAML_LINT_RUBOCOP_CONF=' . ale#Escape(l:rubocop_config_file_path)
|
||||
endif
|
||||
endif
|
||||
|
||||
return (!empty(l:prefix) ? l:prefix . ' ' : '')
|
||||
\ . 'haml-lint'
|
||||
\ . (!empty(l:hamllint_config_file_path) ? ' --config ' . ale#Escape(l:hamllint_config_file_path) : '')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#haml#hamllint#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
" <path>:51 [W] RuboCop: Use the new Ruby 1.9 hash syntax.
|
||||
|
@ -46,6 +21,6 @@ endfunction
|
|||
call ale#linter#Define('haml', {
|
||||
\ 'name': 'hamllint',
|
||||
\ 'executable': 'haml-lint',
|
||||
\ 'command_callback': 'ale_linters#haml#hamllint#GetCommand',
|
||||
\ 'command': 'haml-lint %t',
|
||||
\ 'callback': 'ale_linters#haml#hamllint#Handle'
|
||||
\})
|
||||
|
|
|
@ -16,19 +16,27 @@ function! ale_linters#handlebars#embertemplatelint#GetCommand(buffer) abort
|
|||
endfunction
|
||||
|
||||
function! ale_linters#handlebars#embertemplatelint#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
let l:json = ale#util#FuzzyJSONDecode(a:lines, {})
|
||||
if len(a:lines) == 0
|
||||
return []
|
||||
endif
|
||||
|
||||
for l:error in get(values(l:json), 0, [])
|
||||
let l:output = []
|
||||
|
||||
let l:input_json = json_decode(join(a:lines, ''))
|
||||
let l:file_errors = values(l:input_json)[0]
|
||||
|
||||
for l:error in l:file_errors
|
||||
if has_key(l:error, 'fatal')
|
||||
call add(l:output, {
|
||||
\ 'lnum': get(l:error, 'line', 1),
|
||||
\ 'col': get(l:error, 'column', 1),
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': 1,
|
||||
\ 'col': 1,
|
||||
\ 'text': l:error.message,
|
||||
\ 'type': l:error.severity == 1 ? 'W' : 'E',
|
||||
\})
|
||||
else
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:error.line,
|
||||
\ 'col': l:error.column,
|
||||
\ 'text': l:error.rule . ': ' . l:error.message,
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'ghc-mod',
|
||||
\ 'executable': 'ghc-mod',
|
||||
\ 'command': 'ghc-mod --map-file %s=%t check %s',
|
||||
\ 'command': 'ghc-mod check %t',
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'stack-ghc-mod',
|
||||
\ 'executable': 'stack',
|
||||
\ 'command': 'stack exec ghc-mod -- --map-file %s=%t check %s',
|
||||
\ 'command': 'stack exec ghc-mod check %t',
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" 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', {
|
||||
\ 'name': 'ghc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'ghc',
|
||||
\ 'command_callback': 'ale_linters#haskell#ghc#GetCommand',
|
||||
\ 'command': 'ghc -fno-code -v0 %t',
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'stack-ghc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'stack',
|
||||
\ 'command': 'stack ghc -- -fno-code -v0 %t',
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
||||
|
|
|
@ -1,22 +1,9 @@
|
|||
" Author: rob-b, Takano Akio <tak@anoak.io>
|
||||
" Author: rob-b
|
||||
" Description: hdevtools for Haskell files
|
||||
|
||||
call ale#Set('haskell_hdevtools_executable', 'hdevtools')
|
||||
call ale#Set('haskell_hdevtools_options', '-g -Wall')
|
||||
|
||||
function! ale_linters#haskell#hdevtools#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'haskell_hdevtools_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#haskell#hdevtools#GetCommand(buffer) abort
|
||||
return ale#Escape(ale_linters#haskell#hdevtools#GetExecutable(a:buffer))
|
||||
\ . ' check ' . ale#Var(a:buffer, 'haskell_hdevtools_options')
|
||||
\ . ' -p %s %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'hdevtools',
|
||||
\ 'executable_callback': 'ale_linters#haskell#hdevtools#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#haskell#hdevtools#GetCommand',
|
||||
\ 'executable': 'hdevtools',
|
||||
\ 'command': 'hdevtools check -g -Wall -p %s %t',
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
||||
|
|
|
@ -2,24 +2,17 @@
|
|||
" Description: hlint for Haskell files
|
||||
|
||||
function! ale_linters#haskell#hlint#Handle(buffer, lines) abort
|
||||
let l:errors = json_decode(join(a:lines, ''))
|
||||
|
||||
let l:output = []
|
||||
|
||||
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
|
||||
if l:error.severity is# 'Error'
|
||||
let l:type = 'E'
|
||||
elseif l:error.severity is# 'Suggestion'
|
||||
let l:type = 'I'
|
||||
else
|
||||
let l:type = 'W'
|
||||
endif
|
||||
|
||||
for l:error in l:errors
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:error.startLine),
|
||||
\ 'col': str2nr(l:error.startColumn),
|
||||
\ 'end_lnum': str2nr(l:error.endLine),
|
||||
\ 'end_col': str2nr(l:error.endColumn),
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:error.startLine + 0,
|
||||
\ 'col': l:error.startColumn + 0,
|
||||
\ 'text': l:error.severity . ': ' . l:error.hint . '. Found: ' . l:error.from . ' Why not: ' . l:error.to,
|
||||
\ 'type': l:type,
|
||||
\ 'type': l:error.severity ==# 'Error' ? 'E' : 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
" Author: Jake Zimmerman <jake@zimmerman.io>
|
||||
" Description: Like stack-ghc, but for entire projects
|
||||
"
|
||||
" Note: Ideally, this would *only* typecheck. Right now, it also does codegen.
|
||||
" See <https://github.com/commercialhaskell/stack/issues/977>.
|
||||
|
||||
call ale#Set('haskell_stack_build_options', '--fast')
|
||||
|
||||
function! ale_linters#haskell#stack_build#GetCommand(buffer) abort
|
||||
let l:flags = ale#Var(a:buffer, 'haskell_stack_build_options')
|
||||
|
||||
return 'stack build ' . l:flags
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'stack-build',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'stack',
|
||||
\ 'command_callback': 'ale_linters#haskell#stack_build#GetCommand',
|
||||
\ 'lint_file': 1,
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
|
@ -1,10 +0,0 @@
|
|||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: ghc for Haskell files, using Stack
|
||||
|
||||
call ale#linter#Define('haskell', {
|
||||
\ 'name': 'stack-ghc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'stack',
|
||||
\ 'command': 'stack ghc -- -fno-code -v0 %t',
|
||||
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
|
||||
\})
|
|
@ -1,11 +0,0 @@
|
|||
" Author: Johannes Wienke <languitar@semipol.de>
|
||||
" Description: alex for help files
|
||||
|
||||
call ale#linter#Define('help', {
|
||||
\ 'name': 'alex',
|
||||
\ 'executable': 'alex',
|
||||
\ 'command': 'alex %s -t',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale#handlers#alex#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
|
@ -1,9 +0,0 @@
|
|||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for vim Help files
|
||||
|
||||
call ale#linter#Define('help', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
|
@ -1,11 +0,0 @@
|
|||
" Author: Johannes Wienke <languitar@semipol.de>
|
||||
" Description: alex for HTML files
|
||||
|
||||
call ale#linter#Define('html', {
|
||||
\ 'name': 'alex',
|
||||
\ 'executable': 'alex',
|
||||
\ 'command': 'alex %s -t',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale#handlers#alex#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
|
@ -1,7 +1,7 @@
|
|||
" Author: KabbAmine <amine.kabb@gmail.com>, deathmaz <00maz1987@gmail.com>, diartyz <diartyz@gmail.com>
|
||||
" Description: HTMLHint for checking html files
|
||||
|
||||
call ale#Set('html_htmlhint_options', '')
|
||||
call ale#Set('html_htmlhint_options', '--format=unix')
|
||||
call ale#Set('html_htmlhint_executable', 'htmlhint')
|
||||
call ale#Set('html_htmlhint_use_global', 0)
|
||||
|
||||
|
@ -12,22 +12,9 @@ function! ale_linters#html#htmlhint#GetExecutable(buffer) abort
|
|||
endfunction
|
||||
|
||||
function! ale_linters#html#htmlhint#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'html_htmlhint_options')
|
||||
let l:config = l:options !~# '--config'
|
||||
\ ? 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'
|
||||
return ale_linters#html#htmlhint#GetExecutable(a:buffer)
|
||||
\ . ' ' . ale#Var(a:buffer, 'html_htmlhint_options')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('html', {
|
||||
|
|
|
@ -25,16 +25,8 @@ function! ale_linters#html#tidy#GetCommand(buffer) abort
|
|||
\ 'utf-8': '-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 -',
|
||||
\ l:executable,
|
||||
\ ale#Var(a:buffer, 'html_tidy_executable'),
|
||||
\ ale#Var(a:buffer, 'html_tidy_options'),
|
||||
\ l:file_encoding
|
||||
\)
|
||||
|
@ -54,7 +46,7 @@ function! ale_linters#html#tidy#Handle(buffer, lines) abort
|
|||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:line = l:match[1] + 0
|
||||
let l:col = l:match[2] + 0
|
||||
let l:type = l:match[3] is# 'Error' ? 'E' : 'W'
|
||||
let l:type = l:match[3] ==# 'Error' ? 'E' : 'W'
|
||||
let l:text = l:match[4]
|
||||
|
||||
call add(l:output, {
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for nroff files
|
||||
|
||||
call ale#linter#Define('html', {
|
||||
\ 'name': 'write-good',
|
||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
||||
\})
|
|
@ -1,87 +0,0 @@
|
|||
" Author: Scott Bonds <scott@ggr.com>
|
||||
" Description: default Idris compiler
|
||||
|
||||
call ale#Set('idris_idris_executable', 'idris')
|
||||
call ale#Set('idris_idris_options', '--total --warnpartial --warnreach --warnipkg')
|
||||
|
||||
function! ale_linters#idris#idris#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'idris_idris_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#idris#idris#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'idris_idris_options')
|
||||
|
||||
return ale#Escape(ale_linters#idris#idris#GetExecutable(a:buffer))
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' --check %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#idris#idris#Handle(buffer, lines) abort
|
||||
" This was copied almost verbatim from ale#handlers#haskell#HandleGHCFormat
|
||||
|
||||
" Look for lines like the following:
|
||||
" foo.idr:2:6:When checking right hand side of main with expected type
|
||||
" bar.idr:11:11-13:
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)(-\d+)?:(.*)?$'
|
||||
let l:output = []
|
||||
|
||||
let l:corrected_lines = []
|
||||
|
||||
for l:line in a:lines
|
||||
if len(matchlist(l:line, l:pattern)) > 0
|
||||
call add(l:corrected_lines, l:line)
|
||||
elseif len(l:corrected_lines) > 0
|
||||
if l:line is# ''
|
||||
let l:corrected_lines[-1] .= ' ' " turn a blank line into a space
|
||||
else
|
||||
let l:corrected_lines[-1] .= l:line
|
||||
endif
|
||||
let l:corrected_lines[-1] = substitute(l:corrected_lines[-1], '\s\+', ' ', 'g')
|
||||
endif
|
||||
endfor
|
||||
|
||||
for l:line in l:corrected_lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
continue
|
||||
endif
|
||||
|
||||
if !ale#path#IsBufferPath(a:buffer, l:match[1])
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:errors = matchlist(l:match[5], '\v([wW]arning|[eE]rror) - ?(.*)')
|
||||
|
||||
if len(l:errors) > 0
|
||||
let l:ghc_type = l:errors[1]
|
||||
let l:text = l:errors[2]
|
||||
else
|
||||
let l:ghc_type = ''
|
||||
let l:text = l:match[5][:0] is# ' ' ? l:match[5][1:] : l:match[5]
|
||||
endif
|
||||
|
||||
if l:ghc_type is? 'Warning'
|
||||
let l:type = 'W'
|
||||
else
|
||||
let l:type = 'E'
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type,
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('idris', {
|
||||
\ 'name': 'idris',
|
||||
\ 'executable_callback': 'ale_linters#idris#idris#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#idris#idris#GetCommand',
|
||||
\ 'callback': 'ale_linters#idris#idris#Handle',
|
||||
\})
|
||||
|
|
@ -2,17 +2,27 @@
|
|||
" Description: checkstyle for Java files
|
||||
|
||||
function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v\[(WARN|ERROR)\] [a-zA-Z]?:?[^:]+:(\d+):(\d+)?:? (.*) \[(.+)\]$'
|
||||
let l:patterns = [
|
||||
\ '\v\[(WARN|ERROR)\] .*:(\d+):(\d+): (.*)',
|
||||
\ '\v\[(WARN|ERROR)\] .*:(\d+): (.*)',
|
||||
\]
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'type': l:match[1] is? 'WARN' ? 'W' : 'E',
|
||||
for l:match in ale#util#GetMatches(a:lines, l:patterns)
|
||||
let l:args = {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[4],
|
||||
\ 'code': l:match[5],
|
||||
\})
|
||||
\ 'type': l:match[1] =~? 'WARN' ? 'W' : 'E'
|
||||
\ }
|
||||
|
||||
let l:col = l:match[3] + 0
|
||||
if l:col > 0
|
||||
let l:args['col'] = l:col
|
||||
let l:args['text'] = l:match[4]
|
||||
else
|
||||
let l:args['text'] = l:match[3]
|
||||
endif
|
||||
|
||||
call add(l:output, l:args)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
|
|
|
@ -14,11 +14,6 @@ function! ale_linters#java#javac#GetImportPaths(buffer) abort
|
|||
\ . 'mvn dependency:build-classpath'
|
||||
endif
|
||||
|
||||
let l:classpath_command = ale#gradle#BuildClasspathCommand(a:buffer)
|
||||
if !empty(l:classpath_command)
|
||||
return l:classpath_command
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
|
@ -41,42 +36,15 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort
|
|||
|
||||
" Find the src directory, for files in this project.
|
||||
let l:src_dir = ale#path#FindNearestDirectory(a:buffer, 'src/main/java')
|
||||
let l:sp_dirs = []
|
||||
|
||||
if !empty(l:src_dir)
|
||||
call add(l:sp_dirs, l:src_dir)
|
||||
|
||||
" Automatically include the jaxb directory too, if it's there.
|
||||
let l:jaxb_dir = fnamemodify(l:src_dir, ':h:h')
|
||||
\ . (has('win32') ? '\jaxb\' : '/jaxb/')
|
||||
|
||||
if isdirectory(l:jaxb_dir)
|
||||
call add(l:sp_dirs, l:jaxb_dir)
|
||||
endif
|
||||
|
||||
" Automatically include the test directory, but only for test code.
|
||||
if expand('#' . a:buffer . ':p') =~? '\vsrc[/\\]test[/\\]java'
|
||||
let l:test_dir = fnamemodify(l:src_dir, ':h:h:h')
|
||||
\ . (has('win32') ? '\test\java\' : '/test/java/')
|
||||
|
||||
if isdirectory(l:test_dir)
|
||||
call add(l:sp_dirs, l:test_dir)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if !empty(l:sp_dirs)
|
||||
let l:sp_option = '-sourcepath '
|
||||
\ . ale#Escape(join(l:sp_dirs, s:classpath_sep))
|
||||
let l:sp_option = '-sourcepath ' . ale#Escape(l:src_dir)
|
||||
endif
|
||||
|
||||
" Create .class files in a temporary directory, which we will delete later.
|
||||
let l:class_file_directory = ale#engine#CreateDirectory(a:buffer)
|
||||
|
||||
" Always run javac from the directory the file is in, so we can resolve
|
||||
" relative paths correctly.
|
||||
return ale#path#BufferCdString(a:buffer)
|
||||
\ . 'javac -Xlint'
|
||||
return 'javac -Xlint'
|
||||
\ . ' ' . l:cp_option
|
||||
\ . ' ' . l:sp_option
|
||||
\ . ' -d ' . ale#Escape(l:class_file_directory)
|
||||
|
@ -90,26 +58,24 @@ function! ale_linters#java#javac#Handle(buffer, lines) abort
|
|||
" Main.java:13: warning: [deprecation] donaught() in Testclass has been deprecated
|
||||
" Main.java:16: error: ';' expected
|
||||
|
||||
let l:directory = expand('#' . a:buffer . ':p:h')
|
||||
let l:pattern = '\v^(.*):(\d+): (.+):(.+)$'
|
||||
let l:pattern = '\v^.*:(\d+): (.+):(.+)$'
|
||||
let l:col_pattern = '\v^(\s*\^)$'
|
||||
let l:symbol_pattern = '\v^ +symbol: *(class|method) +([^ ]+)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, [l:pattern, l:col_pattern, l:symbol_pattern])
|
||||
if empty(l:match[2]) && empty(l:match[3])
|
||||
let l:output[-1].col = len(l:match[1])
|
||||
let l:output[-1].col = len(l:match[1])
|
||||
elseif empty(l:match[3])
|
||||
" Add symbols to 'cannot find symbol' errors.
|
||||
if l:output[-1].text is# 'error: cannot find symbol'
|
||||
if l:output[-1].text ==# 'error: cannot find symbol'
|
||||
let l:output[-1].text .= ': ' . l:match[2]
|
||||
endif
|
||||
else
|
||||
call add(l:output, {
|
||||
\ 'filename': ale#path#GetAbsPath(l:directory, l:match[1]),
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'text': l:match[3] . ':' . l:match[4],
|
||||
\ 'type': l:match[3] is# 'error' ? 'E' : 'W',
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'text': l:match[2] . ':' . l:match[3],
|
||||
\ 'type': l:match[2] ==# 'error' ? 'E' : 'W',
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
call ale#linter#Define('javascript', {
|
||||
\ 'name': 'eslint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable_callback': 'ale#handlers#eslint#GetExecutable',
|
||||
\ 'command_callback': 'ale#handlers#eslint#GetCommand',
|
||||
\ 'callback': 'ale#handlers#eslint#Handle',
|
||||
|
|
131
ale_linters/javascript/flow.vim
Executable file → Normal file
131
ale_linters/javascript/flow.vim
Executable file → Normal file
|
@ -1,12 +1,21 @@
|
|||
" Author: Zach Perrault -- @zperrault
|
||||
" Author: Florian Beeres <yuuki@protonmail.com>
|
||||
" Description: FlowType checking for JavaScript files
|
||||
|
||||
call ale#Set('javascript_flow_executable', 'flow')
|
||||
call ale#Set('javascript_flow_use_home_config', 0)
|
||||
call ale#Set('javascript_flow_use_global', 0)
|
||||
|
||||
function! ale_linters#javascript#flow#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_flow', [
|
||||
\ 'node_modules/.bin/flow',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#flow#VersionCheck(buffer) abort
|
||||
return ale#Escape(ale_linters#javascript#flow#GetExecutable(a:buffer))
|
||||
\ . ' --version'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#flow#GetCommand(buffer, version_lines) abort
|
||||
let l:flow_config = ale#path#FindNearestFile(a:buffer, '.flowconfig')
|
||||
|
||||
if empty(l:flow_config)
|
||||
|
@ -14,106 +23,27 @@ function! ale_linters#javascript#flow#GetExecutable(buffer) abort
|
|||
return ''
|
||||
endif
|
||||
|
||||
" Don't run Flow with a configuration file from the home directory by
|
||||
" default, which can eat all of your RAM.
|
||||
if fnamemodify(l:flow_config, ':h') is? $HOME
|
||||
\&& !ale#Var(a:buffer, 'javascript_flow_use_home_config')
|
||||
return ''
|
||||
endif
|
||||
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_flow', [
|
||||
\ 'node_modules/.bin/flow',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#flow#VersionCheck(buffer) abort
|
||||
let l:executable = ale_linters#javascript#flow#GetExecutable(a:buffer)
|
||||
|
||||
if empty(l:executable)
|
||||
return ''
|
||||
endif
|
||||
|
||||
return ale#Escape(l:executable) . ' --version'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#flow#GetCommand(buffer, version_lines) abort
|
||||
let l:executable = ale_linters#javascript#flow#GetExecutable(a:buffer)
|
||||
|
||||
if empty(l:executable)
|
||||
return ''
|
||||
endif
|
||||
|
||||
let l:version = ale#semver#GetVersion(l:executable, a:version_lines)
|
||||
let l:use_respect_pragma = 1
|
||||
|
||||
" If we can parse the version number, then only use --respect-pragma
|
||||
" if the version is >= 0.36.0, which added the argument.
|
||||
let l:use_respect_pragma = empty(l:version)
|
||||
\ || ale#semver#GTE(l:version, [0, 36])
|
||||
for l:match in ale#util#GetMatches(a:version_lines, '\v\d+\.\d+\.\d+$')
|
||||
let l:use_respect_pragma = ale#semver#GreaterOrEqual(
|
||||
\ ale#semver#Parse(l:match[0]),
|
||||
\ [0, 36, 0]
|
||||
\)
|
||||
endfor
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
return ale#Escape(ale_linters#javascript#flow#GetExecutable(a:buffer))
|
||||
\ . ' check-contents'
|
||||
\ . (l:use_respect_pragma ? ' --respect-pragma': '')
|
||||
\ . ' --json --from ale %s'
|
||||
endfunction
|
||||
|
||||
" Filter lines of flow output until we find the first line where the JSON
|
||||
" output starts.
|
||||
function! s:GetJSONLines(lines) abort
|
||||
let l:start_index = 0
|
||||
|
||||
for l:line in a:lines
|
||||
if l:line[:0] is# '{'
|
||||
break
|
||||
endif
|
||||
|
||||
let l:start_index += 1
|
||||
endfor
|
||||
|
||||
return a:lines[l:start_index :]
|
||||
endfunction
|
||||
|
||||
function! s:ExtraErrorMsg(current, new) abort
|
||||
let l:newMsg = ''
|
||||
|
||||
if a:current is# ''
|
||||
" extra messages appear to already have a :
|
||||
let l:newMsg = a:new
|
||||
else
|
||||
let l:newMsg = a:current . ' ' . a:new
|
||||
endif
|
||||
|
||||
return l:newMsg
|
||||
endfunction
|
||||
|
||||
|
||||
function! s:GetDetails(error) abort
|
||||
let l:detail = ''
|
||||
|
||||
for l:extra_error in a:error.extra
|
||||
|
||||
if has_key(l:extra_error, 'message')
|
||||
for l:extra_message in l:extra_error.message
|
||||
let l:detail = s:ExtraErrorMsg(l:detail, l:extra_message.descr)
|
||||
endfor
|
||||
endif
|
||||
|
||||
if has_key(l:extra_error, 'children')
|
||||
for l:child in l:extra_error.children
|
||||
for l:child_message in l:child.message
|
||||
let l:detail = l:detail . ' ' . l:child_message.descr
|
||||
endfor
|
||||
endfor
|
||||
endif
|
||||
|
||||
endfor
|
||||
|
||||
return l:detail
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#flow#Handle(buffer, lines) abort
|
||||
let l:str = join(s:GetJSONLines(a:lines), '')
|
||||
let l:str = join(a:lines, '')
|
||||
|
||||
if empty(l:str)
|
||||
if l:str ==# ''
|
||||
return []
|
||||
endif
|
||||
|
||||
|
@ -131,13 +61,13 @@ function! ale_linters#javascript#flow#Handle(buffer, lines) abort
|
|||
" In certain cases, `l:message.loc.source` points to a different path
|
||||
" than the buffer one, thus we skip this loc information too.
|
||||
if has_key(l:message, 'loc')
|
||||
\&& l:line is# 0
|
||||
\&& l:line ==# 0
|
||||
\&& ale#path#IsBufferPath(a:buffer, l:message.loc.source)
|
||||
let l:line = l:message.loc.start.line + 0
|
||||
let l:col = l:message.loc.start.column + 0
|
||||
endif
|
||||
|
||||
if l:text is# ''
|
||||
if l:text ==# ''
|
||||
let l:text = l:message.descr . ':'
|
||||
else
|
||||
let l:text = l:text . ' ' . l:message.descr
|
||||
|
@ -148,19 +78,12 @@ function! ale_linters#javascript#flow#Handle(buffer, lines) abort
|
|||
let l:text = l:text . ' See also: ' . l:error.operation.descr
|
||||
endif
|
||||
|
||||
let l:errorToAdd = {
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:line,
|
||||
\ 'col': l:col,
|
||||
\ 'text': l:text,
|
||||
\ 'type': has_key(l:error, 'level') && l:error.level is# 'error' ? 'E' : 'W',
|
||||
\}
|
||||
|
||||
if has_key(l:error, 'extra')
|
||||
let l:errorToAdd.detail = s:GetDetails(l:error)
|
||||
endif
|
||||
|
||||
call add(l:output, l:errorToAdd)
|
||||
|
||||
\ 'type': l:error.level ==# 'error' ? 'E' : 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
|
@ -174,5 +97,5 @@ call ale#linter#Define('javascript', {
|
|||
\ {'callback': 'ale_linters#javascript#flow#GetCommand'},
|
||||
\ ],
|
||||
\ 'callback': 'ale_linters#javascript#flow#Handle',
|
||||
\ 'add_newline': !has('win32'),
|
||||
\ 'add_newline': 1,
|
||||
\})
|
||||
|
|
|
@ -1,67 +1,9 @@
|
|||
" Author: Chris Kyrouac - https://github.com/fijshion
|
||||
" Description: jscs for JavaScript files
|
||||
|
||||
call ale#Set('javascript_jscs_executable', 'jscs')
|
||||
call ale#Set('javascript_jscs_use_global', 0)
|
||||
|
||||
function! ale_linters#javascript#jscs#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_jscs', [
|
||||
\ 'node_modules/.bin/jscs',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#jscs#GetCommand(buffer) abort
|
||||
" Search for a local JShint config locaation, and default to a global one.
|
||||
let l:jscs_config = ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ '.jscsrc',
|
||||
\ get(g:, 'ale_jscs_config_loc', '')
|
||||
\)
|
||||
|
||||
let l:command = ale#Escape(ale_linters#javascript#jscs#GetExecutable(a:buffer))
|
||||
let l:command .= ' --reporter inline --no-colors'
|
||||
|
||||
if !empty(l:jscs_config)
|
||||
let l:command .= ' --config ' . ale#Escape(l:jscs_config)
|
||||
endif
|
||||
|
||||
let l:command .= ' -'
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#jscs#Handle(buffer, lines) abort
|
||||
" Matches patterns looking like the following
|
||||
"
|
||||
" foobar.js: line 2, col 1, Expected indentation of 1 characters
|
||||
"
|
||||
let l:pattern = '\v^.*:\s+line (\d+),\s+col\s+(\d+),\s+(.*)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:obj = {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[3]
|
||||
\}
|
||||
|
||||
let l:code_match = matchlist(l:match[3], '\v([^ :]+): (.+)$')
|
||||
|
||||
if !empty(l:code_match)
|
||||
let l:obj.code = l:code_match[1]
|
||||
let l:obj.text = l:code_match[2]
|
||||
endif
|
||||
|
||||
call add(l:output, l:obj)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('javascript', {
|
||||
\ 'name': 'jscs',
|
||||
\ 'executable_callback': 'ale_linters#javascript#jscs#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#javascript#jscs#GetCommand',
|
||||
\ 'callback': 'ale_linters#javascript#jscs#Handle',
|
||||
\ 'executable': 'jscs',
|
||||
\ 'command': 'jscs -r unix -n -',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsError',
|
||||
\})
|
||||
|
||||
|
|
|
@ -7,17 +7,13 @@ call ale#Set('javascript_standard_options', '')
|
|||
|
||||
function! ale_linters#javascript#standard#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_standard', [
|
||||
\ 'node_modules/standard/bin/cmd.js',
|
||||
\ 'node_modules/.bin/standard',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#standard#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#javascript#standard#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'javascript_standard_options')
|
||||
|
||||
return ale#node#Executable(a:buffer, l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
return ale#Escape(ale_linters#javascript#standard#GetExecutable(a:buffer))
|
||||
\ . ' ' . ale#Var(a:buffer, 'javascript_standard_options')
|
||||
\ . ' --stdin %s'
|
||||
endfunction
|
||||
|
||||
|
|
|
@ -12,21 +12,17 @@ let g:ale_kotlin_kotlinc_module_filename = get(g:, 'ale_kotlin_kotlinc_module_fi
|
|||
let s:classpath_sep = has('unix') ? ':' : ';'
|
||||
|
||||
function! ale_linters#kotlin#kotlinc#GetImportPaths(buffer) abort
|
||||
" exec maven/gradle only if classpath is not set
|
||||
if ale#Var(a:buffer, 'kotlin_kotlinc_classpath') isnot# ''
|
||||
" exec maven only if classpath is not set
|
||||
if ale#Var(a:buffer, 'kotlin_kotlinc_classpath') !=# ''
|
||||
return ''
|
||||
else
|
||||
let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml')
|
||||
|
||||
if !empty(l:pom_path) && executable('mvn')
|
||||
return ale#path#CdString(fnamemodify(l:pom_path, ':h'))
|
||||
\ . 'mvn dependency:build-classpath'
|
||||
endif
|
||||
|
||||
let l:classpath_command = ale#gradle#BuildClasspathCommand(a:buffer)
|
||||
if !empty(l:classpath_command)
|
||||
return l:classpath_command
|
||||
endif
|
||||
|
||||
return ''
|
||||
endif
|
||||
endfunction
|
||||
|
@ -70,27 +66,19 @@ function! ale_linters#kotlin#kotlinc#GetCommand(buffer, import_paths) abort
|
|||
endif
|
||||
|
||||
" We only get here if not using module or the module file not readable
|
||||
if ale#Var(a:buffer, 'kotlin_kotlinc_classpath') isnot# ''
|
||||
if ale#Var(a:buffer, 'kotlin_kotlinc_classpath') !=# ''
|
||||
let l:kotlinc_opts .= ' -cp ' . ale#Var(a:buffer, 'kotlin_kotlinc_classpath')
|
||||
else
|
||||
" get classpath from maven/gradle
|
||||
" get classpath from maven
|
||||
let l:kotlinc_opts .= s:BuildClassPathOption(a:buffer, a:import_paths)
|
||||
endif
|
||||
|
||||
let l:fname = ''
|
||||
if ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath') isnot# ''
|
||||
if ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath') !=# ''
|
||||
let l:fname .= expand(ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath'), 1) . ' '
|
||||
else
|
||||
" Find the src directory for files in this project.
|
||||
|
||||
let l:project_root = ale#gradle#FindProjectRoot(a:buffer)
|
||||
if !empty(l:project_root)
|
||||
let l:src_dir = l:project_root
|
||||
else
|
||||
let l:src_dir = ale#path#FindNearestDirectory(a:buffer, 'src/main/java')
|
||||
\ . ' ' . ale#path#FindNearestDirectory(a:buffer, 'src/main/kotlin')
|
||||
endif
|
||||
|
||||
let l:src_dir = ale#path#FindNearestDirectory(a:buffer, 'src/main/java')
|
||||
let l:fname .= expand(l:src_dir, 1) . ' '
|
||||
endif
|
||||
let l:fname .= ale#Escape(expand('#' . a:buffer . ':p'))
|
||||
|
@ -121,10 +109,10 @@ function! ale_linters#kotlin#kotlinc#Handle(buffer, lines) abort
|
|||
let l:curbuf_abspath = expand('#' . a:buffer . ':p')
|
||||
|
||||
" Skip if file is not loaded
|
||||
if l:buf_abspath isnot# l:curbuf_abspath
|
||||
if l:buf_abspath !=# l:curbuf_abspath
|
||||
continue
|
||||
endif
|
||||
let l:type_marker_str = l:type is# 'warning' ? 'W' : 'E'
|
||||
let l:type_marker_str = l:type ==# 'warning' ? 'W' : 'E'
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:line,
|
||||
|
@ -145,7 +133,7 @@ function! ale_linters#kotlin#kotlinc#Handle(buffer, lines) abort
|
|||
let l:type = l:match[1]
|
||||
let l:text = l:match[2]
|
||||
|
||||
let l:type_marker_str = l:type is# 'warning' || l:type is# 'info' ? 'W' : 'E'
|
||||
let l:type_marker_str = l:type ==# 'warning' || l:type ==# 'info' ? 'W' : 'E'
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': 1,
|
||||
|
@ -167,4 +155,3 @@ call ale#linter#Define('kotlin', {
|
|||
\ 'callback': 'ale_linters#kotlin#kotlinc#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
" Author: zanona <https://github.com/zanona>, w0rp <devw0rp@gmail.com>
|
||||
" Description: This file adds support for checking Less code with lessc.
|
||||
|
||||
call ale#Set('less_lessc_executable', 'lessc')
|
||||
call ale#Set('less_lessc_options', '')
|
||||
call ale#Set('less_lessc_use_global', 0)
|
||||
|
||||
function! ale_linters#less#lessc#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'less_lessc', [
|
||||
\ 'node_modules/.bin/lessc',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#less#lessc#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#less#lessc#GetExecutable(a:buffer)
|
||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||
let l:options = ale#Var(a:buffer, 'less_lessc_options')
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . ' --no-color --lint'
|
||||
\ . ' --include-path=' . ale#Escape(l:dir)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' -'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#less#lessc#Handle(buffer, lines) abort
|
||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
||||
" Matches patterns like the following:
|
||||
let l:pattern = '^\(\w\+\): \(.\{-}\) in \(.\{-}\) on line \(\d\+\), column \(\d\+\):$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:item = {
|
||||
\ 'lnum': l:match[4] + 0,
|
||||
\ 'col': l:match[5] + 0,
|
||||
\ 'text': l:match[2],
|
||||
\ 'type': 'E',
|
||||
\}
|
||||
|
||||
if l:match[3] isnot# '-'
|
||||
let l:item.filename = ale#path#GetAbsPath(l:dir, l:match[3])
|
||||
endif
|
||||
|
||||
call add(l:output, l:item)
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('less', {
|
||||
\ 'name': 'lessc',
|
||||
\ 'executable_callback': 'ale_linters#less#lessc#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#less#lessc#GetCommand',
|
||||
\ 'callback': 'ale_linters#less#lessc#Handle',
|
||||
\ 'output_stream': 'stderr',
|
||||
\})
|
|
@ -1,27 +0,0 @@
|
|||
" Author: diartyz <diartyz@gmail.com>, w0rp <devw0rp@gmail.com>
|
||||
|
||||
call ale#Set('less_stylelint_executable', 'stylelint')
|
||||
call ale#Set('less_stylelint_options', '')
|
||||
call ale#Set('less_stylelint_use_global', 0)
|
||||
|
||||
function! ale_linters#less#stylelint#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'less_stylelint', [
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#less#stylelint#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#less#stylelint#GetExecutable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'less_stylelint_options')
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' --stdin-filename %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('less', {
|
||||
\ 'name': 'stylelint',
|
||||
\ 'executable_callback': 'ale_linters#less#stylelint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#less#stylelint#GetCommand',
|
||||
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
|
||||
\})
|
|
@ -1,35 +0,0 @@
|
|||
" Author: rhysd <https://rhysd.github.io>
|
||||
" Description: Support for checking LLVM IR with llc
|
||||
|
||||
call ale#Set('llvm_llc_executable', 'llc')
|
||||
|
||||
function! ale_linters#llvm#llc#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'llvm_llc_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#llvm#llc#GetCommand(buffer) abort
|
||||
return ale#Escape(ale_linters#llvm#llc#GetExecutable(a:buffer))
|
||||
\ . ' -filetype=null -o='
|
||||
\ . ale#Escape(g:ale#util#nul_file)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#llvm#llc#HandleErrors(buffer, lines) abort
|
||||
" Handle '{path}: {file}:{line}:{col}: error: {message}' format
|
||||
let l:pattern = '\v^[a-zA-Z]?:?[^:]+: [^:]+:(\d+):(\d+): (.+)$'
|
||||
let l:matches = ale#util#GetMatches(a:lines, l:pattern)
|
||||
|
||||
return map(l:matches, "{
|
||||
\ 'lnum': str2nr(v:val[1]),
|
||||
\ 'col': str2nr(v:val[2]),
|
||||
\ 'text': v:val[3],
|
||||
\ 'type': 'E',
|
||||
\}")
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('llvm', {
|
||||
\ 'name': 'llc',
|
||||
\ 'executable_callback': 'ale_linters#llvm#llc#GetExecutable',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'command_callback': 'ale_linters#llvm#llc#GetCommand',
|
||||
\ 'callback': 'ale_linters#llvm#llc#HandleErrors',
|
||||
\})
|
|
@ -1,40 +0,0 @@
|
|||
" 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',
|
||||
\})
|
|
@ -22,22 +22,15 @@ function! ale_linters#lua#luacheck#Handle(buffer, lines) abort
|
|||
"
|
||||
" artal.lua:159:17: (W111) shadowing definition of loop variable 'i' on line 106
|
||||
" artal.lua:182:7: (W213) unused loop variable 'i'
|
||||
let l:pattern = '^.*:\(\d\+\):\(\d\+\): (\([WE]\)\(\d\+\)) \(.\+\)$'
|
||||
let l:pattern = '^.*:\(\d\+\):\(\d\+\): (\([WE]\)\d\+) \(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
if !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
||||
\ && l:match[3] is# 'W'
|
||||
\ && index(range(611, 614), str2nr(l:match[4])) >= 0
|
||||
continue
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[4],
|
||||
\ 'type': l:match[3],
|
||||
\ 'code': l:match[3] . l:match[4],
|
||||
\ 'text': l:match[5],
|
||||
\})
|
||||
endfor
|
||||
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
" Author: Johannes Wienke <languitar@semipol.de>
|
||||
" Description: alex for HTML files
|
||||
|
||||
call ale#linter#Define('mail', {
|
||||
\ 'name': 'alex',
|
||||
\ 'executable': 'alex',
|
||||
\ 'command': 'alex %s -t',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale#handlers#alex#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
|
@ -1,9 +0,0 @@
|
|||
" Author: Daniel M. Capella https://github.com/polyzen
|
||||
" Description: proselint for mail files
|
||||
|
||||
call ale#linter#Define('mail', {
|
||||
\ 'name': 'proselint',
|
||||
\ 'executable': 'proselint',
|
||||
\ 'command': 'proselint %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
|
@ -1,9 +0,0 @@
|
|||
" Author: chew-z https://github.com/chew-z
|
||||
" Description: vale for Markdown files
|
||||
|
||||
call ale#linter#Define('mail', {
|
||||
\ 'name': 'vale',
|
||||
\ 'executable': 'vale',
|
||||
\ 'command': 'vale --output=JSON %t',
|
||||
\ 'callback': 'ale#handlers#vale#Handle',
|
||||
\})
|
|
@ -1,24 +0,0 @@
|
|||
" Author: aurieh - https://github.com/aurieh
|
||||
|
||||
function! ale_linters#make#checkmake#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^(\d+):(.+):(.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'type': 'E',
|
||||
\ 'code': l:match[2],
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endfor
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('make', {
|
||||
\ 'name': 'checkmake',
|
||||
\ 'executable': 'checkmake',
|
||||
\ 'command': 'checkmake %s --format="{{.LineNumber}}:{{.Rule}}:{{.Violation}}"',
|
||||
\ 'callback': 'ale_linters#make#checkmake#Handle',
|
||||
\})
|
|
@ -1,11 +0,0 @@
|
|||
" Author: Johannes Wienke <languitar@semipol.de>
|
||||
" Description: alex for markdown files
|
||||
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'alex',
|
||||
\ 'executable': 'alex',
|
||||
\ 'command': 'alex %s -t',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale#handlers#alex#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
|
@ -1,20 +1,5 @@
|
|||
" Author: Steve Dignam <steve@dignam.xyz>, Josh Leeb-du Toit <joshleeb.com>
|
||||
" 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:options = ale#Var(a:buffer, 'markdown_mdl_options')
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
endfunction
|
||||
" Author: Steve Dignam <steve@dignam.xyz>
|
||||
" Description: Support for mdl, a markdown linter
|
||||
|
||||
function! ale_linters#markdown#mdl#Handle(buffer, lines) abort
|
||||
" matches: '(stdin):173: MD004 Unordered list style'
|
||||
|
@ -34,7 +19,7 @@ endfunction
|
|||
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'mdl',
|
||||
\ 'executable_callback': 'ale_linters#markdown#mdl#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#markdown#mdl#GetCommand',
|
||||
\ 'executable': 'mdl',
|
||||
\ 'command': 'mdl',
|
||||
\ 'callback': 'ale_linters#markdown#mdl#Handle'
|
||||
\})
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
" Author: rhysd https://rhysd.github.io
|
||||
" Description: Redpen, a proofreading tool (http://redpen.cc)
|
||||
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'redpen',
|
||||
\ 'executable': 'redpen',
|
||||
\ 'command': 'redpen -f markdown -r json %t',
|
||||
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
|
||||
\})
|
|
@ -1,28 +0,0 @@
|
|||
" Author rhysd https://rhysd.github.io/
|
||||
" Description: remark-lint for Markdown files
|
||||
|
||||
function! ale_linters#markdown#remark_lint#Handle(buffer, lines) abort
|
||||
" matches: ' 1:4 warning Incorrect list-item indent: add 1 space list-item-indent remark-lint'
|
||||
let l:pattern = '^ \+\(\d\+\):\(\d\+\) \(warning\|error\) \(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'type': l:match[3] is# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('markdown', {
|
||||
\ 'name': 'remark-lint',
|
||||
\ 'executable': 'remark',
|
||||
\ 'command': 'remark --no-stdout --no-color %s',
|
||||
\ 'callback': 'ale_linters#markdown#remark_lint#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\ 'output_stream': 'stderr',
|
||||
\})
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue