mirror of https://github.com/dense-analysis/ale
Complain about binary operators on the ends of lines
This commit is contained in:
parent
d072d2654c
commit
7a48750610
|
@ -101,8 +101,8 @@ function! ale_linters#perl6#perl6#Handle(buffer, lines) abort
|
|||
|
||||
if type(l:json) is v:t_dict
|
||||
for l:key in keys(l:json)
|
||||
if has_key(l:json[l:key], 'sorrows') &&
|
||||
\ has_key(l:json[l:key], 'worries')
|
||||
if has_key(l:json[l:key], 'sorrows')
|
||||
\&& has_key(l:json[l:key], 'worries')
|
||||
if !empty(l:json[l:key]['sorrows'])
|
||||
for l:dictionary in get(l:json[l:key], 'sorrows')
|
||||
for l:item in keys(l:dictionary)
|
||||
|
|
|
@ -87,8 +87,8 @@ endfunction
|
|||
" Skip sandbox error which is caused by directives
|
||||
" because what we want is syntactic or semantic check.
|
||||
function! s:Ignore(item) abort
|
||||
return a:item.type is# 'E' &&
|
||||
\ a:item.text =~# '\vNo permission to (call|directive|assert) sandboxed'
|
||||
return a:item.type is# 'E'
|
||||
\ && a:item.text =~# '\vNo permission to (call|directive|assert) sandboxed'
|
||||
endfunction
|
||||
|
||||
call ale#linter#Define('prolog', {
|
||||
|
|
|
@ -7,9 +7,10 @@ call ale#Set('python_bandit_use_global', get(g:, 'ale_use_global_executables', 0
|
|||
call ale#Set('python_bandit_auto_pipenv', 0)
|
||||
|
||||
function! ale_linters#python#bandit#GetExecutable(buffer) abort
|
||||
if (ale#Var(a:buffer, 'python_auto_pipenv') ||
|
||||
\ ale#Var(a:buffer, 'python_bandit_auto_pipenv'))
|
||||
\ && ale#python#PipenvPresent(a:buffer)
|
||||
if (
|
||||
\ ale#Var(a:buffer, 'python_auto_pipenv')
|
||||
\ || ale#Var(a:buffer, 'python_bandit_auto_pipenv')
|
||||
\) && ale#python#PipenvPresent(a:buffer)
|
||||
return 'pipenv'
|
||||
endif
|
||||
|
||||
|
|
|
@ -53,9 +53,11 @@ function! ale#loclist_jumping#FindNearest(direction, wrap, ...) abort
|
|||
\ l:search_item
|
||||
\)
|
||||
|
||||
if (l:filter is# 'any' || l:filter is# l:item.type) &&
|
||||
\ (l:subtype_filter is# 'any' ||
|
||||
\ l:subtype_filter is# get(l:item, 'sub_type', ''))
|
||||
if (l:filter is# 'any' || l:filter is# l:item.type)
|
||||
\&& (
|
||||
\ l:subtype_filter is# 'any'
|
||||
\ || l:subtype_filter is# get(l:item, 'sub_type', '')
|
||||
\)
|
||||
|
||||
if a:direction is# 'before' && l:cmp_value < 0
|
||||
return [l:item.lnum, l:item.col]
|
||||
|
@ -71,9 +73,11 @@ function! ale#loclist_jumping#FindNearest(direction, wrap, ...) abort
|
|||
" wrap around the list of warnings/errors
|
||||
if a:wrap
|
||||
for l:item in l:loclist
|
||||
if (l:filter is# 'any' || l:filter is# l:item.type) &&
|
||||
\ (l:subtype_filter is# 'any' ||
|
||||
\ l:subtype_filter is# get(l:item, 'sub_type', ''))
|
||||
if (l:filter is# 'any' || l:filter is# l:item.type)
|
||||
\&& (
|
||||
\ l:subtype_filter is# 'any'
|
||||
\ || l:subtype_filter is# get(l:item, 'sub_type', '')
|
||||
\)
|
||||
return [l:item.lnum, l:item.col]
|
||||
endif
|
||||
endfor
|
||||
|
|
|
@ -11,6 +11,7 @@ import re
|
|||
INDENTATION_RE = re.compile(r'^ *')
|
||||
COMMENT_LINE_RE = re.compile(r'^ *"')
|
||||
COMMAND_RE = re.compile(r'^ *([a-zA-Z\\]+)')
|
||||
OPERATOR_END_RE = re.compile(r'(&&|\|\||\+|-|\*\| /)$')
|
||||
|
||||
START_BLOCKS = set(['if', 'for', 'while', 'try', 'function'])
|
||||
END_BLOCKS = set(['endif', 'endfor', 'endwhile', 'endtry', 'endfunction'])
|
||||
|
@ -70,7 +71,7 @@ def check_lines(line_iter):
|
|||
if (
|
||||
previous_indentation_level is not None
|
||||
and indentation_level != previous_indentation_level
|
||||
and abs(indentation_level - previous_indentation_level) != 4
|
||||
and abs(indentation_level - previous_indentation_level) != 4 # noqa
|
||||
):
|
||||
yield (
|
||||
line_number,
|
||||
|
@ -119,6 +120,12 @@ def check_lines(line_iter):
|
|||
previous_line_blank = False
|
||||
previous_indentation_level = indentation_level
|
||||
|
||||
if OPERATOR_END_RE.search(line):
|
||||
yield (
|
||||
line_number,
|
||||
'Put operators at the start of lines instead'
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
status = 0
|
||||
|
|
Loading…
Reference in New Issue