Ban use of ==# or ==? in the codebase, and prefer is# or is? instead

This commit is contained in:
w0rp
2017-08-08 08:39:13 +01:00
parent 5010ddc28f
commit a535d07f28
61 changed files with 158 additions and 154 deletions

View File

@@ -115,7 +115,7 @@ function! ale_linters#python#flake8#Handle(buffer, lines) abort
for l:match in ale#util#GetMatches(a:lines, l:pattern)
let l:code = l:match[3]
if (l:code ==# 'W291' || l:code ==# 'W293')
if (l:code is# 'W291' || l:code is# 'W293')
\ && !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
" Skip warnings for trailing whitespace if the option is off.
continue
@@ -128,12 +128,12 @@ function! ale_linters#python#flake8#Handle(buffer, lines) abort
\ 'type': 'W',
\}
if l:code[:0] ==# 'F' || l:code ==# 'E999'
if l:code[:0] is# 'F' || l:code is# 'E999'
let l:item.type = 'E'
elseif l:code[:0] ==# 'E'
elseif l:code[:0] is# 'E'
let l:item.type = 'E'
let l:item.sub_type = 'style'
elseif l:code[:0] ==# 'W'
elseif l:code[:0] is# 'W'
let l:item.sub_type = 'style'
endif

View File

@@ -31,13 +31,13 @@ function! ale_linters#python#pylint#Handle(buffer, lines) abort
"let l:failed = append(0, l:match)
let l:code = l:match[3]
if (l:code ==# 'C0303')
if (l:code is# 'C0303')
\ && !ale#Var(a:buffer, 'warn_about_trailing_whitespace')
" Skip warnings for trailing whitespace if the option is off.
continue
endif
if l:code ==# 'I0011'
if l:code is# 'I0011'
" Skip 'Locally disabling' message
continue
endif
@@ -46,7 +46,7 @@ function! ale_linters#python#pylint#Handle(buffer, lines) abort
\ 'lnum': l:match[1] + 0,
\ 'col': l:match[2] + 1,
\ 'text': l:code . ': ' . l:match[5] . ' (' . l:match[4] . ')',
\ 'type': l:code[:0] ==# 'E' ? 'E' : 'W',
\ 'type': l:code[:0] is# 'E' ? 'E' : 'W',
\})
endfor