summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-11-15 12:00:08 +0000
committerw0rp <devw0rp@gmail.com>2017-11-15 12:00:13 +0000
commite12e5c912cd42abe4aebf54c21f57f5a8c735dc6 (patch)
tree8420bc7774e313ae2f3990d4906ab17cbbe05e9e /autoload
parent38bc4896042eda8eeb7ca7fbff70520d58925ced (diff)
downloadale-e12e5c912cd42abe4aebf54c21f57f5a8c735dc6.zip
Complain about stray echo lines in the codebase
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/cursor.vim6
-rw-r--r--autoload/ale/debugging.vim58
-rw-r--r--autoload/ale/engine.vim4
-rw-r--r--autoload/ale/fix.vim7
-rw-r--r--autoload/ale/toggle.vim2
5 files changed, 41 insertions, 36 deletions
diff --git a/autoload/ale/cursor.vim b/autoload/ale/cursor.vim
index 69076102..5a1d7789 100644
--- a/autoload/ale/cursor.vim
+++ b/autoload/ale/cursor.vim
@@ -18,7 +18,7 @@ function! s:EchoWithShortMess(setting, message) abort
elseif a:setting is# 'off'
setlocal shortmess-=T
" Regular echo is needed for printing newline characters.
- echo a:message
+ execute 'echo a:message'
else
throw 'Invalid setting: ' . string(a:setting)
endif
@@ -78,7 +78,7 @@ function! s:EchoImpl() abort
elseif get(l:info, 'echoed')
" We'll only clear the echoed message when moving off errors once,
" so we don't continually clear the echo line.
- echo
+ execute 'echo'
let l:info.echoed = 0
endif
endfunction
@@ -126,6 +126,6 @@ function! ale#cursor#ShowCursorDetail() abort
let l:message = get(l:loc, 'detail', l:loc.text)
call ale#preview#Show(split(l:message, "\n"))
- echo
+ execute 'echo'
endif
endfunction
diff --git a/autoload/ale/debugging.vim b/autoload/ale/debugging.vim
index 7454bb1a..9ce69ce8 100644
--- a/autoload/ale/debugging.vim
+++ b/autoload/ale/debugging.vim
@@ -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
diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim
index e08de16c..f65108ff 100644
--- a/autoload/ale/engine.vim
+++ b/autoload/ale/engine.vim
@@ -251,10 +251,10 @@ function! s:HandleTSServerDiagnostics(response, error_type) abort
endfunction
function! s:HandleLSPErrorMessage(error_message) abort
- echoerr 'Error from LSP:'
+ execute 'echoerr ''Error from LSP:'''
for l:line in split(a:error_message, "\n")
- echoerr l:line
+ execute 'echoerr l:line'
endfor
endfunction
diff --git a/autoload/ale/fix.vim b/autoload/ale/fix.vim
index 5a42b74f..c4143aa1 100644
--- a/autoload/ale/fix.vim
+++ b/autoload/ale/fix.vim
@@ -75,7 +75,7 @@ function! ale#fix#ApplyFixes(buffer, output) abort
if l:data.lines_before != l:lines
call remove(g:ale_fix_buffer_data, a:buffer)
- echoerr 'The file was changed before fixing finished'
+ execute 'echoerr ''The file was changed before fixing finished'''
return
endif
endif
@@ -406,17 +406,18 @@ function! ale#fix#Fix(...) abort
let l:callback_list = s:GetCallbacks()
catch /E700/
let l:function_name = join(split(split(v:exception, ':')[3]))
- echom printf(
+ let l:echo_message = printf(
\ 'There is no fixer named `%s`. Check :ALEFixSuggest',
\ l:function_name,
\)
+ execute 'echom l:echo_message'
return 0
endtry
if empty(l:callback_list)
if l:fixing_flag is# ''
- echom 'No fixers have been defined. Try :ALEFixSuggest'
+ execute 'echom ''No fixers have been defined. Try :ALEFixSuggest'''
endif
return 0
diff --git a/autoload/ale/toggle.vim b/autoload/ale/toggle.vim
index aa6d113b..7197498e 100644
--- a/autoload/ale/toggle.vim
+++ b/autoload/ale/toggle.vim
@@ -158,7 +158,7 @@ function! ale#toggle#ToggleBuffer(buffer) abort
" Disabling ALE globally removes autocmd events, so we cannot enable
" linting locally when linting is disabled globally
if l:enabled && !g:ale_enabled
- echom 'ALE cannot be enabled locally when disabled globally'
+ execute 'echom ''ALE cannot be enabled locally when disabled globally'''
return
endif