-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
90 changed files
with
2,201 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: David Houston <houstdav000> | ||
" Description: cspell support for Ada files. | ||
|
||
call ale#handlers#cspell#DefineLinter('ada') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: David Houston <houstdav000> | ||
" Description: cspell support for ASCIIDoc files. | ||
|
||
call ale#handlers#cspell#DefineLinter('asciidoc') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
" 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', | ||
\}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
" 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', | ||
\ }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
" 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, | ||
\}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: David Houston <houstdav000> | ||
" Description: cspell support for C files. | ||
|
||
call ale#handlers#cspell#DefineLinter('c') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
" Author: 0xHyoga <0xHyoga@gmx.com> | ||
" Description: Report starknet-compile errors in cairo code | ||
|
||
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', | ||
\}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
" 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 . ' %t' | ||
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', | ||
\}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: David Houston <houstdav000> | ||
" Description: cspell support for C++ files. | ||
|
||
call ale#handlers#cspell#DefineLinter('cpp') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: David Houston <houstdav000> | ||
" Description: cspell support for C# files. | ||
|
||
call ale#handlers#cspell#DefineLinter('cs') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: David Houston <houstdav000> | ||
" Description: cspell support for CSS files. | ||
|
||
call ale#handlers#cspell#DefineLinter('css') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
" 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'), | ||
\}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: David Houston <houstdav000> | ||
" Description: cspell support for Elixir files. | ||
|
||
call ale#handlers#cspell#DefineLinter('elixir') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: David Houston <houstdav000> | ||
" Description: cspell support for Go files. | ||
|
||
call ale#handlers#cspell#DefineLinter('go') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: David Houston <houstdav000> | ||
" Description: cspell support for Haskell files. | ||
|
||
call ale#handlers#cspell#DefineLinter('haskell') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: David Houston <houstdav000> | ||
" Description: cspell support for help files. | ||
|
||
call ale#handlers#cspell#DefineLinter('help') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: David Houston <houstdav000> | ||
" Description: cspell support for HTML files. | ||
|
||
call ale#handlers#cspell#DefineLinter('html') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
" Author: Dalius Dobravolskas <dalius.dobravolskas@gmail.com> | ||
" Description: VSCode html language server | ||
|
||
function! ale_linters#html#vscodehtml#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('html', { | ||
\ 'name': 'vscodehtml', | ||
\ 'lsp': 'stdio', | ||
\ 'executable': 'vscode-html-language-server', | ||
\ 'command': '%e --stdio', | ||
\ 'project_root': function('ale_linters#html#vscodehtml#GetProjectRoot'), | ||
\}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: David Houston <houstdav000> | ||
" Description: cspell support for Java files. | ||
|
||
call ale#handlers#cspell#DefineLinter('java') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: David Houston <houstdav000> | ||
" Description: cspell support for JavaScript files. | ||
|
||
call ale#handlers#cspell#DefineLinter('javascript') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: David Houston <houstdav000> | ||
" Description: cspell support for JSON files. | ||
|
||
call ale#handlers#cspell#DefineLinter('json') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
" Author: Dalius Dobravolskas <dalius.dobravolskas@gmail.com> | ||
" Description: VSCode json language server | ||
|
||
function! ale_linters#json#vscodejson#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('json', { | ||
\ 'name': 'vscodejson', | ||
\ 'lsp': 'stdio', | ||
\ 'executable': 'vscode-json-language-server', | ||
\ 'command': '%e --stdio', | ||
\ 'project_root': function('ale_linters#json#vscodejson#GetProjectRoot'), | ||
\}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: David Houston <houstdav000> | ||
" Description: cspell support for Lua files. | ||
|
||
call ale#handlers#cspell#DefineLinter('lua') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
call ale#Set('lua_selene_executable', 'selene') | ||
call ale#Set('lua_selene_options', '') | ||
|
||
function! ale_linters#lua#selene#GetCommand(buffer) abort | ||
return '%e' . ale#Pad(ale#Var(a:buffer, 'lua_selene_options')) | ||
\ . ' --display-style=json -' | ||
endfunction | ||
|
||
function! ale_linters#lua#selene#Handle(buffer, lines) abort | ||
let l:output = [] | ||
|
||
for l:line in a:lines | ||
" as of version 0.17.0, selene has no way to suppress summary | ||
" information when outputting json, so stop processing when we hit it | ||
" (PR for this here: https://github.com/Kampfkarren/selene/pull/356) | ||
if l:line is# 'Results:' | ||
break | ||
endif | ||
|
||
let l:json = json_decode(l:line) | ||
let l:lint = { | ||
\ 'lnum': l:json.primary_label.span.start_line + 1, | ||
\ 'end_lnum': l:json.primary_label.span.end_line + 1, | ||
\ 'col': l:json.primary_label.span.start_column + 1, | ||
\ 'end_col': l:json.primary_label.span.end_column, | ||
\ 'text': l:json.message, | ||
\ 'code': l:json.code, | ||
\ 'type': l:json.severity is# 'Warning' ? 'W' : 'E', | ||
\} | ||
|
||
if has_key(l:json, 'notes') && len(l:json.notes) > 0 | ||
let l:lint.detail = l:lint.text . "\n\n" . join(l:json.notes, "\n") | ||
endif | ||
|
||
call add(l:output, l:lint) | ||
endfor | ||
|
||
return l:output | ||
endfunction | ||
|
||
call ale#linter#Define('lua', { | ||
\ 'name': 'selene', | ||
\ 'executable': {b -> ale#Var(b, 'lua_selene_executable')}, | ||
\ 'command': function('ale_linters#lua#selene#GetCommand'), | ||
\ 'callback': 'ale_linters#lua#selene#Handle', | ||
\}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
scriptencoding utf-8 | ||
" Author: David Houston <houstdav000> | ||
" Description: cspell support for Markdown files. | ||
|
||
call ale#handlers#cspell#DefineLinter('markdown') |
Oops, something went wrong.