mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 20:54:26 +08:00
Merge pull request #3455 from Thau/feat/credo_config_file
feat: Adds variable to use custom config file with Elixir Credo
This commit is contained in:
@@ -45,6 +45,16 @@ function! ale_linters#elixir#credo#GetMode() abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! ale_linters#elixir#credo#GetConfigFile() abort
|
||||||
|
let l:config_file = get(g:, 'ale_elixir_credo_config_file', '')
|
||||||
|
|
||||||
|
if empty(l:config_file)
|
||||||
|
return ''
|
||||||
|
endif
|
||||||
|
|
||||||
|
return ' --config-file ' . l:config_file
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! ale_linters#elixir#credo#GetCommand(buffer) abort
|
function! ale_linters#elixir#credo#GetCommand(buffer) abort
|
||||||
let l:project_root = ale#handlers#elixir#FindMixUmbrellaRoot(a:buffer)
|
let l:project_root = ale#handlers#elixir#FindMixUmbrellaRoot(a:buffer)
|
||||||
let l:mode = ale_linters#elixir#credo#GetMode()
|
let l:mode = ale_linters#elixir#credo#GetMode()
|
||||||
@@ -52,6 +62,7 @@ function! ale_linters#elixir#credo#GetCommand(buffer) abort
|
|||||||
return ale#path#CdString(l:project_root)
|
return ale#path#CdString(l:project_root)
|
||||||
\ . 'mix help credo && '
|
\ . 'mix help credo && '
|
||||||
\ . 'mix credo ' . ale_linters#elixir#credo#GetMode()
|
\ . 'mix credo ' . ale_linters#elixir#credo#GetMode()
|
||||||
|
\ . ale_linters#elixir#credo#GetConfigFile()
|
||||||
\ . ' --format=flycheck --read-from-stdin %s'
|
\ . ' --format=flycheck --read-from-stdin %s'
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|||||||
@@ -85,5 +85,12 @@ g:ale_elixir_credo_strict *g:ale_elixir_credo_strict*
|
|||||||
Tells credo to run in strict mode or suggest mode. Set variable to 1 to
|
Tells credo to run in strict mode or suggest mode. Set variable to 1 to
|
||||||
enable --strict mode.
|
enable --strict mode.
|
||||||
|
|
||||||
|
g:ale_elixir_credo_config_file g:ale_elixir_credo_config_file
|
||||||
|
|
||||||
|
Type: String
|
||||||
|
Default: ''
|
||||||
|
|
||||||
|
Tells credo to use a custom configuration file.
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
vim:tw=78:ts=2:sts=2:sw=2:ft=help:norl:
|
||||||
|
|||||||
@@ -38,3 +38,10 @@ Execute(Builds credo command with suggest mode when set to 0):
|
|||||||
AssertLinter 'mix',
|
AssertLinter 'mix',
|
||||||
\ ale#path#CdString(ale#path#Simplify(g:dir . '/elixir_paths/mix_project'))
|
\ ale#path#CdString(ale#path#Simplify(g:dir . '/elixir_paths/mix_project'))
|
||||||
\ . 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s'
|
\ . 'mix help credo && mix credo suggest --format=flycheck --read-from-stdin %s'
|
||||||
|
|
||||||
|
Execute(Builds credo command with a custom config file):
|
||||||
|
let g:ale_elixir_credo_config_file = '/home/user/custom_credo.exs'
|
||||||
|
|
||||||
|
AssertLinter 'mix',
|
||||||
|
\ ale#path#CdString(ale#path#Simplify(g:dir . '/elixir_paths/mix_project'))
|
||||||
|
\ . 'mix help credo && mix credo suggest --config-file /home/user/custom_credo.exs --format=flycheck --read-from-stdin %s'
|
||||||
|
|||||||
Reference in New Issue
Block a user