From d5ae3201a4128c9e7b1042e9ea40b7f13cf72a10 Mon Sep 17 00:00:00 2001 From: w0rp Date: Fri, 11 Aug 2017 00:31:42 +0100 Subject: [PATCH] =?UTF-8?q?Ban=20!=3D#=20and=20!=3D=3F=20from=20the=20code?= =?UTF-8?q?base?= --- ale_linters/dockerfile/hadolint.vim | 2 +- ale_linters/elm/make.vim | 2 +- ale_linters/kotlin/kotlinc.vim | 8 ++++---- ale_linters/nim/nimcheck.vim | 2 +- ale_linters/perl/perl.vim | 2 +- ale_linters/perl/perlcritic.vim | 4 ++-- ale_linters/python/mypy.vim | 2 +- ale_linters/rust/cargo.vim | 2 +- ale_linters/rust/rustc.vim | 2 +- autoload/ale.vim | 2 +- autoload/ale/cursor.vim | 4 ++-- autoload/ale/engine.vim | 8 ++++---- autoload/ale/fix.vim | 2 +- autoload/ale/job.vim | 2 +- autoload/ale/linter.vim | 6 +++--- autoload/ale/list.vim | 2 +- autoload/ale/lsp.vim | 2 +- autoload/ale/ruby.vim | 2 +- autoload/ale/sign.vim | 2 +- autoload/ale/test.vim | 2 +- autoload/ale/util.vim | 2 +- custom-checks | 4 ++++ plugin/ale.vim | 2 +- test/test_ale_init_au_groups.vader | 2 +- 24 files changed, 37 insertions(+), 33 deletions(-) diff --git a/ale_linters/dockerfile/hadolint.vim b/ale_linters/dockerfile/hadolint.vim index 563be63..5550d69 100644 --- a/ale_linters/dockerfile/hadolint.vim +++ b/ale_linters/dockerfile/hadolint.vim @@ -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 diff --git a/ale_linters/elm/make.vim b/ale_linters/elm/make.vim index 5f7705b..04563a4 100644 --- a/ale_linters/elm/make.vim +++ b/ale_linters/elm/make.vim @@ -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 diff --git a/ale_linters/kotlin/kotlinc.vim b/ale_linters/kotlin/kotlinc.vim index c8d238b..00f94be 100644 --- a/ale_linters/kotlin/kotlinc.vim +++ b/ale_linters/kotlin/kotlinc.vim @@ -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' diff --git a/ale_linters/nim/nimcheck.vim b/ale_linters/nim/nimcheck.vim index e9576ff..cdd8c56 100644 --- a/ale_linters/nim/nimcheck.vim +++ b/ale_linters/nim/nimcheck.vim @@ -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 diff --git a/ale_linters/perl/perl.vim b/ale_linters/perl/perl.vim index 087d03e..3328806 100644 --- a/ale_linters/perl/perl.vim +++ b/ale_linters/perl/perl.vim @@ -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 \ ) diff --git a/ale_linters/perl/perlcritic.vim b/ale_linters/perl/perlcritic.vim index 6f23048..df2f8b2 100644 --- a/ale_linters/perl/perlcritic.vim +++ b/ale_linters/perl/perlcritic.vim @@ -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 diff --git a/ale_linters/python/mypy.vim b/ale_linters/python/mypy.vim index f71365a..1d4efe8 100644 --- a/ale_linters/python/mypy.vim +++ b/ale_linters/python/mypy.vim @@ -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 diff --git a/ale_linters/rust/cargo.vim b/ale_linters/rust/cargo.vim index 32c09a5..f19061a 100644 --- a/ale_linters/rust/cargo.vim +++ b/ale_linters/rust/cargo.vim @@ -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, diff --git a/ale_linters/rust/rustc.vim b/ale_linters/rust/rustc.vim index 73c99cd..e792faa 100644 --- a/ale_linters/rust/rustc.vim +++ b/ale_linters/rust/rustc.vim @@ -7,7 +7,7 @@ function! ale_linters#rust#rustc#RustcCommand(buffer_number) abort " /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' diff --git a/autoload/ale.vim b/autoload/ale.vim index 6e16a8e..766ed6f 100644 --- a/autoload/ale.vim +++ b/autoload/ale.vim @@ -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 diff --git a/autoload/ale/cursor.vim b/autoload/ale/cursor.vim index d30b1eb..693d164 100644 --- a/autoload/ale/cursor.vim +++ b/autoload/ale/cursor.vim @@ -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 diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim index 2cd691b..b22b1a6 100644 --- a/autoload/ale/engine.vim +++ b/autoload/ale/engine.vim @@ -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. diff --git a/autoload/ale/fix.vim b/autoload/ale/fix.vim index 3669fcd..80f46c2 100644 --- a/autoload/ale/fix.vim +++ b/autoload/ale/fix.vim @@ -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 diff --git a/autoload/ale/job.vim b/autoload/ale/job.vim index 63cb8ab..a52e57b 100644 --- a/autoload/ale/job.vim +++ b/autoload/ale/job.vim @@ -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 diff --git a/autoload/ale/linter.vim b/autoload/ale/linter.vim index 7c6f08f..80c045f 100644 --- a/autoload/ale/linter.vim +++ b/autoload/ale/linter.vim @@ -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 {} diff --git a/autoload/ale/list.vim b/autoload/ale/list.vim index 4487e95..e01f9e6 100644 --- a/autoload/ale/list.vim +++ b/autoload/ale/list.vim @@ -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 diff --git a/autoload/ale/lsp.vim b/autoload/ale/lsp.vim index ef09dde..b5525c9 100644 --- a/autoload/ale/lsp.vim +++ b/autoload/ale/lsp.vim @@ -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, diff --git a/autoload/ale/ruby.vim b/autoload/ale/ruby.vim index 503ff1d..b981ded 100644 --- a/autoload/ale/ruby.vim +++ b/autoload/ale/ruby.vim @@ -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') diff --git a/autoload/ale/sign.vim b/autoload/ale/sign.vim index 222fa6b..0652f4f 100644 --- a/autoload/ale/sign.vim +++ b/autoload/ale/sign.vim @@ -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 diff --git a/autoload/ale/test.vim b/autoload/ale/test.vim index 204b711..c045805 100644 --- a/autoload/ale/test.vim +++ b/autoload/ale/test.vim @@ -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 diff --git a/autoload/ale/util.vim b/autoload/ale/util.vim index 37c6f10..adfcd47 100644 --- a/autoload/ale/util.vim +++ b/autoload/ale/util.vim @@ -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 diff --git a/custom-checks b/custom-checks index 9a61eee..aad16c9 100755 --- a/custom-checks +++ b/custom-checks @@ -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 diff --git a/plugin/ale.vim b/plugin/ale.vim index 6b8b6ec..23e7ad1 100644 --- a/plugin/ale.vim +++ b/plugin/ale.vim @@ -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('') + \ && b:ale_original_filetype isnot# expand('') \| call ale#Queue(300, 'lint_file') \| endif endif diff --git a/test/test_ale_init_au_groups.vader b/test/test_ale_init_au_groups.vader index e036343..c7f5646 100644 --- a/test/test_ale_init_au_groups.vader +++ b/test/test_ale_init_au_groups.vader @@ -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('''')' + \ . '&& b:ale_original_filetype isnot# expand('''')' \ . '| call ale#Queue(300, ''lint_file'')' \ . '| endif', \], CheckAutocmd('ALERunOnFiletypeChangeGroup')