mypy: Pass user options before any others (#3582)

This enables us to use a custom `python` exe as the "mypy" executable
and pass `-m mypy` in `mypy_options`
This commit is contained in:
Daniel Leong 2021-02-11 15:29:23 -05:00 committed by GitHub
parent 3b184f88d3
commit 8cb9f5ef51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 18 deletions

View file

@ -43,12 +43,14 @@ function! ale_linters#python#mypy#GetCommand(buffer) abort
\ ? ' run mypy'
\ : ''
let l:options = ale#Var(a:buffer, 'python_mypy_options')
" We have to always switch to an explicit directory for a command so
" we can know with certainty the base path for the 'filename' keys below.
return ale#path#CdString(l:dir)
\ . ale#Escape(l:executable) . l:exec_args
\ . (len(l:options) ? (' ' . l:options) : '')
\ . ' --show-column-numbers'
\ . ale#Var(a:buffer, 'python_mypy_options')
\ . ' --shadow-file %s %t %s'
endfunction

View file

@ -29,7 +29,8 @@ Execute(The mypy command callback should let you set options):
AssertLinter 'mypy',
\ ale#path#CdString(g:dir) . ale#Escape('mypy')
\ . ' --show-column-numbers --some-option '
\ . ' --some-option'
\ . ' --show-column-numbers'
\ . ' --shadow-file %s %t %s'
Execute(The mypy command should switch directories to the detected project root):