mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-23 04:21:26 +08:00
Complain about stray echo lines in the codebase
This commit is contained in:
@@ -29,6 +29,10 @@ let s:global_variable_list = [
|
||||
\ 'ale_warn_about_trailing_whitespace',
|
||||
\]
|
||||
|
||||
function! s:Echo(message) abort
|
||||
execute 'echo a:message'
|
||||
endfunction
|
||||
|
||||
function! s:GetLinterVariables(filetype, linter_names) abort
|
||||
let l:variable_list = []
|
||||
let l:filetype_parts = split(a:filetype, '\.')
|
||||
@@ -52,20 +56,20 @@ endfunction
|
||||
|
||||
function! s:EchoLinterVariables(variable_list) abort
|
||||
for l:key in a:variable_list
|
||||
echom 'let g:' . l:key . ' = ' . string(g:[l:key])
|
||||
call s:Echo('let g:' . l:key . ' = ' . string(g:[l:key]))
|
||||
|
||||
if has_key(b:, l:key)
|
||||
echom 'let b:' . l:key . ' = ' . string(b:[l:key])
|
||||
call s:Echo('let b:' . l:key . ' = ' . string(b:[l:key]))
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
|
||||
function! s:EchoGlobalVariables() abort
|
||||
for l:key in s:global_variable_list
|
||||
echom 'let g:' . l:key . ' = ' . string(get(g:, l:key, v:null))
|
||||
call s:Echo('let g:' . l:key . ' = ' . string(get(g:, l:key, v:null)))
|
||||
|
||||
if has_key(b:, l:key)
|
||||
echom 'let b:' . l:key . ' = ' . string(b:[l:key])
|
||||
call s:Echo('let b:' . l:key . ' = ' . string(b:[l:key]))
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
@@ -79,34 +83,34 @@ function! s:EchoCommand(item) abort
|
||||
let l:status_message .= ' - exit code ' . a:item.exit_code
|
||||
endif
|
||||
|
||||
echom '(' . l:status_message . ') ' . string(a:item.command)
|
||||
call s:Echo('(' . l:status_message . ') ' . string(a:item.command))
|
||||
|
||||
if g:ale_history_log_output && has_key(a:item, 'output')
|
||||
if empty(a:item.output)
|
||||
echom ''
|
||||
echom '<<<NO OUTPUT RETURNED>>>'
|
||||
echom ''
|
||||
call s:Echo('')
|
||||
call s:Echo('<<<NO OUTPUT RETURNED>>>')
|
||||
call s:Echo('')
|
||||
else
|
||||
echom ''
|
||||
echom '<<<OUTPUT STARTS>>>'
|
||||
call s:Echo('')
|
||||
call s:Echo('<<<OUTPUT STARTS>>>')
|
||||
|
||||
for l:line in a:item.output
|
||||
echom l:line
|
||||
call s:Echo(l:line)
|
||||
endfor
|
||||
|
||||
echom '<<<OUTPUT ENDS>>>'
|
||||
echom ''
|
||||
call s:Echo('<<<OUTPUT ENDS>>>')
|
||||
call s:Echo('')
|
||||
endif
|
||||
endif
|
||||
endfunction
|
||||
|
||||
" Echo the results of an executable check.
|
||||
function! s:EchoExecutable(item) abort
|
||||
echom printf(
|
||||
call s:Echo(printf(
|
||||
\ '(executable check - %s) %s',
|
||||
\ a:item.status ? 'success' : 'failure',
|
||||
\ a:item.command,
|
||||
\)
|
||||
\))
|
||||
endfunction
|
||||
|
||||
function! s:EchoCommandHistory() abort
|
||||
@@ -127,12 +131,12 @@ function! s:EchoLinterAliases(all_linters) abort
|
||||
for l:linter in a:all_linters
|
||||
if !empty(l:linter.aliases)
|
||||
if l:first
|
||||
echom ' Linter Aliases:'
|
||||
call s:Echo(' Linter Aliases:')
|
||||
endif
|
||||
|
||||
let l:first = 0
|
||||
|
||||
echom string(l:linter.name) . ' -> ' . string(l:linter.aliases)
|
||||
call s:Echo(string(l:linter.name) . ' -> ' . string(l:linter.aliases))
|
||||
endif
|
||||
endfor
|
||||
endfunction
|
||||
@@ -159,18 +163,18 @@ function! ale#debugging#Info() abort
|
||||
" This must be done after linters are loaded.
|
||||
let l:variable_list = s:GetLinterVariables(l:filetype, l:enabled_names)
|
||||
|
||||
echom ' Current Filetype: ' . l:filetype
|
||||
echom 'Available Linters: ' . string(l:all_names)
|
||||
call s:Echo(' Current Filetype: ' . l:filetype)
|
||||
call s:Echo('Available Linters: ' . string(l:all_names))
|
||||
call s:EchoLinterAliases(l:all_linters)
|
||||
echom ' Enabled Linters: ' . string(l:enabled_names)
|
||||
echom ' Linter Variables:'
|
||||
echom ''
|
||||
call s:Echo(' Enabled Linters: ' . string(l:enabled_names))
|
||||
call s:Echo(' Linter Variables:')
|
||||
call s:Echo('')
|
||||
call s:EchoLinterVariables(l:variable_list)
|
||||
echom ' Global Variables:'
|
||||
echom ''
|
||||
call s:Echo(' Global Variables:')
|
||||
call s:Echo('')
|
||||
call s:EchoGlobalVariables()
|
||||
echom ' Command History:'
|
||||
echom ''
|
||||
call s:Echo(' Command History:')
|
||||
call s:Echo('')
|
||||
call s:EchoCommandHistory()
|
||||
endfunction
|
||||
|
||||
@@ -179,5 +183,5 @@ function! ale#debugging#InfoToClipboard() abort
|
||||
silent call ale#debugging#Info()
|
||||
redir END
|
||||
|
||||
echom 'ALEInfo copied to your clipboard'
|
||||
call s:Echo('ALEInfo copied to your clipboard')
|
||||
endfunction
|
||||
|
||||
Reference in New Issue
Block a user