mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-08 05:24:46 +08:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d8abe0d6a2 | ||
|
|
55757e3d78 | ||
|
|
8e7ede3be8 | ||
|
|
6f8db3e5c4 | ||
|
|
2398fd7456 | ||
|
|
c1366f8a62 | ||
|
|
5089b09b7e | ||
|
|
220ebb3a79 | ||
|
|
25b5fad15c | ||
|
|
39f15811c3 | ||
|
|
34171774eb | ||
|
|
80328fa156 | ||
|
|
1fcf6444dc | ||
|
|
e57978ddd6 |
@@ -1,28 +1,8 @@
|
|||||||
<!--
|
<!--
|
||||||
This is a template for bug reports. If you want to request a new feature,
|
For bugs, paste output from your clipboard after running :ALEInfoToClipboard
|
||||||
you can clear this entire form field and write a short description of what
|
here. If that doesn't work for some reason, try running :ALEInfo and copying
|
||||||
you want.
|
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.
|
|
||||||
|
|||||||
274
README.md
274
README.md
@@ -17,7 +17,8 @@ back to a filesystem.
|
|||||||
In other words, this plugin allows you to lint while you type.
|
In other words, this plugin allows you to lint while you type.
|
||||||
|
|
||||||
In addition to linting support, ALE offers some support for fixing code with
|
In addition to linting support, ALE offers some support for fixing code with
|
||||||
formatting tools, and some Language Server Protocol and `tsserver` features.
|
formatting tools, and completion via Language Server Protocol servers, or
|
||||||
|
servers with similar enough protocols, like `tsserver`.
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
@@ -26,7 +27,6 @@ formatting tools, and some Language Server Protocol and `tsserver` features.
|
|||||||
1. [Linting](#usage-linting)
|
1. [Linting](#usage-linting)
|
||||||
2. [Fixing](#usage-fixing)
|
2. [Fixing](#usage-fixing)
|
||||||
3. [Completion](#usage-completion)
|
3. [Completion](#usage-completion)
|
||||||
4. [Go To Definition](#usage-go-to-definition)
|
|
||||||
3. [Installation](#installation)
|
3. [Installation](#installation)
|
||||||
1. [Installation with Vim package management](#standard-installation)
|
1. [Installation with Vim package management](#standard-installation)
|
||||||
2. [Installation with Pathogen](#installation-with-pathogen)
|
2. [Installation with Pathogen](#installation-with-pathogen)
|
||||||
@@ -36,18 +36,15 @@ formatting tools, and some Language Server Protocol and `tsserver` features.
|
|||||||
1. [How do I disable particular linters?](#faq-disable-linters)
|
1. [How do I disable particular linters?](#faq-disable-linters)
|
||||||
2. [How can I keep the sign gutter open?](#faq-keep-signs)
|
2. [How can I keep the sign gutter open?](#faq-keep-signs)
|
||||||
3. [How can I change the signs ALE uses?](#faq-change-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)
|
4. [How can I show errors or warnings in my statusline?](#faq-statusline)
|
||||||
5. [How can I show errors or warnings in my statusline?](#faq-statusline)
|
5. [How can I show errors or warnings in my lightline?](#faq-lightline)
|
||||||
6. [How can I show errors or warnings in my lightline?](#faq-lightline)
|
6. [How can I change the format for echo messages?](#faq-echo-format)
|
||||||
7. [How can I change the format for echo messages?](#faq-echo-format)
|
7. [How can I execute some code when ALE stops linting?](#faq-autocmd)
|
||||||
8. [How can I execute some code when ALE starts or stops linting?](#faq-autocmd)
|
8. [How can I navigate between errors quickly?](#faq-navigation)
|
||||||
9. [How can I navigate between errors quickly?](#faq-navigation)
|
9. [How can I run linters only when I save files?](#faq-lint-on-save)
|
||||||
10. [How can I run linters only when I save files?](#faq-lint-on-save)
|
10. [How can I use the quickfix list instead of the loclist?](#faq-quickfix)
|
||||||
11. [How can I use the quickfix list instead of the loclist?](#faq-quickfix)
|
11. [How can I check JSX files with both stylelint and eslint?](#faq-jsx-stylelint-eslint)
|
||||||
12. [How can I check JSX files with both stylelint and eslint?](#faq-jsx-stylelint-eslint)
|
12. [Will this plugin eat all of my laptop battery power?](#faq-my-battery-is-sad)
|
||||||
13. [Will this plugin eat all of my laptop battery power?](#faq-my-battery-is-sad)
|
|
||||||
14. [How can I configure my C or C++ project?](#faq-c-configuration)
|
|
||||||
15. [How can I configure ALE differently for different buffers?](#faq-buffer-configuration)
|
|
||||||
|
|
||||||
<a name="supported-languages"></a>
|
<a name="supported-languages"></a>
|
||||||
|
|
||||||
@@ -74,25 +71,22 @@ formatting.
|
|||||||
| -------- | ----- |
|
| -------- | ----- |
|
||||||
| ASM | [gcc](https://gcc.gnu.org) |
|
| ASM | [gcc](https://gcc.gnu.org) |
|
||||||
| Ansible | [ansible-lint](https://github.com/willthames/ansible-lint) |
|
| Ansible | [ansible-lint](https://github.com/willthames/ansible-lint) |
|
||||||
| API Blueprint | [drafter](https://github.com/apiaryio/drafter) |
|
| AsciiDoc | [proselint](http://proselint.com/) |
|
||||||
| AsciiDoc | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [write-good](https://github.com/btford/write-good) |
|
|
||||||
| Awk | [gawk](https://www.gnu.org/software/gawk/)|
|
| Awk | [gawk](https://www.gnu.org/software/gawk/)|
|
||||||
| Bash | shell [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set), [shellcheck](https://www.shellcheck.net/), [shfmt](https://github.com/mvdan/sh) |
|
| Bash | shell [-n flag](https://www.gnu.org/software/bash/manual/bash.html#index-set), [shellcheck](https://www.shellcheck.net/) |
|
||||||
| Bourne Shell | shell [-n flag](http://linux.die.net/man/1/sh), [shellcheck](https://www.shellcheck.net/), [shfmt](https://github.com/mvdan/sh) |
|
| Bourne Shell | shell [-n flag](http://linux.die.net/man/1/sh), [shellcheck](https://www.shellcheck.net/) |
|
||||||
| C | [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint), [gcc](https://gcc.gnu.org/), [clang](http://clang.llvm.org/), [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html)|
|
| C | [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint), [gcc](https://gcc.gnu.org/), [clang](http://clang.llvm.org/), [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html)|
|
||||||
| C++ (filetype cpp) | [clang](http://clang.llvm.org/), [clangcheck](http://clang.llvm.org/docs/ClangCheck.html) !!, [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [clang-format](https://clang.llvm.org/docs/ClangFormat.html), [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint) !!, [gcc](https://gcc.gnu.org/) |
|
| C++ (filetype cpp) | [clang](http://clang.llvm.org/), [clangcheck](http://clang.llvm.org/docs/ClangCheck.html) !!, [clangtidy](http://clang.llvm.org/extra/clang-tidy/) !!, [cppcheck](http://cppcheck.sourceforge.net), [cpplint](https://github.com/google/styleguide/tree/gh-pages/cpplint) !!, [gcc](https://gcc.gnu.org/), [clang-format](https://clang.llvm.org/docs/ClangFormat.html)|
|
||||||
| CUDA | [nvcc](http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html) |
|
| CUDA | [nvcc](http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html) |
|
||||||
| C# | [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) see:`help ale-cs-mcs` for details, [mcsc](http://www.mono-project.com/docs/about-mono/languages/csharp/) !! see:`help ale-cs-mcsc` for details and configuration|
|
| C# | [mcs](http://www.mono-project.com/docs/about-mono/languages/csharp/) see:`help ale-cs-mcs` for details, [mcsc](http://www.mono-project.com/docs/about-mono/languages/csharp/) !! see:`help ale-cs-mcsc` for details and configuration|
|
||||||
| Chef | [foodcritic](http://www.foodcritic.io/) |
|
| Chef | [foodcritic](http://www.foodcritic.io/) |
|
||||||
| Clojure | [joker](https://github.com/candid82/joker) |
|
|
||||||
| CMake | [cmakelint](https://github.com/richq/cmake-lint) |
|
| CMake | [cmakelint](https://github.com/richq/cmake-lint) |
|
||||||
| CoffeeScript | [coffee](http://coffeescript.org/), [coffeelint](https://www.npmjs.com/package/coffeelint) |
|
| CoffeeScript | [coffee](http://coffeescript.org/), [coffeelint](https://www.npmjs.com/package/coffeelint) |
|
||||||
| Crystal | [crystal](https://crystal-lang.org/) !! |
|
| Crystal | [crystal](https://crystal-lang.org/) !! |
|
||||||
| CSS | [csslint](http://csslint.net/), [prettier](https://github.com/prettier/prettier), [stylelint](https://github.com/stylelint/stylelint) |
|
| CSS | [csslint](http://csslint.net/), [stylelint](https://github.com/stylelint/stylelint), [prettier](https://github.com/prettier/prettier) |
|
||||||
| Cython (pyrex filetype) | [cython](http://cython.org/) |
|
| Cython (pyrex filetype) | [cython](http://cython.org/) |
|
||||||
| D | [dmd](https://dlang.org/dmd-linux.html) |
|
| D | [dmd](https://dlang.org/dmd-linux.html) |
|
||||||
| Dafny | [dafny](https://rise4fun.com/Dafny) !! |
|
| Dart | [dartanalyzer](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) |
|
||||||
| Dart | [dartanalyzer](https://github.com/dart-lang/sdk/tree/master/pkg/analyzer_cli) !!, [language_server](https://github.com/natebosch/dart_language_server) |
|
|
||||||
| Dockerfile | [hadolint](https://github.com/lukasmartinelli/hadolint) |
|
| Dockerfile | [hadolint](https://github.com/lukasmartinelli/hadolint) |
|
||||||
| Elixir | [credo](https://github.com/rrrene/credo), [dogma](https://github.com/lpil/dogma) !! |
|
| Elixir | [credo](https://github.com/rrrene/credo), [dogma](https://github.com/lpil/dogma) !! |
|
||||||
| Elm | [elm-format](https://github.com/avh4/elm-format), [elm-make](https://github.com/elm-lang/elm-make) |
|
| Elm | [elm-format](https://github.com/avh4/elm-format), [elm-make](https://github.com/elm-lang/elm-make) |
|
||||||
@@ -100,66 +94,60 @@ formatting.
|
|||||||
| Erlang | [erlc](http://erlang.org/doc/man/erlc.html), [SyntaxErl](https://github.com/ten0s/syntaxerl) |
|
| Erlang | [erlc](http://erlang.org/doc/man/erlc.html), [SyntaxErl](https://github.com/ten0s/syntaxerl) |
|
||||||
| Fortran | [gcc](https://gcc.gnu.org/) |
|
| Fortran | [gcc](https://gcc.gnu.org/) |
|
||||||
| FusionScript | [fusion-lint](https://github.com/RyanSquared/fusionscript) |
|
| FusionScript | [fusion-lint](https://github.com/RyanSquared/fusionscript) |
|
||||||
| GLSL | [glslang](https://github.com/KhronosGroup/glslang), [glslls](https://github.com/svenstaro/glsl-language-server) |
|
| GLSL | [glslang](https://github.com/KhronosGroup/glslang) |
|
||||||
| Go | [gofmt](https://golang.org/cmd/gofmt/), [goimports](https://godoc.org/golang.org/x/tools/cmd/goimports), [go vet](https://golang.org/cmd/vet/), [golint](https://godoc.org/github.com/golang/lint), [gometalinter](https://github.com/alecthomas/gometalinter) !!, [go build](https://golang.org/cmd/go/) !!, [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple) !!, [staticcheck](https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck) !! |
|
| Go | [gofmt](https://golang.org/cmd/gofmt/), [go vet](https://golang.org/cmd/vet/), [golint](https://godoc.org/github.com/golang/lint), [gometalinter](https://github.com/alecthomas/gometalinter) !!, [go build](https://golang.org/cmd/go/) !!, [gosimple](https://github.com/dominikh/go-tools/tree/master/cmd/gosimple) !!, [staticcheck](https://github.com/dominikh/go-tools/tree/master/cmd/staticcheck) !! |
|
||||||
| GraphQL | [eslint](http://eslint.org/), [gqlint](https://github.com/happylinks/gqlint) |
|
| GraphQL | [gqlint](https://github.com/happylinks/gqlint) |
|
||||||
| Haml | [haml-lint](https://github.com/brigade/haml-lint) |
|
| Haml | [haml-lint](https://github.com/brigade/haml-lint) |
|
||||||
| Handlebars | [ember-template-lint](https://github.com/rwjblue/ember-template-lint) |
|
| Handlebars | [ember-template-lint](https://github.com/rwjblue/ember-template-lint) |
|
||||||
| Haskell | [brittany](https://github.com/lspitzner/brittany), [ghc](https://www.haskell.org/ghc/), [stack-ghc](https://haskellstack.org/), [stack-build](https://haskellstack.org/) !!, [ghc-mod](https://github.com/DanielG/ghc-mod), [stack-ghc-mod](https://github.com/DanielG/ghc-mod), [hlint](https://hackage.haskell.org/package/hlint), [hdevtools](https://hackage.haskell.org/package/hdevtools), [hfmt](https://github.com/danstiner/hfmt) |
|
| Haskell | [ghc](https://www.haskell.org/ghc/), [stack-ghc](https://haskellstack.org/), [stack-build](https://haskellstack.org/) !!, [ghc-mod](https://github.com/DanielG/ghc-mod), [stack-ghc-mod](https://github.com/DanielG/ghc-mod), [hlint](https://hackage.haskell.org/package/hlint), [hdevtools](https://hackage.haskell.org/package/hdevtools) |
|
||||||
| HTML | [alex](https://github.com/wooorm/alex) !!, [HTMLHint](http://htmlhint.com/), [proselint](http://proselint.com/), [tidy](http://www.html-tidy.org/), [write-good](https://github.com/btford/write-good) |
|
| HTML | [HTMLHint](http://htmlhint.com/), [proselint](http://proselint.com/), [tidy](http://www.html-tidy.org/) |
|
||||||
| Idris | [idris](http://www.idris-lang.org/) |
|
| Idris | [idris](http://www.idris-lang.org/) |
|
||||||
| Java | [checkstyle](http://checkstyle.sourceforge.net), [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html), [google-java-format](https://github.com/google/google-java-format) |
|
| Java | [checkstyle](http://checkstyle.sourceforge.net), [javac](http://www.oracle.com/technetwork/java/javase/downloads/index.html) |
|
||||||
| JavaScript | [eslint](http://eslint.org/), [flow](https://flowtype.org/), [jscs](http://jscs.info/), [jshint](http://jshint.com/), [prettier](https://github.com/prettier/prettier), [prettier-eslint](https://github.com/prettier/prettier-eslint), [prettier-standard](https://github.com/sheerun/prettier-standard), [standard](http://standardjs.com/), [xo](https://github.com/sindresorhus/xo)
|
| JavaScript | [eslint](http://eslint.org/), [jscs](http://jscs.info/), [jshint](http://jshint.com/), [flow](https://flowtype.org/), [prettier](https://github.com/prettier/prettier), prettier-eslint >= 4.2.0, prettier-standard, [standard](http://standardjs.com/), [xo](https://github.com/sindresorhus/xo)
|
||||||
| JSON | [jsonlint](http://zaa.ch/jsonlint/), [prettier](https://github.com/prettier/prettier) |
|
| JSON | [jsonlint](http://zaa.ch/jsonlint/), [prettier](https://github.com/prettier/prettier) |
|
||||||
| Kotlin | [kotlinc](https://kotlinlang.org) !!, [ktlint](https://ktlint.github.io) !! see `:help ale-integration-kotlin` for configuration instructions |
|
| Kotlin | [kotlinc](https://kotlinlang.org) !!, [ktlint](https://ktlint.github.io) !! see `:help ale-integration-kotlin` for configuration instructions |
|
||||||
| LaTeX | [alex](https://github.com/wooorm/alex) !!, [chktex](http://www.nongnu.org/chktex/), [lacheck](https://www.ctan.org/pkg/lacheck), [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
|
| LaTeX | [chktex](http://www.nongnu.org/chktex/), [lacheck](https://www.ctan.org/pkg/lacheck), [proselint](http://proselint.com/) |
|
||||||
| Less | [lessc](https://www.npmjs.com/package/less), [prettier](https://github.com/prettier/prettier), [stylelint](https://github.com/stylelint/stylelint) |
|
|
||||||
| LLVM | [llc](https://llvm.org/docs/CommandGuide/llc.html) |
|
| LLVM | [llc](https://llvm.org/docs/CommandGuide/llc.html) |
|
||||||
| Lua | [luacheck](https://github.com/mpeterv/luacheck) |
|
| Lua | [luacheck](https://github.com/mpeterv/luacheck) |
|
||||||
| Mail | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale) |
|
| Markdown | [mdl](https://github.com/mivok/markdownlint), [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale), [remark-lint](https://github.com/wooorm/remark-lint) !! |
|
||||||
| Make | [checkmake](https://github.com/mrtazz/checkmake) |
|
|
||||||
| Markdown | [alex](https://github.com/wooorm/alex) !!, [mdl](https://github.com/mivok/markdownlint), [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [remark-lint](https://github.com/wooorm/remark-lint) !!, [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
|
|
||||||
| MATLAB | [mlint](https://www.mathworks.com/help/matlab/ref/mlint.html) |
|
| MATLAB | [mlint](https://www.mathworks.com/help/matlab/ref/mlint.html) |
|
||||||
| Nim | [nim check](https://nim-lang.org/docs/nimc.html) !! |
|
| Nim | [nim check](https://nim-lang.org/docs/nimc.html) !! |
|
||||||
| nix | [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate) |
|
| nix | [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate) |
|
||||||
| nroff | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good)|
|
| nroff | [proselint](http://proselint.com/)|
|
||||||
| Objective-C | [clang](http://clang.llvm.org/) |
|
| Objective-C | [clang](http://clang.llvm.org/) |
|
||||||
| Objective-C++ | [clang](http://clang.llvm.org/) |
|
| Objective-C++ | [clang](http://clang.llvm.org/) |
|
||||||
| OCaml | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-ocaml-merlin` for configuration instructions, [ols](https://github.com/freebroccolo/ocaml-language-server) |
|
| OCaml | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-ocaml-merlin` for configuration instructions |
|
||||||
| Perl | [perl -c](https://perl.org/), [perl-critic](https://metacpan.org/pod/Perl::Critic) |
|
| Perl | [perl -c](https://perl.org/), [perl-critic](https://metacpan.org/pod/Perl::Critic) |
|
||||||
| PHP | [hack](http://hacklang.org/), [hackfmt](https://github.com/facebook/flow/tree/master/hack/hackfmt), [langserver](https://github.com/felixfbecker/php-language-server), [phan](https://github.com/phan/phan) see `:help ale-php-phan` to instructions, [php -l](https://secure.php.net/), [phpcs](https://github.com/squizlabs/PHP_CodeSniffer), [phpmd](https://phpmd.org), [phpstan](https://github.com/phpstan/phpstan), [phpcbf](https://github.com/squizlabs/PHP_CodeSniffer) |
|
| PHP | [hack](http://hacklang.org/), [langserver](https://github.com/felixfbecker/php-language-server), [php -l](https://secure.php.net/), [phpcs](https://github.com/squizlabs/PHP_CodeSniffer), [phpmd](https://phpmd.org), [phpstan](https://github.com/phpstan/phpstan), [phpcbf](https://github.com/squizlabs/PHP_CodeSniffer) |
|
||||||
| Pod | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
| Pod | [proselint](http://proselint.com/)|
|
||||||
| proto | [protoc-gen-lint](https://github.com/ckaznocha/protoc-gen-lint) |
|
|
||||||
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) |
|
| Pug | [pug-lint](https://github.com/pugjs/pug-lint) |
|
||||||
| Puppet | [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) |
|
| Puppet | [puppet](https://puppet.com), [puppet-lint](https://puppet-lint.com) |
|
||||||
| Python | [autopep8](https://github.com/hhatto/autopep8), [flake8](http://flake8.pycqa.org/en/latest/), [isort](https://github.com/timothycrosley/isort), [mypy](http://mypy-lang.org/), [prospector](http://github.com/landscapeio/prospector), [pycodestyle](https://github.com/PyCQA/pycodestyle), [pyls](https://github.com/palantir/python-language-server), [pylint](https://www.pylint.org/) !!, [yapf](https://github.com/google/yapf) |
|
| Python | [autopep8](https://github.com/hhatto/autopep8), [flake8](http://flake8.pycqa.org/en/latest/), [isort](https://github.com/timothycrosley/isort), [mypy](http://mypy-lang.org/), [pycodestyle](https://github.com/PyCQA/pycodestyle), [pylint](https://www.pylint.org/) !!, [yapf](https://github.com/google/yapf) |
|
||||||
| R | [lintr](https://github.com/jimhester/lintr) |
|
| R | [lintr](https://github.com/jimhester/lintr) |
|
||||||
| ReasonML | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-integration-reason-merlin` for configuration instructions, [ols](https://github.com/freebroccolo/ocaml-language-server), [refmt](https://github.com/reasonml/reason-cli) |
|
| ReasonML | [merlin](https://github.com/the-lambda-church/merlin) see `:help ale-integration-reason-merlin` for configuration instructions |
|
||||||
| reStructuredText | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [redpen](http://redpen.cc/), [rstcheck](https://github.com/myint/rstcheck), [vale](https://github.com/ValeLint/vale), [write-good](https://github.com/btford/write-good) |
|
| reStructuredText | [proselint](http://proselint.com/) |
|
||||||
| Re:VIEW | [redpen](http://redpen.cc/) |
|
|
||||||
| RPM spec | [rpmlint](https://github.com/rpm-software-management/rpmlint) (disabled by default; see `:help ale-integration-spec`) |
|
| RPM spec | [rpmlint](https://github.com/rpm-software-management/rpmlint) (disabled by default; see `:help ale-integration-spec`) |
|
||||||
| Ruby | [brakeman](http://brakemanscanner.org/) !!, [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) !!, [reek](https://github.com/troessner/reek), [rubocop](https://github.com/bbatsov/rubocop), [ruby](https://www.ruby-lang.org) |
|
| Ruby | [brakeman](http://brakemanscanner.org/) !!, [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) !!, [reek](https://github.com/troessner/reek), [rubocop](https://github.com/bbatsov/rubocop), [ruby](https://www.ruby-lang.org) |
|
||||||
| Rust | cargo !! (see `:help ale-integration-rust` for configuration instructions), [rls](https://github.com/rust-lang-nursery/rls), [rustc](https://www.rust-lang.org/), [rustfmt](https://github.com/rust-lang-nursery/rustfmt) |
|
| Rust | cargo !! (see `:help ale-integration-rust` for configuration instructions), [rls](https://github.com/rust-lang-nursery/rls), [rustc](https://www.rust-lang.org/) |
|
||||||
| SASS | [sass-lint](https://www.npmjs.com/package/sass-lint), [stylelint](https://github.com/stylelint/stylelint) |
|
| SASS | [sass-lint](https://www.npmjs.com/package/sass-lint), [stylelint](https://github.com/stylelint/stylelint) |
|
||||||
| SCSS | [prettier](https://github.com/prettier/prettier), [sass-lint](https://www.npmjs.com/package/sass-lint), [scss-lint](https://github.com/brigade/scss-lint), [stylelint](https://github.com/stylelint/stylelint) |
|
| SCSS | [sass-lint](https://www.npmjs.com/package/sass-lint), [scss-lint](https://github.com/brigade/scss-lint), [stylelint](https://github.com/stylelint/stylelint), [prettier](https://github.com/prettier/prettier) |
|
||||||
| Scala | [scalac](http://scala-lang.org), [scalastyle](http://www.scalastyle.org) |
|
| Scala | [scalac](http://scala-lang.org), [scalastyle](http://www.scalastyle.org) |
|
||||||
| Slim | [slim-lint](https://github.com/sds/slim-lint) |
|
| Slim | [slim-lint](https://github.com/sds/slim-lint) |
|
||||||
| SML | [smlnj](http://www.smlnj.org/) |
|
| SML | [smlnj](http://www.smlnj.org/) |
|
||||||
| Solidity | [solhint](https://github.com/protofire/solhint), [solium](https://github.com/duaraghav8/Solium) |
|
| Solidity | [solium](https://github.com/duaraghav8/Solium) |
|
||||||
| Stylus | [stylelint](https://github.com/stylelint/stylelint) |
|
| Stylus | [stylelint](https://github.com/stylelint/stylelint) |
|
||||||
| SQL | [sqlint](https://github.com/purcell/sqlint) |
|
| SQL | [sqlint](https://github.com/purcell/sqlint) |
|
||||||
| Swift | [swiftlint](https://github.com/realm/SwiftLint), [swiftformat](https://github.com/nicklockwood/SwiftFormat) |
|
| Swift | [swiftlint](https://github.com/realm/SwiftLint), [swiftformat](https://github.com/nicklockwood/SwiftFormat) |
|
||||||
| Tcl | [nagelfar](http://nagelfar.sourceforge.net) !! |
|
| Tcl | [nagelfar](http://nagelfar.sourceforge.net) !! |
|
||||||
| Terraform | [tflint](https://github.com/wata727/tflint) |
|
| Texinfo | [proselint](http://proselint.com/)|
|
||||||
| Texinfo | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good)|
|
| Text^ | [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale) |
|
||||||
| 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/) |
|
| Thrift | [thrift](http://thrift.apache.org/) |
|
||||||
| TypeScript | [eslint](http://eslint.org/), [prettier](https://github.com/prettier/prettier), [tslint](https://github.com/palantir/tslint), tsserver, typecheck |
|
| TypeScript | [eslint](http://eslint.org/), [tslint](https://github.com/palantir/tslint), tsserver, typecheck, [prettier](https://github.com/prettier/prettier) |
|
||||||
| Verilog | [iverilog](https://github.com/steveicarus/iverilog), [verilator](http://www.veripool.org/projects/verilator/wiki/Intro) |
|
| Verilog | [iverilog](https://github.com/steveicarus/iverilog), [verilator](http://www.veripool.org/projects/verilator/wiki/Intro) |
|
||||||
| Vim | [vint](https://github.com/Kuniwak/vint) |
|
| Vim | [vint](https://github.com/Kuniwak/vint) |
|
||||||
| Vim help^ | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
| Vim help^ | [proselint](http://proselint.com/)|
|
||||||
| XHTML | [alex](https://github.com/wooorm/alex) !!, [proselint](http://proselint.com/), [write-good](https://github.com/btford/write-good) |
|
| XHTML | [proselint](http://proselint.com/)|
|
||||||
| XML | [xmllint](http://xmlsoft.org/xmllint.html) |
|
| XML | [xmllint](http://xmlsoft.org/xmllint.html)|
|
||||||
| YAML | [swaglint](https://github.com/byCedric/swaglint), [yamllint](https://yamllint.readthedocs.io/) |
|
| YAML | [swaglint](https://github.com/byCedric/swaglint), [yamllint](https://yamllint.readthedocs.io/) |
|
||||||
|
|
||||||
<a name="usage"></a>
|
<a name="usage"></a>
|
||||||
@@ -223,15 +211,6 @@ let g:ale_completion_enabled = 1
|
|||||||
|
|
||||||
See `:help ale-completion` for more information.
|
See `:help ale-completion` for more information.
|
||||||
|
|
||||||
<a name="usage-go-to-definition"></a>
|
|
||||||
|
|
||||||
### 2.iv Go To Definition
|
|
||||||
|
|
||||||
ALE supports jumping to the definition of words under your cursor with the
|
|
||||||
`:ALEGoToDefinition` command using any enabled LSP linters and `tsserver`.
|
|
||||||
|
|
||||||
See `:help ale-go-to-definition` for more information.
|
|
||||||
|
|
||||||
<a name="installation"></a>
|
<a name="installation"></a>
|
||||||
|
|
||||||
## 3. Installation
|
## 3. Installation
|
||||||
@@ -391,35 +370,9 @@ highlight clear ALEErrorSign
|
|||||||
highlight clear ALEWarningSign
|
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>
|
<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
|
[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
|
for displaying error information in the status bar. If you want to see the
|
||||||
@@ -459,16 +412,68 @@ See `:help ale#statusline#Count()` for more information.
|
|||||||
|
|
||||||
<a name="faq-lightline"></a>
|
<a name="faq-lightline"></a>
|
||||||
|
|
||||||
### 5.vi. How can I show errors or warnings in my lightline?
|
### 5.v. How can I show errors or warnings in my lightline?
|
||||||
|
|
||||||
[lightline](https://github.com/itchyny/lightline.vim) does not have built-in
|
[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).
|
support for ALE, nevertheless it's easy to do it yourself:
|
||||||
|
|
||||||
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).
|
```vim
|
||||||
|
" This is regular lightline configuration, we just added
|
||||||
|
" 'linter_warnings', 'linter_errors' and 'linter_ok' to
|
||||||
|
" the active right panel. Feel free to move it anywhere.
|
||||||
|
" `component_expand' and `component_type' are required.
|
||||||
|
"
|
||||||
|
" For more info on how this works, see lightline documentation.
|
||||||
|
let g:lightline = {
|
||||||
|
\ 'active': {
|
||||||
|
\ 'right': [ [ 'lineinfo' ],
|
||||||
|
\ [ 'percent' ],
|
||||||
|
\ [ 'linter_warnings', 'linter_errors', 'linter_ok' ],
|
||||||
|
\ [ 'fileformat', 'fileencoding', 'filetype' ] ]
|
||||||
|
\ },
|
||||||
|
\ 'component_expand': {
|
||||||
|
\ 'linter_warnings': 'LightlineLinterWarnings',
|
||||||
|
\ 'linter_errors': 'LightlineLinterErrors',
|
||||||
|
\ 'linter_ok': 'LightlineLinterOK'
|
||||||
|
\ },
|
||||||
|
\ 'component_type': {
|
||||||
|
\ 'linter_warnings': 'warning',
|
||||||
|
\ 'linter_errors': 'error',
|
||||||
|
\ 'linter_ok': 'ok'
|
||||||
|
\ },
|
||||||
|
\ }
|
||||||
|
|
||||||
|
autocmd User ALELint call lightline#update()
|
||||||
|
|
||||||
|
" ale + lightline
|
||||||
|
function! LightlineLinterWarnings() abort
|
||||||
|
let l:counts = ale#statusline#Count(bufnr(''))
|
||||||
|
let l:all_errors = l:counts.error + l:counts.style_error
|
||||||
|
let l:all_non_errors = l:counts.total - l:all_errors
|
||||||
|
return l:counts.total == 0 ? '' : printf('%d --', all_non_errors)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! LightlineLinterErrors() abort
|
||||||
|
let l:counts = ale#statusline#Count(bufnr(''))
|
||||||
|
let l:all_errors = l:counts.error + l:counts.style_error
|
||||||
|
let l:all_non_errors = l:counts.total - l:all_errors
|
||||||
|
return l:counts.total == 0 ? '' : printf('%d >>', all_errors)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! LightlineLinterOK() abort
|
||||||
|
let l:counts = ale#statusline#Count(bufnr(''))
|
||||||
|
let l:all_errors = l:counts.error + l:counts.style_error
|
||||||
|
let l:all_non_errors = l:counts.total - l:all_errors
|
||||||
|
return l:counts.total == 0 ? '✓' : ''
|
||||||
|
endfunction
|
||||||
|
```
|
||||||
|
|
||||||
|
See `:help ale#statusline#Count()` and [lightline documentation](https://github.com/itchyny/lightline.vim#advanced-configuration)
|
||||||
|
for more information.
|
||||||
|
|
||||||
<a name="faq-echo-format"></a>
|
<a name="faq-echo-format"></a>
|
||||||
|
|
||||||
### 5.vii. How can I change the format for echo messages?
|
### 5.vi. How can I change the format for echo messages?
|
||||||
|
|
||||||
There are 3 global options that allow customizing the echoed message.
|
There are 3 global options that allow customizing the echoed message.
|
||||||
|
|
||||||
@@ -493,24 +498,22 @@ Will give you:
|
|||||||
|
|
||||||
<a name="faq-autocmd"></a>
|
<a name="faq-autocmd"></a>
|
||||||
|
|
||||||
### 5.viii. How can I execute some code when ALE starts or stops linting?
|
### 5.vii. How can I execute some code when ALE stops linting?
|
||||||
|
|
||||||
ALE runs its own [autocmd](http://vimdoc.sourceforge.net/htmldoc/autocmd.html)
|
ALE runs its own [autocmd](http://vimdoc.sourceforge.net/htmldoc/autocmd.html)
|
||||||
events whenever has a linter is started and has been successfully executed and
|
event whenever has a linter has been successfully executed and processed. This
|
||||||
processed. These events can be used to call arbitrary functions before and after
|
autocmd event can be used to call arbitrary functions after ALE stops linting.
|
||||||
ALE stops linting.
|
|
||||||
|
|
||||||
```vim
|
```vim
|
||||||
augroup YourGroup
|
augroup YourGroup
|
||||||
autocmd!
|
autocmd!
|
||||||
autocmd User ALELintPre call YourFunction()
|
autocmd User ALELint call YourFunction()
|
||||||
autocmd User ALELintPost call YourFunction()
|
|
||||||
augroup END
|
augroup END
|
||||||
```
|
```
|
||||||
|
|
||||||
<a name="faq-navigation"></a>
|
<a name="faq-navigation"></a>
|
||||||
|
|
||||||
### 5.ix. How can I navigate between errors quickly?
|
### 5.viii. How can I navigate between errors quickly?
|
||||||
|
|
||||||
ALE offers some commands with `<Plug>` keybinds for moving between warnings and
|
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
|
errors quickly. You can map the keys Ctrl+j and Ctrl+k to moving between errors
|
||||||
@@ -526,7 +529,7 @@ For more information, consult the online documentation with
|
|||||||
|
|
||||||
<a name="faq-lint-on-save"></a>
|
<a name="faq-lint-on-save"></a>
|
||||||
|
|
||||||
### 5.x. How can I run linters only when I save files?
|
### 5.ix. How can I run linters only when I save files?
|
||||||
|
|
||||||
ALE offers an option `g:ale_lint_on_save` for enabling running the linters
|
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
|
when files are saved. This option is enabled by default. If you only
|
||||||
@@ -546,7 +549,7 @@ files, you can set `g:ale_lint_on_save` to `0`.
|
|||||||
|
|
||||||
<a name="faq-quickfix"></a>
|
<a name="faq-quickfix"></a>
|
||||||
|
|
||||||
### 5.xi. How can I use the quickfix list instead of the loclist?
|
### 5.x. How can I use the quickfix list instead of the loclist?
|
||||||
|
|
||||||
The quickfix list can be enabled by turning the `g:ale_set_quickfix`
|
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
|
option on. If you wish to also disable the loclist, you can disable
|
||||||
@@ -573,7 +576,7 @@ let g:ale_keep_list_window_open = 1
|
|||||||
|
|
||||||
<a name="faq-jsx-stylelint-eslint"></a>
|
<a name="faq-jsx-stylelint-eslint"></a>
|
||||||
|
|
||||||
### 5.xii. How can I check JSX files with both stylelint and eslint?
|
### 5.xi. How can I check JSX files with both stylelint and eslint?
|
||||||
|
|
||||||
If you configure ALE options correctly in your vimrc file, and install
|
If you configure ALE options correctly in your vimrc file, and install
|
||||||
the right tools, you can check JSX files with stylelint and eslint.
|
the right tools, you can check JSX files with stylelint and eslint.
|
||||||
@@ -606,7 +609,7 @@ no linter will be run twice for the same file.
|
|||||||
|
|
||||||
<a name="faq-my-battery-is-sad"></a>
|
<a name="faq-my-battery-is-sad"></a>
|
||||||
|
|
||||||
### 5.xiii. Will this plugin eat all of my laptop battery power?
|
### 5.xii. 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
|
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
|
course means that CPU time will be used to continuously check your code. If you
|
||||||
@@ -628,64 +631,3 @@ still be an advantage.
|
|||||||
If you are still concerned, you can turn the automatic linting off altogether,
|
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
|
including the option `g:ale_lint_on_enter`, and you can run ALE manually with
|
||||||
`:ALELint`.
|
`:ALELint`.
|
||||||
|
|
||||||
<a name="faq-c-configuration"></a>
|
|
||||||
|
|
||||||
### 5.xiv. How can I configure my C or C++ project?
|
|
||||||
|
|
||||||
The structure of C and C++ projects varies wildly from project to project, with
|
|
||||||
many different build tools being used for building them, and many different
|
|
||||||
formats for project configuration files. ALE can run compilers easily, but
|
|
||||||
ALE cannot easily detect which compiler flags to use.
|
|
||||||
|
|
||||||
Some tools and build configurations can generate
|
|
||||||
[compile_commands.json](https://clang.llvm.org/docs/JSONCompilationDatabase.html)
|
|
||||||
files. The `cppcheck`, `clangcheck` and `clangtidy` linters can read these
|
|
||||||
files for automatically determining the appropriate compiler flags to use.
|
|
||||||
|
|
||||||
For linting with compilers like `gcc` and `clang`, and with other tools, you
|
|
||||||
will need to tell ALE which compiler flags to use yourself. You can use
|
|
||||||
different options for different projects with the `g:ale_pattern_options`
|
|
||||||
setting. Consult the documentation for that setting for more information.
|
|
||||||
`b:ale_linters` can be used to select which tools you want to run, say if you
|
|
||||||
want to use only `gcc` for one project, and only `clang` for another.
|
|
||||||
|
|
||||||
You may also configure buffer-local settings for linters with project-specific
|
|
||||||
vimrc files. [local_vimrc](https://github.com/LucHermitte/local_vimrc) can be
|
|
||||||
used for executing local vimrc files which can be shared in your project.
|
|
||||||
|
|
||||||
<a name="faq-buffer-configuration"></a>
|
|
||||||
|
|
||||||
### 5.xv. How can I configure ALE differently for different buffers?
|
|
||||||
|
|
||||||
ALE offers various ways to configure which linters or fixers are run, and
|
|
||||||
other settings. For the majority of ALE's settings, they can either be
|
|
||||||
configured globally with a `g:` variable prefix, or for a specific buffer
|
|
||||||
with a `b:` variable prefix. For example, you can configure a Python ftplugin
|
|
||||||
file like so.
|
|
||||||
|
|
||||||
```vim
|
|
||||||
" In ~/.vim/ftplugin/python.vim
|
|
||||||
|
|
||||||
" Check Python files with flake8 and pylint.
|
|
||||||
let b:ale_linters = ['flake8', 'pylint']
|
|
||||||
" Fix Python files with autopep8 and yapf.
|
|
||||||
let b:ale_fixers = ['autopep8', 'yapf']
|
|
||||||
" Disable warnings about trailing whitespace for Python files.
|
|
||||||
let b:ale_warn_about_trailing_whitespace = 0
|
|
||||||
```
|
|
||||||
|
|
||||||
For configuring files based on regular expression patterns matched against the
|
|
||||||
absolute path to a file, you can use `g:ale_pattern_options`.
|
|
||||||
|
|
||||||
```vim
|
|
||||||
" Do not lint or fix minified files.
|
|
||||||
let g:ale_pattern_options = {
|
|
||||||
\ '\.min\.js$': {'ale_linters': [], 'ale_fixers': []},
|
|
||||||
\ '\.min\.css$': {'ale_linters': [], 'ale_fixers': []},
|
|
||||||
\}
|
|
||||||
" If you configure g:ale_pattern_options outside of vimrc, you need this.
|
|
||||||
let g:ale_pattern_options_enabled = 1
|
|
||||||
```
|
|
||||||
|
|
||||||
Buffer-local variables for settings always override the global settings.
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
|
|||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
let l:code = l:match[4]
|
let l:code = l:match[4]
|
||||||
|
|
||||||
if l:code is# 'EANSIBLE0002'
|
if l:code is# 'EANSIBLE002'
|
||||||
\&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
\&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
||||||
" Skip warnings for trailing whitespace if the option is off.
|
" Skip warnings for trailing whitespace if the option is off.
|
||||||
continue
|
continue
|
||||||
@@ -31,8 +31,7 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
|
|||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': l:match[2] + 0,
|
\ 'lnum': l:match[2] + 0,
|
||||||
\ 'col': l:match[3] + 0,
|
\ 'col': l:match[3] + 0,
|
||||||
\ 'text': l:match[5],
|
\ 'text': l:code . ': ' . l:match[5],
|
||||||
\ 'code': l:code,
|
|
||||||
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
|
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
|
||||||
\})
|
\})
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -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>
|
" Author: Lucas Kolstad <lkolstad@uw.edu>
|
||||||
" Description: gcc linter for asm files
|
" Description: gcc linter for asm files
|
||||||
|
|
||||||
call ale#Set('asm_gcc_executable', 'gcc')
|
let g:ale_asm_gcc_options = get(g:, 'ale_asm_gcc_options', '-Wall')
|
||||||
call ale#Set('asm_gcc_options', '-Wall')
|
|
||||||
|
|
||||||
function! ale_linters#asm#gcc#GetExecutable(buffer) abort
|
|
||||||
return ale#Var(a:buffer, 'asm_gcc_executable')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#asm#gcc#GetCommand(buffer) abort
|
function! ale_linters#asm#gcc#GetCommand(buffer) abort
|
||||||
return ale#Escape(ale_linters#asm#gcc#GetExecutable(a:buffer))
|
return 'gcc -x assembler -fsyntax-only '
|
||||||
\ . ' -x assembler -fsyntax-only '
|
|
||||||
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||||
\ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -'
|
\ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -'
|
||||||
endfunction
|
endfunction
|
||||||
@@ -33,7 +27,7 @@ endfunction
|
|||||||
call ale#linter#Define('asm', {
|
call ale#linter#Define('asm', {
|
||||||
\ 'name': 'gcc',
|
\ 'name': 'gcc',
|
||||||
\ 'output_stream': 'stderr',
|
\ 'output_stream': 'stderr',
|
||||||
\ 'executable_callback': 'ale_linters#asm#gcc#GetExecutable',
|
\ 'executable': 'gcc',
|
||||||
\ 'command_callback': 'ale_linters#asm#gcc#GetCommand',
|
\ 'command_callback': 'ale_linters#asm#gcc#GetCommand',
|
||||||
\ 'callback': 'ale_linters#asm#gcc#Handle',
|
\ 'callback': 'ale_linters#asm#gcc#Handle',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,37 +1,24 @@
|
|||||||
" Author: Edward Larkey <edwlarkey@mac.com>
|
" Author: Edward Larkey <edwlarkey@mac.com>
|
||||||
" Author: Jose Junior <jose.junior@gmail.com>
|
" Author: Jose Junior <jose.junior@gmail.com>
|
||||||
" Author: w0rp <devw0rp@gmail.com>
|
|
||||||
" Description: This file adds the foodcritic linter for Chef files.
|
" Description: This file adds the foodcritic linter for Chef files.
|
||||||
|
|
||||||
call ale#Set('chef_foodcritic_executable', 'foodcritic')
|
" Support options!
|
||||||
call ale#Set('chef_foodcritic_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#GetExecutable(buffer) abort
|
|
||||||
return ale#Var(a:buffer, 'chef_foodcritic_executable')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#chef#foodcritic#GetCommand(buffer) abort
|
|
||||||
let l:executable = ale_linters#chef#foodcritic#GetExecutable(a:buffer)
|
|
||||||
let l:options = ale#Var(a:buffer, 'chef_foodcritic_options')
|
|
||||||
|
|
||||||
return ale#Escape(l:executable)
|
|
||||||
\ . (!empty(l:options) ? ' ' . escape(l:options, '~') : '')
|
|
||||||
\ . ' %s'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#chef#foodcritic#Handle(buffer, lines) abort
|
function! ale_linters#chef#foodcritic#Handle(buffer, lines) abort
|
||||||
" Matches patterns line the following:
|
" Matches patterns line the following:
|
||||||
"
|
"
|
||||||
" FC002: Avoid string interpolation where not required: httpd.rb:13
|
" 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 = []
|
let l:output = []
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
let l:text = l:match[1]
|
||||||
|
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'code': l:match[1],
|
\ 'lnum': l:match[3] + 0,
|
||||||
\ 'text': l:match[2],
|
\ 'text': l:text,
|
||||||
\ 'filename': l:match[3],
|
|
||||||
\ 'lnum': l:match[4] + 0,
|
|
||||||
\ 'type': 'W',
|
\ 'type': 'W',
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
@@ -39,10 +26,17 @@ function! ale_linters#chef#foodcritic#Handle(buffer, lines) abort
|
|||||||
return l:output
|
return l:output
|
||||||
endfunction
|
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', {
|
call ale#linter#Define('chef', {
|
||||||
\ 'name': 'foodcritic',
|
\ 'name': 'foodcritic',
|
||||||
\ 'executable_callback': 'ale_linters#chef#foodcritic#GetExecutable',
|
\ 'executable': 'foodcritic',
|
||||||
\ 'command_callback': 'ale_linters#chef#foodcritic#GetCommand',
|
\ 'command_callback': 'ale_linters#chef#foodcritic#GetCommand',
|
||||||
\ 'callback': 'ale_linters#chef#foodcritic#Handle',
|
\ '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',
|
|
||||||
\})
|
|
||||||
@@ -24,9 +24,9 @@ function! ale_linters#cpp#clangcheck#GetCommand(buffer) abort
|
|||||||
" detected.
|
" detected.
|
||||||
return ale#Escape(ale_linters#cpp#clangcheck#GetExecutable(a:buffer))
|
return ale#Escape(ale_linters#cpp#clangcheck#GetExecutable(a:buffer))
|
||||||
\ . ' -analyze %s'
|
\ . ' -analyze %s'
|
||||||
\ . (empty(l:build_dir) ? ' -extra-arg -Xclang -extra-arg -analyzer-output=text' : '')
|
|
||||||
\ . (!empty(l:user_options) ? ' ' . l:user_options : '')
|
\ . (!empty(l:user_options) ? ' ' . l:user_options : '')
|
||||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||||
|
\ . (empty(l:build_dir) ? ' -extra-arg -Xanalyzer -extra-arg -analyzer-output=text' : '')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('cpp', {
|
call ale#linter#Define('cpp', {
|
||||||
|
|||||||
@@ -8,16 +8,15 @@ function! ale_linters#cs#mcs#Handle(buffer, lines) abort
|
|||||||
" Look for lines like the following.
|
" Look for lines like the following.
|
||||||
"
|
"
|
||||||
" Tests.cs(12,29): error CSXXXX: ; expected
|
" Tests.cs(12,29): error CSXXXX: ; expected
|
||||||
let l:pattern = '^\v(.+\.cs)\((\d+),(\d+)\)\: ([^ ]+) ([^ ]+): (.+)$'
|
let l:pattern = '^.\+.cs(\(\d\+\),\(\d\+\)): \(.\+\): \(.\+\)'
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': l:match[2] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'col': l:match[3] + 0,
|
\ 'col': l:match[2] + 0,
|
||||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
\ 'text': l:match[3] . ': ' . l:match[4],
|
||||||
\ 'code': l:match[5],
|
\ 'type': l:match[3] =~# '^error' ? 'E' : 'W',
|
||||||
\ 'text': l:match[6],
|
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
|||||||
@@ -1,47 +1,55 @@
|
|||||||
call ale#Set('cs_mcsc_options', '')
|
" general mcs options which are likely to stay constant across
|
||||||
call ale#Set('cs_mcsc_source', '')
|
" source trees like -pkg:dotnet
|
||||||
call ale#Set('cs_mcsc_assembly_path', [])
|
let g:ale_cs_mcsc_options = get(g:, 'ale_cs_mcsc_options', '')
|
||||||
call ale#Set('cs_mcsc_assemblies', [])
|
|
||||||
|
|
||||||
function! s:GetWorkingDirectory(buffer) abort
|
" path string pointing the linter to the base path of the
|
||||||
let l:working_directory = ale#Var(a:buffer, 'cs_mcsc_source')
|
" source tree to check
|
||||||
|
let g:ale_cs_mcsc_source = get(g:, 'ale_cs_mcsc_source','.')
|
||||||
|
|
||||||
if !empty(l:working_directory)
|
" list of search paths for additional assemblies to consider
|
||||||
return l:working_directory
|
let g:ale_cs_mcsc_assembly_path = get(g:, 'ale_cs_mcsc_assembly_path',[])
|
||||||
|
|
||||||
|
" list of assemblies to consider
|
||||||
|
let g:ale_cs_mcsc_assemblies = get(g:, 'ale_cs_mcsc_assemblies',[])
|
||||||
|
function! ale_linters#cs#mcsc#GetCommand(buffer) abort
|
||||||
|
|
||||||
|
" if list of assembly search paths is not empty convert it to
|
||||||
|
" appropriate -lib: parameter of mcs
|
||||||
|
let l:path = ale#Var(a:buffer, 'cs_mcsc_assembly_path')
|
||||||
|
|
||||||
|
if !empty(l:path)
|
||||||
|
let l:path = '-lib:"' . join(l:path, '","') .'"'
|
||||||
|
else
|
||||||
|
let l:path =''
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return fnamemodify(bufname(a:buffer), ':p:h')
|
" if list of assemblies to link is not empty convert it to the
|
||||||
endfunction
|
" appropriate -r: parameter of mcs
|
||||||
|
let l:assemblies = ale#Var(a:buffer, 'cs_mcsc_assemblies')
|
||||||
|
|
||||||
function! ale_linters#cs#mcsc#GetCommand(buffer) abort
|
if !empty(l:assemblies)
|
||||||
" Pass assembly paths via the -lib: parameter.
|
let l:assemblies = '-r:"' . join(l:assemblies, '","') . '"'
|
||||||
let l:path_list = ale#Var(a:buffer, 'cs_mcsc_assembly_path')
|
else
|
||||||
|
let l:assemblies =''
|
||||||
let l:lib_option = !empty(l:path_list)
|
endif
|
||||||
\ ? '-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
|
" register temporary module target file with ale
|
||||||
let l:out = tempname()
|
let l:out = tempname()
|
||||||
call ale#engine#ManageFile(a:buffer, l:out)
|
call ale#engine#ManageFile(a:buffer, l:out)
|
||||||
|
|
||||||
" The code is compiled as a module and the output is redirected to a
|
" assemble linter command string to be executed by ale
|
||||||
" temporary file.
|
" implicitly set -unsafe mcs flag set compilation
|
||||||
return ale#path#CdString(s:GetWorkingDirectory(a:buffer))
|
" target to module (-t:module), direct mcs output to
|
||||||
|
" temporary file (-out)
|
||||||
|
"
|
||||||
|
return 'cd "' . ale#Var(a:buffer, 'cs_mcsc_source') . '";'
|
||||||
\ . 'mcs -unsafe'
|
\ . 'mcs -unsafe'
|
||||||
\ . ' ' . ale#Var(a:buffer, 'cs_mcsc_options')
|
\ . ' ' . ale#Var(a:buffer, 'cs_mcsc_options')
|
||||||
\ . ' ' . l:lib_option
|
\ . ' ' . l:path
|
||||||
\ . ' ' . l:r_option
|
\ . ' ' . l:assemblies
|
||||||
\ . ' -out:' . l:out
|
\ . ' -out:' . l:out
|
||||||
\ . ' -t:module'
|
\ . ' -t:module'
|
||||||
\ . ' -recurse:' . ale#Escape('*.cs')
|
\ . ' -recurse:"*.cs"'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#cs#mcsc#Handle(buffer, lines) abort
|
function! ale_linters#cs#mcsc#Handle(buffer, lines) abort
|
||||||
@@ -52,19 +60,17 @@ function! ale_linters#cs#mcsc#Handle(buffer, lines) abort
|
|||||||
" NOTE: pattern also captures file name as linter compiles all
|
" NOTE: pattern also captures file name as linter compiles all
|
||||||
" files within the source tree rooted at the specified source
|
" files within the source tree rooted at the specified source
|
||||||
" path and not just the file loaded in the buffer
|
" path and not just the file loaded in the buffer
|
||||||
let l:pattern = '^\v(.+\.cs)\((\d+),(\d+)\)\: ([^ ]+) ([^ ]+): (.+)$'
|
let l:pattern = '^\(.\+\.cs\)(\(\d\+\),\(\d\+\)): \(.\+\): \(.\+\)'
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
let l:source = ale#Var(a:buffer, 'cs_mcsc_source')
|
||||||
let l:dir = s:GetWorkingDirectory(a:buffer)
|
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
\ 'filename': fnamemodify(l:source . '/' . l:match[1], ':p'),
|
||||||
\ 'lnum': l:match[2] + 0,
|
\ 'lnum': l:match[2] + 0,
|
||||||
\ 'col': l:match[3] + 0,
|
\ 'col': l:match[3] + 0,
|
||||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
\ 'text': l:match[4] . ': ' . l:match[5],
|
||||||
\ 'code': l:match[5],
|
\ 'type': l:match[4] =~# '^error' ? 'E' : 'W',
|
||||||
\ 'text': l:match[6],
|
|
||||||
\})
|
\})
|
||||||
endfor
|
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,
|
|
||||||
\ })
|
|
||||||
@@ -13,7 +13,7 @@ function! ale_linters#dart#dartanalyzer#GetCommand(buffer) abort
|
|||||||
|
|
||||||
return ale#Escape(l:executable)
|
return ale#Escape(l:executable)
|
||||||
\ . (!empty(l:path) ? ' --packages ' . ale#Escape(l:path) : '')
|
\ . (!empty(l:path) ? ' --packages ' . ale#Escape(l:path) : '')
|
||||||
\ . ' %s'
|
\ . ' %t'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#dart#dartanalyzer#Handle(buffer, lines) abort
|
function! ale_linters#dart#dartanalyzer#Handle(buffer, lines) abort
|
||||||
@@ -37,5 +37,4 @@ call ale#linter#Define('dart', {
|
|||||||
\ 'executable_callback': 'ale_linters#dart#dartanalyzer#GetExecutable',
|
\ 'executable_callback': 'ale_linters#dart#dartanalyzer#GetExecutable',
|
||||||
\ 'command_callback': 'ale_linters#dart#dartanalyzer#GetCommand',
|
\ 'command_callback': 'ale_linters#dart#dartanalyzer#GetCommand',
|
||||||
\ 'callback': 'ale_linters#dart#dartanalyzer#Handle',
|
\ '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,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,23 +1,11 @@
|
|||||||
" Author: Jake Zimmerman <jake@zimmerman.io>, Eddie Lebow https://github.com/elebow
|
" Author: Jake Zimmerman <jake@zimmerman.io>
|
||||||
" Description: eruby checker using `erubis`, instead of `erb`
|
" 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', {
|
call ale#linter#Define('eruby', {
|
||||||
\ 'name': 'erubis',
|
\ 'name': 'erubis',
|
||||||
\ 'executable': 'erubis',
|
\ 'executable': 'erubis',
|
||||||
\ 'output_stream': 'stderr',
|
\ 'output_stream': 'stderr',
|
||||||
\ 'command_callback': 'ale_linters#eruby#erubis#GetCommand',
|
\ 'command': 'erubis -x %t | ruby -c',
|
||||||
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
|
\ '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,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,5 +1,4 @@
|
|||||||
" Author: Joshua Rubin <joshua@rubixconsulting.com>, Ben Reedy <https://github.com/breed808>,
|
" Author: Joshua Rubin <joshua@rubixconsulting.com>, Ben Reedy <https://github.com/breed808>
|
||||||
" Jeff Willette <jrwillette88@gmail.com>
|
|
||||||
" Description: go build for Go files
|
" Description: go build for Go files
|
||||||
|
|
||||||
" inspired by work from dzhou121 <dzhou121@gmail.com>
|
" inspired by work from dzhou121 <dzhou121@gmail.com>
|
||||||
@@ -40,12 +39,15 @@ function! ale_linters#go#gobuild#GetMatches(lines) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#go#gobuild#Handler(buffer, lines) abort
|
function! ale_linters#go#gobuild#Handler(buffer, lines) abort
|
||||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
for l:match in ale_linters#go#gobuild#GetMatches(a:lines)
|
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, {
|
call add(l:output, {
|
||||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
|
||||||
\ 'lnum': l:match[2] + 0,
|
\ 'lnum': l:match[2] + 0,
|
||||||
\ 'col': l:match[3] + 0,
|
\ 'col': l:match[3] + 0,
|
||||||
\ 'text': l:match[4],
|
\ 'text': l:match[4],
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
call ale#linter#Define('go', {
|
call ale#linter#Define('go', {
|
||||||
\ 'name': 'golint',
|
\ 'name': 'golint',
|
||||||
\ 'output_stream': 'both',
|
|
||||||
\ 'executable': 'golint',
|
\ 'executable': 'golint',
|
||||||
\ 'command': 'golint %t',
|
\ 'command': 'golint %t',
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
" 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
|
" Description: Adds support for the gometalinter suite for Go files
|
||||||
|
|
||||||
call ale#Set('go_gometalinter_options', '')
|
call ale#Set('go_gometalinter_options', '')
|
||||||
call ale#Set('go_gometalinter_executable', 'gometalinter')
|
call ale#Set('go_gometalinter_executable', 'gometalinter')
|
||||||
call ale#Set('go_gometalinter_lint_package', 0)
|
|
||||||
|
|
||||||
function! ale_linters#go#gometalinter#GetExecutable(buffer) abort
|
function! ale_linters#go#gometalinter#GetExecutable(buffer) abort
|
||||||
return ale#Var(a:buffer, 'go_gometalinter_executable')
|
return ale#Var(a:buffer, 'go_gometalinter_executable')
|
||||||
@@ -11,22 +10,13 @@ endfunction
|
|||||||
|
|
||||||
function! ale_linters#go#gometalinter#GetCommand(buffer) abort
|
function! ale_linters#go#gometalinter#GetCommand(buffer) abort
|
||||||
let l:executable = ale_linters#go#gometalinter#GetExecutable(a:buffer)
|
let l:executable = ale_linters#go#gometalinter#GetExecutable(a:buffer)
|
||||||
let l:filename = expand('#' . a:buffer . ':t')
|
let l:filename = expand('#' . a:buffer)
|
||||||
let l:options = ale#Var(a:buffer, 'go_gometalinter_options')
|
let l:options = ale#Var(a:buffer, 'go_gometalinter_options')
|
||||||
let l:lint_package = ale#Var(a:buffer, 'go_gometalinter_lint_package')
|
|
||||||
|
|
||||||
" BufferCdString is used so that we can be sure the paths output from gometalinter can
|
return ale#Escape(l:executable)
|
||||||
" be calculated to absolute paths in the Handler
|
\ . ' --include=' . ale#Escape('^' . ale#util#EscapePCRE(l:filename))
|
||||||
if l:lint_package
|
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||||
return ale#path#BufferCdString(a:buffer)
|
\ . ' ' . ale#Escape(fnamemodify(l:filename, ':h'))
|
||||||
\ . ale#Escape(l:executable)
|
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
|
||||||
endif
|
|
||||||
|
|
||||||
return ale#path#BufferCdString(a:buffer)
|
|
||||||
\ . ale#Escape(l:executable)
|
|
||||||
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(l:filename))
|
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '') . ' .'
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#go#gometalinter#GetMatches(lines) abort
|
function! ale_linters#go#gometalinter#GetMatches(lines) abort
|
||||||
@@ -36,13 +26,10 @@ function! ale_linters#go#gometalinter#GetMatches(lines) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#go#gometalinter#Handler(buffer, lines) abort
|
function! ale_linters#go#gometalinter#Handler(buffer, lines) abort
|
||||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
for l:match in ale_linters#go#gometalinter#GetMatches(a:lines)
|
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, {
|
call add(l:output, {
|
||||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
|
||||||
\ 'lnum': l:match[2] + 0,
|
\ 'lnum': l:match[2] + 0,
|
||||||
\ 'col': l:match[3] + 0,
|
\ 'col': l:match[3] + 0,
|
||||||
\ 'type': tolower(l:match[4]) is# 'warning' ? 'W' : 'E',
|
\ 'type': tolower(l:match[4]) is# 'warning' ? 'W' : 'E',
|
||||||
|
|||||||
@@ -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,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
|
" 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
|
function! ale_linters#haml#hamllint#Handle(buffer, lines) abort
|
||||||
" Matches patterns like the following:
|
" Matches patterns like the following:
|
||||||
" <path>:51 [W] RuboCop: Use the new Ruby 1.9 hash syntax.
|
" <path>:51 [W] RuboCop: Use the new Ruby 1.9 hash syntax.
|
||||||
@@ -46,6 +21,6 @@ endfunction
|
|||||||
call ale#linter#Define('haml', {
|
call ale#linter#Define('haml', {
|
||||||
\ 'name': 'hamllint',
|
\ 'name': 'hamllint',
|
||||||
\ 'executable': 'haml-lint',
|
\ 'executable': 'haml-lint',
|
||||||
\ 'command_callback': 'ale_linters#haml#hamllint#GetCommand',
|
\ 'command': 'haml-lint %t',
|
||||||
\ 'callback': 'ale_linters#haml#hamllint#Handle'
|
\ 'callback': 'ale_linters#haml#hamllint#Handle'
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -22,13 +22,15 @@ function! ale_linters#handlebars#embertemplatelint#Handle(buffer, lines) abort
|
|||||||
for l:error in get(values(l:json), 0, [])
|
for l:error in get(values(l:json), 0, [])
|
||||||
if has_key(l:error, 'fatal')
|
if has_key(l:error, 'fatal')
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': get(l:error, 'line', 1),
|
\ 'bufnr': a:buffer,
|
||||||
\ 'col': get(l:error, 'column', 1),
|
\ 'lnum': 1,
|
||||||
|
\ 'col': 1,
|
||||||
\ 'text': l:error.message,
|
\ 'text': l:error.message,
|
||||||
\ 'type': l:error.severity == 1 ? 'W' : 'E',
|
\ 'type': l:error.severity == 1 ? 'W' : 'E',
|
||||||
\})
|
\})
|
||||||
else
|
else
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
|
\ 'bufnr': a:buffer,
|
||||||
\ 'lnum': l:error.line,
|
\ 'lnum': l:error.line,
|
||||||
\ 'col': l:error.column,
|
\ 'col': l:error.column,
|
||||||
\ 'text': l:error.rule . ': ' . l:error.message,
|
\ 'text': l:error.rule . ': ' . l:error.message,
|
||||||
|
|||||||
@@ -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,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',
|
|
||||||
\})
|
|
||||||
@@ -2,17 +2,27 @@
|
|||||||
" Description: checkstyle for Java files
|
" Description: checkstyle for Java files
|
||||||
|
|
||||||
function! ale_linters#java#checkstyle#Handle(buffer, lines) abort
|
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 = []
|
let l:output = []
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:patterns)
|
||||||
call add(l:output, {
|
let l:args = {
|
||||||
\ 'type': l:match[1] is? 'WARN' ? 'W' : 'E',
|
|
||||||
\ 'lnum': l:match[2] + 0,
|
\ 'lnum': l:match[2] + 0,
|
||||||
\ 'col': l:match[3] + 0,
|
\ 'type': l:match[1] =~? 'WARN' ? 'W' : 'E'
|
||||||
\ 'text': l:match[4],
|
\ }
|
||||||
\ 'code': l:match[5],
|
|
||||||
\})
|
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
|
endfor
|
||||||
|
|
||||||
return l:output
|
return l:output
|
||||||
|
|||||||
@@ -41,33 +41,9 @@ function! ale_linters#java#javac#GetCommand(buffer, import_paths) abort
|
|||||||
|
|
||||||
" Find the src directory, for files in this project.
|
" Find the src directory, for files in this project.
|
||||||
let l:src_dir = ale#path#FindNearestDirectory(a:buffer, 'src/main/java')
|
let l:src_dir = ale#path#FindNearestDirectory(a:buffer, 'src/main/java')
|
||||||
let l:sp_dirs = []
|
|
||||||
|
|
||||||
if !empty(l:src_dir)
|
if !empty(l:src_dir)
|
||||||
call add(l:sp_dirs, l:src_dir)
|
let l:sp_option = '-sourcepath ' . ale#Escape(l:src_dir)
|
||||||
|
|
||||||
" Automatically include the jaxb directory too, if it's there.
|
|
||||||
let l:jaxb_dir = fnamemodify(l:src_dir, ':h:h')
|
|
||||||
\ . (has('win32') ? '\jaxb\' : '/jaxb/')
|
|
||||||
|
|
||||||
if isdirectory(l:jaxb_dir)
|
|
||||||
call add(l:sp_dirs, l:jaxb_dir)
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Automatically include the test directory, but only for test code.
|
|
||||||
if expand('#' . a:buffer . ':p') =~? '\vsrc[/\\]test[/\\]java'
|
|
||||||
let l:test_dir = fnamemodify(l:src_dir, ':h:h:h')
|
|
||||||
\ . (has('win32') ? '\test\java\' : '/test/java/')
|
|
||||||
|
|
||||||
if isdirectory(l:test_dir)
|
|
||||||
call add(l:sp_dirs, l:test_dir)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !empty(l:sp_dirs)
|
|
||||||
let l:sp_option = '-sourcepath '
|
|
||||||
\ . ale#Escape(join(l:sp_dirs, s:classpath_sep))
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Create .class files in a temporary directory, which we will delete later.
|
" Create .class files in a temporary directory, which we will delete later.
|
||||||
|
|||||||
105
ale_linters/javascript/flow.vim
Executable file → Normal file
105
ale_linters/javascript/flow.vim
Executable file → Normal file
@@ -1,12 +1,21 @@
|
|||||||
" Author: Zach Perrault -- @zperrault
|
" Author: Zach Perrault -- @zperrault
|
||||||
" Author: Florian Beeres <yuuki@protonmail.com>
|
|
||||||
" Description: FlowType checking for JavaScript files
|
" Description: FlowType checking for JavaScript files
|
||||||
|
|
||||||
call ale#Set('javascript_flow_executable', 'flow')
|
call ale#Set('javascript_flow_executable', 'flow')
|
||||||
call ale#Set('javascript_flow_use_home_config', 0)
|
|
||||||
call ale#Set('javascript_flow_use_global', 0)
|
call ale#Set('javascript_flow_use_global', 0)
|
||||||
|
|
||||||
function! ale_linters#javascript#flow#GetExecutable(buffer) abort
|
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')
|
let l:flow_config = ale#path#FindNearestFile(a:buffer, '.flowconfig')
|
||||||
|
|
||||||
if empty(l:flow_config)
|
if empty(l:flow_config)
|
||||||
@@ -14,43 +23,18 @@ function! ale_linters#javascript#flow#GetExecutable(buffer) abort
|
|||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" Don't run Flow with a configuration file from the home directory by
|
let l:use_respect_pragma = 1
|
||||||
" default, which can eat all of your RAM.
|
|
||||||
if fnamemodify(l:flow_config, ':h') is? $HOME
|
|
||||||
\&& !ale#Var(a:buffer, 'javascript_flow_use_home_config')
|
|
||||||
return ''
|
|
||||||
endif
|
|
||||||
|
|
||||||
return ale#node#FindExecutable(a:buffer, 'javascript_flow', [
|
|
||||||
\ 'node_modules/.bin/flow',
|
|
||||||
\])
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#javascript#flow#VersionCheck(buffer) abort
|
|
||||||
let l:executable = ale_linters#javascript#flow#GetExecutable(a:buffer)
|
|
||||||
|
|
||||||
if empty(l:executable)
|
|
||||||
return ''
|
|
||||||
endif
|
|
||||||
|
|
||||||
return ale#Escape(l:executable) . ' --version'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#javascript#flow#GetCommand(buffer, version_lines) abort
|
|
||||||
let l:executable = ale_linters#javascript#flow#GetExecutable(a:buffer)
|
|
||||||
|
|
||||||
if empty(l:executable)
|
|
||||||
return ''
|
|
||||||
endif
|
|
||||||
|
|
||||||
let l:version = ale#semver#GetVersion(l:executable, a:version_lines)
|
|
||||||
|
|
||||||
" If we can parse the version number, then only use --respect-pragma
|
" If we can parse the version number, then only use --respect-pragma
|
||||||
" if the version is >= 0.36.0, which added the argument.
|
" if the version is >= 0.36.0, which added the argument.
|
||||||
let l:use_respect_pragma = empty(l:version)
|
for l:match in ale#util#GetMatches(a:version_lines, '\v\d+\.\d+\.\d+$')
|
||||||
\ || ale#semver#GTE(l:version, [0, 36])
|
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'
|
\ . ' check-contents'
|
||||||
\ . (l:use_respect_pragma ? ' --respect-pragma': '')
|
\ . (l:use_respect_pragma ? ' --respect-pragma': '')
|
||||||
\ . ' --json --from ale %s'
|
\ . ' --json --from ale %s'
|
||||||
@@ -72,44 +56,6 @@ function! s:GetJSONLines(lines) abort
|
|||||||
return a:lines[l:start_index :]
|
return a:lines[l:start_index :]
|
||||||
endfunction
|
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
|
function! ale_linters#javascript#flow#Handle(buffer, lines) abort
|
||||||
let l:str = join(s:GetJSONLines(a:lines), '')
|
let l:str = join(s:GetJSONLines(a:lines), '')
|
||||||
|
|
||||||
@@ -148,19 +94,12 @@ function! ale_linters#javascript#flow#Handle(buffer, lines) abort
|
|||||||
let l:text = l:text . ' See also: ' . l:error.operation.descr
|
let l:text = l:text . ' See also: ' . l:error.operation.descr
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:errorToAdd = {
|
call add(l:output, {
|
||||||
\ 'lnum': l:line,
|
\ 'lnum': l:line,
|
||||||
\ 'col': l:col,
|
\ 'col': l:col,
|
||||||
\ 'text': l:text,
|
\ 'text': l:text,
|
||||||
\ 'type': has_key(l:error, 'level') && l:error.level is# 'error' ? 'E' : 'W',
|
\ 'type': l:error.level is# 'error' ? 'E' : 'W',
|
||||||
\}
|
\})
|
||||||
|
|
||||||
if has_key(l:error, 'extra')
|
|
||||||
let l:errorToAdd.detail = s:GetDetails(l:error)
|
|
||||||
endif
|
|
||||||
|
|
||||||
call add(l:output, l:errorToAdd)
|
|
||||||
|
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return l:output
|
return l:output
|
||||||
|
|||||||
@@ -35,23 +35,19 @@ function! ale_linters#javascript#jscs#Handle(buffer, lines) abort
|
|||||||
"
|
"
|
||||||
" foobar.js: line 2, col 1, Expected indentation of 1 characters
|
" 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:pattern = '^.*:\s\+line \(\d\+\),\s\+col\s\+\(\d\+\),\s\+\(.*\)$'
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
let l:m = ale#util#GetMatches(a:lines, [l:pattern])
|
||||||
|
|
||||||
|
for l:match in l:m
|
||||||
|
let l:text = l:match[3]
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
||||||
let l:obj = {
|
let l:obj = {
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'col': l:match[2] + 0,
|
\ 'col': l:match[2] + 0,
|
||||||
\ 'text': l:match[3]
|
\ '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)
|
call add(l:output, l:obj)
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
|||||||
@@ -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',
|
|
||||||
\})
|
|
||||||
@@ -35,9 +35,8 @@ function! ale_linters#lua#luacheck#Handle(buffer, lines) abort
|
|||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'col': l:match[2] + 0,
|
\ 'col': l:match[2] + 0,
|
||||||
|
\ 'text': l:match[3] . l:match[4] . ': ' . l:match[5],
|
||||||
\ 'type': l:match[3],
|
\ 'type': l:match[3],
|
||||||
\ 'code': l:match[3] . l:match[4],
|
|
||||||
\ 'text': l:match[5],
|
|
||||||
\})
|
\})
|
||||||
endfor
|
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,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',
|
|
||||||
\})
|
|
||||||
@@ -4,6 +4,6 @@
|
|||||||
call ale#linter#Define('markdown', {
|
call ale#linter#Define('markdown', {
|
||||||
\ 'name': 'vale',
|
\ 'name': 'vale',
|
||||||
\ 'executable': 'vale',
|
\ 'executable': 'vale',
|
||||||
\ 'command': 'vale --output=JSON %t',
|
\ 'command': 'vale --output=line %t',
|
||||||
\ 'callback': 'ale#handlers#vale#Handle',
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
|
||||||
" Description: write-good for Markdown files
|
|
||||||
|
|
||||||
call ale#linter#Define('markdown', {
|
|
||||||
\ 'name': 'write-good',
|
|
||||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
|
||||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
|
||||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
|
||||||
\})
|
|
||||||
@@ -10,40 +10,33 @@ function! ale_linters#nim#nimcheck#Handle(buffer, lines) abort
|
|||||||
" Only show errors of the current buffer
|
" Only show errors of the current buffer
|
||||||
" NOTE: Checking filename only is OK because nim enforces unique
|
" NOTE: Checking filename only is OK because nim enforces unique
|
||||||
" module names.
|
" module names.
|
||||||
let l:temp_buffer_filename = fnamemodify(l:match[1], ':p:t')
|
|
||||||
|
|
||||||
|
let l:temp_buffer_filename = fnamemodify(l:match[1], ':p:t')
|
||||||
if l:buffer_filename isnot# '' && l:temp_buffer_filename isnot# l:buffer_filename
|
if l:buffer_filename isnot# '' && l:temp_buffer_filename isnot# l:buffer_filename
|
||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:item = {
|
let l:line = l:match[2] + 0
|
||||||
\ 'lnum': l:match[2] + 0,
|
let l:column = l:match[3] + 0
|
||||||
\ 'col': l:match[3] + 0,
|
let l:text = l:match[4]
|
||||||
\ 'text': l:match[4],
|
let l:type = 'W'
|
||||||
\ 'type': 'W',
|
|
||||||
\}
|
|
||||||
|
|
||||||
" Extract error type from message of type 'Error: Some error message'
|
" Extract error type from message of type 'Error: Some error message'
|
||||||
let l:error_match = matchlist(l:item.text, '^\(.\{-}\): \(.\+\)$')
|
let l:textmatch = matchlist(l:match[4], '^\(.\{-}\): .\+$')
|
||||||
|
|
||||||
if !empty(l:error_match)
|
if len(l:textmatch) > 0
|
||||||
if l:error_match[1] is# 'Error'
|
let l:errortype = l:textmatch[1]
|
||||||
let l:item.type = 'E'
|
if l:errortype is# 'Error'
|
||||||
let l:item.text = l:error_match[2]
|
let l:type = 'E'
|
||||||
elseif l:error_match[1] is# 'Warning'
|
|
||||||
\|| l:error_match[1] is# 'Hint'
|
|
||||||
let l:item.text = l:error_match[2]
|
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:code_match = matchlist(l:item.text, '\v^(.+) \[([^ \[]+)\]$')
|
call add(l:output, {
|
||||||
|
\ 'lnum': l:line,
|
||||||
if !empty(l:code_match)
|
\ 'col': l:column,
|
||||||
let l:item.text = l:code_match[1]
|
\ 'text': l:text,
|
||||||
let l:item.code = l:code_match[2]
|
\ 'type': l:type,
|
||||||
endif
|
\})
|
||||||
|
|
||||||
call add(l:output, l:item)
|
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return l:output
|
return l:output
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
" Author: Johannes Wienke <languitar@semipol.de>
|
|
||||||
" Description: alex for nroff files
|
|
||||||
|
|
||||||
call ale#linter#Define('nroff', {
|
|
||||||
\ 'name': 'alex',
|
|
||||||
\ 'executable': 'alex',
|
|
||||||
\ 'command': 'alex %s -t',
|
|
||||||
\ 'output_stream': 'stderr',
|
|
||||||
\ 'callback': 'ale#handlers#alex#Handle',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
|
||||||
" Description: write-good for nroff files
|
|
||||||
|
|
||||||
call ale#linter#Define('nroff', {
|
|
||||||
\ 'name': 'write-good',
|
|
||||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
|
||||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
|
||||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
|
||||||
\})
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
" Author: Michael Jungo <michaeljungo92@gmail.com>
|
|
||||||
" Description: A language server for OCaml
|
|
||||||
|
|
||||||
call ale#Set('ocaml_ols_executable', 'ocaml-language-server')
|
|
||||||
call ale#Set('ocaml_ols_use_global', 0)
|
|
||||||
|
|
||||||
call ale#linter#Define('ocaml', {
|
|
||||||
\ 'name': 'ols',
|
|
||||||
\ 'lsp': 'stdio',
|
|
||||||
\ 'executable_callback': 'ale#handlers#ols#GetExecutable',
|
|
||||||
\ 'command_callback': 'ale#handlers#ols#GetCommand',
|
|
||||||
\ 'language_callback': 'ale#handlers#ols#GetLanguage',
|
|
||||||
\ 'project_root_callback': 'ale#handlers#ols#GetProjectRoot',
|
|
||||||
\})
|
|
||||||
@@ -12,7 +12,7 @@ function! ale_linters#perl#perl#GetExecutable(buffer) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#perl#perl#GetCommand(buffer) abort
|
function! ale_linters#perl#perl#GetCommand(buffer) abort
|
||||||
return ale#Escape(ale_linters#perl#perl#GetExecutable(a:buffer))
|
return ale_linters#perl#perl#GetExecutable(a:buffer)
|
||||||
\ . ' ' . ale#Var(a:buffer, 'perl_perl_options')
|
\ . ' ' . ale#Var(a:buffer, 'perl_perl_options')
|
||||||
\ . ' %t'
|
\ . ' %t'
|
||||||
endfunction
|
endfunction
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ function! ale_linters#perl#perlcritic#Handle(buffer, lines) abort
|
|||||||
\ 'lnum': l:match[1],
|
\ 'lnum': l:match[1],
|
||||||
\ 'col': l:match[2],
|
\ 'col': l:match[2],
|
||||||
\ 'text': l:match[3],
|
\ 'text': l:match[3],
|
||||||
\ 'type': 'W'
|
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
" Author: diegoholiveira <https://github.com/diegoholiveira>
|
|
||||||
" Description: static analyzer for PHP
|
|
||||||
|
|
||||||
" Define the minimum severity
|
|
||||||
let g:ale_php_phan_minimum_severity = get(g:, 'ale_php_phan_minimum_severity', 0)
|
|
||||||
|
|
||||||
function! ale_linters#php#phan#GetCommand(buffer) abort
|
|
||||||
return 'phan -y '
|
|
||||||
\ . ale#Var(a:buffer, 'php_phan_minimum_severity')
|
|
||||||
\ . ' %s'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#php#phan#Handle(buffer, lines) abort
|
|
||||||
" Matches against lines like the following:
|
|
||||||
"
|
|
||||||
" /path/to/some-filename.php:18 ERRORTYPE message
|
|
||||||
let l:pattern = '^.*:\(\d\+\)\s\(\w\+\)\s\(.\+\)$'
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'lnum': l:match[1] + 0,
|
|
||||||
\ 'text': l:match[3],
|
|
||||||
\ 'type': 'W',
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('php', {
|
|
||||||
\ 'name': 'phan',
|
|
||||||
\ 'executable': 'phan',
|
|
||||||
\ 'command_callback': 'ale_linters#php#phan#GetCommand',
|
|
||||||
\ 'callback': 'ale_linters#php#phan#Handle',
|
|
||||||
\})
|
|
||||||
@@ -4,14 +4,12 @@
|
|||||||
function! ale_linters#php#php#Handle(buffer, lines) abort
|
function! ale_linters#php#php#Handle(buffer, lines) abort
|
||||||
" Matches patterns like the following:
|
" Matches patterns like the following:
|
||||||
"
|
"
|
||||||
" PHP 7.1<= - Parse error: syntax error, unexpected ';', expecting ']' in - on line 15
|
" Parse error: syntax error, unexpected ';', expecting ']' in - on line 15
|
||||||
" PHP 7.2>= - Parse error: syntax error, unexpected ';', expecting ']' in Standard input code on line 15
|
let l:pattern = '\v^%(Fatal|Parse) error:\s+(.+unexpected ''(.+)%(expecting.+)@<!''.*|.+) in - on line (\d+)'
|
||||||
let l:pattern = '\v^%(Fatal|Parse) error:\s+(.+unexpected ''(.+)%(expecting.+)@<!''.*|.+) in %(-|Standard input code) on line (\d+)'
|
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
let l:col = empty(l:match[2]) ? 0 : stridx(getline(l:match[3]), l:match[2]) + 1
|
let l:col = empty(l:match[2]) ? 0 : stridx(getline(l:match[3]), l:match[2]) + 1
|
||||||
|
|
||||||
let l:obj = {
|
let l:obj = {
|
||||||
\ 'lnum': l:match[3] + 0,
|
\ 'lnum': l:match[3] + 0,
|
||||||
\ 'col': l:col,
|
\ 'col': l:col,
|
||||||
|
|||||||
@@ -29,12 +29,11 @@ function! ale_linters#php#phpcs#Handle(buffer, lines) abort
|
|||||||
" Matches against lines like the following:
|
" Matches against lines like the following:
|
||||||
"
|
"
|
||||||
" /path/to/some-filename.php:18:3: error - Line indented incorrectly; expected 4 spaces, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
|
" /path/to/some-filename.php:18:3: error - Line indented incorrectly; expected 4 spaces, found 2 (Generic.WhiteSpace.ScopeIndent.IncorrectExact)
|
||||||
let l:pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) - \(.\+\) (\(.\+\))$'
|
let l:pattern = '^.*:\(\d\+\):\(\d\+\): \(.\+\) - \(.\+\) \(\(.\+\)\)$'
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
let l:code = l:match[5]
|
let l:text = l:match[4]
|
||||||
let l:text = l:match[4] . ' (' . l:code . ')'
|
|
||||||
let l:type = l:match[3]
|
let l:type = l:match[3]
|
||||||
|
|
||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
|
|||||||
@@ -1,20 +1,11 @@
|
|||||||
" Author: medains <https://github.com/medains>, David Sierra <https://github.com/davidsierradz>
|
" Author: medains <https://github.com/medains>
|
||||||
" Description: phpmd for PHP files
|
" Description: phpmd for PHP files
|
||||||
|
|
||||||
let g:ale_php_phpmd_executable = get(g:, 'ale_php_phpmd_executable', 'phpmd')
|
|
||||||
|
|
||||||
" Set to change the ruleset
|
" Set to change the ruleset
|
||||||
let g:ale_php_phpmd_ruleset = get(g:, 'ale_php_phpmd_ruleset', 'cleancode,codesize,controversial,design,naming,unusedcode')
|
let g:ale_php_phpmd_ruleset = get(g:, 'ale_php_phpmd_ruleset', 'cleancode,codesize,controversial,design,naming,unusedcode')
|
||||||
|
|
||||||
function! ale_linters#php#phpmd#GetExecutable(buffer) abort
|
|
||||||
return ale#Var(a:buffer, 'php_phpmd_executable')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#php#phpmd#GetCommand(buffer) abort
|
function! ale_linters#php#phpmd#GetCommand(buffer) abort
|
||||||
let l:executable = ale_linters#php#phpmd#GetExecutable(a:buffer)
|
return 'phpmd %s text '
|
||||||
|
|
||||||
return ale#Escape(l:executable)
|
|
||||||
\ . ' %s text '
|
|
||||||
\ . ale#Var(a:buffer, 'php_phpmd_ruleset')
|
\ . ale#Var(a:buffer, 'php_phpmd_ruleset')
|
||||||
\ . ' --ignore-violations-on-exit %t'
|
\ . ' --ignore-violations-on-exit %t'
|
||||||
endfunction
|
endfunction
|
||||||
@@ -39,7 +30,7 @@ endfunction
|
|||||||
|
|
||||||
call ale#linter#Define('php', {
|
call ale#linter#Define('php', {
|
||||||
\ 'name': 'phpmd',
|
\ 'name': 'phpmd',
|
||||||
\ 'executable_callback': 'ale_linters#php#phpmd#GetExecutable',
|
\ 'executable': 'phpmd',
|
||||||
\ 'command_callback': 'ale_linters#php#phpmd#GetCommand',
|
\ 'command_callback': 'ale_linters#php#phpmd#GetCommand',
|
||||||
\ 'callback': 'ale_linters#php#phpmd#Handle',
|
\ 'callback': 'ale_linters#php#phpmd#Handle',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
" Author: Johannes Wienke <languitar@semipol.de>
|
|
||||||
" Description: alex for pod files
|
|
||||||
|
|
||||||
call ale#linter#Define('pod', {
|
|
||||||
\ 'name': 'alex',
|
|
||||||
\ 'executable': 'alex',
|
|
||||||
\ 'command': 'alex %s -t',
|
|
||||||
\ 'output_stream': 'stderr',
|
|
||||||
\ 'callback': 'ale#handlers#alex#Handle',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
|
||||||
" Description: write-good for Pod files
|
|
||||||
|
|
||||||
call ale#linter#Define('pod', {
|
|
||||||
\ 'name': 'write-good',
|
|
||||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
|
||||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
|
||||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
|
||||||
\})
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
" Author: Jeff Willette <jrwillette88@gmail.com>
|
|
||||||
" Description: run the protoc-gen-lint plugin for the protoc binary
|
|
||||||
|
|
||||||
function! ale_linters#proto#protoc_gen_lint#GetCommand(buffer) abort
|
|
||||||
let l:dirname = expand('#' . a:buffer . ':p:h')
|
|
||||||
|
|
||||||
return 'protoc'
|
|
||||||
\ . ' -I ' . ale#Escape(l:dirname)
|
|
||||||
\ . ' --lint_out=. ' . '%s'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('proto', {
|
|
||||||
\ 'name': 'protoc-gen-lint',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\ 'output_stream': 'stderr',
|
|
||||||
\ 'executable': 'protoc',
|
|
||||||
\ 'command_callback': 'ale_linters#proto#protoc_gen_lint#GetCommand',
|
|
||||||
\ 'callback': 'ale#handlers#unix#HandleAsError',
|
|
||||||
\})
|
|
||||||
@@ -3,9 +3,8 @@
|
|||||||
function! ale_linters#puppet#puppet#Handle(buffer, lines) abort
|
function! ale_linters#puppet#puppet#Handle(buffer, lines) abort
|
||||||
" Matches patterns like the following:
|
" Matches patterns like the following:
|
||||||
" Error: Could not parse for environment production: Syntax error at ':' at /root/puppetcode/modules/nginx/manifests/init.pp:43:12
|
" Error: Could not parse for environment production: Syntax error at ':' at /root/puppetcode/modules/nginx/manifests/init.pp:43:12
|
||||||
" Error: Could not parse for environment production: Syntax error at '='; expected '}' at /root/puppetcode/modules/pancakes/manifests/init.pp:5"
|
|
||||||
|
|
||||||
let l:pattern = '^Error: .*: \(.\+\) at .\+\.pp:\(\d\+\):\=\(\d*\)'
|
let l:pattern = '^Error: .*: \(.\+\) at .\+:\(\d\+\):\(\d\+\)$'
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ let g:ale_python_flake8_options =
|
|||||||
\ get(g:, 'ale_python_flake8_options', s:default_options)
|
\ get(g:, 'ale_python_flake8_options', s:default_options)
|
||||||
let g:ale_python_flake8_use_global = get(g:, 'ale_python_flake8_use_global', 0)
|
let g:ale_python_flake8_use_global = get(g:, 'ale_python_flake8_use_global', 0)
|
||||||
|
|
||||||
|
" A map from Python executable paths to semver strings parsed for those
|
||||||
|
" executables, so we don't have to look up the version number constantly.
|
||||||
|
let s:version_cache = {}
|
||||||
|
|
||||||
function! s:UsingModule(buffer) abort
|
function! s:UsingModule(buffer) abort
|
||||||
return ale#Var(a:buffer, 'python_flake8_options') =~# ' *-m flake8'
|
return ale#Var(a:buffer, 'python_flake8_options') =~# ' *-m flake8'
|
||||||
endfunction
|
endfunction
|
||||||
@@ -22,35 +26,62 @@ function! ale_linters#python#flake8#GetExecutable(buffer) abort
|
|||||||
return ale#Var(a:buffer, 'python_flake8_executable')
|
return ale#Var(a:buffer, 'python_flake8_executable')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#python#flake8#ClearVersionCache() abort
|
||||||
|
let s:version_cache = {}
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#python#flake8#VersionCheck(buffer) abort
|
function! ale_linters#python#flake8#VersionCheck(buffer) abort
|
||||||
let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer)
|
let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer)
|
||||||
|
|
||||||
" If we have previously stored the version number in a cache, then
|
" If we have previously stored the version number in a cache, then
|
||||||
" don't look it up again.
|
" don't look it up again.
|
||||||
if ale#semver#HasVersion(l:executable)
|
if has_key(s:version_cache, l:executable)
|
||||||
" Returning an empty string skips this command.
|
" Returning an empty string skips this command.
|
||||||
return ''
|
return ''
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:executable = ale#Escape(l:executable)
|
let l:executable = ale#Escape(ale_linters#python#flake8#GetExecutable(a:buffer))
|
||||||
let l:module_string = s:UsingModule(a:buffer) ? ' -m flake8' : ''
|
let l:module_string = s:UsingModule(a:buffer) ? ' -m flake8' : ''
|
||||||
|
|
||||||
return l:executable . l:module_string . ' --version'
|
return l:executable . l:module_string . ' --version'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#python#flake8#GetCommand(buffer, version_output) abort
|
" Get the flake8 version from the output, or the cache.
|
||||||
|
function! s:GetVersion(buffer, version_output) abort
|
||||||
let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer)
|
let l:executable = ale_linters#python#flake8#GetExecutable(a:buffer)
|
||||||
let l:version = ale#semver#GetVersion(l:executable, a:version_output)
|
let l:version = []
|
||||||
|
|
||||||
|
" Get the version from the cache.
|
||||||
|
if has_key(s:version_cache, l:executable)
|
||||||
|
return s:version_cache[l:executable]
|
||||||
|
endif
|
||||||
|
|
||||||
|
if !empty(a:version_output)
|
||||||
|
" Parse the version string, and store it in the cache.
|
||||||
|
let l:version = ale#semver#Parse(a:version_output[0])
|
||||||
|
let s:version_cache[l:executable] = l:version
|
||||||
|
endif
|
||||||
|
|
||||||
|
return l:version
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
" flake8 versions 3 and up support the --stdin-display-name argument.
|
||||||
|
function! s:SupportsDisplayName(version) abort
|
||||||
|
return !empty(a:version) && ale#semver#GreaterOrEqual(a:version, [3, 0, 0])
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#python#flake8#GetCommand(buffer, version_output) abort
|
||||||
|
let l:version = s:GetVersion(a:buffer, a:version_output)
|
||||||
|
|
||||||
" Only include the --stdin-display-name argument if we can parse the
|
" Only include the --stdin-display-name argument if we can parse the
|
||||||
" flake8 version, and it is recent enough to support it.
|
" flake8 version, and it is recent enough to support it.
|
||||||
let l:display_name_args = ale#semver#GTE(l:version, [3, 0, 0])
|
let l:display_name_args = s:SupportsDisplayName(l:version)
|
||||||
\ ? ' --stdin-display-name %s'
|
\ ? ' --stdin-display-name %s'
|
||||||
\ : ''
|
\ : ''
|
||||||
|
|
||||||
let l:options = ale#Var(a:buffer, 'python_flake8_options')
|
let l:options = ale#Var(a:buffer, 'python_flake8_options')
|
||||||
|
|
||||||
return ale#Escape(l:executable)
|
return ale#Escape(ale_linters#python#flake8#GetExecutable(a:buffer))
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||||
\ . ' --format=default'
|
\ . ' --format=default'
|
||||||
\ . l:display_name_args . ' -'
|
\ . l:display_name_args . ' -'
|
||||||
@@ -91,17 +122,10 @@ function! ale_linters#python#flake8#Handle(buffer, lines) abort
|
|||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if l:code is# 'W391'
|
|
||||||
\&& !ale#Var(a:buffer, 'warn_about_trailing_blank_lines')
|
|
||||||
" Skip warnings for trailing blank lines if the option is off
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
|
|
||||||
let l:item = {
|
let l:item = {
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'col': l:match[2] + 0,
|
\ 'col': l:match[2] + 0,
|
||||||
\ 'text': l:match[4],
|
\ 'text': l:code . ': ' . l:match[4],
|
||||||
\ 'code': l:code,
|
|
||||||
\ 'type': 'W',
|
\ 'type': 'W',
|
||||||
\}
|
\}
|
||||||
|
|
||||||
|
|||||||
@@ -1,82 +0,0 @@
|
|||||||
" Author: chocoelho <carlospecter@gmail.com>
|
|
||||||
" Description: prospector linter python files
|
|
||||||
|
|
||||||
let g:ale_python_prospector_executable =
|
|
||||||
\ get(g:, 'ale_python_prospector_executable', 'prospector')
|
|
||||||
|
|
||||||
let g:ale_python_prospector_options =
|
|
||||||
\ get(g:, 'ale_python_prospector_options', '')
|
|
||||||
|
|
||||||
let g:ale_python_prospector_use_global = get(g:, 'ale_python_prospector_use_global', 0)
|
|
||||||
|
|
||||||
function! ale_linters#python#prospector#GetExecutable(buffer) abort
|
|
||||||
return ale#python#FindExecutable(a:buffer, 'python_prospector', ['prospector'])
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#python#prospector#GetCommand(buffer) abort
|
|
||||||
return ale#Escape(ale_linters#python#prospector#GetExecutable(a:buffer))
|
|
||||||
\ . ' ' . ale#Var(a:buffer, 'python_prospector_options')
|
|
||||||
\ . ' --messages-only --absolute-paths --zero-exit --output-format json'
|
|
||||||
\ . ' %s'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#python#prospector#Handle(buffer, lines) abort
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
let l:prospector_error = json_decode(join(a:lines, ''))
|
|
||||||
|
|
||||||
for l:error in l:prospector_error.messages
|
|
||||||
if (l:error.code is# 'W291' || l:error.code is# 'W293' || l:error.code is# 'trailing-whitespace')
|
|
||||||
\ && !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
|
||||||
" Skip warnings for trailing whitespace if the option is off.
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
|
|
||||||
if l:error.code is# 'W391'
|
|
||||||
\&& !ale#Var(a:buffer, 'warn_about_trailing_blank_lines')
|
|
||||||
" Skip warnings for trailing blank lines if the option is off
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
|
|
||||||
if l:error.source =~# '\v\[%(dodgy|mccabe|pep8|pep257|pyroma)\]$'
|
|
||||||
let l:sub_type = 'style'
|
|
||||||
else
|
|
||||||
let l:sub_type = ''
|
|
||||||
endif
|
|
||||||
|
|
||||||
if l:error.source =~# '\v\[pylint\]$'
|
|
||||||
let l:type = l:error.code =~? '\m^[CRW]' ? 'W' : 'E'
|
|
||||||
elseif l:error.source =~# '\v\[%(frosted|pep8)\]$'
|
|
||||||
let l:type = l:error.code =~? '\m^W' ? 'W' : 'E'
|
|
||||||
elseif l:error.source =~# '\v\[%(dodgy|pyroma|vulture)\]$'
|
|
||||||
let l:type = 'W'
|
|
||||||
else
|
|
||||||
let l:type = 'E'
|
|
||||||
endif
|
|
||||||
|
|
||||||
let l:item = {
|
|
||||||
\ 'lnum': l:error.location.line,
|
|
||||||
\ 'col': l:error.location.character + 1,
|
|
||||||
\ 'text': l:error.message,
|
|
||||||
\ 'code': printf('(%s) %s', l:error.source, l:error.code),
|
|
||||||
\ 'type': l:type,
|
|
||||||
\ 'sub_type': l:sub_type,
|
|
||||||
\}
|
|
||||||
|
|
||||||
if l:sub_type is# ''
|
|
||||||
unlet l:item.sub_type
|
|
||||||
endif
|
|
||||||
|
|
||||||
call add(l:output, l:item)
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('python', {
|
|
||||||
\ 'name': 'prospector',
|
|
||||||
\ 'executable_callback': 'ale_linters#python#prospector#GetExecutable',
|
|
||||||
\ 'command_callback': 'ale_linters#python#prospector#GetCommand',
|
|
||||||
\ 'callback': 'ale_linters#python#prospector#Handle',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
|
||||||
@@ -17,39 +17,18 @@ function! ale_linters#python#pycodestyle#GetCommand(buffer) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#python#pycodestyle#Handle(buffer, lines) abort
|
function! ale_linters#python#pycodestyle#Handle(buffer, lines) abort
|
||||||
let l:pattern = '\v^(\S*):(\d*):(\d*): ([EW]\d+) (.*)$'
|
let l:pattern = '\v^(\S*):(\d*):(\d*): ((([EW])\d+) .*)$'
|
||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
" lines are formatted as follows:
|
" lines are formatted as follows:
|
||||||
" file.py:21:26: W291 trailing whitespace
|
" file.py:21:26: W291 trailing whitespace
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
if(l:match[4] is# 'W291' || l:match[4] is# 'W293')
|
call add(l:output, {
|
||||||
\&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
|
||||||
" Skip warnings for trailing whitespace if the option is off.
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
|
|
||||||
if l:match[4] is# 'W391'
|
|
||||||
\&& !ale#Var(a:buffer, 'warn_about_trailing_blank_lines')
|
|
||||||
" Skip warnings for trailing blank lines if the option is off
|
|
||||||
continue
|
|
||||||
endif
|
|
||||||
|
|
||||||
let l:item = {
|
|
||||||
\ 'lnum': l:match[2] + 0,
|
\ 'lnum': l:match[2] + 0,
|
||||||
\ 'col': l:match[3] + 0,
|
\ 'col': l:match[3] + 0,
|
||||||
\ 'type': l:match[4][0],
|
\ 'type': l:match[6],
|
||||||
\ 'sub_type': 'style',
|
\ 'text': l:match[4],
|
||||||
\ 'text': l:match[5],
|
\})
|
||||||
\ 'code': l:match[4],
|
|
||||||
\}
|
|
||||||
|
|
||||||
" E999 is not a style error, it's a syntax error.
|
|
||||||
if l:match[4] is# 'E999'
|
|
||||||
unlet l:item.sub_type
|
|
||||||
endif
|
|
||||||
|
|
||||||
call add(l:output, l:item)
|
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return l:output
|
return l:output
|
||||||
|
|||||||
@@ -1,38 +0,0 @@
|
|||||||
" Author: w0rp <devw0rp@gmail.com>
|
|
||||||
" Description: pyflakes for python files
|
|
||||||
|
|
||||||
call ale#Set('python_pyflakes_executable', 'pyflakes')
|
|
||||||
call ale#Set('python_pyflakes_use_global', 0)
|
|
||||||
|
|
||||||
function! ale_linters#python#pyflakes#GetExecutable(buffer) abort
|
|
||||||
return ale#python#FindExecutable(a:buffer, 'python_pyflakes', ['pyflakes'])
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#python#pyflakes#GetCommand(buffer) abort
|
|
||||||
let l:executable = ale_linters#python#pyflakes#GetExecutable(a:buffer)
|
|
||||||
|
|
||||||
return ale#Escape(l:executable) . ' %t'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#python#pyflakes#Handle(buffer, lines) abort
|
|
||||||
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+):(\d+)?:? (.+)$'
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'lnum': l:match[1] + 0,
|
|
||||||
\ 'col': l:match[2] + 0,
|
|
||||||
\ 'text': l:match[3],
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('python', {
|
|
||||||
\ 'name': 'pyflakes',
|
|
||||||
\ 'executable_callback': 'ale_linters#python#pyflakes#GetExecutable',
|
|
||||||
\ 'command_callback': 'ale_linters#python#pyflakes#GetCommand',
|
|
||||||
\ 'callback': 'ale_linters#python#pyflakes#Handle',
|
|
||||||
\ 'output_stream': 'both',
|
|
||||||
\})
|
|
||||||
@@ -45,8 +45,7 @@ function! ale_linters#python#pylint#Handle(buffer, lines) abort
|
|||||||
call add(l:output, {
|
call add(l:output, {
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'col': l:match[2] + 1,
|
\ 'col': l:match[2] + 1,
|
||||||
\ 'text': l:match[5],
|
\ 'text': l:code . ': ' . l:match[5] . ' (' . l:match[4] . ')',
|
||||||
\ 'code': l:match[4],
|
|
||||||
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
|
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
" Author: aurieh <me@aurieh.me>
|
|
||||||
" Description: A language server for Python
|
|
||||||
|
|
||||||
call ale#Set('python_pyls_executable', 'pyls')
|
|
||||||
call ale#Set('python_pyls_use_global', 0)
|
|
||||||
|
|
||||||
function! ale_linters#python#pyls#GetExecutable(buffer) abort
|
|
||||||
return ale#python#FindExecutable(a:buffer, 'python_pyls', ['pyls'])
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#python#pyls#GetCommand(buffer) abort
|
|
||||||
let l:executable = ale_linters#python#pyls#GetExecutable(a:buffer)
|
|
||||||
|
|
||||||
return ale#Escape(l:executable)
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#python#pyls#GetLanguage(buffer) abort
|
|
||||||
return 'python'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('python', {
|
|
||||||
\ 'name': 'pyls',
|
|
||||||
\ 'lsp': 'stdio',
|
|
||||||
\ 'executable_callback': 'ale_linters#python#pyls#GetExecutable',
|
|
||||||
\ 'command_callback': 'ale_linters#python#pyls#GetCommand',
|
|
||||||
\ 'language_callback': 'ale_linters#python#pyls#GetLanguage',
|
|
||||||
\ 'project_root_callback': 'ale#python#FindProjectRoot',
|
|
||||||
\})
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
" Author: Michael Jungo <michaeljungo92@gmail.com>
|
|
||||||
" Description: A language server for Reason
|
|
||||||
|
|
||||||
call ale#Set('reason_ols_executable', 'ocaml-language-server')
|
|
||||||
call ale#Set('reason_ols_use_global', 0)
|
|
||||||
|
|
||||||
call ale#linter#Define('reason', {
|
|
||||||
\ 'name': 'ols',
|
|
||||||
\ 'lsp': 'stdio',
|
|
||||||
\ 'executable_callback': 'ale#handlers#ols#GetExecutable',
|
|
||||||
\ 'command_callback': 'ale#handlers#ols#GetCommand',
|
|
||||||
\ 'language_callback': 'ale#handlers#ols#GetLanguage',
|
|
||||||
\ 'project_root_callback': 'ale#handlers#ols#GetProjectRoot',
|
|
||||||
\})
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
" Author: rhysd https://rhysd.github.io
|
|
||||||
" Description: Redpen, a proofreading tool (http://redpen.cc)
|
|
||||||
|
|
||||||
call ale#linter#Define('review', {
|
|
||||||
\ 'name': 'redpen',
|
|
||||||
\ 'executable': 'redpen',
|
|
||||||
\ 'command': 'redpen -f review -r json %t',
|
|
||||||
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
|
|
||||||
\})
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
" Author: Johannes Wienke <languitar@semipol.de>
|
|
||||||
" Description: alex for rst files
|
|
||||||
|
|
||||||
call ale#linter#Define('rst', {
|
|
||||||
\ 'name': 'alex',
|
|
||||||
\ 'executable': 'alex',
|
|
||||||
\ 'command': 'alex %s -t',
|
|
||||||
\ 'output_stream': 'stderr',
|
|
||||||
\ 'callback': 'ale#handlers#alex#Handle',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
" Author: rhysd https://rhysd.github.io
|
|
||||||
" Description: Redpen, a proofreading tool (http://redpen.cc)
|
|
||||||
|
|
||||||
call ale#linter#Define('rst', {
|
|
||||||
\ 'name': 'redpen',
|
|
||||||
\ 'executable': 'redpen',
|
|
||||||
\ 'command': 'redpen -f rest -r json %t',
|
|
||||||
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
|
|
||||||
\})
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
" Author: John Nduli https://github.com/jnduli
|
|
||||||
" Description: Rstcheck for reStructuredText files
|
|
||||||
"
|
|
||||||
|
|
||||||
function! ale_linters#rst#rstcheck#Handle(buffer, lines) abort
|
|
||||||
" matches: 'bad_rst.rst:1: (SEVERE/4) Title overline & underline
|
|
||||||
" mismatch.'
|
|
||||||
let l:pattern = '\v^(.+):(\d*): \(([a-zA-Z]*)/\d*\) (.+)$'
|
|
||||||
let l:dir = expand('#' . a:buffer . ':p:h')
|
|
||||||
let l:output = []
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
|
||||||
\ 'lnum': l:match[2] + 0,
|
|
||||||
\ 'col': 0,
|
|
||||||
\ 'type': l:match[3] is# 'SEVERE' ? 'E' : 'W',
|
|
||||||
\ 'text': l:match[4],
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#rst#rstcheck#GetCommand(buffer) abort
|
|
||||||
return ale#path#BufferCdString(a:buffer)
|
|
||||||
\ . 'rstcheck'
|
|
||||||
\ . ' %t'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
|
|
||||||
call ale#linter#Define('rst', {
|
|
||||||
\ 'name': 'rstcheck',
|
|
||||||
\ 'executable': 'rstcheck',
|
|
||||||
\ 'command_callback': 'ale_linters#rst#rstcheck#GetCommand',
|
|
||||||
\ 'callback': 'ale_linters#rst#rstcheck#Handle',
|
|
||||||
\ 'output_stream': 'both',
|
|
||||||
\})
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
" Author: chew-z https://github.com/chew-z
|
|
||||||
" Description: vale for RST files
|
|
||||||
|
|
||||||
call ale#linter#Define('rst', {
|
|
||||||
\ 'name': 'vale',
|
|
||||||
\ 'executable': 'vale',
|
|
||||||
\ 'command': 'vale --output=JSON %t',
|
|
||||||
\ 'callback': 'ale#handlers#vale#Handle',
|
|
||||||
\})
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
|
||||||
" Description: write-good for reStructuredText files
|
|
||||||
|
|
||||||
call ale#linter#Define('rst', {
|
|
||||||
\ 'name': 'write-good',
|
|
||||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
|
||||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
|
||||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
|
||||||
\})
|
|
||||||
@@ -13,7 +13,6 @@ function! ale_linters#ruby#reek#Handle(buffer, lines) abort
|
|||||||
\ 'lnum': l:location,
|
\ 'lnum': l:location,
|
||||||
\ 'type': 'W',
|
\ 'type': 'W',
|
||||||
\ 'text': s:BuildText(a:buffer, l:error),
|
\ 'text': s:BuildText(a:buffer, l:error),
|
||||||
\ 'code': l:error.smell_type,
|
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
endfor
|
endfor
|
||||||
@@ -22,19 +21,19 @@ function! ale_linters#ruby#reek#Handle(buffer, lines) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:BuildText(buffer, error) abort
|
function! s:BuildText(buffer, error) abort
|
||||||
let l:parts = []
|
let l:text = a:error.smell_type . ':'
|
||||||
|
|
||||||
if ale#Var(a:buffer, 'ruby_reek_show_context')
|
if ale#Var(a:buffer, 'ruby_reek_show_context')
|
||||||
call add(l:parts, a:error.context)
|
let l:text .= ' ' . a:error.context
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call add(l:parts, a:error.message)
|
let l:text .= ' ' . a:error.message
|
||||||
|
|
||||||
if ale#Var(a:buffer, 'ruby_reek_show_wiki_link')
|
if ale#Var(a:buffer, 'ruby_reek_show_wiki_link')
|
||||||
call add(l:parts, '[' . a:error.wiki_link . ']')
|
let l:text .= ' [' . a:error.wiki_link . ']'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return join(l:parts, ' ')
|
return l:text
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('ruby', {
|
call ale#linter#Define('ruby', {
|
||||||
|
|||||||
@@ -34,8 +34,7 @@ function! ale_linters#ruby#rubocop#Handle(buffer, lines) abort
|
|||||||
\ 'lnum': l:error['location']['line'] + 0,
|
\ 'lnum': l:error['location']['line'] + 0,
|
||||||
\ 'col': l:start_col,
|
\ 'col': l:start_col,
|
||||||
\ 'end_col': l:start_col + l:error['location']['length'] - 1,
|
\ 'end_col': l:start_col + l:error['location']['length'] - 1,
|
||||||
\ 'code': l:error['cop_name'],
|
\ 'text': printf('%s [%s]', l:error['message'], l:error['cop_name']),
|
||||||
\ 'text': l:error['message'],
|
|
||||||
\ 'type': ale_linters#ruby#rubocop#GetType(l:error['severity']),
|
\ 'type': ale_linters#ruby#rubocop#GetType(l:error['severity']),
|
||||||
\})
|
\})
|
||||||
endfor
|
endfor
|
||||||
|
|||||||
@@ -1,22 +1,10 @@
|
|||||||
" Author: Brandon Roehl - https://github.com/BrandonRoehl
|
" Author: Brandon Roehl - https://github.com/BrandonRoehl
|
||||||
" Description: Ruby MRI for Ruby files
|
" Description: Ruby MRI for Ruby files
|
||||||
|
|
||||||
call ale#Set('ruby_ruby_executable', 'ruby')
|
|
||||||
|
|
||||||
function! ale_linters#ruby#ruby#GetExecutable(buffer) abort
|
|
||||||
return ale#Var(a:buffer, 'ruby_ruby_executable')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#ruby#ruby#GetCommand(buffer) abort
|
|
||||||
let l:executable = ale_linters#ruby#ruby#GetExecutable(a:buffer)
|
|
||||||
|
|
||||||
return ale#Escape(l:executable) . ' -w -c -T1 %t'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('ruby', {
|
call ale#linter#Define('ruby', {
|
||||||
\ 'name': 'ruby',
|
\ 'name': 'ruby',
|
||||||
\ 'executable_callback': 'ale_linters#ruby#ruby#GetExecutable',
|
\ 'executable': 'ruby',
|
||||||
\ 'command_callback': 'ale_linters#ruby#ruby#GetCommand',
|
|
||||||
\ 'output_stream': 'stderr',
|
\ 'output_stream': 'stderr',
|
||||||
|
\ 'command': 'ruby -w -c -T1 %t',
|
||||||
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
|
\ 'callback': 'ale#handlers#ruby#HandleSyntaxErrors',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
" Author: Daniel Schemala <istjanichtzufassen@gmail.com>
|
" Author: Daniel Schemala <istjanichtzufassen@gmail.com>
|
||||||
" Description: rustc invoked by cargo for rust files
|
" Description: rustc invoked by cargo for rust files
|
||||||
|
|
||||||
call ale#Set('rust_cargo_use_check', 1)
|
let g:ale_rust_cargo_use_check = get(g:, 'ale_rust_cargo_use_check', 0)
|
||||||
call ale#Set('rust_cargo_check_all_targets', 0)
|
|
||||||
|
|
||||||
function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort
|
function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort
|
||||||
if ale#path#FindNearestFile(a:bufnr, 'Cargo.toml') isnot# ''
|
if ale#path#FindNearestFile(a:bufnr, 'Cargo.toml') isnot# ''
|
||||||
@@ -14,34 +13,18 @@ function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#rust#cargo#VersionCheck(buffer) abort
|
function! ale_linters#rust#cargo#GetCommand(buffer) abort
|
||||||
return !ale#semver#HasVersion('cargo')
|
let l:command = ale#Var(a:buffer, 'rust_cargo_use_check')
|
||||||
\ ? 'cargo --version'
|
\ ? 'check'
|
||||||
\ : ''
|
\ : 'build'
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#rust#cargo#GetCommand(buffer, version_output) abort
|
return 'cargo ' . l:command . ' --frozen --message-format=json -q'
|
||||||
let l:version = ale#semver#GetVersion('cargo', a:version_output)
|
|
||||||
|
|
||||||
let l:use_check = ale#Var(a:buffer, 'rust_cargo_use_check')
|
|
||||||
\ && ale#semver#GTE(l:version, [0, 17, 0])
|
|
||||||
let l:use_all_targets = l:use_check
|
|
||||||
\ && ale#Var(a:buffer, 'rust_cargo_check_all_targets')
|
|
||||||
\ && ale#semver#GTE(l:version, [0, 22, 0])
|
|
||||||
|
|
||||||
return 'cargo '
|
|
||||||
\ . (l:use_check ? 'check' : 'build')
|
|
||||||
\ . (l:use_all_targets ? ' --all-targets' : '')
|
|
||||||
\ . ' --frozen --message-format=json -q'
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('rust', {
|
call ale#linter#Define('rust', {
|
||||||
\ 'name': 'cargo',
|
\ 'name': 'cargo',
|
||||||
\ 'executable_callback': 'ale_linters#rust#cargo#GetCargoExecutable',
|
\ 'executable_callback': 'ale_linters#rust#cargo#GetCargoExecutable',
|
||||||
\ 'command_chain': [
|
\ 'command_callback': 'ale_linters#rust#cargo#GetCommand',
|
||||||
\ {'callback': 'ale_linters#rust#cargo#VersionCheck'},
|
|
||||||
\ {'callback': 'ale_linters#rust#cargo#GetCommand'},
|
|
||||||
\ ],
|
|
||||||
\ 'callback': 'ale#handlers#rust#HandleRustErrors',
|
\ 'callback': 'ale#handlers#rust#HandleRustErrors',
|
||||||
\ 'output_stream': 'both',
|
\ 'output_stream': 'both',
|
||||||
\ 'lint_file': 1,
|
\ 'lint_file': 1,
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
" Description: A language server for Rust
|
" Description: A language server for Rust
|
||||||
|
|
||||||
call ale#Set('rust_rls_executable', 'rls')
|
call ale#Set('rust_rls_executable', 'rls')
|
||||||
call ale#Set('rust_rls_toolchain', 'nightly')
|
|
||||||
|
|
||||||
function! ale_linters#rust#rls#GetExecutable(buffer) abort
|
function! ale_linters#rust#rls#GetExecutable(buffer) abort
|
||||||
return ale#Var(a:buffer, 'rust_rls_executable')
|
return ale#Var(a:buffer, 'rust_rls_executable')
|
||||||
@@ -10,10 +9,8 @@ endfunction
|
|||||||
|
|
||||||
function! ale_linters#rust#rls#GetCommand(buffer) abort
|
function! ale_linters#rust#rls#GetCommand(buffer) abort
|
||||||
let l:executable = ale_linters#rust#rls#GetExecutable(a:buffer)
|
let l:executable = ale_linters#rust#rls#GetExecutable(a:buffer)
|
||||||
let l:toolchain = ale#Var(a:buffer, 'rust_rls_toolchain')
|
|
||||||
|
|
||||||
return ale#Escape(l:executable)
|
return ale#Escape(l:executable) . ' +nightly'
|
||||||
\ . ' +' . ale#Escape(l:toolchain)
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#rust#rls#GetLanguage(buffer) abort
|
function! ale_linters#rust#rls#GetLanguage(buffer) abort
|
||||||
|
|||||||
@@ -1,27 +1,21 @@
|
|||||||
" Author: Daniel Schemala <istjanichtzufassen@gmail.com>
|
" Author: Daniel Schemala <istjanichtzufassen@gmail.com>
|
||||||
" Description: rustc for rust files
|
" Description: rustc for rust files
|
||||||
|
|
||||||
call ale#Set('rust_rustc_options', '-Z no-trans')
|
function! ale_linters#rust#rustc#RustcCommand(buffer_number) abort
|
||||||
|
|
||||||
function! ale_linters#rust#rustc#RustcCommand(buffer) abort
|
|
||||||
" Try to guess the library search path. If the project is managed by cargo,
|
" Try to guess the library search path. If the project is managed by cargo,
|
||||||
" it's usually <project root>/target/debug/deps/ or
|
" it's usually <project root>/target/debug/deps/ or
|
||||||
" <project root>/target/release/deps/
|
" <project root>/target/release/deps/
|
||||||
let l:cargo_file = ale#path#FindNearestFile(a:buffer, 'Cargo.toml')
|
let l:cargo_file = ale#path#FindNearestFile(a:buffer_number, 'Cargo.toml')
|
||||||
|
|
||||||
if l:cargo_file isnot# ''
|
if l:cargo_file isnot# ''
|
||||||
let l:root = fnamemodify(l:cargo_file, ':h')
|
let l:project_root = fnamemodify(l:cargo_file, ':h')
|
||||||
let l:dependencies = ' -L ' . ale#Escape(ale#path#GetAbsPath(l:root, 'target/debug/deps'))
|
let l:dependencies = '-L ' . l:project_root . '/target/debug/deps -L ' .
|
||||||
\ . ' -L ' . ale#Escape(ale#path#GetAbsPath(l:root, 'target/release/deps'))
|
\ l:project_root . '/target/release/deps'
|
||||||
else
|
else
|
||||||
let l:dependencies = ''
|
let l:dependencies = ''
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:options = ale#Var(a:buffer, 'rust_rustc_options')
|
return 'rustc --error-format=json -Z no-trans ' . l:dependencies . ' -'
|
||||||
|
|
||||||
return 'rustc --error-format=json'
|
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
|
||||||
\ . l:dependencies . ' -'
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
call ale#linter#Define('rust', {
|
call ale#linter#Define('rust', {
|
||||||
|
|||||||
@@ -43,75 +43,21 @@ function! ale_linters#sh#shellcheck#GetDialectArgument(buffer) abort
|
|||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#sh#shellcheck#VersionCheck(buffer) abort
|
function! ale_linters#sh#shellcheck#GetCommand(buffer) abort
|
||||||
let l:executable = ale_linters#sh#shellcheck#GetExecutable(a:buffer)
|
|
||||||
|
|
||||||
" Don't check the version again if we've already cached it.
|
|
||||||
return !ale#semver#HasVersion(l:executable)
|
|
||||||
\ ? ale#Escape(l:executable) . ' --version'
|
|
||||||
\ : ''
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#sh#shellcheck#GetCommand(buffer, version_output) abort
|
|
||||||
let l:executable = ale_linters#sh#shellcheck#GetExecutable(a:buffer)
|
|
||||||
let l:version = ale#semver#GetVersion(l:executable, a:version_output)
|
|
||||||
|
|
||||||
let l:options = ale#Var(a:buffer, 'sh_shellcheck_options')
|
let l:options = ale#Var(a:buffer, 'sh_shellcheck_options')
|
||||||
let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions')
|
let l:exclude_option = ale#Var(a:buffer, 'sh_shellcheck_exclusions')
|
||||||
let l:dialect = ale_linters#sh#shellcheck#GetDialectArgument(a:buffer)
|
let l:dialect = ale_linters#sh#shellcheck#GetDialectArgument(a:buffer)
|
||||||
let l:external_option = ale#semver#GTE(l:version, [0, 4, 0]) ? ' -x' : ''
|
|
||||||
|
|
||||||
return ale#path#BufferCdString(a:buffer)
|
return ale_linters#sh#shellcheck#GetExecutable(a:buffer)
|
||||||
\ . ale#Escape(l:executable)
|
|
||||||
\ . (!empty(l:dialect) ? ' -s ' . l:dialect : '')
|
\ . (!empty(l:dialect) ? ' -s ' . l:dialect : '')
|
||||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||||
\ . (!empty(l:exclude_option) ? ' -e ' . l:exclude_option : '')
|
\ . (!empty(l:exclude_option) ? ' -e ' . l:exclude_option : '')
|
||||||
\ . l:external_option
|
|
||||||
\ . ' -f gcc -'
|
\ . ' -f gcc -'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#sh#shellcheck#Handle(buffer, lines) abort
|
|
||||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+) \[([^\]]+)\]$'
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
||||||
if l:match[4] is# 'error'
|
|
||||||
let l:type = 'E'
|
|
||||||
elseif l:match[4] is# 'note'
|
|
||||||
let l:type = 'I'
|
|
||||||
else
|
|
||||||
let l:type = 'W'
|
|
||||||
endif
|
|
||||||
|
|
||||||
let l:item = {
|
|
||||||
\ 'lnum': str2nr(l:match[2]),
|
|
||||||
\ 'type': l:type,
|
|
||||||
\ 'text': l:match[5],
|
|
||||||
\ 'code': l:match[6],
|
|
||||||
\}
|
|
||||||
|
|
||||||
if !empty(l:match[3])
|
|
||||||
let l:item.col = str2nr(l:match[3])
|
|
||||||
endif
|
|
||||||
|
|
||||||
" If the filename is something like <stdin>, <nofile> or -, then
|
|
||||||
" this is an error for the file we checked.
|
|
||||||
if l:match[1] isnot# '-' && l:match[1][0] isnot# '<'
|
|
||||||
let l:item['filename'] = l:match[1]
|
|
||||||
endif
|
|
||||||
|
|
||||||
call add(l:output, l:item)
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('sh', {
|
call ale#linter#Define('sh', {
|
||||||
\ 'name': 'shellcheck',
|
\ 'name': 'shellcheck',
|
||||||
\ 'executable_callback': 'ale_linters#sh#shellcheck#GetExecutable',
|
\ 'executable_callback': 'ale_linters#sh#shellcheck#GetExecutable',
|
||||||
\ 'command_chain': [
|
\ 'command_callback': 'ale_linters#sh#shellcheck#GetCommand',
|
||||||
\ {'callback': 'ale_linters#sh#shellcheck#VersionCheck'},
|
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||||
\ {'callback': 'ale_linters#sh#shellcheck#GetCommand'},
|
|
||||||
\ ],
|
|
||||||
\ 'callback': 'ale_linters#sh#shellcheck#Handle',
|
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -28,20 +28,11 @@ function! ale_linters#slim#slimlint#Handle(buffer, lines) abort
|
|||||||
let l:output = []
|
let l:output = []
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||||
let l:item = {
|
call add(l:output, {
|
||||||
\ 'lnum': l:match[1] + 0,
|
\ 'lnum': l:match[1] + 0,
|
||||||
\ 'type': l:match[2],
|
\ 'type': l:match[2],
|
||||||
\ 'text': l:match[3]
|
\ 'text': l:match[3]
|
||||||
\}
|
\})
|
||||||
|
|
||||||
let l:code_match = matchlist(l:item.text, '\v^([^:]+): (.+)$')
|
|
||||||
|
|
||||||
if !empty(l:code_match)
|
|
||||||
let l:item.code = l:code_match[1]
|
|
||||||
let l:item.text = l:code_match[2]
|
|
||||||
endif
|
|
||||||
|
|
||||||
call add(l:output, l:item)
|
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return l:output
|
return l:output
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
" Author: Franco Victorio - https://github.com/fvictorio
|
|
||||||
" Description: Report errors in Solidity code with solhint
|
|
||||||
|
|
||||||
function! ale_linters#solidity#solhint#Handle(buffer, lines) abort
|
|
||||||
" Matches patterns like the following:
|
|
||||||
" /path/to/file/file.sol: line 1, col 10, Error - 'addOne' is defined but never used. (no-unused-vars)
|
|
||||||
|
|
||||||
let l:pattern = '\v^[^:]+: line (\d+), col (\d+), (Error|Warning) - (.*) \((.*)\)$'
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
||||||
let l:isError = l:match[3] is? 'error'
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'lnum': l:match[1] + 0,
|
|
||||||
\ 'col': l:match[2] + 0,
|
|
||||||
\ 'text': l:match[4],
|
|
||||||
\ 'code': l:match[5],
|
|
||||||
\ 'type': l:isError ? 'E' : 'W',
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('solidity', {
|
|
||||||
\ 'name': 'solhint',
|
|
||||||
\ 'executable': 'solhint',
|
|
||||||
\ 'command': 'solhint --formatter compact %t',
|
|
||||||
\ 'callback': 'ale_linters#solidity#solhint#Handle',
|
|
||||||
\})
|
|
||||||
@@ -1,51 +1,9 @@
|
|||||||
" Author: David Mohundro <david@mohundro.com>
|
" Author: David Mohundro <david@mohundro.com>
|
||||||
" Description: swiftlint for swift files
|
" Description: swiftlint for swift files
|
||||||
|
|
||||||
|
|
||||||
function! ale_linters#swift#swiftlint#Handle(buffer, lines) abort
|
|
||||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):(\d+)?:? ([^:]+): (.+)$'
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
|
||||||
let l:item = {
|
|
||||||
\ 'lnum': str2nr(l:match[2]),
|
|
||||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
|
||||||
\ 'text': l:match[5],
|
|
||||||
\}
|
|
||||||
|
|
||||||
if l:match[4] is# 'error'
|
|
||||||
let l:item.type = 'E'
|
|
||||||
elseif l:match[4] is# 'note'
|
|
||||||
let l:item.type = 'I'
|
|
||||||
endif
|
|
||||||
|
|
||||||
if !empty(l:match[3])
|
|
||||||
let l:item.col = str2nr(l:match[3])
|
|
||||||
endif
|
|
||||||
|
|
||||||
" If the filename is something like <stdin>, <nofile> or -, then
|
|
||||||
" this is an error for the file we checked.
|
|
||||||
if l:match[1] isnot# '-' && l:match[1][0] isnot# '<'
|
|
||||||
let l:item['filename'] = l:match[1]
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Parse the code if it's there.
|
|
||||||
let l:code_match = matchlist(l:item.text, '\v^(.+) \(([^ (]+)\)$')
|
|
||||||
|
|
||||||
if !empty(l:code_match)
|
|
||||||
let l:item.text = l:code_match[1]
|
|
||||||
let l:item.code = l:code_match[2]
|
|
||||||
endif
|
|
||||||
|
|
||||||
call add(l:output, l:item)
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('swift', {
|
call ale#linter#Define('swift', {
|
||||||
\ 'name': 'swiftlint',
|
\ 'name': 'swiftlint',
|
||||||
\ 'executable': 'swiftlint',
|
\ 'executable': 'swiftlint',
|
||||||
\ 'command': 'swiftlint lint --use-stdin',
|
\ 'command': 'swiftlint lint --use-stdin',
|
||||||
\ 'callback': 'ale_linters#swift#swiftlint#Handle',
|
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,62 +0,0 @@
|
|||||||
" Author: Nat Williams <nat.williams@gmail.com>
|
|
||||||
" Description: tflint for Terraform files
|
|
||||||
"
|
|
||||||
" See: https://www.terraform.io/
|
|
||||||
" https://github.com/wata727/tflint
|
|
||||||
|
|
||||||
call ale#Set('terraform_tflint_options', '')
|
|
||||||
call ale#Set('terraform_tflint_executable', 'tflint')
|
|
||||||
|
|
||||||
function! ale_linters#terraform#tflint#Handle(buffer, lines) abort
|
|
||||||
let l:output = []
|
|
||||||
|
|
||||||
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
|
|
||||||
if l:error.type is# 'ERROR'
|
|
||||||
let l:type = 'E'
|
|
||||||
elseif l:error.type is# 'NOTICE'
|
|
||||||
let l:type = 'I'
|
|
||||||
else
|
|
||||||
let l:type = 'W'
|
|
||||||
endif
|
|
||||||
|
|
||||||
call add(l:output, {
|
|
||||||
\ 'lnum': l:error.line,
|
|
||||||
\ 'text': l:error.message,
|
|
||||||
\ 'type': l:type,
|
|
||||||
\ 'code': l:error.detector,
|
|
||||||
\})
|
|
||||||
endfor
|
|
||||||
|
|
||||||
return l:output
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#terraform#tflint#GetExecutable(buffer) abort
|
|
||||||
return ale#Var(a:buffer, 'terraform_tflint_executable')
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#terraform#tflint#GetCommand(buffer) abort
|
|
||||||
let l:cmd = ale#Escape(ale#Var(a:buffer, 'terraform_tflint_executable'))
|
|
||||||
|
|
||||||
let l:config_file = ale#path#FindNearestFile(a:buffer, '.tflint.hcl')
|
|
||||||
if !empty(l:config_file)
|
|
||||||
let l:cmd .= ' --config ' . ale#Escape(l:config_file)
|
|
||||||
endif
|
|
||||||
|
|
||||||
let l:opts = ale#Var(a:buffer, 'terraform_tflint_options')
|
|
||||||
if !empty(l:opts)
|
|
||||||
let l:cmd .= ' ' . l:opts
|
|
||||||
endif
|
|
||||||
|
|
||||||
let l:cmd .= ' -f json %t'
|
|
||||||
|
|
||||||
return l:cmd
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
call ale#linter#Define('terraform', {
|
|
||||||
\ 'name': 'tflint',
|
|
||||||
\ 'executable_callback': 'ale_linters#terraform#tflint#GetExecutable',
|
|
||||||
\ 'command_callback': 'ale_linters#terraform#tflint#GetCommand',
|
|
||||||
\ 'callback': 'ale_linters#terraform#tflint#Handle',
|
|
||||||
\})
|
|
||||||
|
|
||||||
" vim:sw=4
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
" Author: Johannes Wienke <languitar@semipol.de>
|
|
||||||
" Description: alex for TeX files
|
|
||||||
|
|
||||||
call ale#linter#Define('tex', {
|
|
||||||
\ 'name': 'alex',
|
|
||||||
\ 'executable': 'alex',
|
|
||||||
\ 'command': 'alex %s -t',
|
|
||||||
\ 'output_stream': 'stderr',
|
|
||||||
\ 'callback': 'ale#handlers#alex#Handle',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
" Author: rhysd https://rhysd.github.io
|
|
||||||
" Description: Redpen, a proofreading tool (http://redpen.cc)
|
|
||||||
|
|
||||||
call ale#linter#Define('tex', {
|
|
||||||
\ 'name': 'redpen',
|
|
||||||
\ 'executable': 'redpen',
|
|
||||||
\ 'command': 'redpen -f latex -r json %t',
|
|
||||||
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
|
|
||||||
\})
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
" Author: chew-z https://github.com/chew-z
|
|
||||||
" Description: vale for LaTeX files
|
|
||||||
|
|
||||||
call ale#linter#Define('tex', {
|
|
||||||
\ 'name': 'vale',
|
|
||||||
\ 'executable': 'vale',
|
|
||||||
\ 'command': 'vale --output=JSON %t',
|
|
||||||
\ 'callback': 'ale#handlers#vale#Handle',
|
|
||||||
\})
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
|
||||||
" Description: write-good for TeX files
|
|
||||||
|
|
||||||
call ale#linter#Define('tex', {
|
|
||||||
\ 'name': 'write-good',
|
|
||||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
|
||||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
|
||||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
|
||||||
\})
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
" Author: Johannes Wienke <languitar@semipol.de>
|
|
||||||
" Description: alex for texinfo files
|
|
||||||
|
|
||||||
call ale#linter#Define('texinfo', {
|
|
||||||
\ 'name': 'alex',
|
|
||||||
\ 'executable': 'alex',
|
|
||||||
\ 'command': 'alex %s -t',
|
|
||||||
\ 'output_stream': 'stderr',
|
|
||||||
\ 'callback': 'ale#handlers#alex#Handle',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
|
||||||
" Description: write-good for Texinfo files
|
|
||||||
|
|
||||||
call ale#linter#Define('texinfo', {
|
|
||||||
\ 'name': 'write-good',
|
|
||||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
|
||||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
|
||||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
|
||||||
\})
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
" Author: Johannes Wienke <languitar@semipol.de>
|
|
||||||
" Description: alex for text files
|
|
||||||
|
|
||||||
call ale#linter#Define('text', {
|
|
||||||
\ 'name': 'alex',
|
|
||||||
\ 'executable': 'alex',
|
|
||||||
\ 'command': 'alex %s -t',
|
|
||||||
\ 'output_stream': 'stderr',
|
|
||||||
\ 'callback': 'ale#handlers#alex#Handle',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
" Author: rhysd https://rhysd.github.io
|
|
||||||
" Description: Redpen, a proofreading tool (http://redpen.cc)
|
|
||||||
|
|
||||||
call ale#linter#Define('text', {
|
|
||||||
\ 'name': 'redpen',
|
|
||||||
\ 'executable': 'redpen',
|
|
||||||
\ 'command': 'redpen -f plain -r json %t',
|
|
||||||
\ 'callback': 'ale#handlers#redpen#HandleRedpenOutput',
|
|
||||||
\})
|
|
||||||
@@ -4,6 +4,6 @@
|
|||||||
call ale#linter#Define('text', {
|
call ale#linter#Define('text', {
|
||||||
\ 'name': 'vale',
|
\ 'name': 'vale',
|
||||||
\ 'executable': 'vale',
|
\ 'executable': 'vale',
|
||||||
\ 'command': 'vale --output=JSON %t',
|
\ 'command': 'vale --output=line %t',
|
||||||
\ 'callback': 'ale#handlers#vale#Handle',
|
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
|
||||||
" Description: write-good for text files
|
|
||||||
|
|
||||||
call ale#linter#Define('text', {
|
|
||||||
\ 'name': 'write-good',
|
|
||||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
|
||||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
|
||||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
|
||||||
\})
|
|
||||||
@@ -28,27 +28,17 @@ function! ale_linters#typescript#tslint#Handle(buffer, lines) abort
|
|||||||
continue
|
continue
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let l:item = {
|
call add(l:output, {
|
||||||
|
\ 'filename': ale#path#GetAbsPath(l:dir, l:error.name),
|
||||||
\ 'type': (get(l:error, 'ruleSeverity', '') is# 'WARNING' ? 'W' : 'E'),
|
\ 'type': (get(l:error, 'ruleSeverity', '') is# 'WARNING' ? 'W' : 'E'),
|
||||||
\ 'text': l:error.failure,
|
\ 'text': has_key(l:error, 'ruleName')
|
||||||
|
\ ? l:error.ruleName . ': ' . l:error.failure
|
||||||
|
\ : l:error.failure,
|
||||||
\ 'lnum': l:error.startPosition.line + 1,
|
\ 'lnum': l:error.startPosition.line + 1,
|
||||||
\ 'col': l:error.startPosition.character + 1,
|
\ 'col': l:error.startPosition.character + 1,
|
||||||
\ 'end_lnum': l:error.endPosition.line + 1,
|
\ 'end_lnum': l:error.endPosition.line + 1,
|
||||||
\ 'end_col': l:error.endPosition.character + 1,
|
\ 'end_col': l:error.endPosition.character + 1,
|
||||||
\}
|
\})
|
||||||
|
|
||||||
let l:filename = ale#path#GetAbsPath(l:dir, l:error.name)
|
|
||||||
|
|
||||||
" Assume temporary files are this file.
|
|
||||||
if !ale#path#IsTempName(l:filename)
|
|
||||||
let l:item.filename = l:filename
|
|
||||||
endif
|
|
||||||
|
|
||||||
if has_key(l:error, 'ruleName')
|
|
||||||
let l:item.code = l:error.ruleName
|
|
||||||
endif
|
|
||||||
|
|
||||||
call add(l:output, l:item)
|
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
return l:output
|
return l:output
|
||||||
|
|||||||
@@ -1,14 +1,6 @@
|
|||||||
" Author: Masahiro H https://github.com/mshr-h
|
" Author: Masahiro H https://github.com/mshr-h
|
||||||
" Description: iverilog for verilog files
|
" Description: iverilog for verilog files
|
||||||
|
|
||||||
call ale#Set('verilog_iverilog_options', '')
|
|
||||||
|
|
||||||
function! ale_linters#verilog#iverilog#GetCommand(buffer) abort
|
|
||||||
return 'iverilog -t null -Wall '
|
|
||||||
\ . ale#Var(a:buffer, 'verilog_iverilog_options')
|
|
||||||
\ . ' %t'
|
|
||||||
endfunction
|
|
||||||
|
|
||||||
function! ale_linters#verilog#iverilog#Handle(buffer, lines) abort
|
function! ale_linters#verilog#iverilog#Handle(buffer, lines) abort
|
||||||
" Look for lines like the following.
|
" Look for lines like the following.
|
||||||
"
|
"
|
||||||
@@ -38,6 +30,6 @@ call ale#linter#Define('verilog', {
|
|||||||
\ 'name': 'iverilog',
|
\ 'name': 'iverilog',
|
||||||
\ 'output_stream': 'stderr',
|
\ 'output_stream': 'stderr',
|
||||||
\ 'executable': 'iverilog',
|
\ 'executable': 'iverilog',
|
||||||
\ 'command_callback': 'ale_linters#verilog#iverilog#GetCommand',
|
\ 'command': 'iverilog -t null -Wall %t',
|
||||||
\ 'callback': 'ale_linters#verilog#iverilog#Handle',
|
\ 'callback': 'ale_linters#verilog#iverilog#Handle',
|
||||||
\})
|
\})
|
||||||
|
|||||||
@@ -6,19 +6,25 @@ let g:ale_vim_vint_show_style_issues =
|
|||||||
\ get(g:, 'ale_vim_vint_show_style_issues', 1)
|
\ get(g:, 'ale_vim_vint_show_style_issues', 1)
|
||||||
let s:enable_neovim = has('nvim') ? ' --enable-neovim ' : ''
|
let s:enable_neovim = has('nvim') ? ' --enable-neovim ' : ''
|
||||||
let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {description} (see {reference})"'
|
let s:format = '-f "{file_path}:{line_number}:{column_number}: {severity}: {description} (see {reference})"'
|
||||||
|
let s:vint_version = []
|
||||||
|
|
||||||
function! ale_linters#vim#vint#VersionCommand(buffer) abort
|
function! ale_linters#vim#vint#VersionCommand(buffer) abort
|
||||||
" Check the Vint version if we haven't checked it already.
|
if empty(s:vint_version)
|
||||||
return !ale#semver#HasVersion('vint')
|
" Check the Vint version if we haven't checked it already.
|
||||||
\ ? 'vint --version'
|
return 'vint --version'
|
||||||
\ : ''
|
endif
|
||||||
|
|
||||||
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#vim#vint#GetCommand(buffer, version_output) abort
|
function! ale_linters#vim#vint#GetCommand(buffer, version_output) abort
|
||||||
let l:version = ale#semver#GetVersion('vint', a:version_output)
|
if empty(s:vint_version) && !empty(a:version_output)
|
||||||
|
" Parse the version out of the --version output.
|
||||||
|
let s:vint_version = ale#semver#Parse(join(a:version_output, "\n"))
|
||||||
|
endif
|
||||||
|
|
||||||
let l:can_use_no_color_flag = empty(l:version)
|
let l:can_use_no_color_flag = empty(s:vint_version)
|
||||||
\ || ale#semver#GTE(l:version, [0, 3, 7])
|
\ || ale#semver#GreaterOrEqual(s:vint_version, [0, 3, 7])
|
||||||
|
|
||||||
let l:warning_flag = ale#Var(a:buffer, 'vim_vint_show_style_issues') ? '-s' : '-w'
|
let l:warning_flag = ale#Var(a:buffer, 'vim_vint_show_style_issues') ? '-s' : '-w'
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
" Author: Johannes Wienke <languitar@semipol.de>
|
|
||||||
" Description: alex for XHTML files
|
|
||||||
|
|
||||||
call ale#linter#Define('xhtml', {
|
|
||||||
\ 'name': 'alex',
|
|
||||||
\ 'executable': 'alex',
|
|
||||||
\ 'command': 'alex %s -t',
|
|
||||||
\ 'output_stream': 'stderr',
|
|
||||||
\ 'callback': 'ale#handlers#alex#Handle',
|
|
||||||
\ 'lint_file': 1,
|
|
||||||
\})
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
|
||||||
" Description: write-good for XHTML files
|
|
||||||
|
|
||||||
call ale#linter#Define('xhtml', {
|
|
||||||
\ 'name': 'write-good',
|
|
||||||
\ 'executable_callback': 'ale#handlers#writegood#GetExecutable',
|
|
||||||
\ 'command_callback': 'ale#handlers#writegood#GetCommand',
|
|
||||||
\ 'callback': 'ale#handlers#writegood#Handle',
|
|
||||||
\})
|
|
||||||
@@ -27,14 +27,6 @@ function! ale_linters#yaml#swaglint#Handle(buffer, lines) abort
|
|||||||
\ 'text': l:match[4],
|
\ 'text': l:match[4],
|
||||||
\}
|
\}
|
||||||
|
|
||||||
" Parse the code if it's there.
|
|
||||||
let l:code_match = matchlist(l:obj.text, '\v^(.+) \(([^ (]+)\)$')
|
|
||||||
|
|
||||||
if !empty(l:code_match)
|
|
||||||
let l:obj.text = l:code_match[1]
|
|
||||||
let l:obj.code = l:code_match[2]
|
|
||||||
endif
|
|
||||||
|
|
||||||
call add(l:output, l:obj)
|
call add(l:output, l:obj)
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
|
|||||||
@@ -257,31 +257,3 @@ function! ale#Escape(str) abort
|
|||||||
|
|
||||||
return shellescape (a:str)
|
return shellescape (a:str)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Get the loclist item message according to a given format string.
|
|
||||||
"
|
|
||||||
" See `:help g:ale_loclist_msg_format` and `:help g:ale_echo_msg_format`
|
|
||||||
function! ale#GetLocItemMessage(item, format_string) abort
|
|
||||||
let l:msg = a:format_string
|
|
||||||
let l:severity = g:ale_echo_msg_warning_str
|
|
||||||
let l:code = get(a:item, 'code', '')
|
|
||||||
let l:type = get(a:item, 'type', 'E')
|
|
||||||
let l:linter_name = get(a:item, 'linter_name', '')
|
|
||||||
let l:code_repl = !empty(l:code) ? '\=submatch(1) . l:code . submatch(2)' : ''
|
|
||||||
|
|
||||||
if l:type is# 'E'
|
|
||||||
let l:severity = g:ale_echo_msg_error_str
|
|
||||||
elseif l:type is# 'I'
|
|
||||||
let l:severity = g:ale_echo_msg_info_str
|
|
||||||
endif
|
|
||||||
|
|
||||||
" Replace special markers with certain information.
|
|
||||||
" \=l:variable is used to avoid escaping issues.
|
|
||||||
let l:msg = substitute(l:msg, '\V%severity%', '\=l:severity', 'g')
|
|
||||||
let l:msg = substitute(l:msg, '\V%linter%', '\=l:linter_name', 'g')
|
|
||||||
let l:msg = substitute(l:msg, '\v\%([^\%]*)code([^\%]*)\%', l:code_repl, 'g')
|
|
||||||
" Replace %s with the text.
|
|
||||||
let l:msg = substitute(l:msg, '\V%s', '\=a:item.text', 'g')
|
|
||||||
|
|
||||||
return l:msg
|
|
||||||
endfunction
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user