summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorKevin Locke <kevin@kevinlocke.name>2019-02-10 20:37:13 -0700
committerKevin Locke <kevin@kevinlocke.name>2019-02-12 10:45:26 -0700
commita6caa85a58d81aa4cd47172979a9c94aa8a902c6 (patch)
treeb05c7aa83a50e1b8fb21838b59d6006a24795a7e /ale_linters
parentbf196ba17c9e261e4e3a9dba64260c6d0b2c8af9 (diff)
downloadale-a6caa85a58d81aa4cd47172979a9c94aa8a902c6.zip
pylama: Use %s instead of %t
Although using %t to lint changes was desirable, many pylama checks use surrounding paths and file contents (e.g. C0103 module name, E0402 relative import beyond top, etc.) The more such errors I find during testing, the less %t seems like a good idea. Switch to %s. Also set `lint_file` to 1 and mark Pylama as a file linter in the docs. Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/python/pylama.vim12
1 files changed, 5 insertions, 7 deletions
diff --git a/ale_linters/python/pylama.vim b/ale_linters/python/pylama.vim
index 52b7c8c8..4ad25c0f 100644
--- a/ale_linters/python/pylama.vim
+++ b/ale_linters/python/pylama.vim
@@ -34,10 +34,13 @@ function! ale_linters#python#pylama#GetCommand(buffer) abort
\ ? ' run pylama'
\ : ''
+ " Note: Using %t to lint changes would be preferable, but many pylama
+ " checks use surrounding paths (e.g. C0103 module name, E0402 relative
+ " import beyond top, etc.). Neither is ideal.
return l:cd_string
\ . ale#Escape(l:executable) . l:exec_args
\ . ale#Pad(ale#Var(a:buffer, 'python_pylama_options'))
- \ . ' %t'
+ \ . ' %s'
endfunction
function! ale_linters#python#pylama#Handle(buffer, lines) abort
@@ -67,12 +70,6 @@ function! ale_linters#python#pylama#Handle(buffer, lines) abort
\}
for l:match in ale#util#GetMatches(a:lines, l:pattern)
- " Ignore C0103 for module name from temporary path (%t) which may not
- " comply with module-rgx.
- if l:match[3] is# 'C0103' && l:match[4] =~# '^Module name '
- continue
- endif
-
call add(l:output, {
\ 'lnum': str2nr(l:match[1]),
\ 'col': str2nr(l:match[2]),
@@ -91,4 +88,5 @@ call ale#linter#Define('python', {
\ 'executable_callback': 'ale_linters#python#pylama#GetExecutable',
\ 'command_callback': 'ale_linters#python#pylama#GetCommand',
\ 'callback': 'ale_linters#python#pylama#Handle',
+\ 'lint_file': 1,
\})