mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 20:54:26 +08:00
Compare commits
4 Commits
neovim-lsp
...
v1.1.x
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97b410bbba | ||
|
|
78b05d30a5 | ||
|
|
6f6c156995 | ||
|
|
62a45f8ae4 |
@@ -1,62 +0,0 @@
|
||||
---
|
||||
# Disabling building for AppVeyor. We are just testing things.
|
||||
build: false
|
||||
clone_depth: 10
|
||||
# Use the directory C:\testplugin so test directories will mostly work.
|
||||
clone_folder: C:\testplugin
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- /v\d+\.\d+\.(x|\d+)/
|
||||
|
||||
# Skip running Windows tests if we only change files that can't impact
|
||||
# Windows tests.
|
||||
skip_commits:
|
||||
files:
|
||||
- '.github/**/*'
|
||||
- .gitattributes
|
||||
- Dockerfile
|
||||
- README.md
|
||||
- doc/*
|
||||
- lua/*
|
||||
- run-tests
|
||||
- supported-tools.md
|
||||
- syntax/*
|
||||
|
||||
# Cache the vim and vader directories between builds.
|
||||
cache:
|
||||
- C:\vim -> .appveyor.yml
|
||||
- C:\vader -> .appveyor.yml
|
||||
|
||||
init:
|
||||
# Stop git from changing newlines
|
||||
- git config --global core.autocrlf input
|
||||
|
||||
# NOTE: If you change the Vim or Vader versions here, please also update the
|
||||
# instructions for running tests on Windows in ale-development.txt
|
||||
|
||||
install:
|
||||
# Download and unpack Vim
|
||||
- ps: >-
|
||||
if (!(Test-Path -Path C:\vim)){
|
||||
Add-Type -A System.IO.Compression.FileSystem
|
||||
Invoke-WebRequest ftp://ftp.vim.org/pub/vim/pc/vim80-586w32.zip `
|
||||
-OutFile C:\vim.zip
|
||||
[IO.Compression.ZipFile]::ExtractToDirectory('C:\vim.zip', 'C:\vim')
|
||||
Invoke-WebRequest ftp://ftp.vim.org/pub/vim/pc/vim80-586rt.zip `
|
||||
-OutFile C:\rt.zip
|
||||
[IO.Compression.ZipFile]::ExtractToDirectory('C:\rt.zip', 'C:\vim')
|
||||
}
|
||||
# Clone Vader and check out the commit we want
|
||||
- ps: >-
|
||||
if (!(Test-Path -Path C:\vader)){
|
||||
git clone https://github.com/junegunn/vader.vim C:\vader 2> $null
|
||||
cd C:\vader
|
||||
git checkout -qf c6243dd81c98350df4dec608fa972df98fa2a3af 2> $null
|
||||
}
|
||||
|
||||
test_script:
|
||||
- cd C:\testplugin
|
||||
- 'C:\vim\vim\vim80\vim.exe -u test\vimrc "+Vader!
|
||||
test/*.vader test/*/*.vader test/*/*/*.vader test/*/*/*.vader"'
|
||||
@@ -1,18 +0,0 @@
|
||||
# EditorConfig is awesome: http://EditorConfig.org
|
||||
|
||||
# Top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Match and apply these rules for all file
|
||||
# types you open in your code editor
|
||||
[*]
|
||||
# Unix-style newlines
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.vader]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
11
.eslintrc.js
Normal file
11
.eslintrc.js
Normal file
@@ -0,0 +1,11 @@
|
||||
module.exports = {
|
||||
parserOptions: {
|
||||
ecmaVersion: 6,
|
||||
sourceType: "module",
|
||||
},
|
||||
rules: {
|
||||
semi: 'error',
|
||||
'space-infix-ops': 'warn',
|
||||
radix: 'error',
|
||||
}
|
||||
}
|
||||
7
.gitattributes
vendored
7
.gitattributes
vendored
@@ -1,13 +1,8 @@
|
||||
.* export-ignore
|
||||
/CODE_OF_CONDUCT.md export-ignore
|
||||
/CONTRIBUTING.md export-ignore
|
||||
/Dockerfile export-ignore
|
||||
/ISSUE_TEMPLATE export-ignore
|
||||
/ISSUE_TEMPLATE.md export-ignore
|
||||
/Makefile export-ignore
|
||||
/PULL_REQUEST_TEMPLATE.md export-ignore
|
||||
/README.md export-ignore
|
||||
/img export-ignore
|
||||
/run-tests export-ignore
|
||||
/run-tests.bat export-ignore
|
||||
/test export-ignore
|
||||
/custom-checks export-ignore
|
||||
|
||||
3
.github/CODE_OF_CONDUCT.md
vendored
3
.github/CODE_OF_CONDUCT.md
vendored
@@ -1,3 +0,0 @@
|
||||
Codes of conduct are totally unnecessary and dumb.
|
||||
|
||||
Just don't be a jerk and have fun.
|
||||
25
.github/CONTRIBUTING.md
vendored
25
.github/CONTRIBUTING.md
vendored
@@ -1,25 +0,0 @@
|
||||
## Guidelines
|
||||
|
||||
Have fun, and work on whatever floats your boat. Take It Easy :tm:.
|
||||
|
||||
For help with contributing to ALE, see `:help ale-development` in Vim, or view
|
||||
the help file online [here](/doc/ale-development.txt).
|
||||
|
||||
## Creating Issues
|
||||
|
||||
Before creating any issues, please look through the current list of issues and
|
||||
pull requests, and ensure that the issue hasn't already been reported. If an
|
||||
issue has already been reported, but you have some new insight, please add
|
||||
a comment to the existing issue.
|
||||
|
||||
Please read the FAQ in the README before creating any issues. A feature
|
||||
you desire may already exist and be documented, or the FAQ might explain
|
||||
how to solve a problem you have already.
|
||||
|
||||
Please try and describe any issues reported with as much detail as you can
|
||||
provide about your Vim version, the linter you were trying to run, your
|
||||
operating system, or any other information you think might be helpful.
|
||||
|
||||
Please describe your issue in clear, grammatically correct, and easy to
|
||||
understand English. You are more likely to see an issue resolved if others
|
||||
can understand you.
|
||||
6
.github/ISSUE_TEMPLATE/config.yml
vendored
6
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,6 +0,0 @@
|
||||
---
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Ask for Help
|
||||
url: https://github.com/dense-analysis/ale/discussions/new?category=q-a-ask-for-help-with-problems
|
||||
about: Ask for Help in ALE Discussions
|
||||
48
.github/ISSUE_TEMPLATE/report-a-bug.md
vendored
48
.github/ISSUE_TEMPLATE/report-a-bug.md
vendored
@@ -1,48 +0,0 @@
|
||||
---
|
||||
name: Report a bug
|
||||
labels: bug
|
||||
about: Report a bug with ALE.
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
This is the template for reporting ALE bugs. Make sure you try updating ALE
|
||||
to a more recent version before reporting a bug. Look through existing bug
|
||||
reports for similar issues before reporting a new one. Don't leave comments
|
||||
about new bugs in the comment section for old issues.
|
||||
|
||||
Make sure to try disabling other plugins and trying to repeat your bug before
|
||||
reporting it in ALE. Some times problems can arise when two plugins are used
|
||||
together, but often your issues might be problems with other plugins.
|
||||
-->
|
||||
|
||||
## Information
|
||||
|
||||
**VIM version**
|
||||
|
||||
<!-- Paste just the first two lines of :version here. -->
|
||||
|
||||
Operating System: <!-- Describe your operating system version. -->
|
||||
|
||||
## What went wrong
|
||||
|
||||
<!-- Describe what went wrong here. Be specific. -->
|
||||
|
||||
Something went wrong in specifically this place, and I also searched through both open and closed issues for the same problem before reporting a bug here.
|
||||
|
||||
Are you having trouble configuring ALE? Try asking for help on [Stack Exchange](https://vi.stackexchange.com/) or perhaps on [Reddit](https://www.reddit.com/r/vim/) instead. The GitHub issue tracker should be used for reporting bugs or asking for new features.
|
||||
|
||||
## Reproducing the bug
|
||||
|
||||
<!-- Write a list of steps below. -->
|
||||
|
||||
1. I did this.
|
||||
2. Then this happened.
|
||||
|
||||
### :ALEInfo
|
||||
<details>
|
||||
<summary>Expand</summary>
|
||||
<!-- Paste the output of :ALEInfo here. Try :ALEInfo -clipboard -->
|
||||
<!-- Make sure to run :ALEInfo from the buffer where the bug occurred. -->
|
||||
<!-- Read the output. You might figure out what went wrong yourself. -->
|
||||
</details>
|
||||
@@ -1,21 +0,0 @@
|
||||
---
|
||||
name: Suggest a new linter or fixer
|
||||
labels: new tool
|
||||
about: Suggest a new tool ALE can officially integrate with.
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
Write "Add support for foobar" as the issue title, or similar.
|
||||
|
||||
Fill out the details below.
|
||||
-->
|
||||
|
||||
**Name:** foobar
|
||||
**URL:** https://foo.bar.com
|
||||
|
||||
<!--
|
||||
Write a description of the tool, and add any other information you think might
|
||||
be helpful. Consider creating a pull request to add support for the tool
|
||||
yourself.
|
||||
-->
|
||||
@@ -1,8 +0,0 @@
|
||||
---
|
||||
name: Suggest an improvement
|
||||
labels: enhancement
|
||||
about: Suggest some way to improve ALE, or add a new feature.
|
||||
|
||||
---
|
||||
|
||||
<!-- There's no fixed format for feature requests. Just add your thoughts. -->
|
||||
13
.github/PULL_REQUEST_TEMPLATE.md
vendored
13
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,13 +0,0 @@
|
||||
<!--
|
||||
Before creating a pull request, do the following.
|
||||
|
||||
* Read the Contributing guide linked above first.
|
||||
* Read the documentation that comes with ALE with `:help ale-dev`.
|
||||
|
||||
Have fun!
|
||||
-->
|
||||
|
||||
Where are the tests? Have you added tests? Have you updated the tests? Read the
|
||||
comment above and the documentation referenced in it first. Write tests!
|
||||
|
||||
Seriously, read `:help ale-dev` and write tests.
|
||||
17
.github/stale.yml
vendored
17
.github/stale.yml
vendored
@@ -1,17 +0,0 @@
|
||||
---
|
||||
# This configuration closes stale PRs after 56 + 7 days.
|
||||
# That's 8 weeks until stale bot complains, and a week until it closes a PR.
|
||||
# Issues in ALE are never, ever stale. They are either resolved or not.
|
||||
only: pulls
|
||||
daysUntilStale: 56
|
||||
daysUntilClose: 7
|
||||
exemptLabels: []
|
||||
staleLabel: stale
|
||||
markComment: >
|
||||
This pull request has been automatically marked as stale because it has not
|
||||
been updated recently. Make sure to write tests and document your changes.
|
||||
See `:help ale-dev` for information on writing tests.
|
||||
|
||||
If your pull request is good to merge, bother w0rp or another maintainer
|
||||
again, and get them to merge it.
|
||||
closeComment: false
|
||||
38
.github/workflows/main.yml
vendored
38
.github/workflows/main.yml
vendored
@@ -1,38 +0,0 @@
|
||||
---
|
||||
name: CI
|
||||
on: # yamllint disable-line rule:truthy
|
||||
push:
|
||||
branches: [ master ] # yamllint disable-line rule:brackets
|
||||
tags:
|
||||
- v[0-9]+.[0-9]+.x
|
||||
- v[0-9]+.[0-9]+.[0-9]+
|
||||
pull_request:
|
||||
branches: [ master ] # yamllint disable-line rule:brackets
|
||||
|
||||
jobs:
|
||||
build_image:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build docker run image
|
||||
shell: bash
|
||||
env:
|
||||
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
|
||||
DOCKER_HUB_PASS: ${{ secrets.DOCKER_HUB_PASS }}
|
||||
run: ./run-tests --build-image
|
||||
test_ale:
|
||||
needs: build_image
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
vim-version:
|
||||
- '--vim-80-only'
|
||||
- '--vim-90-only'
|
||||
- '--neovim-07-only'
|
||||
- '--neovim-08-only'
|
||||
- '--lua-only'
|
||||
- '--linters-only'
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Run tests
|
||||
run: ./run-tests -v ${{ matrix.vim-version }}
|
||||
14
.gitignore
vendored
14
.gitignore
vendored
@@ -1,12 +1,4 @@
|
||||
!.editorconfig
|
||||
*.obj
|
||||
*.pyc
|
||||
# Ignore all hidden files everywhere.
|
||||
# Use `git add -f` to add hidden files.
|
||||
.*
|
||||
/doc/tags
|
||||
/init.vim
|
||||
/test/ale-info-test-file
|
||||
/vader_output
|
||||
__pycache__
|
||||
tags
|
||||
/doc/tags
|
||||
.*
|
||||
*.obj
|
||||
|
||||
19
.luarc.json
19
.luarc.json
@@ -1,19 +0,0 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
|
||||
"diagnostics.globals": [
|
||||
"vim"
|
||||
],
|
||||
"workspace.ignoreDir": [
|
||||
"test"
|
||||
],
|
||||
"workspace.library": [
|
||||
"/usr/share/nvim/runtime/lua"
|
||||
],
|
||||
"runtime.pathStrict": true,
|
||||
"runtime.path": [
|
||||
"lua/?.lua",
|
||||
"lua/?/init.lua"
|
||||
],
|
||||
"runtime.version": "LuaJIT",
|
||||
"hint.enable": false
|
||||
}
|
||||
10
.travis.yml
Normal file
10
.travis.yml
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
sudo: required
|
||||
services:
|
||||
- docker
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
language: python
|
||||
script: |
|
||||
make test
|
||||
@@ -1,5 +0,0 @@
|
||||
policies:
|
||||
# Disable a violation that is thrown randomly for reasons I still
|
||||
# do not understand.
|
||||
ProhibitMissingScriptEncoding:
|
||||
enabled: false
|
||||
92
CONTRIBUTING.md
Normal file
92
CONTRIBUTING.md
Normal file
@@ -0,0 +1,92 @@
|
||||
# Contributing to ALE
|
||||
|
||||
1. [Guidelines](#guidelines)
|
||||
2. [Creating Issues](#issues)
|
||||
3. [Creating Pull Requests](#pull-requests)
|
||||
1. [Adding a New Linter](#adding-a-new-linter)
|
||||
2. [Adding New Options](#adding-new-options)
|
||||
|
||||
<a name="guidelines"></a>
|
||||
|
||||
# 1. Guidelines
|
||||
|
||||
Have fun, and work on whatever floats your boat. Take It Easy :tm:.
|
||||
|
||||
When writing code, follow the [Google Vimscript Style
|
||||
Guide](https://google.github.io/styleguide/vimscriptguide.xml), and run `vint
|
||||
-s` on your files to check for most of what the guide mentions and more. If you
|
||||
install this plugin (ALE) and install [Vint](https://github.com/Kuniwak/vint), it
|
||||
will check your code while you type.
|
||||
|
||||
<a name="issues"></a>
|
||||
|
||||
# 2. Creating Issues
|
||||
|
||||
Before creating any issues, please look through the current list of issues and
|
||||
pull requests, and ensure that the issue hasn't already been reported. If an
|
||||
issue has already been reported, but you have some new insight, please add
|
||||
a comment to the existing issue.
|
||||
|
||||
Please read the FAQ in the README before creating any issues. A feature
|
||||
you desire may already exist and be documented, or the FAQ might explain
|
||||
how to solve a problem you have already.
|
||||
|
||||
Please try and describe any issues reported with as much detail as you can
|
||||
provide about your Vim version, the linter you were trying to run, your
|
||||
operating system, or any other information you think might be helpful.
|
||||
|
||||
Please describe your issue in clear, grammatically correct, and easy to
|
||||
understand English. You are more likely to see an issue resolved if others
|
||||
can understand you.
|
||||
|
||||
<a name="pull-requests"></a>
|
||||
|
||||
# 3. Creating Pull Requests
|
||||
|
||||
For code you write, make sure to credit yourself at the top of files you add,
|
||||
and probably those you modify. You can write some comments at the top of your
|
||||
VIM files.
|
||||
|
||||
```vim
|
||||
" Author: John Smith <john.smith@gmail.com>
|
||||
" Description: This file adds support for awesomelinter for the best language ever.
|
||||
```
|
||||
|
||||
If you want to credit multiple authors, you can comma separate them.
|
||||
|
||||
```vim
|
||||
" Author: John Smith <john.smith@gmail.com>, Jane Doe <https://jane-doe.info>
|
||||
```
|
||||
|
||||
<a name="adding-a-new-linter"></a>
|
||||
|
||||
# 3.i. Adding a New Linter
|
||||
|
||||
If you add a new linter, look for existing handlers first in the
|
||||
[handlers.vim](autoload/ale/handlers.vim) file. One of the handlers there may
|
||||
already be able to handle your lines of output. If you find that your new
|
||||
linter replicates an existing error handler, consider pulling it up into the
|
||||
[handlers.vim](autoload/ale/handlers.vim) file, and use the generic handler in
|
||||
both places.
|
||||
|
||||
When you add a linter, make sure the language for the linter and the linter
|
||||
itself are present in the table in the [README.md](README.md) file and in the
|
||||
Vim [help file](doc/ale.txt). The programs and linters should be sorted
|
||||
alphabetically in the table and list.
|
||||
|
||||
<a name="adding-new-options"></a>
|
||||
|
||||
# 3.ii. Adding New Options
|
||||
|
||||
If you add new options to the plugin, make sure to document those new options
|
||||
in the [README.md](README.md) file, and also in the [help file](doc/ale.txt).
|
||||
Follow the format of other options in each. Global options should appear in the
|
||||
README file, and in the relevant section in the help file. Options specific
|
||||
to a particular linter should appear in the section for that linter.
|
||||
|
||||
Linter options for customizing general argument lists should be named
|
||||
`g:ale_<filetype>_<linter>_options`, so that all linters can have similar
|
||||
global variable names.
|
||||
|
||||
Any options for linters should be set to some default value so it is always
|
||||
easy to see what the default is with `:echo g:ale...`.
|
||||
28
Dockerfile
28
Dockerfile
@@ -1,32 +1,20 @@
|
||||
ARG TESTBED_VIM_VERSION=24
|
||||
FROM tweekmonster/vim-testbed:latest
|
||||
|
||||
FROM testbed/vim:${TESTBED_VIM_VERSION}
|
||||
RUN install_vim -tag v8.0.0000 -build \
|
||||
-tag v8.0.0027 -build
|
||||
|
||||
ENV PACKAGES="\
|
||||
lua5.1 \
|
||||
lua5.1-dev \
|
||||
lua5.1-busted \
|
||||
bash \
|
||||
git \
|
||||
python2 \
|
||||
python3 \
|
||||
py3-pip \
|
||||
grep \
|
||||
sed \
|
||||
python=2.7.12-r0 \
|
||||
py-pip=8.1.2-r0 \
|
||||
nodejs \
|
||||
"
|
||||
RUN apk --update add $PACKAGES && \
|
||||
rm -rf /var/cache/apk/* /tmp/* /var/tmp/*
|
||||
|
||||
RUN install_vim -tag v8.0.0027 -build \
|
||||
-tag v9.0.0297 -build \
|
||||
-tag neovim:v0.7.0 -build \
|
||||
-tag neovim:v0.8.0 -build
|
||||
RUN pip install vim-vint==0.3.9
|
||||
|
||||
RUN pip install vim-vint==0.3.21
|
||||
RUN npm install -g eslint@3.7.1
|
||||
|
||||
RUN git clone https://github.com/junegunn/vader.vim vader && \
|
||||
cd vader && git checkout c6243dd81c98350df4dec608fa972df98fa2a3af
|
||||
|
||||
ARG GIT_VERSION
|
||||
LABEL Version=${GIT_VERSION}
|
||||
LABEL Name=denseanalysis/ale
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2016-2023, Dense Analysis
|
||||
Copyright (c) 2016, w0rp <devw0rp@gmail.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
44
Makefile
Normal file
44
Makefile
Normal file
@@ -0,0 +1,44 @@
|
||||
SHELL := /usr/bin/env bash
|
||||
IMAGE ?= w0rp/ale
|
||||
CURRENT_IMAGE_ID = 107e4efc4267
|
||||
DOCKER_FLAGS = --rm -v $(PWD):/testplugin -v $(PWD)/test:/home "$(IMAGE)"
|
||||
|
||||
test-setup:
|
||||
docker images -q w0rp/ale | grep ^$(CURRENT_IMAGE_ID) > /dev/null || \
|
||||
docker pull $(IMAGE)
|
||||
|
||||
test: test-setup
|
||||
@:; \
|
||||
vims=$$(docker run --rm $(IMAGE) ls /vim-build/bin | grep -E '^n?vim'); \
|
||||
if [ -z "$$vims" ]; then echo "No Vims found!"; exit 1; fi; \
|
||||
EXIT=0; \
|
||||
for vim in $$vims; do \
|
||||
echo; \
|
||||
echo '========================================'; \
|
||||
echo "Running tests for $$vim"; \
|
||||
echo '========================================'; \
|
||||
echo; \
|
||||
docker run -a stderr $(DOCKER_FLAGS) $$vim '+Vader! test/*' || EXIT=$$?; \
|
||||
done; \
|
||||
echo; \
|
||||
echo '========================================'; \
|
||||
echo 'Running Vint to lint our code'; \
|
||||
echo '========================================'; \
|
||||
echo 'Vint warnings/errors follow:'; \
|
||||
echo; \
|
||||
set -o pipefail; \
|
||||
docker run -a stdout $(DOCKER_FLAGS) vint -s /testplugin | sed s:^/testplugin/:: || EXIT=$$?; \
|
||||
set +o pipefail; \
|
||||
echo; \
|
||||
echo '========================================'; \
|
||||
echo 'Running custom checks'; \
|
||||
echo '========================================'; \
|
||||
echo 'Custom warnings/errors follow:'; \
|
||||
echo; \
|
||||
set -o pipefail; \
|
||||
docker run -a stdout $(DOCKER_FLAGS) /testplugin/custom-checks /testplugin | sed s:^/testplugin/:: || EXIT=$$?; \
|
||||
set +o pipefail; \
|
||||
echo; \
|
||||
exit $$EXIT;
|
||||
|
||||
.DEFAULT_GOAL := test
|
||||
@@ -1,26 +0,0 @@
|
||||
" Author: Bartek Jasicki http://github.com/thindil
|
||||
" Description: Support for Ada Language Server
|
||||
|
||||
call ale#Set('ada_adals_executable', 'ada_language_server')
|
||||
call ale#Set('ada_adals_project', 'default.gpr')
|
||||
call ale#Set('ada_adals_encoding', 'utf-8')
|
||||
|
||||
function! ale_linters#ada#adals#GetAdaLSConfig(buffer) abort
|
||||
return {
|
||||
\ 'ada.projectFile': ale#Var(a:buffer, 'ada_adals_project'),
|
||||
\ 'ada.defaultCharset': ale#Var(a:buffer, 'ada_adals_encoding')
|
||||
\}
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ada#adals#GetRootDirectory(buffer) abort
|
||||
return fnamemodify(bufname(a:buffer), ':p:h')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ada', {
|
||||
\ 'name': 'adals',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'ada_adals_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale_linters#ada#adals#GetRootDirectory'),
|
||||
\ 'lsp_config': function('ale_linters#ada#adals#GetAdaLSConfig')
|
||||
\})
|
||||
@@ -1,5 +0,0 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for Ada files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('ada')
|
||||
@@ -1,54 +0,0 @@
|
||||
" Author: Martino Pilia <martino.pilia@gmail.com>
|
||||
" Description: Lint Ada files with GCC
|
||||
|
||||
call ale#Set('ada_gcc_executable', 'gcc')
|
||||
|
||||
" -gnatwa: activate most optional warnings
|
||||
" -gnatq: try semantic analysis even if syntax errors have been found
|
||||
call ale#Set('ada_gcc_options', '-gnatwa -gnatq')
|
||||
|
||||
function! ale_linters#ada#gcc#GetCommand(buffer) abort
|
||||
" Build a suitable output file name. The output file is specified because
|
||||
" the .ali file may be created even if no code generation is attempted.
|
||||
" The output file name must match the source file name (except for the
|
||||
" extension), so here we cannot use the null file as output.
|
||||
let l:tmp_dir = fnamemodify(ale#command#CreateDirectory(a:buffer), ':p')
|
||||
let l:out_file = l:tmp_dir . fnamemodify(bufname(a:buffer), ':t:r') . '.o'
|
||||
|
||||
" -gnatc: Check syntax and semantics only (no code generation attempted)
|
||||
return '%e -x ada -c -gnatc'
|
||||
\ . ' -o ' . ale#Escape(l:out_file)
|
||||
\ . ' -I %s:h'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'ada_gcc_options'))
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
" For the message format please refer to:
|
||||
" https://gcc.gnu.org/onlinedocs/gnat_ugn/Output-and-Error-Message-Control.html
|
||||
" https://gcc.gnu.org/onlinedocs/gnat_ugn/Warning-Message-Control.html
|
||||
function! ale_linters#ada#gcc#Handle(buffer, lines) abort
|
||||
" Error format: <filename>:<lnum>:<col>: <text>
|
||||
" Warning format: <filename>:<lnum>:<col>: warning: <text>
|
||||
let l:re = '\v(.+):([0-9]+):([0-9]+):\s+(warning:)?\s*(.+)\s*'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:re)
|
||||
call add(l:output, {
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'col': str2nr(l:match[3]),
|
||||
\ 'type': l:match[4] is# 'warning:' ? 'W' : 'E',
|
||||
\ 'text': l:match[5],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ada', {
|
||||
\ 'name': 'gcc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'ada_gcc_executable')},
|
||||
\ 'command': function('ale_linters#ada#gcc#GetCommand'),
|
||||
\ 'callback': 'ale_linters#ada#gcc#Handle',
|
||||
\})
|
||||
9
ale_linters/ansible/ansible-lint.vim
Normal file
9
ale_linters/ansible/ansible-lint.vim
Normal file
@@ -0,0 +1,9 @@
|
||||
" Author: Bjorn Neergaard <bjorn@neersighted.com>
|
||||
" Description: ansible-lint for ansible-yaml files
|
||||
|
||||
call ale#linter#Define('ansible', {
|
||||
\ 'name': 'ansible',
|
||||
\ 'executable': 'ansible',
|
||||
\ 'command': g:ale#util#stdin_wrapper . ' .yml ansible-lint -p',
|
||||
\ 'callback': 'ale#handlers#HandlePEP8Format',
|
||||
\})
|
||||
@@ -1,138 +0,0 @@
|
||||
" Authors: Bjorn Neergaard <bjorn@neersighted.com>, Vytautas Macionis <vytautas.macionis@manomail.de>
|
||||
" Description: ansible-lint for ansible-yaml files
|
||||
|
||||
call ale#Set('ansible_ansible_lint_executable', 'ansible-lint')
|
||||
|
||||
function! ale_linters#ansible#ansible_lint#GetExecutable(buffer) abort
|
||||
return ale#Var(a:buffer, 'ansible_ansible_lint_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ansible#ansible_lint#Handle(buffer, version, lines) abort
|
||||
for l:line in a:lines[:10]
|
||||
if match(l:line, '^Traceback') >= 0
|
||||
return [{
|
||||
\ 'lnum': 1,
|
||||
\ 'text': 'An exception was thrown. See :ALEDetail',
|
||||
\ 'detail': join(a:lines, "\n"),
|
||||
\}]
|
||||
endif
|
||||
endfor
|
||||
|
||||
let l:version_group = ale#semver#GTE(a:version, [6, 0, 0]) ? '>=6.0.0' :
|
||||
\ ale#semver#GTE(a:version, [5, 0, 0]) ? '>=5.0.0' :
|
||||
\ '<5.0.0'
|
||||
let l:output = []
|
||||
|
||||
if '>=6.0.0' is# l:version_group
|
||||
let l:error_codes = { 'blocker': 'E', 'critical': 'E', 'major': 'W', 'minor': 'W', 'info': 'I' }
|
||||
let l:linter_issues = ale#util#FuzzyJSONDecode(a:lines, [])
|
||||
|
||||
for l:issue in l:linter_issues
|
||||
if ale#path#IsBufferPath(a:buffer, l:issue.location.path)
|
||||
if exists('l:issue.location.positions')
|
||||
let l:coord_keyname = 'positions'
|
||||
else
|
||||
let l:coord_keyname = 'lines'
|
||||
endif
|
||||
|
||||
let l:column_member = printf(
|
||||
\ 'l:issue.location.%s.begin.column', l:coord_keyname
|
||||
\)
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': exists(l:column_member) ? l:issue.location[l:coord_keyname].begin.line :
|
||||
\ l:issue.location[l:coord_keyname].begin,
|
||||
\ 'col': exists(l:column_member) ? l:issue.location[l:coord_keyname].begin.column : 0,
|
||||
\ 'text': l:issue.check_name,
|
||||
\ 'detail': l:issue.description,
|
||||
\ 'code': l:issue.severity,
|
||||
\ 'type': l:error_codes[l:issue.severity],
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if '>=5.0.0' is# l:version_group
|
||||
" Matches patterns line the following:
|
||||
" test.yml:3:148: syntax-check 'var' is not a valid attribute for a Play
|
||||
" roles/test/tasks/test.yml:8: [package-latest] [VERY_LOW] Package installs should not use latest
|
||||
" D:\test\tasks\test.yml:8: [package-latest] [VERY_LOW] package installs should not use latest
|
||||
let l:pattern = '\v^(%([a-zA-Z]:)?[^:]+):(\d+):%((\d+):)? %(\[([-[:alnum:]]+)\]) %(\[([_[:alnum:]]+)\]) (.*)$'
|
||||
let l:error_codes = { 'VERY_HIGH': 'E', 'HIGH': 'E', 'MEDIUM': 'W', 'LOW': 'W', 'VERY_LOW': 'W', 'INFO': 'I' }
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
if ale#path#IsBufferPath(a:buffer, l:match[1])
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[6],
|
||||
\ 'code': l:match[4],
|
||||
\ 'type': l:error_codes[l:match[5]],
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
if '<5.0.0' is# l:version_group
|
||||
" Matches patterns line the following:
|
||||
" test.yml:35: [EANSIBLE0002] Trailing whitespace
|
||||
let l:pattern = '\v^([a-zA-Z]?:?[^:]+):(\d+):?(\d+)?: \[?([[:alnum:]]+)\]? (.*)$'
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:code = l:match[4]
|
||||
|
||||
if l:code is# 'EANSIBLE0002'
|
||||
\&& !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
|
||||
" Skip warnings for trailing whitespace if the option is off.
|
||||
continue
|
||||
endif
|
||||
|
||||
if ale#path#IsBufferPath(a:buffer, l:match[1])
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'text': l:match[5],
|
||||
\ 'code': l:code,
|
||||
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
endif
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ansible#ansible_lint#GetCommand(buffer, version) abort
|
||||
let l:commands = {
|
||||
\ '>=6.0.0': '%e --nocolor -f json -x yaml %s',
|
||||
\ '>=5.0.0': '%e --nocolor --parseable-severity -x yaml %s',
|
||||
\ '<5.0.0': '%e --nocolor -p %t'
|
||||
\}
|
||||
let l:command = ale#semver#GTE(a:version, [6, 0]) ? l:commands['>=6.0.0'] :
|
||||
\ ale#semver#GTE(a:version, [5, 0]) ? l:commands['>=5.0.0'] :
|
||||
\ l:commands['<5.0.0']
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ansible', {
|
||||
\ 'name': 'ansible_lint',
|
||||
\ 'aliases': ['ansible', 'ansible-lint'],
|
||||
\ 'executable': function('ale_linters#ansible#ansible_lint#GetExecutable'),
|
||||
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale_linters#ansible#ansible_lint#GetExecutable(buffer),
|
||||
\ '%e --version',
|
||||
\ function('ale_linters#ansible#ansible_lint#GetCommand'),
|
||||
\ )},
|
||||
\ 'lint_file': 1,
|
||||
\ 'callback': {buffer, lines -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale_linters#ansible#ansible_lint#GetExecutable(buffer),
|
||||
\ '%e --version',
|
||||
\ {buffer, version -> ale_linters#ansible#ansible_lint#Handle(
|
||||
\ buffer,
|
||||
\ l:version,
|
||||
\ lines)},
|
||||
\ )},
|
||||
\})
|
||||
@@ -1,47 +0,0 @@
|
||||
" Author: Horacio Sanson <https://github.com/hsanson>
|
||||
" Description: Support ansible language server https://github.com/ansible/ansible-language-server/
|
||||
|
||||
call ale#Set('ansible_language_server_executable', 'ansible-language-server')
|
||||
call ale#Set('ansible_language_server_config', {})
|
||||
|
||||
function! ale_linters#ansible#language_server#Executable(buffer) abort
|
||||
return ale#Var(a:buffer, 'ansible_language_server_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ansible#language_server#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#ansible#language_server#Executable(a:buffer)
|
||||
|
||||
return ale#Escape(l:executable) . ' --stdio'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#ansible#language_server#FindProjectRoot(buffer) abort
|
||||
let l:dir = fnamemodify(
|
||||
\ ale#path#FindNearestFile(a:buffer, 'ansible.cfg'),
|
||||
\ ':h'
|
||||
\)
|
||||
|
||||
if l:dir isnot# '.' && isdirectory(l:dir)
|
||||
return l:dir
|
||||
endif
|
||||
|
||||
let l:dir = fnamemodify(
|
||||
\ ale#path#FindNearestDirectory(a:buffer, '.git'),
|
||||
\ ':h:h'
|
||||
\)
|
||||
|
||||
if l:dir isnot# '.' && isdirectory(l:dir)
|
||||
return l:dir
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('ansible', {
|
||||
\ 'name': 'language_server',
|
||||
\ 'aliases': ['ansible_language_server', 'ansible-language-server'],
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': function('ale_linters#ansible#language_server#Executable'),
|
||||
\ 'command': function('ale_linters#ansible#language_server#GetCommand'),
|
||||
\ 'project_root': function('ale_linters#ansible#language_server#FindProjectRoot'),
|
||||
\ 'lsp_config': {b -> ale#Var(b, 'ansible_language_server_config')}
|
||||
\})
|
||||
@@ -1,38 +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',
|
||||
\ 'callback': 'ale_linters#apiblueprint#drafter#HandleErrors',
|
||||
\})
|
||||
@@ -1,12 +0,0 @@
|
||||
" Author: Leo <thinkabit.ukim@gmail.com>
|
||||
" Description: apkbuild-lint from atools linter for APKBUILDs
|
||||
|
||||
call ale#Set('apkbuild_apkbuild_lint_executable', 'apkbuild-lint')
|
||||
|
||||
call ale#linter#Define('apkbuild', {
|
||||
\ 'name': 'apkbuild_lint',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': {b -> ale#Var(b, 'apkbuild_apkbuild_lint_executable')},
|
||||
\ 'command': '%e %t',
|
||||
\ 'callback': 'ale#handlers#atools#Handle',
|
||||
\})
|
||||
@@ -1,12 +0,0 @@
|
||||
" Author: Leo <thinkabit.ukim@gmail.com>
|
||||
" Description: secfixes-check from atools linter for APKBUILDs
|
||||
|
||||
call ale#Set('apkbuild_secfixes_check_executable', 'secfixes-check')
|
||||
|
||||
call ale#linter#Define('apkbuild', {
|
||||
\ 'name': 'secfixes_check',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': {b -> ale#Var(b, 'apkbuild_secfixes_check_executable')},
|
||||
\ 'command': '%e %t',
|
||||
\ 'callback': 'ale#handlers#atools#Handle',
|
||||
\})
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Johannes Wienke <languitar@semipol.de>
|
||||
" Description: alex for asciidoc files
|
||||
|
||||
call ale#handlers#alex#DefineLinter('asciidoc', '--text')
|
||||
@@ -1,5 +0,0 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for ASCIIDoc files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('asciidoc')
|
||||
@@ -1,5 +0,0 @@
|
||||
" Author: Horacio Sanson (hsanson [ät] gmail.com)
|
||||
" Description: languagetool for asciidoc files, copied from markdown.
|
||||
|
||||
|
||||
call ale#handlers#languagetool#DefineLinter('asciidoc')
|
||||
@@ -1,9 +0,0 @@
|
||||
" Author: Daniel M. Capella https://github.com/polyzen
|
||||
" Description: proselint for AsciiDoc files
|
||||
|
||||
call ale#linter#Define('asciidoc', {
|
||||
\ 'name': 'proselint',
|
||||
\ 'executable': 'proselint',
|
||||
\ 'command': 'proselint %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
||||
@@ -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: TANIGUCHI Masaya <ta2gch@gmail.com>
|
||||
" Description: textlint for AsciiDoc files
|
||||
|
||||
call ale#linter#Define('asciidoc', {
|
||||
\ 'name': 'textlint',
|
||||
\ 'executable': function('ale#handlers#textlint#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#textlint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#textlint#HandleTextlintOutput',
|
||||
\})
|
||||
@@ -1,9 +0,0 @@
|
||||
" Author: Jeff Kreeftmeijer https://github.com/jeffkreeftmeijer
|
||||
" Description: vale for AsciiDoc files
|
||||
|
||||
call ale#linter#Define('asciidoc', {
|
||||
\ 'name': 'vale',
|
||||
\ 'executable': 'vale',
|
||||
\ 'command': 'vale --output=line %t',
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Sumner Evans <sumner.evans98@gmail.com>
|
||||
" Description: write-good for AsciiDoc files
|
||||
|
||||
call ale#handlers#writegood#DefineLinter('asciidoc')
|
||||
@@ -1,37 +0,0 @@
|
||||
" Author: Lucas Kolstad <lkolstad@uw.edu>
|
||||
" Description: gcc linter for asm files
|
||||
|
||||
call ale#Set('asm_gcc_executable', 'gcc')
|
||||
call ale#Set('asm_gcc_options', '-Wall')
|
||||
|
||||
function! ale_linters#asm#gcc#GetCommand(buffer) abort
|
||||
" `-o /dev/null` or `-o null` is needed to catch all errors,
|
||||
" -fsyntax-only doesn't catch everything.
|
||||
return '%e -x assembler'
|
||||
\ . ' -o ' . g:ale#util#nul_file
|
||||
\ . '-iquote %s:h'
|
||||
\ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#asm#gcc#Handle(buffer, lines) abort
|
||||
let l:pattern = '^.\+:\(\d\+\): \([^:]\+\): \(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'type': l:match[2] =~? 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('asm', {
|
||||
\ 'name': 'gcc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'asm_gcc_executable')},
|
||||
\ 'command': function('ale_linters#asm#gcc#GetCommand'),
|
||||
\ 'callback': 'ale_linters#asm#gcc#Handle',
|
||||
\})
|
||||
@@ -1,37 +0,0 @@
|
||||
" Author: uidops <uidops@protonmail.com>
|
||||
" Description: llvm-mc linter for asm files
|
||||
|
||||
call ale#Set('asm_llvm_mc_executable', 'llvm-mc')
|
||||
call ale#Set('asm_llvm_mc_options', '')
|
||||
|
||||
function! ale_linters#asm#llvm_mc#GetCommand(buffer) abort
|
||||
return '%e --assemble'
|
||||
\ . ' --filetype=asm'
|
||||
\ . ' -o ' . g:ale#util#nul_file
|
||||
\ . ' ' . ale#Var(a:buffer, 'asm_llvm_mc_options')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#asm#llvm_mc#Handle(buffer, lines) abort
|
||||
let l:pattern = '^.\+:\(\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,
|
||||
\ 'type': l:match[3] =~? 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('asm', {
|
||||
\ 'name': 'llvm_mc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'asm_llvm_mc_executable')},
|
||||
\ 'command': function('ale_linters#asm#llvm_mc#GetCommand'),
|
||||
\ 'callback': 'ale_linters#asm#llvm_mc#Handle',
|
||||
\})
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
" Author: Hyuksang Kwon <gwonhyuksang@gmail.com>
|
||||
" Description: eslint for astro files
|
||||
|
||||
call ale#linter#Define('astro', {
|
||||
\ 'name': 'eslint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': function('ale#handlers#eslint#GetExecutable'),
|
||||
\ 'cwd': function('ale#handlers#eslint#GetCwd'),
|
||||
\ 'command': function('ale#handlers#eslint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#eslint#HandleJSON',
|
||||
\})
|
||||
@@ -1,36 +0,0 @@
|
||||
" Author: Utkarsh Verma <utkarshverma@protonmail.com>
|
||||
" Description: AVRA linter for avra syntax.
|
||||
|
||||
call ale#Set('avra_avra_executable', 'avra')
|
||||
call ale#Set('avra_avra_options', '')
|
||||
|
||||
function! ale_linters#avra#avra#GetCommand(buffer) abort
|
||||
return '%e'
|
||||
\ . ' %t'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'avra_avra_options'))
|
||||
\ . ' -o ' . g:ale#util#nul_file
|
||||
endfunction
|
||||
|
||||
function! ale_linters#avra#avra#Handle(buffer, lines) abort
|
||||
" Note that we treat 'fatal' as errors.
|
||||
let l:pattern = '^\S\+(\(\d\+\))\s\+:\s\+\(\S\+\)\s\+:\s\+\(.\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'type': l:match[2] =~? 'Error' ? 'E' : 'W',
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('avra', {
|
||||
\ 'name': 'avra',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'avra_avra_executable')},
|
||||
\ 'command': function('ale_linters#avra#avra#GetCommand'),
|
||||
\ 'callback': 'ale_linters#avra#avra#Handle',
|
||||
\})
|
||||
@@ -1,23 +0,0 @@
|
||||
" Author: kmarc <korondi.mark@gmail.com>
|
||||
" Description: This file adds support for using GNU awk with scripts.
|
||||
|
||||
call ale#Set('awk_gawk_executable', 'gawk')
|
||||
call ale#Set('awk_gawk_options', '')
|
||||
|
||||
function! ale_linters#awk#gawk#GetCommand(buffer) abort
|
||||
" note the --source 'BEGIN ...' is to prevent
|
||||
" gawk from attempting to execute the body of the script
|
||||
" it is linting.
|
||||
return '%e --source ' . ale#Escape('BEGIN { exit } END { exit 1 }')
|
||||
\ . ' --lint'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'awk_gawk_options'))
|
||||
\ . ' -f %t /dev/null'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('awk', {
|
||||
\ 'name': 'gawk',
|
||||
\ 'executable': {b -> ale#Var(b, 'awk_gawk_executable')},
|
||||
\ 'command': function('ale_linters#awk#gawk#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#gawk#HandleGawkFormat',
|
||||
\ 'output_stream': 'both'
|
||||
\})
|
||||
@@ -1,4 +0,0 @@
|
||||
" Author: Ian2020 <https://github.com/Ian2020>
|
||||
" Description: shellcheck linter for bats scripts.
|
||||
|
||||
call ale#handlers#shellcheck#DefineLinter('bats')
|
||||
@@ -1,80 +0,0 @@
|
||||
" Author: Horacio Sanson - https://github.com/hsanson
|
||||
" Description: Support for bibclean linter for BibTeX files.
|
||||
|
||||
call ale#Set('bib_bibclean_executable', 'bibclean')
|
||||
|
||||
function! ale_linters#bib#bibclean#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'bib_bibclean_executable')
|
||||
|
||||
return ale#Escape(l:executable) . ' -file-position '
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bib#bibclean#get_type(str) abort
|
||||
if a:str is# '??'
|
||||
return 'E'
|
||||
else
|
||||
return 'W'
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bib#bibclean#match_msg(line) abort
|
||||
" Legacy message pattern works for bibclean <= v2.11.4. If empty, try
|
||||
" the new message pattern for bibtex > v2.11.4
|
||||
let l:matches_legacy = matchlist(a:line, '^\(.*\) "stdin", line \(\d\+\): \(.*\)$')
|
||||
|
||||
return ! empty(l:matches_legacy) ? l:matches_legacy
|
||||
\ : matchlist(a:line, '^\(.*\) stdin:\(\d\+\):\(.*\)$')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bib#bibclean#match_entry(line) abort
|
||||
return matchlist(a:line, 'Entry input byte=.* line=\(.*\) column=\(.*\) output .*$')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bib#bibclean#match_value(line) abort
|
||||
return matchlist(a:line, 'Value input byte=.* line=\(.*\) column=\(.*\) output .*$')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bib#bibclean#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
let l:type = 'E'
|
||||
let l:msg = ''
|
||||
|
||||
for l:line in a:lines
|
||||
if empty(l:msg)
|
||||
let l:mlist = ale_linters#bib#bibclean#match_msg(l:line)
|
||||
|
||||
if !empty(l:mlist)
|
||||
let l:msg = l:mlist[3]
|
||||
let l:type = ale_linters#bib#bibclean#get_type(l:mlist[1])
|
||||
endif
|
||||
else
|
||||
if l:type is# 'E'
|
||||
let l:mlist = ale_linters#bib#bibclean#match_entry(l:line)
|
||||
else
|
||||
let l:mlist = ale_linters#bib#bibclean#match_value(l:line)
|
||||
endif
|
||||
|
||||
if !empty(l:mlist)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:mlist[1],
|
||||
\ 'col': l:mlist[2],
|
||||
\ 'text': l:msg,
|
||||
\ 'type': l:type
|
||||
\})
|
||||
|
||||
let l:msg = ''
|
||||
endif
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('bib', {
|
||||
\ 'name': 'bibclean',
|
||||
\ 'executable': {b -> ale#Var(b, 'bib_bibclean_executable')},
|
||||
\ 'command': function('ale_linters#bib#bibclean#GetCommand'),
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale_linters#bib#bibclean#Handle',
|
||||
\})
|
||||
@@ -1,69 +0,0 @@
|
||||
" Author: Carl Smedstad <carl.smedstad at protonmail dot com>
|
||||
" Description: az_bicep for bicep files
|
||||
|
||||
let g:ale_bicep_az_bicep_executable =
|
||||
\ get(g:, 'ale_bicep_az_bicep_executable', 'az')
|
||||
|
||||
let g:ale_bicep_az_bicep_options =
|
||||
\ get(g:, 'ale_bicep_az_bicep_options', '')
|
||||
|
||||
function! ale_linters#bicep#az_bicep#Executable(buffer) abort
|
||||
return ale#Var(a:buffer, 'bicep_az_bicep_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bicep#az_bicep#Command(buffer) abort
|
||||
let l:executable = ale_linters#bicep#az_bicep#Executable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'bicep_az_bicep_options')
|
||||
|
||||
if has('win32')
|
||||
let l:nullfile = 'NUL'
|
||||
else
|
||||
let l:nullfile = '/dev/null'
|
||||
endif
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . ' bicep build --outfile '
|
||||
\ . l:nullfile
|
||||
\ . ' --file '
|
||||
\ . '%s '
|
||||
\ . l:options
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bicep#az_bicep#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^([A-Z]+)?(:\s)?(.*)\((\d+),(\d+)\)\s:\s([a-zA-Z]*)\s([-a-zA-Z0-9]*):\s(.*)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
if l:match[1] is# 'ERROR'
|
||||
let l:type = 'E'
|
||||
elseif l:match[1] is# 'WARNING'
|
||||
let l:type = 'W'
|
||||
elseif l:match[6] is# 'Error'
|
||||
let l:type = 'E'
|
||||
elseif l:match[6] is# 'Warning'
|
||||
let l:type = 'W'
|
||||
else
|
||||
let l:type = 'I'
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'filename': l:match[3],
|
||||
\ 'lnum': l:match[4] + 0,
|
||||
\ 'col': l:match[5] + 0,
|
||||
\ 'type': l:type,
|
||||
\ 'code': l:match[7],
|
||||
\ 'text': l:match[8],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('bicep', {
|
||||
\ 'name': 'az_bicep',
|
||||
\ 'executable': function('ale_linters#bicep#az_bicep#Executable'),
|
||||
\ 'command': function('ale_linters#bicep#az_bicep#Command'),
|
||||
\ 'callback': 'ale_linters#bicep#az_bicep#Handle',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
@@ -1,65 +0,0 @@
|
||||
" Author: Carl Smedstad <carl.smedstad at protonmail dot com>
|
||||
" Description: bicep for bicep files
|
||||
|
||||
let g:ale_bicep_bicep_executable =
|
||||
\ get(g:, 'ale_bicep_bicep_executable', 'bicep')
|
||||
|
||||
let g:ale_bicep_bicep_options =
|
||||
\ get(g:, 'ale_bicep_bicep_options', '')
|
||||
|
||||
function! ale_linters#bicep#bicep#Executable(buffer) abort
|
||||
return ale#Var(a:buffer, 'bicep_bicep_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bicep#bicep#Command(buffer) abort
|
||||
let l:executable = ale_linters#bicep#bicep#Executable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'bicep_bicep_options')
|
||||
|
||||
if has('win32')
|
||||
let l:nullfile = 'NUL'
|
||||
else
|
||||
let l:nullfile = '/dev/null'
|
||||
endif
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . ' build --outfile '
|
||||
\ . l:nullfile
|
||||
\ . ' '
|
||||
\ . l:options
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bicep#bicep#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^(.*)\((\d+),(\d+)\)\s:\s([a-zA-Z]*)\s([-a-zA-Z0-9]*):\s(.*)'
|
||||
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# 'Warning'
|
||||
let l:type = 'W'
|
||||
else
|
||||
let l:type = 'I'
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'filename': l:match[1],
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': l:type,
|
||||
\ 'code': l:match[5],
|
||||
\ 'text': l:match[6],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('bicep', {
|
||||
\ 'name': 'bicep',
|
||||
\ 'executable': function('ale_linters#bicep#bicep#Executable'),
|
||||
\ 'command': function('ale_linters#bicep#bicep#Command'),
|
||||
\ 'callback': 'ale_linters#bicep#bicep#Handle',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
@@ -1,47 +0,0 @@
|
||||
" Author: offa
|
||||
" Description: oelint-adv for BitBake files
|
||||
|
||||
call ale#Set('bitbake_oelint_adv_executable', 'oelint-adv')
|
||||
call ale#Set('bitbake_oelint_adv_options', '')
|
||||
call ale#Set('bitbake_oelint_adv_config', '.oelint.cfg')
|
||||
|
||||
function! ale_linters#bitbake#oelint_adv#Command(buffer) abort
|
||||
let l:config_file = ale#path#FindNearestFile(a:buffer,
|
||||
\ ale#Var(a:buffer, 'bitbake_oelint_adv_config'))
|
||||
|
||||
return ((!empty(l:config_file))
|
||||
\ ? 'OELINT_CONFIG=' . ale#Escape(l:config_file) . ' '
|
||||
\ : '')
|
||||
\ . '%e --quiet '
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'bitbake_oelint_adv_options')) . '%s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bitbake#oelint_adv#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^(.+):(.+):(.+):(.+):(.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[2]),
|
||||
\ 'type': l:match[3] is# 'error'
|
||||
\ ? 'E' : (l:match[3] is# 'warning' ? 'W' : 'I'),
|
||||
\ 'text': StripAnsiCodes(l:match[5]),
|
||||
\ 'code': l:match[4]
|
||||
\ })
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! StripAnsiCodes(line) abort
|
||||
return substitute(a:line, '\e\[[0-9;]\+[mK]', '', 'g')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('bitbake', {
|
||||
\ 'name': 'oelint_adv',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#Var(b, 'bitbake_oelint_adv_executable')},
|
||||
\ 'cwd': '%s:h',
|
||||
\ 'command': function('ale_linters#bitbake#oelint_adv#Command'),
|
||||
\ 'callback': 'ale_linters#bitbake#oelint_adv#Handle',
|
||||
\ })
|
||||
@@ -1,40 +0,0 @@
|
||||
" Author: Chuck Grindel <chuck.grindel@gmail.com>
|
||||
" Description: Bazel Starlark lint support using buildifier.
|
||||
|
||||
function! ale_linters#bzl#buildifier#GetCommand(buffer) abort
|
||||
let l:executable = ale#Escape(ale#fixers#buildifier#GetExecutable(a:buffer))
|
||||
let l:options = ale#Var(a:buffer, 'bazel_buildifier_options')
|
||||
let l:filename = ale#Escape(bufname(a:buffer))
|
||||
|
||||
let l:command = l:executable . ' -mode check -lint warn -path %s'
|
||||
|
||||
if l:options isnot# ''
|
||||
let l:command .= ' ' . l:options
|
||||
endif
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
||||
function! ale_linters#bzl#buildifier#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^[^:]+:(\d+):(\d+)?:?\s+(syntax error near)?(.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[3] . l:match[4],
|
||||
\ 'type': l:match[3] is# 'syntax error near' ? 'E' : 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('bzl', {
|
||||
\ 'name': 'buildifier',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': function('ale#fixers#buildifier#GetExecutable'),
|
||||
\ 'command': function('ale_linters#bzl#buildifier#GetCommand'),
|
||||
\ 'callback': function('ale_linters#bzl#buildifier#Handle'),
|
||||
\})
|
||||
@@ -1,67 +0,0 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: A C compiler linter for C files with gcc/clang, etc.
|
||||
|
||||
call ale#Set('c_cc_executable', '<auto>')
|
||||
call ale#Set('c_cc_options', '-std=c11 -Wall')
|
||||
call ale#Set('c_cc_use_header_lang_flag', -1)
|
||||
call ale#Set('c_cc_header_exts', ['h'])
|
||||
|
||||
function! ale_linters#c#cc#GetExecutable(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'c_cc_executable')
|
||||
|
||||
" Default to either clang or gcc.
|
||||
if l:executable is# '<auto>'
|
||||
if ale#engine#IsExecutable(a:buffer, 'clang')
|
||||
let l:executable = 'clang'
|
||||
else
|
||||
let l:executable = 'gcc'
|
||||
endif
|
||||
endif
|
||||
|
||||
return l:executable
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#cc#GetCommand(buffer, output) abort
|
||||
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||
let l:ale_flags = ale#Var(a:buffer, 'c_cc_options')
|
||||
|
||||
if l:cflags =~# '-std='
|
||||
let l:ale_flags = substitute(
|
||||
\ l:ale_flags,
|
||||
\ '-std=\(c\|gnu\)[0-9]\{2\}',
|
||||
\ '',
|
||||
\ 'g')
|
||||
endif
|
||||
|
||||
" Select the correct language flag depending on the executable, options
|
||||
" and file extension
|
||||
let l:executable = ale_linters#c#cc#GetExecutable(a:buffer)
|
||||
let l:use_header_lang_flag = ale#Var(a:buffer, 'c_cc_use_header_lang_flag')
|
||||
let l:header_exts = ale#Var(a:buffer, 'c_cc_header_exts')
|
||||
let l:lang_flag = ale#c#GetLanguageFlag(
|
||||
\ a:buffer,
|
||||
\ l:executable,
|
||||
\ l:use_header_lang_flag,
|
||||
\ l:header_exts,
|
||||
\ 'c')
|
||||
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
"
|
||||
" `-o /dev/null` or `-o null` is needed to catch all errors,
|
||||
" -fsyntax-only doesn't catch everything.
|
||||
return '%e -S -x ' . l:lang_flag
|
||||
\ . ' -o ' . g:ale#util#nul_file
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ale#Pad(l:cflags)
|
||||
\ . ale#Pad(l:ale_flags) . ' -'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'cc',
|
||||
\ 'aliases': ['gcc', 'clang'],
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': function('ale_linters#c#cc#GetExecutable'),
|
||||
\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#c#cc#GetCommand'))},
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
|
||||
\})
|
||||
@@ -1,15 +0,0 @@
|
||||
" Author: Ye Jingchen <ye.jingchen@gmail.com>, Ben Falconer <ben@falconers.me.uk>, jtalowell <jtalowell@protonmail.com>
|
||||
" Description: A language server for C
|
||||
|
||||
call ale#Set('c_ccls_executable', 'ccls')
|
||||
call ale#Set('c_ccls_init_options', {})
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'ccls',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'c_ccls_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale#handlers#ccls#GetProjectRoot'),
|
||||
\ 'initialization_options': {b -> ale#handlers#ccls#GetInitOpts(b, 'c_ccls_init_options')},
|
||||
\})
|
||||
20
ale_linters/c/clang.vim
Normal file
20
ale_linters/c/clang.vim
Normal file
@@ -0,0 +1,20 @@
|
||||
" Author: Masahiro H https://github.com/mshr-h
|
||||
" Description: clang linter for c files
|
||||
|
||||
" Set this option to change the Clang options for warnings for C.
|
||||
if !exists('g:ale_c_clang_options')
|
||||
" let g:ale_c_clang_options = '-Wall'
|
||||
" let g:ale_c_clang_options = '-std=c99 -Wall'
|
||||
" c11 compatible
|
||||
let g:ale_c_clang_options = '-std=c11 -Wall'
|
||||
endif
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'clang',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'clang',
|
||||
\ 'command': 'clang -S -x c -fsyntax-only '
|
||||
\ . g:ale_c_clang_options
|
||||
\ . ' -',
|
||||
\ 'callback': 'ale#handlers#HandleGCCFormat',
|
||||
\})
|
||||
@@ -1,38 +0,0 @@
|
||||
" Author: gagbo <gagbobada@gmail.com>
|
||||
" : luibo <ng.akhoa98@gmail.com>
|
||||
" : Jorengarenar <jorengarenar@outlook.com>
|
||||
" Description: clang-check linter for C files
|
||||
" modified from cpp/clangcheck.vim to match for C
|
||||
|
||||
call ale#Set('c_clangcheck_executable', 'clang-check')
|
||||
call ale#Set('c_clangcheck_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#c#clangcheck#GetCommand(buffer) abort
|
||||
let l:user_options = ale#Var(a:buffer, 'c_clangcheck_options')
|
||||
|
||||
" Try to find compilation database to link automatically
|
||||
let l:build_dir = ale#Var(a:buffer, 'c_build_dir')
|
||||
|
||||
if empty(l:build_dir)
|
||||
let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer)
|
||||
let l:build_dir = ale#path#Dirname(l:json_file)
|
||||
endif
|
||||
|
||||
" The extra arguments in the command are used to prevent .plist files from
|
||||
" being generated. These are only added if no build directory can be
|
||||
" detected.
|
||||
return '%e -analyze %s'
|
||||
\ . (empty(l:build_dir) ? ' --extra-arg=-Xclang --extra-arg=-analyzer-output=text --extra-arg=-fno-color-diagnostics': '')
|
||||
\ . ale#Pad(l:user_options)
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'clangcheck',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'c_clangcheck_executable')},
|
||||
\ 'command': function('ale_linters#c#clangcheck#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
@@ -1,22 +0,0 @@
|
||||
" Author: Andrey Melentyev <andrey.melentyev@protonmail.com>
|
||||
" Description: Clangd language server
|
||||
|
||||
call ale#Set('c_clangd_executable', 'clangd')
|
||||
call ale#Set('c_clangd_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#c#clangd#GetCommand(buffer) abort
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
|
||||
return '%e'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'c_clangd_options'))
|
||||
\ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'clangd',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'c_clangd_executable')},
|
||||
\ 'command': function('ale_linters#c#clangd#GetCommand'),
|
||||
\ 'project_root': function('ale#c#FindProjectRoot'),
|
||||
\})
|
||||
@@ -1,52 +0,0 @@
|
||||
" Author: vdeurzen <tim@kompiler.org>, w0rp <devw0rp@gmail.com>,
|
||||
" gagbo <gagbobada@gmail.com>, Andrej Radovic <r.andrej@gmail.com>
|
||||
" Description: clang-tidy linter for c files
|
||||
|
||||
call ale#Set('c_clangtidy_executable', 'clang-tidy')
|
||||
" Set this option to check the checks clang-tidy will apply.
|
||||
" The number of checks that can be applied to C files is limited in contrast to
|
||||
" C++
|
||||
"
|
||||
" Consult the check list in clang-tidy's documentation:
|
||||
" http://clang.llvm.org/extra/clang-tidy/checks/list.html
|
||||
|
||||
call ale#Set('c_clangtidy_checks', [])
|
||||
" Set this option to manually set some options for clang-tidy to use as compile
|
||||
" flags.
|
||||
" This will disable compile_commands.json detection.
|
||||
call ale#Set('c_clangtidy_options', '')
|
||||
" Set this option to manually set options for clang-tidy directly.
|
||||
call ale#Set('c_clangtidy_extra_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#c#clangtidy#GetCommand(buffer, output) abort
|
||||
let l:checks = join(ale#Var(a:buffer, 'c_clangtidy_checks'), ',')
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
let l:options = ''
|
||||
|
||||
" Get the extra options if we couldn't find a build directory.
|
||||
if empty(l:build_dir)
|
||||
let l:options = ale#Var(a:buffer, 'c_clangtidy_options')
|
||||
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||
let l:options .= !empty(l:options) ? ale#Pad(l:cflags) : l:cflags
|
||||
endif
|
||||
|
||||
" Get the options to pass directly to clang-tidy
|
||||
let l:extra_options = ale#Var(a:buffer, 'c_clangtidy_extra_options')
|
||||
|
||||
return '%e'
|
||||
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
|
||||
\ . (!empty(l:extra_options) ? ' ' . ale#Escape(l:extra_options) : '')
|
||||
\ . ' %s'
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
\ . (!empty(l:options) ? ' -- ' . l:options : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'clangtidy',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': {b -> ale#Var(b, 'c_clangtidy_executable')},
|
||||
\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#c#clangtidy#GetCommand'))},
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
@@ -1,29 +1,16 @@
|
||||
" Author: Bart Libert <bart.libert@gmail.com>
|
||||
" Description: cppcheck linter for c files
|
||||
|
||||
call ale#Set('c_cppcheck_executable', 'cppcheck')
|
||||
call ale#Set('c_cppcheck_options', '--enable=style')
|
||||
|
||||
function! ale_linters#c#cppcheck#GetCommand(buffer) abort
|
||||
let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer)
|
||||
let l:buffer_path_include = empty(l:compile_commands_option)
|
||||
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
|
||||
\ : ''
|
||||
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
||||
|
||||
return '%e -q --language=c'
|
||||
\ . l:template
|
||||
\ . ale#Pad(l:compile_commands_option)
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'c_cppcheck_options'))
|
||||
\ . l:buffer_path_include
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
" Set this option to change the cppcheck options
|
||||
if !exists('g:ale_c_cppcheck_options')
|
||||
let g:ale_c_cppcheck_options = '--enable=style'
|
||||
endif
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'cppcheck',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#Var(b, 'c_cppcheck_executable')},
|
||||
\ 'cwd': function('ale#handlers#cppcheck#GetCwd'),
|
||||
\ 'command': function('ale_linters#c#cppcheck#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
|
||||
\ 'executable': 'cppcheck',
|
||||
\ 'command': g:ale#util#stdin_wrapper . ' .c cppcheck -q --language=c '
|
||||
\ . g:ale_c_cppcheck_options,
|
||||
\ 'callback': 'ale#handlers#HandleCppCheckFormat',
|
||||
\})
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
" Author: Justin Huang <justin.y.huang@live.com>
|
||||
" Description: cpplint for c files
|
||||
|
||||
call ale#Set('c_cpplint_executable', 'cpplint')
|
||||
call ale#Set('c_cpplint_options', '')
|
||||
|
||||
function! ale_linters#c#cpplint#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'c_cpplint_options')
|
||||
|
||||
return '%e' . ale#Pad(l:options) . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'cpplint',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'c_cpplint_executable')},
|
||||
\ 'command': function('ale_linters#c#cpplint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#cpplint#HandleCppLintFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
@@ -1,30 +0,0 @@
|
||||
" Author: Ben Falconer <ben@falconers.me.uk>, jtalowell <jtalowell@protonmail.com>
|
||||
" Description: A language server for C
|
||||
|
||||
call ale#Set('c_cquery_executable', 'cquery')
|
||||
call ale#Set('c_cquery_cache_directory', expand('~/.cache/cquery'))
|
||||
|
||||
function! ale_linters#c#cquery#GetProjectRoot(buffer) abort
|
||||
" Try to find cquery configuration files first.
|
||||
let l:config = ale#path#FindNearestFile(a:buffer, '.cquery')
|
||||
|
||||
if !empty(l:config)
|
||||
return fnamemodify(l:config, ':h')
|
||||
endif
|
||||
|
||||
" Fall back on default project root detection.
|
||||
return ale#c#FindProjectRoot(a:buffer)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#c#cquery#GetInitializationOptions(buffer) abort
|
||||
return {'cacheDirectory': ale#Var(a:buffer, 'c_cquery_cache_directory')}
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'cquery',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'c_cquery_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale_linters#c#cquery#GetProjectRoot'),
|
||||
\ 'initialization_options': function('ale_linters#c#cquery#GetInitializationOptions'),
|
||||
\})
|
||||
@@ -1,5 +0,0 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for C files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('c')
|
||||
@@ -1,25 +0,0 @@
|
||||
" Author: Christian Gibbons <cgibbons@gmu.edu>
|
||||
" Description: flawfinder linter for c files
|
||||
|
||||
call ale#Set('c_flawfinder_executable', 'flawfinder')
|
||||
call ale#Set('c_flawfinder_options', '')
|
||||
call ale#Set('c_flawfinder_minlevel', 1)
|
||||
call ale#Set('c_flawfinder_error_severity', 6)
|
||||
|
||||
function! ale_linters#c#flawfinder#GetCommand(buffer) abort
|
||||
" Set the minimum vulnerability level for flawfinder to bother with
|
||||
let l:minlevel = ' --minlevel=' . ale#Var(a:buffer, 'c_flawfinder_minlevel')
|
||||
|
||||
return '%e -CDQS'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'c_flawfinder_options'))
|
||||
\ . l:minlevel
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'flawfinder',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': {b -> ale#Var(b, 'c_flawfinder_executable')},
|
||||
\ 'command': function('ale_linters#c#flawfinder#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#flawfinder#HandleFlawfinderFormat',
|
||||
\})
|
||||
24
ale_linters/c/gcc.vim
Normal file
24
ale_linters/c/gcc.vim
Normal file
@@ -0,0 +1,24 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: gcc linter for c files
|
||||
|
||||
" Set this option to change the GCC options for warnings for C.
|
||||
if !exists('g:ale_c_gcc_options')
|
||||
" let g:ale_c_gcc_options = '-Wall'
|
||||
" let g:ale_c_gcc_options = '-std=c99 -Wall'
|
||||
" c11 compatible
|
||||
let g:ale_c_gcc_options = '-std=c11 -Wall'
|
||||
endif
|
||||
|
||||
function! ale_linters#c#gcc#GetCommand(buffer) abort
|
||||
return 'gcc -S -x c -fsyntax-only '
|
||||
\ . g:ale_c_gcc_options . ' -'
|
||||
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('c', {
|
||||
\ 'name': 'gcc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'gcc',
|
||||
\ 'command_callback': 'ale_linters#c#gcc#GetCommand',
|
||||
\ 'callback': 'ale#handlers#HandleGCCFormat',
|
||||
\})
|
||||
@@ -1,22 +0,0 @@
|
||||
" Author: Koni Marti <koni.marti@gmail.com>
|
||||
" Description: A Language Server implementation for C3
|
||||
|
||||
call ale#Set('c3_c3lsp_executable', 'c3lsp')
|
||||
call ale#Set('c3_c3lsp_options', '')
|
||||
call ale#Set('c3_c3lsp_init_options', {})
|
||||
|
||||
function! ale_linters#c3#c3lsp#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'c3_c3lsp_executable')
|
||||
|
||||
return ale#Escape(l:executable) . ale#Pad(ale#Var(a:buffer, 'c3_c3lsp_options'))
|
||||
endfunction
|
||||
|
||||
|
||||
call ale#linter#Define('c3', {
|
||||
\ 'name': 'c3lsp',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'c3_c3lsp_executable')},
|
||||
\ 'command': function('ale_linters#c3#c3lsp#GetCommand'),
|
||||
\ 'project_root': function('ale#handlers#c3lsp#GetProjectRoot'),
|
||||
\ 'lsp_config': {b -> ale#handlers#c3lsp#GetInitOpts(b, 'c3_c3lsp_init_options')},
|
||||
\})
|
||||
@@ -1,31 +0,0 @@
|
||||
" Author: 0xhyoga <0xhyoga@gmx.com>,
|
||||
" Description: scarb for cairo files
|
||||
|
||||
function! ale_linters#cairo#scarb#GetScarbExecutable(bufnr) abort
|
||||
if ale#path#FindNearestFile(a:bufnr, 'Scarb.toml') isnot# ''
|
||||
return 'scarb'
|
||||
else
|
||||
" if there is no Scarb.toml file, we don't use scarb even if it exists,
|
||||
" so we return '', because executable('') apparently always fails
|
||||
return ''
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cairo#scarb#GetCommand(buffer, version) abort
|
||||
return 'scarb build'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cairo', {
|
||||
\ 'name': 'scarb',
|
||||
\ 'executable': function('ale_linters#cairo#scarb#GetScarbExecutable'),
|
||||
\ 'command': {buffer -> ale#semver#RunWithVersionCheck(
|
||||
\ buffer,
|
||||
\ ale_linters#cairo#scarb#GetScarbExecutable(buffer),
|
||||
\ '%e --version',
|
||||
\ function('ale_linters#cairo#scarb#GetCommand'),
|
||||
\ )},
|
||||
\ 'callback': 'ale#handlers#cairo#HandleCairoErrors',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
" Author: 0xHyoga <0xHyoga@gmx.com>
|
||||
" Description: Report Starknet compile to sierra errors in cairo 1.0 code
|
||||
|
||||
call ale#Set('cairo_sierra_executable', 'starknet-compile')
|
||||
call ale#Set('cairo_sierra_options', '')
|
||||
|
||||
function! ale_linters#cairo#sierra#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
" Error: Expected ';' but got '('
|
||||
" --> /path/to/file/file.cairo:1:10:)
|
||||
let l:pattern = '\v(error|warning): (.*)$'
|
||||
let l:line_and_column_pattern = '\v\.cairo:(\d+):(\d+)'
|
||||
let l:output = []
|
||||
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
let l:match = matchlist(l:line, l:line_and_column_pattern)
|
||||
|
||||
if len(l:match) > 0
|
||||
let l:index = len(l:output) - 1
|
||||
let l:output[l:index]['lnum'] = l:match[1] + 0
|
||||
let l:output[l:index]['col'] = l:match[2] + 0
|
||||
endif
|
||||
else
|
||||
let l:isError = l:match[1] is? 'Error'
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': 0,
|
||||
\ 'col': 0,
|
||||
\ 'text': l:match[2],
|
||||
\ 'type': l:isError ? 'E' : 'W',
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cairo#sierra#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'cairo_sierra_executable')
|
||||
|
||||
return l:executable . ale#Pad(ale#Var(a:buffer, 'cairo_sierra_options')) . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cairo', {
|
||||
\ 'name': 'sierra',
|
||||
\ 'executable': {b -> ale#Var(b, 'cairo_sierra_executable')},
|
||||
\ 'command': function('ale_linters#cairo#sierra#GetCommand'),
|
||||
\ 'callback': 'ale_linters#cairo#sierra#Handle',
|
||||
\ 'output_stream': 'stderr',
|
||||
\})
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
" Author: 0xHyoga <0xHyoga@gmx.com>
|
||||
" Description: Report starknet-compile errors in cairo code (pre-starknet
|
||||
" 1.0). This is deprecated but kept for backwards compatability.
|
||||
|
||||
call ale#Set('cairo_starknet_executable', 'starknet-compile')
|
||||
call ale#Set('cairo_starknet_options', '')
|
||||
|
||||
function! ale_linters#cairo#starknet#Handle(buffer, lines) abort
|
||||
" Error always on the first line
|
||||
" e.g ex01.cairo:20:6: Could not find module 'contracts.utils.ex00_base'. Searched in the following paths:
|
||||
let l:pattern = '\v\.cairo:(\d+):(\d+):+ (.*)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'col': str2nr(l:match[2]),
|
||||
\ 'type': 'E',
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cairo#starknet#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'cairo_starknet_executable')
|
||||
|
||||
return l:executable . ale#Pad(ale#Var(a:buffer, 'cairo_starknet_options')) . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cairo', {
|
||||
\ 'name': 'starknet',
|
||||
\ 'executable': {b -> ale#Var(b, 'cairo_starknet_executable')},
|
||||
\ 'command': function('ale_linters#cairo#starknet#GetCommand'),
|
||||
\ 'callback': 'ale_linters#cairo#starknet#Handle',
|
||||
\ 'output_stream': 'stderr',
|
||||
\})
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
" Author: Raphael Hoegger - https://github.com/pfuender
|
||||
" Description: Cookstyle (RuboCop based), a code style analyzer for Ruby files
|
||||
|
||||
call ale#Set('chef_cookstyle_executable', 'cookstyle')
|
||||
call ale#Set('chef_cookstyle_options', '')
|
||||
|
||||
function! ale_linters#chef#cookstyle#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'chef_cookstyle_options')
|
||||
|
||||
return '%e' . ale#Pad(escape(l:options, '~')) . ' --force-exclusion --format json --stdin ' . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#chef#cookstyle#Handle(buffer, lines) abort
|
||||
if len(a:lines) == 0
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:errors = ale#util#FuzzyJSONDecode(a:lines[0], {})
|
||||
|
||||
if !has_key(l:errors, 'summary')
|
||||
\|| l:errors['summary']['offense_count'] == 0
|
||||
\|| empty(l:errors['files'])
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:output = []
|
||||
|
||||
for l:error in l:errors['files'][0]['offenses']
|
||||
let l:start_col = str2nr(l:error['location']['start_column'])
|
||||
let l:end_col = str2nr(l:error['location']['last_column'])
|
||||
|
||||
if !l:end_col
|
||||
let l:end_col = l:start_col + 1
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:error['location']['line']),
|
||||
\ 'col': l:start_col,
|
||||
\ 'end_col': l:end_col,
|
||||
\ 'code': l:error['cop_name'],
|
||||
\ 'text': l:error['message'],
|
||||
\ 'type': l:error['severity'] is? 'convention' ? 'W' : 'E',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('chef', {
|
||||
\ 'name': 'cookstyle',
|
||||
\ 'executable': {b -> ale#Var(b, 'chef_cookstyle_executable')},
|
||||
\ 'command': function('ale_linters#chef#cookstyle#GetCommand'),
|
||||
\ 'callback': 'ale_linters#chef#cookstyle#Handle',
|
||||
\})
|
||||
@@ -1,31 +1,31 @@
|
||||
" Author: Edward Larkey <edwlarkey@mac.com>
|
||||
" Author: Jose Junior <jose.junior@gmail.com>
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: This file adds the foodcritic linter for Chef files.
|
||||
|
||||
call ale#Set('chef_foodcritic_executable', 'foodcritic')
|
||||
call ale#Set('chef_foodcritic_options', '')
|
||||
|
||||
function! ale_linters#chef#foodcritic#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'chef_foodcritic_options')
|
||||
|
||||
return '%e' . ale#Pad(escape(l:options, '~')) . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#chef#foodcritic#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" FC002: Avoid string interpolation where not required: httpd.rb:13
|
||||
let l:pattern = '\v([^:]+): (.+): ([a-zA-Z]?:?[^:]+):(\d+)$'
|
||||
let l:pattern = '^\(.\+:\s.\+\):\s\(.\+\):\(\d\+\)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:text = l:match[1]
|
||||
|
||||
" vcol is Needed to indicate that the column is a character.
|
||||
call add(l:output, {
|
||||
\ 'code': l:match[1],
|
||||
\ 'text': l:match[2],
|
||||
\ 'filename': l:match[3],
|
||||
\ 'lnum': l:match[4] + 0,
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[3] + 0,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': 0,
|
||||
\ 'text': l:text,
|
||||
\ 'type': 'W',
|
||||
\ 'nr': -1,
|
||||
\})
|
||||
endfor
|
||||
|
||||
@@ -34,8 +34,8 @@ endfunction
|
||||
|
||||
call ale#linter#Define('chef', {
|
||||
\ 'name': 'foodcritic',
|
||||
\ 'executable': {b -> ale#Var(b, 'chef_foodcritic_executable')},
|
||||
\ 'command': function('ale_linters#chef#foodcritic#GetCommand'),
|
||||
\ 'executable': 'foodcritic',
|
||||
\ 'command': g:ale#util#stdin_wrapper . ' .rb foodcritic',
|
||||
\ 'callback': 'ale_linters#chef#foodcritic#Handle',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
" Author: Masashi Iizuka <liquidz.uo@gmail.com>
|
||||
" Description: linter for clojure using clj-kondo https://github.com/borkdude/clj-kondo
|
||||
|
||||
call ale#Set('clojure_clj_kondo_options', '--cache')
|
||||
|
||||
function! ale_linters#clojure#clj_kondo#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'clojure_clj_kondo_options')
|
||||
|
||||
let l:command = 'clj-kondo'
|
||||
\ . ale#Pad(l:options)
|
||||
\ . ' --lint -'
|
||||
\ . ' --filename %s'
|
||||
|
||||
return l:command
|
||||
endfunction
|
||||
|
||||
function! ale_linters#clojure#clj_kondo#HandleCljKondoFormat(buffer, lines) abort
|
||||
" output format
|
||||
" <filename>:<line>:<column>: <issue type>: <message>
|
||||
let l:pattern = '\v^[a-zA-Z]?:?[^:]+:(\d+)?:(\d+)?:? ((Exception|error|warning): ?(.+))$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:type = 'E'
|
||||
|
||||
if l:match[4] is? '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': 'clj-kondo',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': 'clj-kondo',
|
||||
\ 'command': function('ale_linters#clojure#clj_kondo#GetCommand'),
|
||||
\ 'callback': 'ale_linters#clojure#clj_kondo#HandleCljKondoFormat',
|
||||
\})
|
||||
@@ -1,34 +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 --working-dir %s --lint %t',
|
||||
\ 'callback': 'ale_linters#clojure#joker#HandleJokerFormat',
|
||||
\})
|
||||
@@ -1,36 +0,0 @@
|
||||
" Author: Yasuhiro Kiyota <yasuhiroki.duck@gmail.com>
|
||||
" Description: Support cfn-python-lint for AWS Cloudformation template file
|
||||
|
||||
function! ale_linters#cloudformation#cfn_python_lint#Handle(buffer, lines) abort
|
||||
" Matches patterns line the following:
|
||||
"
|
||||
" sample.template.yaml:96:7:96:15:E3012:Property Resources/Sample/Properties/FromPort should be of type Integer
|
||||
let l:pattern = '\v^(.*):(\d+):(\d+):(\d+):(\d+):([[:alnum:]]+):(.*)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:code = l:match[6]
|
||||
|
||||
if ale#path#IsBufferPath(a:buffer, l:match[1])
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2],
|
||||
\ 'col': l:match[3],
|
||||
\ 'end_lnum': l:match[4],
|
||||
\ 'end_col': l:match[5],
|
||||
\ 'code': l:code,
|
||||
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
|
||||
\ 'text': l:match[7]
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cloudformation', {
|
||||
\ 'name': 'cloudformation',
|
||||
\ 'aliases': ['cfn-lint'],
|
||||
\ 'executable': 'cfn-lint',
|
||||
\ 'command': 'cfn-lint --template %t --format parseable',
|
||||
\ 'callback': 'ale_linters#cloudformation#cfn_python_lint#Handle',
|
||||
\})
|
||||
@@ -1,43 +0,0 @@
|
||||
" Author: Carl Smedstad <carl.smedstad at protonmail dot com>
|
||||
" Description: cmake-lint for cmake files
|
||||
|
||||
let g:ale_cmake_cmake_lint_executable =
|
||||
\ get(g:, 'ale_cmake_cmake_lint_executable', 'cmake-lint')
|
||||
|
||||
let g:ale_cmake_cmake_lint_options =
|
||||
\ get(g:, 'ale_cmake_cmake_lint_options', '')
|
||||
|
||||
function! ale_linters#cmake#cmake_lint#Executable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cmake_cmake_lint_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cmake#cmake_lint#Command(buffer) abort
|
||||
let l:executable = ale_linters#cmake#cmake_lint#Executable(a:buffer)
|
||||
let l:options = ale#Var(a:buffer, 'cmake_cmake_lint_options')
|
||||
|
||||
return ale#Escape(l:executable) . ' ' . l:options . ' %s'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cmake#cmake_lint#Handle(buffer, lines) abort
|
||||
let l:pattern = '\v^[^:]+:(\d+),?(\d+)?:\s\[([A-Z]\d+)\]\s(.+)$'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'type': 'W',
|
||||
\ 'code': l:match[3],
|
||||
\ 'text': l:match[4],
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cmake', {
|
||||
\ 'name': 'cmake_lint',
|
||||
\ 'executable': function('ale_linters#cmake#cmake_lint#Executable'),
|
||||
\ 'command': function('ale_linters#cmake#cmake_lint#Command'),
|
||||
\ 'callback': 'ale_linters#cmake#cmake_lint#Handle',
|
||||
\})
|
||||
@@ -1,24 +0,0 @@
|
||||
" Author: Kenneth Benzie <k.benzie83@gmail.com>
|
||||
" Description: cmakelint for cmake files
|
||||
|
||||
let g:ale_cmake_cmakelint_executable =
|
||||
\ get(g:, 'ale_cmake_cmakelint_executable', 'cmakelint')
|
||||
|
||||
let g:ale_cmake_cmakelint_options =
|
||||
\ get(g:, 'ale_cmake_cmakelint_options', '')
|
||||
|
||||
function! ale_linters#cmake#cmakelint#Executable(buffer) abort
|
||||
return ale#Var(a:buffer, 'cmake_cmakelint_executable')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cmake#cmakelint#Command(buffer) abort
|
||||
return ale_linters#cmake#cmakelint#Executable(a:buffer)
|
||||
\ . ' ' . ale#Var(a:buffer, 'cmake_cmakelint_options') . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cmake', {
|
||||
\ 'name': 'cmakelint',
|
||||
\ 'executable': function('ale_linters#cmake#cmakelint#Executable'),
|
||||
\ 'command': function('ale_linters#cmake#cmakelint#Command'),
|
||||
\ 'callback': 'ale#handlers#unix#HandleAsWarning',
|
||||
\})
|
||||
@@ -1,23 +1,10 @@
|
||||
" Author: KabbAmine - https://github.com/KabbAmine
|
||||
" Description: Coffee for checking coffee files
|
||||
|
||||
function! ale_linters#coffee#coffee#GetExecutable(buffer) abort
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/coffee',
|
||||
\ 'coffee'
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#coffee#coffee#GetCommand(buffer) abort
|
||||
return ale_linters#coffee#coffee#GetExecutable(a:buffer)
|
||||
\ . ' -cp -s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('coffee', {
|
||||
\ 'name': 'coffee',
|
||||
\ 'executable': function('ale_linters#coffee#coffee#GetExecutable'),
|
||||
\ 'command': function('ale_linters#coffee#coffee#GetCommand'),
|
||||
\ 'executable': 'coffee',
|
||||
\ 'command': 'coffee -cp -s',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'callback': 'ale#handlers#HandleGCCFormat',
|
||||
\})
|
||||
|
||||
@@ -1,19 +1,6 @@
|
||||
" Author: Prashanth Chandra https://github.com/prashcr
|
||||
" Description: coffeelint linter for coffeescript files
|
||||
|
||||
function! ale_linters#coffee#coffeelint#GetExecutable(buffer) abort
|
||||
return ale#path#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/coffeelint',
|
||||
\ 'coffeelint'
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#coffee#coffeelint#GetCommand(buffer) abort
|
||||
return ale_linters#coffee#coffeelint#GetExecutable(a:buffer)
|
||||
\ . ' --stdin --reporter csv'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#coffee#coffeelint#Handle(buffer, lines) abort
|
||||
" Matches patterns like the following:
|
||||
"
|
||||
@@ -21,14 +8,30 @@ function! ale_linters#coffee#coffeelint#Handle(buffer, lines) abort
|
||||
" stdin,14,,error,Throwing strings is forbidden
|
||||
"
|
||||
" Note that we currently ignore lineNumberEnd for multiline errors
|
||||
let l:pattern = 'stdin,\(\d\+\),\(\d*\),\(.\{-1,}\),\(.\+\)'
|
||||
let l:pattern = 'stdin,\(\d\+\),\(\d*\),\(.\+\),\(.\+\)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
continue
|
||||
endif
|
||||
|
||||
let l:line = l:match[1] + 0
|
||||
let l:column = 1
|
||||
let l:type = l:match[3] ==# 'error' ? 'E' : 'W'
|
||||
let l:text = l:match[4]
|
||||
|
||||
" vcol is needed to indicate that the column is a character
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:match[1]),
|
||||
\ 'type': l:match[3] is# 'error' ? 'E' : 'W',
|
||||
\ 'text': l:match[4],
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:line,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': l:column,
|
||||
\ 'text': l:text,
|
||||
\ 'type': l:type,
|
||||
\ 'nr': -1,
|
||||
\})
|
||||
endfor
|
||||
|
||||
@@ -37,7 +40,7 @@ endfunction
|
||||
|
||||
call ale#linter#Define('coffee', {
|
||||
\ 'name': 'coffeelint',
|
||||
\ 'executable': function('ale_linters#coffee#coffeelint#GetExecutable'),
|
||||
\ 'command': function('ale_linters#coffee#coffeelint#GetCommand'),
|
||||
\ 'executable': 'coffeelint',
|
||||
\ 'command': 'coffeelint --stdin --reporter csv',
|
||||
\ 'callback': 'ale_linters#coffee#coffeelint#Handle',
|
||||
\})
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: A C++ compiler linter for C++ files with gcc/clang, etc.
|
||||
|
||||
call ale#Set('cpp_cc_executable', '<auto>')
|
||||
call ale#Set('cpp_cc_options', '-std=c++14 -Wall')
|
||||
call ale#Set('cpp_cc_use_header_lang_flag', -1)
|
||||
call ale#Set('cpp_cc_header_exts', ['h', 'hpp'])
|
||||
|
||||
function! ale_linters#cpp#cc#GetExecutable(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'cpp_cc_executable')
|
||||
|
||||
" Default to either clang++ or gcc.
|
||||
if l:executable is# '<auto>'
|
||||
if ale#engine#IsExecutable(a:buffer, 'clang++')
|
||||
let l:executable = 'clang++'
|
||||
else
|
||||
let l:executable = 'gcc'
|
||||
endif
|
||||
endif
|
||||
|
||||
return l:executable
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cpp#cc#GetCommand(buffer, output) abort
|
||||
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||
let l:ale_flags = ale#Var(a:buffer, 'cpp_cc_options')
|
||||
|
||||
if l:cflags =~# '-std='
|
||||
let l:ale_flags = substitute(
|
||||
\ l:ale_flags,
|
||||
\ '-std=\(c\|gnu\)++[0-9]\{2\}',
|
||||
\ '',
|
||||
\ 'g')
|
||||
endif
|
||||
|
||||
" Select the correct language flag depending on the executable, options
|
||||
" and file extension
|
||||
let l:executable = ale_linters#cpp#cc#GetExecutable(a:buffer)
|
||||
let l:use_header_lang_flag = ale#Var(a:buffer, 'cpp_cc_use_header_lang_flag')
|
||||
let l:header_exts = ale#Var(a:buffer, 'cpp_cc_header_exts')
|
||||
let l:lang_flag = ale#c#GetLanguageFlag(
|
||||
\ a:buffer,
|
||||
\ l:executable,
|
||||
\ l:use_header_lang_flag,
|
||||
\ l:header_exts,
|
||||
\ 'c++')
|
||||
|
||||
" -iquote with the directory the file is in makes #include work for
|
||||
" headers in the same directory.
|
||||
"
|
||||
" `-o /dev/null` or `-o null` is needed to catch all errors,
|
||||
" -fsyntax-only doesn't catch everything.
|
||||
return '%e -S -x ' . l:lang_flag
|
||||
\ . ' -o ' . g:ale#util#nul_file
|
||||
\ . ' -iquote %s:h'
|
||||
\ . ale#Pad(l:cflags)
|
||||
\ . ale#Pad(l:ale_flags) . ' -'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'cc',
|
||||
\ 'aliases': ['gcc', 'clang', 'g++', 'clang++'],
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': function('ale_linters#cpp#cc#GetExecutable'),
|
||||
\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#cpp#cc#GetCommand'))},
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormatWithIncludes',
|
||||
\})
|
||||
@@ -1,15 +0,0 @@
|
||||
" Author: Ye Jingchen <ye.jingchen@gmail.com>, Ben Falconer <ben@falconers.me.uk>, jtalowell <jtalowell@protonmail.com>
|
||||
" Description: A language server for C++
|
||||
|
||||
call ale#Set('cpp_ccls_executable', 'ccls')
|
||||
call ale#Set('cpp_ccls_init_options', {})
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'ccls',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'cpp_ccls_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale#handlers#ccls#GetProjectRoot'),
|
||||
\ 'initialization_options': {b -> ale#handlers#ccls#GetInitOpts(b, 'cpp_ccls_init_options')},
|
||||
\})
|
||||
@@ -1,35 +0,0 @@
|
||||
" Author: gagbo <gagbobada@gmail.com>
|
||||
" Description: clang-check linter for cpp files
|
||||
|
||||
call ale#Set('cpp_clangcheck_executable', 'clang-check')
|
||||
call ale#Set('cpp_clangcheck_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#cpp#clangcheck#GetCommand(buffer) abort
|
||||
let l:user_options = ale#Var(a:buffer, 'cpp_clangcheck_options')
|
||||
|
||||
" Try to find compilation database to link automatically
|
||||
let l:build_dir = ale#Var(a:buffer, 'c_build_dir')
|
||||
|
||||
if empty(l:build_dir)
|
||||
let [l:root, l:json_file] = ale#c#FindCompileCommands(a:buffer)
|
||||
let l:build_dir = ale#path#Dirname(l:json_file)
|
||||
endif
|
||||
|
||||
" The extra arguments in the command are used to prevent .plist files from
|
||||
" being generated. These are only added if no build directory can be
|
||||
" detected.
|
||||
return '%e -analyze %s'
|
||||
\ . (empty(l:build_dir) ? ' --extra-arg=-Xclang --extra-arg=-analyzer-output=text --extra-arg=-fno-color-diagnostics': '')
|
||||
\ . ale#Pad(l:user_options)
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'clangcheck',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'cpp_clangcheck_executable')},
|
||||
\ 'command': function('ale_linters#cpp#clangcheck#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
@@ -1,22 +0,0 @@
|
||||
" Author: Andrey Melentyev <andrey.melentyev@protonmail.com>
|
||||
" Description: Clangd language server
|
||||
|
||||
call ale#Set('cpp_clangd_executable', 'clangd')
|
||||
call ale#Set('cpp_clangd_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#cpp#clangd#GetCommand(buffer) abort
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
|
||||
return '%e'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cpp_clangd_options'))
|
||||
\ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'clangd',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'cpp_clangd_executable')},
|
||||
\ 'command': function('ale_linters#cpp#clangd#GetCommand'),
|
||||
\ 'project_root': function('ale#c#FindProjectRoot'),
|
||||
\})
|
||||
@@ -1,53 +0,0 @@
|
||||
" Author: vdeurzen <tim@kompiler.org>, w0rp <devw0rp@gmail.com>,
|
||||
" gagbo <gagbobada@gmail.com>
|
||||
" Description: clang-tidy linter for cpp files
|
||||
|
||||
call ale#Set('cpp_clangtidy_executable', 'clang-tidy')
|
||||
" Set this option to check the checks clang-tidy will apply.
|
||||
call ale#Set('cpp_clangtidy_checks', [])
|
||||
" Set this option to manually set some options for clang-tidy to use as compile
|
||||
" flags.
|
||||
" This will disable compile_commands.json detection.
|
||||
call ale#Set('cpp_clangtidy_options', '')
|
||||
" Set this option to manually set options for clang-tidy directly.
|
||||
call ale#Set('cpp_clangtidy_extra_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#cpp#clangtidy#GetCommand(buffer, output) abort
|
||||
let l:checks = join(ale#Var(a:buffer, 'cpp_clangtidy_checks'), ',')
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
let l:options = ''
|
||||
|
||||
" Get the extra options if we couldn't find a build directory.
|
||||
if empty(l:build_dir)
|
||||
let l:options = ale#Var(a:buffer, 'cpp_clangtidy_options')
|
||||
let l:cflags = ale#c#GetCFlags(a:buffer, a:output)
|
||||
let l:options .= !empty(l:options) ? ale#Pad(l:cflags) : l:cflags
|
||||
|
||||
" Tell clang-tidy a .h header with a C++ filetype in Vim is a C++ file
|
||||
" only when compile-commands.json file is not there. Adding these
|
||||
" flags makes clang-tidy completely ignore compile commands.
|
||||
if expand('#' . a:buffer) =~# '\.h$'
|
||||
let l:options .= !empty(l:options) ? ' -x c++' : '-x c++'
|
||||
endif
|
||||
endif
|
||||
|
||||
" Get the options to pass directly to clang-tidy
|
||||
let l:extra_options = ale#Var(a:buffer, 'cpp_clangtidy_extra_options')
|
||||
|
||||
return '%e'
|
||||
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
|
||||
\ . (!empty(l:extra_options) ? ' ' . ale#Escape(l:extra_options) : '')
|
||||
\ . ' %s'
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
\ . (!empty(l:options) ? ' -- ' . l:options : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'clangtidy',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': {b -> ale#Var(b, 'cpp_clangtidy_executable')},
|
||||
\ 'command': {b -> ale#c#RunMakeCommand(b, function('ale_linters#cpp#clangtidy#GetCommand'))},
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
@@ -1,32 +0,0 @@
|
||||
" Description: clazy linter for cpp files (clang-based and Qt-oriented)
|
||||
|
||||
call ale#Set('cpp_clazy_executable', 'clazy-standalone')
|
||||
" Set this option to check the checks clazy will apply.
|
||||
call ale#Set('cpp_clazy_checks', ['level1'])
|
||||
" Set this option to manually set some options for clazy.
|
||||
" This will disable compile_commands.json detection.
|
||||
call ale#Set('cpp_clazy_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#cpp#clazy#GetCommand(buffer) abort
|
||||
let l:checks = join(ale#Var(a:buffer, 'cpp_clazy_checks'), ',')
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
|
||||
" Get the extra options if we couldn't find a build directory.
|
||||
let l:options = ale#Var(a:buffer, 'cpp_clazy_options')
|
||||
|
||||
return '%e'
|
||||
\ . (!empty(l:checks) ? ' -checks=' . ale#Escape(l:checks) : '')
|
||||
\ . (!empty(l:build_dir) ? ' -p ' . ale#Escape(l:build_dir) : '')
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'clazy',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'cpp_clazy_executable')},
|
||||
\ 'command': function('ale_linters#cpp#clazy#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#gcc#HandleGCCFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
@@ -1,29 +1,16 @@
|
||||
" Author: Bart Libert <bart.libert@gmail.com>
|
||||
" Description: cppcheck linter for cpp files
|
||||
|
||||
call ale#Set('cpp_cppcheck_executable', 'cppcheck')
|
||||
call ale#Set('cpp_cppcheck_options', '--enable=style')
|
||||
|
||||
function! ale_linters#cpp#cppcheck#GetCommand(buffer) abort
|
||||
let l:compile_commands_option = ale#handlers#cppcheck#GetCompileCommandsOptions(a:buffer)
|
||||
let l:buffer_path_include = empty(l:compile_commands_option)
|
||||
\ ? ale#handlers#cppcheck#GetBufferPathIncludeOptions(a:buffer)
|
||||
\ : ''
|
||||
let l:template = ' --template=' . ale#Escape('{file}:{line}:{column}: {severity}:{inconclusive:inconclusive:} {message} [{id}]\\n{code}')
|
||||
|
||||
return '%e -q --language=c++'
|
||||
\ . l:template
|
||||
\ . ale#Pad(l:compile_commands_option)
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cpp_cppcheck_options'))
|
||||
\ . l:buffer_path_include
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
" Set this option to change the cppcheck options
|
||||
if !exists('g:ale_cpp_cppcheck_options')
|
||||
let g:ale_cpp_cppcheck_options = '--enable=style'
|
||||
endif
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'cppcheck',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#Var(b, 'cpp_cppcheck_executable')},
|
||||
\ 'cwd': function('ale#handlers#cppcheck#GetCwd'),
|
||||
\ 'command': function('ale_linters#cpp#cppcheck#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#cppcheck#HandleCppCheckFormat',
|
||||
\ 'executable': 'cppcheck',
|
||||
\ 'command': g:ale#util#stdin_wrapper . ' .cpp cppcheck -q --language=c++ '
|
||||
\ . g:ale_cpp_cppcheck_options,
|
||||
\ 'callback': 'ale#handlers#HandleCppCheckFormat',
|
||||
\})
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
" Author: Dawid Kurek https://github.com/dawikur
|
||||
" Description: cpplint for cpp files
|
||||
|
||||
call ale#Set('cpp_cpplint_executable', 'cpplint')
|
||||
call ale#Set('cpp_cpplint_options', '')
|
||||
|
||||
function! ale_linters#cpp#cpplint#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'cpp_cpplint_options')
|
||||
|
||||
return '%e' . ale#Pad(l:options) . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'cpplint',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': {b -> ale#Var(b, 'cpp_cpplint_executable')},
|
||||
\ 'command': function('ale_linters#cpp#cpplint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#cpplint#HandleCppLintFormat',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
@@ -1,30 +0,0 @@
|
||||
" Author: Ben Falconer <ben@falconers.me.uk>
|
||||
" Description: A language server for C++
|
||||
|
||||
call ale#Set('cpp_cquery_executable', 'cquery')
|
||||
call ale#Set('cpp_cquery_cache_directory', expand('~/.cache/cquery'))
|
||||
|
||||
function! ale_linters#cpp#cquery#GetProjectRoot(buffer) abort
|
||||
" Try to find cquery configuration files first.
|
||||
let l:config = ale#path#FindNearestFile(a:buffer, '.cquery')
|
||||
|
||||
if !empty(l:config)
|
||||
return fnamemodify(l:config, ':h')
|
||||
endif
|
||||
|
||||
" Fall back on default project root detection.
|
||||
return ale#c#FindProjectRoot(a:buffer)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cpp#cquery#GetInitializationOptions(buffer) abort
|
||||
return {'cacheDirectory': ale#Var(a:buffer, 'cpp_cquery_cache_directory')}
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'cquery',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'cpp_cquery_executable')},
|
||||
\ 'command': '%e',
|
||||
\ 'project_root': function('ale_linters#cpp#cquery#GetProjectRoot'),
|
||||
\ 'initialization_options': function('ale_linters#cpp#cquery#GetInitializationOptions'),
|
||||
\})
|
||||
@@ -1,5 +0,0 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for C++ files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('cpp')
|
||||
@@ -1,25 +0,0 @@
|
||||
" Author: Christian Gibbons <cgibbons@gmu.edu>
|
||||
" Description: flawfinder linter for c++ files
|
||||
|
||||
call ale#Set('cpp_flawfinder_executable', 'flawfinder')
|
||||
call ale#Set('cpp_flawfinder_options', '')
|
||||
call ale#Set('cpp_flawfinder_minlevel', 1)
|
||||
call ale#Set('c_flawfinder_error_severity', 6)
|
||||
|
||||
function! ale_linters#cpp#flawfinder#GetCommand(buffer) abort
|
||||
" Set the minimum vulnerability level for flawfinder to bother with
|
||||
let l:minlevel = ' --minlevel=' . ale#Var(a:buffer, 'cpp_flawfinder_minlevel')
|
||||
|
||||
return '%e -CDQS'
|
||||
\ . ale#Var(a:buffer, 'cpp_flawfinder_options')
|
||||
\ . l:minlevel
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'flawfinder',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': {b -> ale#Var(b, 'cpp_flawfinder_executable')},
|
||||
\ 'command': function('ale_linters#cpp#flawfinder#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#flawfinder#HandleFlawfinderFormat',
|
||||
\})
|
||||
30
ale_linters/cpp/gcc.vim
Normal file
30
ale_linters/cpp/gcc.vim
Normal file
@@ -0,0 +1,30 @@
|
||||
" Author: geam <mdelage@student.42.fr>
|
||||
" Description: gcc linter for cpp files
|
||||
|
||||
" Set this option to change the GCC options for warnings for C.
|
||||
if !exists('g:ale_cpp_gcc_options')
|
||||
" added c++14 standard support
|
||||
" POSIX thread and standard c++ thread and atomic library Linker
|
||||
" let g:ale_cpp_gcc_options = '-std=c++1z' for c++17
|
||||
" for previous version and default, you can just use
|
||||
" let g:ale_cpp_gcc_options = '-Wall'
|
||||
" for more see man pages of gcc
|
||||
" $ man g++
|
||||
" make sure g++ in your $PATH
|
||||
" Add flags according to your requirements
|
||||
let g:ale_cpp_gcc_options = '-std=c++14 -Wall'
|
||||
endif
|
||||
|
||||
function! ale_linters#cpp#gcc#GetCommand(buffer) abort
|
||||
return 'gcc -S -x c++ -fsyntax-only '
|
||||
\ . g:ale_cpp_gcc_options . ' -'
|
||||
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cpp', {
|
||||
\ 'name': 'g++',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'g++',
|
||||
\ 'command_callback': 'ale_linters#cpp#gcc#GetCommand',
|
||||
\ 'callback': 'ale#handlers#HandleGCCFormat',
|
||||
\})
|
||||
@@ -1,57 +0,0 @@
|
||||
" Author: Harrison Bachrach - https://github.com/HarrisonB
|
||||
" Description: Ameba, a linter for crystal files
|
||||
|
||||
call ale#Set('crystal_ameba_executable', 'bin/ameba')
|
||||
|
||||
function! ale_linters#crystal#ameba#GetCommand(buffer) abort
|
||||
let l:executable = ale#Var(a:buffer, 'crystal_ameba_executable')
|
||||
|
||||
return ale#Escape(l:executable)
|
||||
\ . ' --format json '
|
||||
\ . ale#Escape(expand('#' . a:buffer . ':p'))
|
||||
endfunction
|
||||
|
||||
" Handle output from ameba
|
||||
function! ale_linters#crystal#ameba#HandleAmebaOutput(buffer, lines) abort
|
||||
if len(a:lines) == 0
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:errors = ale#util#FuzzyJSONDecode(a:lines[0], {})
|
||||
|
||||
if !has_key(l:errors, 'summary')
|
||||
\|| l:errors['summary']['issues_count'] == 0
|
||||
\|| empty(l:errors['sources'])
|
||||
return []
|
||||
endif
|
||||
|
||||
let l:output = []
|
||||
|
||||
for l:error in l:errors['sources'][0]['issues']
|
||||
let l:start_col = str2nr(l:error['location']['column'])
|
||||
let l:end_col = str2nr(l:error['end_location']['column'])
|
||||
|
||||
if !l:end_col
|
||||
let l:end_col = l:start_col + 1
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': str2nr(l:error['location']['line']),
|
||||
\ 'col': l:start_col,
|
||||
\ 'end_col': l:end_col,
|
||||
\ 'code': l:error['rule_name'],
|
||||
\ 'text': l:error['message'],
|
||||
\ 'type': 'W',
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('crystal', {
|
||||
\ 'name': 'ameba',
|
||||
\ 'executable': {b -> ale#Var(b, 'crystal_ameba_executable')},
|
||||
\ 'command': function('ale_linters#crystal#ameba#GetCommand'),
|
||||
\ 'callback': 'ale_linters#crystal#ameba#HandleAmebaOutput',
|
||||
\ 'lint_file': 1,
|
||||
\})
|
||||
@@ -1,35 +0,0 @@
|
||||
" Author: Jordan Andree <https://github.com/jordanandree>, David Alexander <opensource@thelonelyghost.com>
|
||||
" Description: This file adds support for checking Crystal with crystal build
|
||||
|
||||
function! ale_linters#crystal#crystal#Handle(buffer, lines) abort
|
||||
let l:output = []
|
||||
|
||||
for l:error in ale#util#FuzzyJSONDecode(a:lines, [])
|
||||
if !has_key(l:error, 'file')
|
||||
continue
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:error.line + 0,
|
||||
\ 'col': l:error.column + 0,
|
||||
\ 'text': l:error.message,
|
||||
\})
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
function! ale_linters#crystal#crystal#GetCommand(buffer) abort
|
||||
return 'crystal build -f json --no-codegen --no-color -o '
|
||||
\ . ale#Escape(g:ale#util#nul_file)
|
||||
\ . ' %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('crystal', {
|
||||
\ 'name': 'crystal',
|
||||
\ 'executable': 'crystal',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'lint_file': 1,
|
||||
\ 'command': function('ale_linters#crystal#crystal#GetCommand'),
|
||||
\ 'callback': 'ale_linters#crystal#crystal#Handle',
|
||||
\})
|
||||
@@ -1,90 +0,0 @@
|
||||
call ale#Set('cs_csc_options', '')
|
||||
call ale#Set('cs_csc_source', '')
|
||||
call ale#Set('cs_csc_assembly_path', [])
|
||||
call ale#Set('cs_csc_assemblies', [])
|
||||
|
||||
function! ale_linters#cs#csc#GetCwd(buffer) abort
|
||||
let l:cwd = ale#Var(a:buffer, 'cs_csc_source')
|
||||
|
||||
return !empty(l:cwd) ? l:cwd : expand('#' . a:buffer . ':p:h')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cs#csc#GetCommand(buffer) abort
|
||||
" Pass assembly paths via the -lib: parameter.
|
||||
let l:path_list = ale#Var(a:buffer, 'cs_csc_assembly_path')
|
||||
|
||||
let l:lib_option = !empty(l:path_list)
|
||||
\ ? '/lib:' . join(map(copy(l:path_list), 'ale#Escape(v:val)'), ',')
|
||||
\ : ''
|
||||
|
||||
" Pass paths to DLL files via the -r: parameter.
|
||||
let l:assembly_list = ale#Var(a:buffer, 'cs_csc_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 = ale#command#CreateFile(a:buffer)
|
||||
|
||||
" The code is compiled as a module and the output is redirected to a
|
||||
" temporary file.
|
||||
return 'csc /unsafe'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cs_csc_options'))
|
||||
\ . ale#Pad(l:lib_option)
|
||||
\ . ale#Pad(l:r_option)
|
||||
\ . ' /out:' . l:out
|
||||
\ . ' /t:module'
|
||||
\ . ' /recurse:' . ale#Escape('*.cs')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cs#csc#Handle(buffer, lines) abort
|
||||
" Look for lines like the following.
|
||||
"
|
||||
" Tests.cs(12,29): error CSXXXX: ; expected
|
||||
"
|
||||
" NOTE: pattern also captures file name as linter compiles all
|
||||
" files within the source tree rooted at the specified source
|
||||
" path and not just the file loaded in the buffer
|
||||
let l:patterns = [
|
||||
\ '^\v(.+\.cs)\((\d+),(\d+)\)\:\s+([^ ]+)\s+([cC][sS][^ ]+):\s(.+)$',
|
||||
\ '^\v([^ ]+)\s+([Cc][sS][^ ]+):\s+(.+)$',
|
||||
\]
|
||||
let l:output = []
|
||||
let l:dir = ale_linters#cs#csc#GetCwd(a:buffer)
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:patterns)
|
||||
if len(l:match) > 6 && strlen(l:match[5]) > 2 && l:match[5][:1] is? 'CS'
|
||||
call add(l:output, {
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
||||
\ 'code': l:match[5],
|
||||
\ 'text': l:match[6] ,
|
||||
\})
|
||||
elseif strlen(l:match[2]) > 2 && l:match[2][:1] is? 'CS'
|
||||
call add(l:output, {
|
||||
\ 'filename':'<csc>',
|
||||
\ 'lnum': -1,
|
||||
\ 'col': -1,
|
||||
\ 'type': l:match[1] is# 'error' ? 'E' : 'W',
|
||||
\ 'code': l:match[2],
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cs',{
|
||||
\ 'name': 'csc',
|
||||
\ 'output_stream': 'stdout',
|
||||
\ 'executable': 'csc',
|
||||
\ 'cwd': function('ale_linters#cs#csc#GetCwd'),
|
||||
\ 'command': function('ale_linters#cs#csc#GetCommand'),
|
||||
\ 'callback': 'ale_linters#cs#csc#Handle',
|
||||
\ 'lint_file': 1
|
||||
\})
|
||||
@@ -1,5 +0,0 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for C# files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('cs')
|
||||
@@ -1,27 +1,29 @@
|
||||
let g:ale_cs_mcs_options = get(g:, 'ale_cs_mcs_options', '')
|
||||
|
||||
function! ale_linters#cs#mcs#GetCommand(buffer) abort
|
||||
let l:options = ale#Var(a:buffer, 'cs_mcs_options')
|
||||
|
||||
return 'mcs -unsafe --parse'
|
||||
\ . (!empty(l:options) ? ' ' . l:options : '')
|
||||
\ . ' %t'
|
||||
endfunction
|
||||
if !exists('g:ale_cs_mcs_options')
|
||||
let g:ale_cs_mcs_options = ''
|
||||
endif
|
||||
|
||||
function! ale_linters#cs#mcs#Handle(buffer, lines) abort
|
||||
" Look for lines like the following.
|
||||
"
|
||||
" Tests.cs(12,29): error CSXXXX: ; expected
|
||||
let l:pattern = '^\v(.+\.cs)\((\d+),(\d+)\)\: ([^ ]+) ([^ ]+): (.+)$'
|
||||
let l:pattern = '^.\+.cs(\(\d\+\),\(\d\+\)): \(.\+\): \(.\+\)'
|
||||
let l:output = []
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
for l:line in a:lines
|
||||
let l:match = matchlist(l:line, l:pattern)
|
||||
|
||||
if len(l:match) == 0
|
||||
continue
|
||||
endif
|
||||
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
||||
\ 'code': l:match[5],
|
||||
\ 'text': l:match[6],
|
||||
\ 'bufnr': a:buffer,
|
||||
\ 'lnum': l:match[1] + 0,
|
||||
\ 'vcol': 0,
|
||||
\ 'col': l:match[2] + 0,
|
||||
\ 'text': l:match[3] . ': ' . l:match[4],
|
||||
\ 'type': l:match[3] =~# '^error' ? 'E' : 'W',
|
||||
\ 'nr': -1,
|
||||
\})
|
||||
endfor
|
||||
|
||||
@@ -29,9 +31,10 @@ function! ale_linters#cs#mcs#Handle(buffer, lines) abort
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cs',{
|
||||
\ 'name': 'mcs',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'mcs',
|
||||
\ 'command': function('ale_linters#cs#mcs#GetCommand'),
|
||||
\ 'callback': 'ale_linters#cs#mcs#Handle',
|
||||
\})
|
||||
\ 'name': 'mcs',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'mcs',
|
||||
\ 'command': g:ale#util#stdin_wrapper . ' .cs mcs -unsafe --parse' . g:ale_cs_mcs_options,
|
||||
\ 'callback': 'ale_linters#cs#mcs#Handle',
|
||||
\ })
|
||||
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
call ale#Set('cs_mcsc_options', '')
|
||||
call ale#Set('cs_mcsc_source', '')
|
||||
call ale#Set('cs_mcsc_assembly_path', [])
|
||||
call ale#Set('cs_mcsc_assemblies', [])
|
||||
|
||||
function! ale_linters#cs#mcsc#GetCwd(buffer) abort
|
||||
let l:cwd = ale#Var(a:buffer, 'cs_mcsc_source')
|
||||
|
||||
return !empty(l:cwd) ? l:cwd : expand('#' . a:buffer . ':p:h')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cs#mcsc#GetCommand(buffer) abort
|
||||
" Pass assembly paths via the -lib: parameter.
|
||||
let l:path_list = ale#Var(a:buffer, 'cs_mcsc_assembly_path')
|
||||
|
||||
let l:lib_option = !empty(l:path_list)
|
||||
\ ? '-lib:' . join(map(copy(l:path_list), 'ale#Escape(v:val)'), ',')
|
||||
\ : ''
|
||||
|
||||
" Pass paths to DLL files via the -r: parameter.
|
||||
let l:assembly_list = ale#Var(a:buffer, 'cs_mcsc_assemblies')
|
||||
|
||||
let l:r_option = !empty(l:assembly_list)
|
||||
\ ? '-r:' . join(map(copy(l:assembly_list), 'ale#Escape(v:val)'), ',')
|
||||
\ : ''
|
||||
|
||||
" register temporary module target file with ale
|
||||
" register temporary module target file with ALE.
|
||||
let l:out = ale#command#CreateFile(a:buffer)
|
||||
|
||||
" The code is compiled as a module and the output is redirected to a
|
||||
" temporary file.
|
||||
return 'mcs -unsafe'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cs_mcsc_options'))
|
||||
\ . ale#Pad(l:lib_option)
|
||||
\ . ale#Pad(l:r_option)
|
||||
\ . ' -out:' . l:out
|
||||
\ . ' -t:module'
|
||||
\ . ' -recurse:' . ale#Escape('*.cs')
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cs#mcsc#Handle(buffer, lines) abort
|
||||
" Look for lines like the following.
|
||||
"
|
||||
" Tests.cs(12,29): error CSXXXX: ; expected
|
||||
"
|
||||
" NOTE: pattern also captures file name as linter compiles all
|
||||
" files within the source tree rooted at the specified source
|
||||
" path and not just the file loaded in the buffer
|
||||
let l:patterns = [
|
||||
\ '^\v(.+\.cs)\((\d+),(\d+)\)\:\s+([^ ]+)\s+([cC][sS][^ ]+):\s(.+)$',
|
||||
\ '^\v([^ ]+)\s+([Cc][sS][^ ]+):\s+(.+)$',
|
||||
\]
|
||||
let l:output = []
|
||||
|
||||
let l:dir = ale_linters#cs#mcsc#GetCwd(a:buffer)
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:patterns)
|
||||
if len(l:match) > 6 && strlen(l:match[5]) > 2 && l:match[5][:1] is? 'CS'
|
||||
call add(l:output, {
|
||||
\ 'filename': ale#path#GetAbsPath(l:dir, l:match[1]),
|
||||
\ 'lnum': l:match[2] + 0,
|
||||
\ 'col': l:match[3] + 0,
|
||||
\ 'type': l:match[4] is# 'error' ? 'E' : 'W',
|
||||
\ 'code': l:match[5],
|
||||
\ 'text': l:match[6] ,
|
||||
\})
|
||||
elseif strlen(l:match[2]) > 2 && l:match[2][:1] is? 'CS'
|
||||
call add(l:output, {
|
||||
\ 'filename':'<mcs>',
|
||||
\ 'lnum': -1,
|
||||
\ 'col': -1,
|
||||
\ 'type': l:match[1] is# 'error' ? 'E' : 'W',
|
||||
\ 'code': l:match[2],
|
||||
\ 'text': l:match[3],
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cs',{
|
||||
\ 'name': 'mcsc',
|
||||
\ 'output_stream': 'stderr',
|
||||
\ 'executable': 'mcs',
|
||||
\ 'cwd': function('ale_linters#cs#mcsc#GetCwd'),
|
||||
\ 'command': function('ale_linters#cs#mcsc#GetCommand'),
|
||||
\ 'callback': 'ale_linters#cs#mcsc#Handle',
|
||||
\ 'lint_file': 1
|
||||
\})
|
||||
@@ -1,5 +0,0 @@
|
||||
scriptencoding utf-8
|
||||
" Author: David Houston <houstdav000>
|
||||
" Description: cspell support for CSS files.
|
||||
|
||||
call ale#handlers#cspell#DefineLinter('css')
|
||||
@@ -1,18 +1,9 @@
|
||||
" Author: w0rp <devw0rp@gmail.com>
|
||||
" Description: This file adds support for checking CSS code with csslint.
|
||||
|
||||
function! ale_linters#css#csslint#GetCommand(buffer) abort
|
||||
let l:csslintrc = ale#path#FindNearestFile(a:buffer, '.csslintrc')
|
||||
let l:config_option = !empty(l:csslintrc)
|
||||
\ ? '--config=' . ale#Escape(l:csslintrc)
|
||||
\ : ''
|
||||
|
||||
return 'csslint --format=compact ' . l:config_option . ' %t'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('css', {
|
||||
\ 'name': 'csslint',
|
||||
\ 'executable': 'csslint',
|
||||
\ 'command': function('ale_linters#css#csslint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#css#HandleCSSLintFormat',
|
||||
\ 'command': g:ale#util#stdin_wrapper . ' .css csslint --format=compact',
|
||||
\ 'callback': 'ale#handlers#HandleCSSLintFormat',
|
||||
\})
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
" Author: harttle <yangjvn@126.com>
|
||||
" Description: fecs for CSS files
|
||||
|
||||
call ale#linter#Define('css', {
|
||||
\ 'name': 'fecs',
|
||||
\ 'executable': function('ale#handlers#fecs#GetExecutable'),
|
||||
\ 'command': function('ale#handlers#fecs#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#fecs#Handle',
|
||||
\})
|
||||
@@ -1,20 +1,31 @@
|
||||
" Author: diartyz <diartyz@gmail.com>
|
||||
|
||||
call ale#Set('css_stylelint_executable', 'stylelint')
|
||||
call ale#Set('css_stylelint_options', '')
|
||||
call ale#Set('css_stylelint_use_global', get(g:, 'ale_use_global_executables', 0))
|
||||
let g:ale_css_stylelint_executable =
|
||||
\ get(g:, 'ale_css_stylelint_executable', 'stylelint')
|
||||
|
||||
let g:ale_css_stylelint_use_global =
|
||||
\ get(g:, 'ale_css_stylelint_use_global', 0)
|
||||
|
||||
function! ale_linters#css#stylelint#GetExecutable(buffer) abort
|
||||
if g:ale_css_stylelint_use_global
|
||||
return g:ale_css_stylelint_executable
|
||||
endif
|
||||
|
||||
return ale#util#ResolveLocalPath(
|
||||
\ a:buffer,
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\ g:ale_css_stylelint_executable
|
||||
\)
|
||||
endfunction
|
||||
|
||||
function! ale_linters#css#stylelint#GetCommand(buffer) abort
|
||||
return '%e ' . ale#Pad(ale#Var(a:buffer, 'css_stylelint_options'))
|
||||
return ale_linters#css#stylelint#GetExecutable(a:buffer)
|
||||
\ . ' --stdin-filename %s'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('css', {
|
||||
\ 'name': 'stylelint',
|
||||
\ 'output_stream': 'both',
|
||||
\ 'executable': {b -> ale#path#FindExecutable(b, 'css_stylelint', [
|
||||
\ 'node_modules/.bin/stylelint',
|
||||
\ ])},
|
||||
\ 'command': function('ale_linters#css#stylelint#GetCommand'),
|
||||
\ 'callback': 'ale#handlers#css#HandleStyleLintFormat',
|
||||
\ 'executable_callback': 'ale_linters#css#stylelint#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#css#stylelint#GetCommand',
|
||||
\ 'callback': 'ale#handlers#HandleStyleLintFormat',
|
||||
\})
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
" Author: Dalius Dobravolskas <dalius.dobravolskas@gmail.com>
|
||||
" Description: VSCode css language server
|
||||
|
||||
function! ale_linters#css#vscodecss#GetProjectRoot(buffer) abort
|
||||
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
|
||||
|
||||
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('css', {
|
||||
\ 'name': 'vscodecss',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': 'vscode-css-language-server',
|
||||
\ 'command': '%e --stdio',
|
||||
\ 'project_root': function('ale_linters#css#vscodecss#GetProjectRoot'),
|
||||
\})
|
||||
@@ -1,46 +0,0 @@
|
||||
" Author: Eddie Lebow https://github.com/elebow
|
||||
" Description: Cucumber, a BDD test tool
|
||||
|
||||
function! ale_linters#cucumber#cucumber#GetCommand(buffer) abort
|
||||
let l:features_dir = ale#path#FindNearestDirectory(a:buffer, 'features')
|
||||
|
||||
if !empty(l:features_dir)
|
||||
let l:features_arg = '-r ' . ale#Escape(l:features_dir)
|
||||
else
|
||||
let l:features_arg = ''
|
||||
endif
|
||||
|
||||
return 'cucumber --dry-run --quiet --strict --format=json '
|
||||
\ . l:features_arg . ' %t'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#cucumber#cucumber#Handle(buffer, lines) abort
|
||||
try
|
||||
let l:json = ale#util#FuzzyJSONDecode(a:lines, {})[0]
|
||||
catch
|
||||
return []
|
||||
endtry
|
||||
|
||||
let l:output = []
|
||||
|
||||
for l:element in get(l:json, 'elements', [])
|
||||
for l:step in l:element['steps']
|
||||
if l:step['result']['status'] is# 'undefined'
|
||||
call add(l:output, {
|
||||
\ 'lnum': l:step['line'],
|
||||
\ 'code': 'E',
|
||||
\ 'text': 'Undefined step'
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
endfor
|
||||
|
||||
return l:output
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cucumber', {
|
||||
\ 'name': 'cucumber',
|
||||
\ 'executable': 'cucumber',
|
||||
\ 'command': function('ale_linters#cucumber#cucumber#GetCommand'),
|
||||
\ 'callback': 'ale_linters#cucumber#cucumber#Handle'
|
||||
\})
|
||||
@@ -1,23 +0,0 @@
|
||||
" Author: Tommy Chiang <ty1208chiang@gmail.com>
|
||||
" Description: Clangd language server for CUDA (modified from Andrey
|
||||
" Melentyev's implementation for C++)
|
||||
|
||||
call ale#Set('cuda_clangd_executable', 'clangd')
|
||||
call ale#Set('cuda_clangd_options', '')
|
||||
call ale#Set('c_build_dir', '')
|
||||
|
||||
function! ale_linters#cuda#clangd#GetCommand(buffer) abort
|
||||
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
||||
|
||||
return '%e'
|
||||
\ . ale#Pad(ale#Var(a:buffer, 'cuda_clangd_options'))
|
||||
\ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '')
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('cuda', {
|
||||
\ 'name': 'clangd',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable': {b -> ale#Var(b, 'cuda_clangd_executable')},
|
||||
\ 'command': function('ale_linters#cuda#clangd#GetCommand'),
|
||||
\ 'project_root': function('ale#c#FindProjectRoot'),
|
||||
\})
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user