pylint: Move to the buffer's directory before running pylint command (Fix #1472)
This commit is contained in:
		
							parent
							
								
									2f2dcb8444
								
							
						
					
					
						commit
						4903b966a7
					
				@ -14,7 +14,8 @@ function! ale_linters#python#pylint#GetExecutable(buffer) abort
 | 
				
			|||||||
endfunction
 | 
					endfunction
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function! ale_linters#python#pylint#GetCommand(buffer) abort
 | 
					function! ale_linters#python#pylint#GetCommand(buffer) abort
 | 
				
			||||||
    return ale#Escape(ale_linters#python#pylint#GetExecutable(a:buffer))
 | 
					    return ale#path#BufferCdString(a:buffer)
 | 
				
			||||||
 | 
					    \   . ale#Escape(ale_linters#python#pylint#GetExecutable(a:buffer))
 | 
				
			||||||
    \   . ' ' . ale#Var(a:buffer, 'python_pylint_options')
 | 
					    \   . ' ' . ale#Var(a:buffer, 'python_pylint_options')
 | 
				
			||||||
    \   . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n'
 | 
					    \   . ' --output-format text --msg-template="{path}:{line}:{column}: {msg_id} ({symbol}) {msg}" --reports n'
 | 
				
			||||||
    \   . ' %s'
 | 
					    \   . ' %s'
 | 
				
			||||||
 | 
				
			|||||||
@ -28,7 +28,8 @@ Execute(The pylint callbacks should return the correct default values):
 | 
				
			|||||||
  \ 'pylint',
 | 
					  \ 'pylint',
 | 
				
			||||||
  \ ale_linters#python#pylint#GetExecutable(bufnr(''))
 | 
					  \ ale_linters#python#pylint#GetExecutable(bufnr(''))
 | 
				
			||||||
  AssertEqual
 | 
					  AssertEqual
 | 
				
			||||||
  \ ale#Escape('pylint') . ' ' . b:command_tail,
 | 
					  \ ale#path#BufferCdString(bufnr(''))
 | 
				
			||||||
 | 
					  \   . ale#Escape('pylint') . ' ' . b:command_tail,
 | 
				
			||||||
  \ ale_linters#python#pylint#GetCommand(bufnr(''))
 | 
					  \ ale_linters#python#pylint#GetCommand(bufnr(''))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Execute(The pylint executable should be configurable, and escaped properly):
 | 
					Execute(The pylint executable should be configurable, and escaped properly):
 | 
				
			||||||
@ -38,14 +39,16 @@ Execute(The pylint executable should be configurable, and escaped properly):
 | 
				
			|||||||
  \ 'executable with spaces',
 | 
					  \ 'executable with spaces',
 | 
				
			||||||
  \ ale_linters#python#pylint#GetExecutable(bufnr(''))
 | 
					  \ ale_linters#python#pylint#GetExecutable(bufnr(''))
 | 
				
			||||||
  AssertEqual
 | 
					  AssertEqual
 | 
				
			||||||
  \ ale#Escape('executable with spaces') . ' ' . b:command_tail,
 | 
					  \ ale#path#BufferCdString(bufnr(''))
 | 
				
			||||||
 | 
					  \   . ale#Escape('executable with spaces') . ' ' . b:command_tail,
 | 
				
			||||||
  \ ale_linters#python#pylint#GetCommand(bufnr(''))
 | 
					  \ ale_linters#python#pylint#GetCommand(bufnr(''))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Execute(The pylint command callback should let you set options):
 | 
					Execute(The pylint command callback should let you set options):
 | 
				
			||||||
  let g:ale_python_pylint_options = '--some-option'
 | 
					  let g:ale_python_pylint_options = '--some-option'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  AssertEqual
 | 
					  AssertEqual
 | 
				
			||||||
  \ ale#Escape('pylint') . ' --some-option' . b:command_tail,
 | 
					  \ ale#path#BufferCdString(bufnr(''))
 | 
				
			||||||
 | 
					  \   . ale#Escape('pylint') . ' --some-option' . b:command_tail,
 | 
				
			||||||
  \ ale_linters#python#pylint#GetCommand(bufnr(''))
 | 
					  \ ale_linters#python#pylint#GetCommand(bufnr(''))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Execute(The pylint callbacks shouldn't detect virtualenv directories where they don't exist):
 | 
					Execute(The pylint callbacks shouldn't detect virtualenv directories where they don't exist):
 | 
				
			||||||
@ -55,7 +58,8 @@ Execute(The pylint callbacks shouldn't detect virtualenv directories where they
 | 
				
			|||||||
  \ 'pylint',
 | 
					  \ 'pylint',
 | 
				
			||||||
  \ ale_linters#python#pylint#GetExecutable(bufnr(''))
 | 
					  \ ale_linters#python#pylint#GetExecutable(bufnr(''))
 | 
				
			||||||
  AssertEqual
 | 
					  AssertEqual
 | 
				
			||||||
  \ ale#Escape('pylint') . ' ' . b:command_tail,
 | 
					  \ ale#path#BufferCdString(bufnr(''))
 | 
				
			||||||
 | 
					  \   . ale#Escape('pylint') . ' ' . b:command_tail,
 | 
				
			||||||
  \ ale_linters#python#pylint#GetCommand(bufnr(''))
 | 
					  \ ale_linters#python#pylint#GetCommand(bufnr(''))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Execute(The pylint callbacks should detect virtualenv directories):
 | 
					Execute(The pylint callbacks should detect virtualenv directories):
 | 
				
			||||||
@ -70,7 +74,8 @@ Execute(The pylint callbacks should detect virtualenv directories):
 | 
				
			|||||||
  \ ale_linters#python#pylint#GetExecutable(bufnr(''))
 | 
					  \ ale_linters#python#pylint#GetExecutable(bufnr(''))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  AssertEqual
 | 
					  AssertEqual
 | 
				
			||||||
  \ ale#Escape(b:executable) . ' ' . b:command_tail,
 | 
					  \ ale#path#BufferCdString(bufnr(''))
 | 
				
			||||||
 | 
					  \   . ale#Escape(b:executable) . ' ' . b:command_tail,
 | 
				
			||||||
  \ ale_linters#python#pylint#GetCommand(bufnr(''))
 | 
					  \ ale_linters#python#pylint#GetCommand(bufnr(''))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Execute(You should able able to use the global pylint instead):
 | 
					Execute(You should able able to use the global pylint instead):
 | 
				
			||||||
@ -81,5 +86,6 @@ Execute(You should able able to use the global pylint instead):
 | 
				
			|||||||
  \ 'pylint',
 | 
					  \ 'pylint',
 | 
				
			||||||
  \ ale_linters#python#pylint#GetExecutable(bufnr(''))
 | 
					  \ ale_linters#python#pylint#GetExecutable(bufnr(''))
 | 
				
			||||||
  AssertEqual
 | 
					  AssertEqual
 | 
				
			||||||
  \ ale#Escape('pylint') . ' ' . b:command_tail,
 | 
					  \ ale#path#BufferCdString(bufnr(''))
 | 
				
			||||||
 | 
					  \   . ale#Escape('pylint') . ' ' . b:command_tail,
 | 
				
			||||||
  \ ale_linters#python#pylint#GetCommand(bufnr(''))
 | 
					  \ ale_linters#python#pylint#GetCommand(bufnr(''))
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user