Skip to content

Commit

Permalink
plugin updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Taewoong Jang committed Nov 8, 2018
1 parent dcdc968 commit 485cf5e
Show file tree
Hide file tree
Showing 116 changed files with 2,329 additions and 601 deletions.
13 changes: 10 additions & 3 deletions sources_non_forked/ale/ale_linters/ansible/ansible_lint.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
" Author: Bjorn Neergaard <[email protected]>
" 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, lines) abort
for l:line in a:lines[:10]
if match(l:line, '^Traceback') >= 0
Expand Down Expand Up @@ -42,8 +48,9 @@ function! ale_linters#ansible#ansible_lint#Handle(buffer, lines) abort
endfunction

call ale#linter#Define('ansible', {
\ 'name': 'ansible',
\ 'executable': 'ansible',
\ 'command': 'ansible-lint -p %t',
\ 'name': 'ansible_lint',
\ 'aliases': ['ansible', 'ansible-lint'],
\ 'executable_callback': 'ale_linters#ansible#ansible_lint#GetExecutable',
\ 'command': '%e -p %t',
\ 'callback': 'ale_linters#ansible#ansible_lint#Handle',
\})
2 changes: 1 addition & 1 deletion sources_non_forked/ale/ale_linters/c/clangtidy.vim
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ call ale#Set('c_clangtidy_executable', 'clang-tidy')
" 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', ['*'])
call ale#Set('c_clangtidy_checks', [])
" Set this option to manually set some options for clang-tidy.
" This will disable compile_commands.json detection.
call ale#Set('c_clangtidy_options', '')
Expand Down
2 changes: 1 addition & 1 deletion sources_non_forked/ale/ale_linters/cpp/clangtidy.vim
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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', ['*'])
call ale#Set('cpp_clangtidy_checks', [])
" Set this option to manually set some options for clang-tidy.
" This will disable compile_commands.json detection.
call ale#Set('cpp_clangtidy_options', '')
Expand Down
22 changes: 22 additions & 0 deletions sources_non_forked/ale/ale_linters/d/dls.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
" Author: aurieh <[email protected]>
" Description: A Language Server implementation for D

call ale#Set('d_dls_executable', 'dls')

function! ale_linters#d#dls#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'd_dls_executable')
endfunction

function! ale_linters#d#dls#FindProjectRoot(buffer) abort
" Note: this will return . if dub config is empty
" dls can run outside DUB projects just fine
return fnamemodify(ale#d#FindDUBConfig(a:buffer), ':h')
endfunction

call ale#linter#Define('d', {
\ 'name': 'dls',
\ 'lsp': 'stdio',
\ 'executable_callback': 'ale_linters#d#dls#GetExecutable',
\ 'command_callback': 'ale_linters#d#dls#GetExecutable',
\ 'project_root_callback': 'ale_linters#d#dls#FindProjectRoot',
\})
16 changes: 1 addition & 15 deletions sources_non_forked/ale/ale_linters/d/dmd.vim
Original file line number Diff line number Diff line change
@@ -1,28 +1,14 @@
" Author: w0rp <[email protected]>
" Description: "dmd for D files"

function! s:FindDUBConfig(buffer) abort
" Find a DUB configuration file in ancestor paths.
" The most DUB-specific names will be tried first.
for l:possible_filename in ['dub.sdl', 'dub.json', 'package.json']
let l:dub_file = ale#path#FindNearestFile(a:buffer, l:possible_filename)

if !empty(l:dub_file)
return l:dub_file
endif
endfor

return ''
endfunction

function! ale_linters#d#dmd#DUBCommand(buffer) abort
" If we can't run dub, then skip this command.
if !executable('dub')
" Returning an empty string skips to the DMD command.
return ''
endif

let l:dub_file = s:FindDUBConfig(a:buffer)
let l:dub_file = ale#d#FindDUBConfig(a:buffer)

if empty(l:dub_file)
return ''
Expand Down
61 changes: 61 additions & 0 deletions sources_non_forked/ale/ale_linters/dockerfile/dockerfile_lint.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
" Author: Alexander Olofsson <[email protected]>

call ale#Set('dockerfile_dockerfile_lint_executable', 'dockerfile_lint')
call ale#Set('dockerfile_dockerfile_lint_options', '')

function! ale_linters#dockerfile#dockerfile_lint#GetType(type) abort
if a:type is? 'error'
return 'E'
elseif a:type is? 'warn'
return 'W'
endif

return 'I'
endfunction

function! ale_linters#dockerfile#dockerfile_lint#Handle(buffer, lines) abort
try
let l:data = json_decode(join(a:lines, ''))
catch
return []
endtry

if empty(l:data)
" Should never happen, but it's better to be on the safe side
return []
endif

let l:messages = []

for l:type in ['error', 'warn', 'info']
for l:object in l:data[l:type]['data']
let l:line = get(l:object, 'line', -1)
let l:message = l:object['message']

if get(l:object, 'description', 'None') isnot# 'None'
let l:message = l:message . '. ' . l:object['description']
endif

call add(l:messages, {
\ 'lnum': l:line,
\ 'text': l:message,
\ 'type': ale_linters#dockerfile#dockerfile_lint#GetType(l:type),
\})
endfor
endfor

return l:messages
endfunction

function! ale_linters#dockerfile#dockerfile_lint#GetCommand(buffer) abort
return '%e' . ale#Pad(ale#Var(a:buffer, 'dockerfile_dockerfile_lint_options'))
\ . ' -p -j -f'
\ . ' %t'
endfunction

call ale#linter#Define('dockerfile', {
\ 'name': 'dockerfile_lint',
\ 'executable_callback': ale#VarFunc('dockerfile_dockerfile_lint_executable'),
\ 'command_callback': 'ale_linters#dockerfile#dockerfile_lint#GetCommand',
\ 'callback': 'ale_linters#dockerfile#dockerfile_lint#Handle',
\})
23 changes: 19 additions & 4 deletions sources_non_forked/ale/ale_linters/elixir/credo.vim
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,18 @@ function! ale_linters#elixir#credo#Handle(buffer, lines) abort
let l:type = l:match[3]
let l:text = l:match[4]

if l:type is# 'C'
let l:type = 'E'
elseif l:type is# 'R'
" Refactoring opportunities
if l:type is# 'F'
let l:type = 'W'
" Consistency
elseif l:type is# 'C'
let l:type = 'W'
" Software Design
elseif l:type is# 'D'
let l:type = 'I'
" Code Readability
elseif l:type is# 'R'
let l:type = 'I'
endif

call add(l:output, {
Expand All @@ -29,9 +37,16 @@ function! ale_linters#elixir#credo#Handle(buffer, lines) abort
return l:output
endfunction

function! ale_linters#elixir#credo#GetCommand(buffer) abort
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)

return ale#path#CdString(l:project_root)
\ . ' mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s'
endfunction

call ale#linter#Define('elixir', {
\ 'name': 'credo',
\ 'executable': 'mix',
\ 'command': 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s',
\ 'command_callback': 'ale_linters#elixir#credo#GetCommand',
\ 'callback': 'ale_linters#elixir#credo#Handle',
\})
9 changes: 8 additions & 1 deletion sources_non_forked/ale/ale_linters/elixir/dialyxir.vim
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,17 @@ function! ale_linters#elixir#dialyxir#Handle(buffer, lines) abort
return l:output
endfunction

function! ale_linters#elixir#dialyxir#GetCommand(buffer) abort
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)

return ale#path#CdString(l:project_root)
\ . ' mix help dialyzer && mix dialyzer'
endfunction

call ale#linter#Define('elixir', {
\ 'name': 'dialyxir',
\ 'executable': 'mix',
\ 'command': 'mix help dialyzer && mix dialyzer',
\ 'command_callback': 'ale_linters#elixir#dialyxir#GetCommand',
\ 'callback': 'ale_linters#elixir#dialyxir#Handle',
\})

9 changes: 8 additions & 1 deletion sources_non_forked/ale/ale_linters/elixir/dogma.vim
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,17 @@ function! ale_linters#elixir#dogma#Handle(buffer, lines) abort
return l:output
endfunction

function! ale_linters#elixir#dogma#GetCommand(buffer) abort
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)

return ale#path#CdString(l:project_root)
\ . ' mix help dogma && mix dogma %s --format=flycheck'
endfunction

call ale#linter#Define('elixir', {
\ 'name': 'dogma',
\ 'executable': 'mix',
\ 'command': 'mix help dogma && mix dogma %s --format=flycheck',
\ 'command_callback': 'ale_linters#elixir#dogma#GetCommand',
\ 'lint_file': 1,
\ 'callback': 'ale_linters#elixir#dogma#Handle',
\})
21 changes: 21 additions & 0 deletions sources_non_forked/ale/ale_linters/elixir/elixir_ls.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
" Author: Jon Parise <[email protected]>
" Description: ElixirLS integration (https://github.com/JakeBecker/elixir-ls)

call ale#Set('elixir_elixir_ls_release', 'elixir-ls')
call ale#Set('elixir_elixir_ls_config', {})

function! ale_linters#elixir#elixir_ls#GetExecutable(buffer) abort
let l:dir = ale#path#Simplify(ale#Var(a:buffer, 'elixir_elixir_ls_release'))
let l:cmd = ale#Has('win32') ? '\language_server.bat' : '/language_server.sh'

return l:dir . l:cmd
endfunction

call ale#linter#Define('elixir', {
\ 'name': 'elixir-ls',
\ 'lsp': 'stdio',
\ 'executable_callback': 'ale_linters#elixir#elixir_ls#GetExecutable',
\ 'command_callback': 'ale_linters#elixir#elixir_ls#GetExecutable',
\ 'project_root_callback': 'ale#handlers#elixir#FindMixUmbrellaRoot',
\ 'lsp_config_callback': ale#VarFunc('elixir_elixir_ls_config'),
\})
16 changes: 3 additions & 13 deletions sources_non_forked/ale/ale_linters/elixir/mix.vim
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,8 @@ function! ale_linters#elixir#mix#Handle(buffer, lines) abort
return l:output
endfunction

function! ale_linters#elixir#mix#FindProjectRoot(buffer) abort
let l:mix_file = ale#path#FindNearestFile(a:buffer, 'mix.exs')

if !empty(l:mix_file)
return fnamemodify(l:mix_file, ':p:h')
endif

return '.'
endfunction

function! ale_linters#elixir#mix#GetCommand(buffer) abort
let l:project_root = ale_linters#elixir#mix#FindProjectRoot(a:buffer)
let l:project_root = ale#handlers#elixir#FindMixProjectRoot(a:buffer)

let l:temp_dir = ale#engine#CreateDirectory(a:buffer)

Expand All @@ -49,8 +39,8 @@ function! ale_linters#elixir#mix#GetCommand(buffer) abort
\ : 'MIX_BUILD_PATH=' . ale#Escape(l:temp_dir)

return ale#path#CdString(l:project_root)
\ . l:mix_build_path
\ . ' mix compile %s'
\ . l:mix_build_path
\ . ' mix compile %s'
endfunction

call ale#linter#Define('elixir', {
Expand Down
62 changes: 62 additions & 0 deletions sources_non_forked/ale/ale_linters/eruby/ruumba.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
" Author: aclemons - https://github.com/aclemons
" based on the ale rubocop linter
" Description: Ruumba, RuboCop linting for ERB templates.

call ale#Set('eruby_ruumba_executable', 'ruumba')
call ale#Set('eruby_ruumba_options', '')

function! ale_linters#eruby#ruumba#GetCommand(buffer) abort
let l:executable = ale#Var(a:buffer, 'eruby_ruumba_executable')

return ale#handlers#ruby#EscapeExecutable(l:executable, 'ruumba')
\ . ' --format json --force-exclusion '
\ . ale#Var(a:buffer, 'eruby_ruumba_options')
\ . ' --stdin ' . ale#Escape(expand('#' . a:buffer . ':p'))
endfunction

function! ale_linters#eruby#ruumba#Handle(buffer, lines) abort
try
let l:errors = json_decode(a:lines[0])
catch
return []
endtry

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 = l:error['location']['column'] + 0
call add(l:output, {
\ 'lnum': l:error['location']['line'] + 0,
\ 'col': l:start_col,
\ 'end_col': l:start_col + l:error['location']['length'] - 1,
\ 'code': l:error['cop_name'],
\ 'text': l:error['message'],
\ 'type': ale_linters#eruby#ruumba#GetType(l:error['severity']),
\})
endfor

return l:output
endfunction

function! ale_linters#eruby#ruumba#GetType(severity) abort
if a:severity is? 'convention'
\|| a:severity is? 'warning'
\|| a:severity is? 'refactor'
return 'W'
endif

return 'E'
endfunction

call ale#linter#Define('eruby', {
\ 'name': 'ruumba',
\ 'executable_callback': ale#VarFunc('eruby_ruumba_executable'),
\ 'command_callback': 'ale_linters#eruby#ruumba#GetCommand',
\ 'callback': 'ale_linters#eruby#ruumba#Handle',
\})
10 changes: 8 additions & 2 deletions sources_non_forked/ale/ale_linters/haml/hamllint.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
" Author: Patrick Lewis - https://github.com/patricklewis, thenoseman - https://github.com/thenoseman
" Description: haml-lint for Haml files

call ale#Set('haml_hamllint_executable', 'haml-lint')

function! ale_linters#haml#hamllint#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'haml_hamllint_executable')
endfunction

function! ale_linters#haml#hamllint#GetCommand(buffer) abort
let l:prefix = ''

Expand All @@ -21,7 +27,7 @@ function! ale_linters#haml#hamllint#GetCommand(buffer) abort
endif

return (!empty(l:prefix) ? l:prefix . ' ' : '')
\ . 'haml-lint'
\ . ale_linters#haml#hamllint#GetExecutable(a:buffer)
\ . (!empty(l:hamllint_config_file_path) ? ' --config ' . ale#Escape(l:hamllint_config_file_path) : '')
\ . ' %t'
endfunction
Expand All @@ -45,7 +51,7 @@ endfunction

call ale#linter#Define('haml', {
\ 'name': 'hamllint',
\ 'executable': 'haml-lint',
\ 'executable_callback': 'ale_linters#haml#hamllint#GetExecutable',
\ 'command_callback': 'ale_linters#haml#hamllint#GetCommand',
\ 'callback': 'ale_linters#haml#hamllint#Handle'
\})
2 changes: 1 addition & 1 deletion sources_non_forked/ale/ale_linters/haskell/stack_build.vim
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ call ale#linter#Define('haskell', {
\ 'name': 'stack_build',
\ 'aliases': ['stack-build'],
\ 'output_stream': 'stderr',
\ 'executable': 'stack',
\ 'executable_callback': 'ale#handlers#haskell#GetStackExecutable',
\ 'command_callback': 'ale_linters#haskell#stack_build#GetCommand',
\ 'lint_file': 1,
\ 'callback': 'ale#handlers#haskell#HandleGHCFormat',
Expand Down
Loading

0 comments on commit 485cf5e

Please sign in to comment.