Ban !=# and !=? from the codebase
This commit is contained in:
parent
b1462ac66c
commit
d5ae3201a4
@ -14,7 +14,7 @@ function! ale_linters#dockerfile#hadolint#Handle(buffer, lines) abort
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
let l:lnum = 0
|
||||
|
||||
if l:match[1] !=# ''
|
||||
if l:match[1] isnot# ''
|
||||
let l:lnum = l:match[1] + 0
|
||||
endif
|
||||
|
||||
|
@ -31,7 +31,7 @@ function! ale_linters#elm#make#Handle(buffer, lines) abort
|
||||
\})
|
||||
endif
|
||||
endfor
|
||||
elseif l:line !=# 'Successfully generated /dev/null'
|
||||
elseif l:line isnot# 'Successfully generated /dev/null'
|
||||
call add(l:unparsed_lines, l:line)
|
||||
endif
|
||||
endfor
|
||||
|
@ -13,7 +13,7 @@ let s:classpath_sep = has('unix') ? ':' : ';'
|
||||
|
||||
function! ale_linters#kotlin#kotlinc#GetImportPaths(buffer) abort
|
||||
" exec maven/gradle only if classpath is not set
|
||||
if ale#Var(a:buffer, 'kotlin_kotlinc_classpath') !=# ''
|
||||
if ale#Var(a:buffer, 'kotlin_kotlinc_classpath') isnot# ''
|
||||
return ''
|
||||
else
|
||||
let l:pom_path = ale#path#FindNearestFile(a:buffer, 'pom.xml')
|
||||
@ -70,7 +70,7 @@ function! ale_linters#kotlin#kotlinc#GetCommand(buffer, import_paths) abort
|
||||
endif
|
||||
|
||||
" We only get here if not using module or the module file not readable
|
||||
if ale#Var(a:buffer, 'kotlin_kotlinc_classpath') !=# ''
|
||||
if ale#Var(a:buffer, 'kotlin_kotlinc_classpath') isnot# ''
|
||||
let l:kotlinc_opts .= ' -cp ' . ale#Var(a:buffer, 'kotlin_kotlinc_classpath')
|
||||
else
|
||||
" get classpath from maven/gradle
|
||||
@ -78,7 +78,7 @@ function! ale_linters#kotlin#kotlinc#GetCommand(buffer, import_paths) abort
|
||||
endif
|
||||
|
||||
let l:fname = ''
|
||||
if ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath') !=# ''
|
||||
if ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath') isnot# ''
|
||||
let l:fname .= expand(ale#Var(a:buffer, 'kotlin_kotlinc_sourcepath'), 1) . ' '
|
||||
else
|
||||
" Find the src directory for files in this project.
|
||||
@ -121,7 +121,7 @@ function! ale_linters#kotlin#kotlinc#Handle(buffer, lines) abort
|
||||
let l:curbuf_abspath = expand('#' . a:buffer . ':p')
|
||||
|
||||
" Skip if file is not loaded
|
||||
if l:buf_abspath !=# l:curbuf_abspath
|
||||
if l:buf_abspath isnot# l:curbuf_abspath
|
||||
continue
|
||||
endif
|
||||
let l:type_marker_str = l:type is# 'warning' ? 'W' : 'E'
|
||||
|
@ -12,7 +12,7 @@ function! ale_linters#nim#nimcheck#Handle(buffer, lines) abort
|
||||
" module names.
|
||||
|
||||
let l:temp_buffer_filename = fnamemodify(l:match[1], ':p:t')
|
||||
if l:buffer_filename !=# '' && l:temp_buffer_filename !=# l:buffer_filename
|
||||
if l:buffer_filename isnot# '' && l:temp_buffer_filename isnot# l:buffer_filename
|
||||
continue
|
||||
endif
|
||||
|
||||
|
@ -34,7 +34,7 @@ function! ale_linters#perl#perl#Handle(buffer, lines) abort
|
||||
|
||||
if ale#path#IsBufferPath(a:buffer, l:match[2])
|
||||
\ && (
|
||||
\ l:text !=# 'BEGIN failed--compilation aborted'
|
||||
\ l:text isnot# 'BEGIN failed--compilation aborted'
|
||||
\ || empty(l:output)
|
||||
\ || match(l:output[-1].text, s:begin_failed_skip_pattern) < 0
|
||||
\ )
|
||||
|
@ -41,10 +41,10 @@ function! ale_linters#perl#perlcritic#GetCommand(buffer) abort
|
||||
let l:command = ale#Escape(ale_linters#perl#perlcritic#GetExecutable(a:buffer))
|
||||
\ . " --verbose '". l:critic_verbosity . "' --nocolor"
|
||||
|
||||
if l:profile !=? ''
|
||||
if l:profile isnot? ''
|
||||
let l:command .= ' --profile ' . ale#Escape(l:profile)
|
||||
endif
|
||||
if l:options !=? ''
|
||||
if l:options isnot? ''
|
||||
let l:command .= ' ' . l:options
|
||||
endif
|
||||
|
||||
|
@ -37,7 +37,7 @@ function! ale_linters#python#mypy#Handle(buffer, lines) abort
|
||||
let l:buffer_filename = expand('#' . a:buffer . ':p')
|
||||
|
||||
for l:match in ale#util#GetMatches(a:lines, l:pattern)
|
||||
if l:buffer_filename[-len(l:match[1]):] !=# l:match[1]
|
||||
if l:buffer_filename[-len(l:match[1]):] isnot# l:match[1]
|
||||
continue
|
||||
endif
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
let g:ale_rust_cargo_use_check = get(g:, 'ale_rust_cargo_use_check', 0)
|
||||
|
||||
function! ale_linters#rust#cargo#GetCargoExecutable(bufnr) abort
|
||||
if ale#path#FindNearestFile(a:bufnr, 'Cargo.toml') !=# ''
|
||||
if ale#path#FindNearestFile(a:bufnr, 'Cargo.toml') isnot# ''
|
||||
return 'cargo'
|
||||
else
|
||||
" if there is no Cargo.toml file, we don't use cargo even if it exists,
|
||||
|
@ -7,7 +7,7 @@ function! ale_linters#rust#rustc#RustcCommand(buffer_number) abort
|
||||
" <project root>/target/release/deps/
|
||||
let l:cargo_file = ale#path#FindNearestFile(a:buffer_number, 'Cargo.toml')
|
||||
|
||||
if l:cargo_file !=# ''
|
||||
if l:cargo_file isnot# ''
|
||||
let l:project_root = fnamemodify(l:cargo_file, ':h')
|
||||
let l:dependencies = '-L ' . l:project_root . '/target/debug/deps -L ' .
|
||||
\ l:project_root . '/target/release/deps'
|
||||
|
@ -58,7 +58,7 @@ function! ale#Queue(delay, ...) abort
|
||||
endfunction
|
||||
|
||||
function! s:ALEQueueImpl(delay, linting_flag, buffer) abort
|
||||
if a:linting_flag !=# '' && a:linting_flag !=# 'lint_file'
|
||||
if a:linting_flag isnot# '' && a:linting_flag isnot# 'lint_file'
|
||||
throw "linting_flag must be either '' or 'lint_file'"
|
||||
endif
|
||||
|
||||
|
@ -72,7 +72,7 @@ function! ale#cursor#EchoCursorWarning(...) abort
|
||||
endif
|
||||
|
||||
" Only echo the warnings in normal mode, otherwise we will get problems.
|
||||
if mode() !=# 'n'
|
||||
if mode() isnot# 'n'
|
||||
return
|
||||
endif
|
||||
|
||||
@ -118,7 +118,7 @@ function! ale#cursor#ShowCursorDetail() abort
|
||||
endif
|
||||
|
||||
" Only echo the warnings in normal mode, otherwise we will get problems.
|
||||
if mode() !=# 'n'
|
||||
if mode() isnot# 'n'
|
||||
return
|
||||
endif
|
||||
|
||||
|
@ -128,14 +128,14 @@ function! s:HandleLoclist(linter_name, buffer, loclist) abort
|
||||
|
||||
" Remove this linter from the list of active linters.
|
||||
" This may have already been done when the job exits.
|
||||
call filter(l:buffer_info.active_linter_list, 'v:val !=# a:linter_name')
|
||||
call filter(l:buffer_info.active_linter_list, 'v:val isnot# a:linter_name')
|
||||
|
||||
" Make some adjustments to the loclists to fix common problems, and also
|
||||
" to set default values for loclist items.
|
||||
let l:linter_loclist = ale#engine#FixLocList(a:buffer, a:linter_name, a:loclist)
|
||||
|
||||
" Remove previous items for this linter.
|
||||
call filter(g:ale_buffer_info[a:buffer].loclist, 'v:val.linter_name !=# a:linter_name')
|
||||
call filter(g:ale_buffer_info[a:buffer].loclist, 'v:val.linter_name isnot# a:linter_name')
|
||||
" Add the new items.
|
||||
call extend(g:ale_buffer_info[a:buffer].loclist, l:linter_loclist)
|
||||
|
||||
@ -169,8 +169,8 @@ function! s:HandleExit(job_id, exit_code) abort
|
||||
" Remove this job from the list.
|
||||
call ale#job#Stop(a:job_id)
|
||||
call remove(s:job_info_map, a:job_id)
|
||||
call filter(g:ale_buffer_info[l:buffer].job_list, 'v:val !=# a:job_id')
|
||||
call filter(g:ale_buffer_info[l:buffer].active_linter_list, 'v:val !=# l:linter.name')
|
||||
call filter(g:ale_buffer_info[l:buffer].job_list, 'v:val isnot# a:job_id')
|
||||
call filter(g:ale_buffer_info[l:buffer].active_linter_list, 'v:val isnot# l:linter.name')
|
||||
|
||||
" Stop here if we land in the handle for a job completing if we're in
|
||||
" a sandbox.
|
||||
|
@ -335,7 +335,7 @@ function! ale#fix#Fix(...) abort
|
||||
|
||||
let l:fixing_flag = get(a:000, 0, '')
|
||||
|
||||
if l:fixing_flag !=# '' && l:fixing_flag !=# 'save_file'
|
||||
if l:fixing_flag isnot# '' && l:fixing_flag isnot# 'save_file'
|
||||
throw "fixing_flag must be either '' or 'save_file'"
|
||||
endif
|
||||
|
||||
|
@ -161,7 +161,7 @@ function! ale#job#ParseVim8ProcessID(job_string) abort
|
||||
endfunction
|
||||
|
||||
function! ale#job#ValidateArguments(command, options) abort
|
||||
if a:options.mode !=# 'nl' && a:options.mode !=# 'raw'
|
||||
if a:options.mode isnot# 'nl' && a:options.mode isnot# 'raw'
|
||||
throw 'Invalid mode: ' . a:options.mode
|
||||
endif
|
||||
endfunction
|
||||
|
@ -60,8 +60,8 @@ function! ale#linter#PreProcess(linter) abort
|
||||
endif
|
||||
|
||||
let l:needs_address = l:obj.lsp is# 'socket'
|
||||
let l:needs_executable = l:obj.lsp !=# 'socket'
|
||||
let l:needs_command = l:obj.lsp !=# 'socket'
|
||||
let l:needs_executable = l:obj.lsp isnot# 'socket'
|
||||
let l:needs_command = l:obj.lsp isnot# 'socket'
|
||||
let l:needs_lsp_details = !empty(l:obj.lsp)
|
||||
|
||||
if empty(l:obj.lsp)
|
||||
@ -377,7 +377,7 @@ function! ale#linter#StartLSP(buffer, linter, callback) abort
|
||||
let l:address = ''
|
||||
let l:root = ale#util#GetFunction(a:linter.project_root_callback)(a:buffer)
|
||||
|
||||
if empty(l:root) && a:linter.lsp !=# 'tsserver'
|
||||
if empty(l:root) && a:linter.lsp isnot# 'tsserver'
|
||||
" If there's no project root, then we can't check files with LSP,
|
||||
" unless we are using tsserver, which doesn't use project roots.
|
||||
return {}
|
||||
|
@ -62,7 +62,7 @@ function! ale#list#SetLists(buffer, loclist) abort
|
||||
endif
|
||||
|
||||
" If focus changed, restore it (jump to the last window).
|
||||
if l:winnr !=# winnr()
|
||||
if l:winnr isnot# winnr()
|
||||
wincmd p
|
||||
endif
|
||||
|
||||
|
@ -296,7 +296,7 @@ function! ale#lsp#ConnectToAddress(address, project_root, callback) abort
|
||||
" Get the current connection or a new one.
|
||||
let l:conn = !empty(l:conn) ? l:conn : s:NewConnection()
|
||||
|
||||
if !has_key(l:conn, 'channel') || ch_status(l:conn.channel) !=# 'open'
|
||||
if !has_key(l:conn, 'channel') || ch_status(l:conn.channel) isnot# 'open'
|
||||
let l:conn.channnel = ch_open(a:address, {
|
||||
\ 'mode': 'raw',
|
||||
\ 'waittime': 0,
|
||||
|
@ -10,7 +10,7 @@ function! ale#ruby#FindRailsRoot(buffer) abort
|
||||
\ ':h:h'
|
||||
\)
|
||||
|
||||
if l:dir !=# '.'
|
||||
if l:dir isnot# '.'
|
||||
\&& isdirectory(l:dir . '/app')
|
||||
\&& isdirectory(l:dir . '/config')
|
||||
\&& isdirectory(l:dir . '/db')
|
||||
|
@ -40,7 +40,7 @@ if !hlexists('ALESignColumnWithoutErrors')
|
||||
|
||||
if !empty(l:match)
|
||||
execute 'highlight link ALESignColumnWithoutErrors ' . l:match[1]
|
||||
elseif l:highlight_syntax !=# 'cleared'
|
||||
elseif l:highlight_syntax isnot# 'cleared'
|
||||
execute 'highlight ALESignColumnWithoutErrors ' . l:highlight_syntax
|
||||
endif
|
||||
endfunction
|
||||
|
@ -12,7 +12,7 @@
|
||||
"
|
||||
" This function should be run in a Vader Before: block.
|
||||
function! ale#test#SetDirectory(docker_path) abort
|
||||
if a:docker_path[:len('/testplugin/') - 1] !=# '/testplugin/'
|
||||
if a:docker_path[:len('/testplugin/') - 1] isnot# '/testplugin/'
|
||||
throw 'docker_path must start with /testplugin/!'
|
||||
endif
|
||||
|
||||
|
@ -136,7 +136,7 @@ function! s:LoadArgCount(function) abort
|
||||
endif
|
||||
|
||||
let l:match = matchstr(split(l:output, "\n")[0], '\v\([^)]+\)')[1:-2]
|
||||
let l:arg_list = filter(split(l:match, ', '), 'v:val !=# ''...''')
|
||||
let l:arg_list = filter(split(l:match, ', '), 'v:val isnot# ''...''')
|
||||
|
||||
return len(l:arg_list)
|
||||
endfunction
|
||||
|
@ -67,6 +67,8 @@ if (( FIX_ERRORS )); then
|
||||
sed -i "s/shellescape(/ale#Escape(/" "$directory"/**/*.vim
|
||||
sed -i 's/==#/is#/g' "$directory"/**/*.vim
|
||||
sed -i 's/==?/is?/g' "$directory"/**/*.vim
|
||||
sed -i 's/!=#/isnot#/g' "$directory"/**/*.vim
|
||||
sed -i 's/!=?/isnot?/g' "$directory"/**/*.vim
|
||||
done
|
||||
fi
|
||||
|
||||
@ -84,5 +86,7 @@ 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 '==#' "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"
|
||||
check_errors '!=?' "Use 'isnot?' instead of '!=?'. 0 !=? 'foobar' is false"
|
||||
|
||||
exit $RETURN_CODE
|
||||
|
@ -236,7 +236,7 @@ function! ALEInitAuGroups() abort
|
||||
" opening a buffer. The FileType will fire when buffers are opened.
|
||||
autocmd FileType *
|
||||
\ if has_key(b:, 'ale_original_filetype')
|
||||
\ && b:ale_original_filetype !=# expand('<amatch>')
|
||||
\ && b:ale_original_filetype isnot# expand('<amatch>')
|
||||
\| call ale#Queue(300, 'lint_file')
|
||||
\| endif
|
||||
endif
|
||||
|
@ -135,7 +135,7 @@ Execute (g:ale_lint_on_filetype_changed = 1 should bind FileType, and required b
|
||||
\ 'BufReadPost * let b:ale_original_filetype = &filetype',
|
||||
\ 'FileType * '
|
||||
\ . 'if has_key(b:, ''ale_original_filetype'') '
|
||||
\ . '&& b:ale_original_filetype !=# expand(''<amatch>'')'
|
||||
\ . '&& b:ale_original_filetype isnot# expand(''<amatch>'')'
|
||||
\ . '| call ale#Queue(300, ''lint_file'')'
|
||||
\ . '| endif',
|
||||
\], CheckAutocmd('ALERunOnFiletypeChangeGroup')
|
||||
|
Loading…
Reference in New Issue
Block a user