summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ale_linters/perl6/perl6.vim4
-rw-r--r--ale_linters/prolog/swipl.vim4
-rw-r--r--ale_linters/python/bandit.vim7
-rw-r--r--autoload/ale/loclist_jumping.vim16
-rwxr-xr-xtest/script/block-padding-checker9
5 files changed, 26 insertions, 14 deletions
diff --git a/ale_linters/perl6/perl6.vim b/ale_linters/perl6/perl6.vim
index 59042e57..39406ac4 100644
--- a/ale_linters/perl6/perl6.vim
+++ b/ale_linters/perl6/perl6.vim
@@ -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)
diff --git a/ale_linters/prolog/swipl.vim b/ale_linters/prolog/swipl.vim
index 401e52b6..77261ede 100644
--- a/ale_linters/prolog/swipl.vim
+++ b/ale_linters/prolog/swipl.vim
@@ -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', {
diff --git a/ale_linters/python/bandit.vim b/ale_linters/python/bandit.vim
index 1b5a84a4..819c83aa 100644
--- a/ale_linters/python/bandit.vim
+++ b/ale_linters/python/bandit.vim
@@ -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
diff --git a/autoload/ale/loclist_jumping.vim b/autoload/ale/loclist_jumping.vim
index c56f1a7a..6b916227 100644
--- a/autoload/ale/loclist_jumping.vim
+++ b/autoload/ale/loclist_jumping.vim
@@ -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
diff --git a/test/script/block-padding-checker b/test/script/block-padding-checker
index 97ae7646..2feab6d0 100755
--- a/test/script/block-padding-checker
+++ b/test/script/block-padding-checker
@@ -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