Ban getcwd() from the codebase, as it causes problems

This commit is contained in:
w0rp 2017-09-12 09:36:16 +01:00
parent 7f42aedaec
commit e2271b769c
2 changed files with 3 additions and 2 deletions

View File

@ -19,7 +19,7 @@ function! ale#test#SetDirectory(docker_path) abort
" Try to switch directory, which will fail when running tests directly,
" and not through the Docker image.
silent! execute 'cd ' . fnameescape(a:docker_path)
let g:dir = getcwd()
let g:dir = getcwd() " no-custom-checks
endfunction
" When g:dir is defined, switch back to the directory we saved, and then
@ -43,7 +43,7 @@ function! ale#test#SetFilename(path) abort
let l:dir = get(g:, 'dir', '')
if empty(l:dir)
let l:dir = getcwd()
let l:dir = getcwd() " no-custom-checks
endif
let l:full_path = ale#path#IsAbsolute(a:path)

View File

@ -85,6 +85,7 @@ check_errors 'let g:ale_\w\+_\w\+_args =' 'Name your option g:ale_<filetype>_<li
check_errors 'shellescape(' 'Use ale#Escape instead of shellescape'
check_errors 'simplify(' 'Use ale#path#Simplify instead of simplify'
check_errors "expand(['\"]%" "Use expand('#' . a:buffer . '...') instead. You might get a filename for the wrong buffer."
check_errors 'getcwd()' "Do not use getcwd(), as it could run from the wrong buffer. Use expand('#' . a:buffer . ':p:h') instead."
check_errors '==#' "Use 'is#' instead of '==#'. 0 ==# 'foobar' is true"
check_errors '==?' "Use 'is?' instead of '==?'. 0 ==? 'foobar' is true"
check_errors '!=#' "Use 'isnot#' instead of '!=#'. 0 !=# 'foobar' is false"