Add g:ale_python_flake8_executable (#174)
* Add g:ale_python_flake8_executable Closes #172. * Add g:ale_python_flake8_args * Always add - to flake8 invocations
This commit is contained in:
		
							parent
							
								
									498a9435de
								
							
						
					
					
						commit
						713a6910d4
					
				@ -1,9 +1,24 @@
 | 
			
		||||
" Author: w0rp <devw0rp@gmail.com>
 | 
			
		||||
" Description: flake8 for python files
 | 
			
		||||
 | 
			
		||||
let g:ale_python_flake8_executable =
 | 
			
		||||
\   get(g:, 'ale_python_flake8_executable', 'flake8')
 | 
			
		||||
 | 
			
		||||
let g:ale_python_flake8_args =
 | 
			
		||||
\   get(g:, 'ale_python_flake8_args', '')
 | 
			
		||||
 | 
			
		||||
function! ale_linters#python#flake8#GetExecutable(buffer) abort
 | 
			
		||||
    return g:ale_python_flake8_executable
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
function! ale_linters#python#flake8#GetCommand(buffer) abort
 | 
			
		||||
    return ale_linters#python#flake8#GetExecutable(a:buffer)
 | 
			
		||||
    \   . ' ' . g:ale_python_flake8_args . ' -'
 | 
			
		||||
endfunction
 | 
			
		||||
 | 
			
		||||
call ale#linter#Define('python', {
 | 
			
		||||
\   'name': 'flake8',
 | 
			
		||||
\   'executable': 'flake8',
 | 
			
		||||
\   'command': 'flake8 -',
 | 
			
		||||
\   'executable_callback': 'ale_linters#python#flake8#GetExecutable',
 | 
			
		||||
\   'command_callback': 'ale_linters#python#flake8#GetCommand',
 | 
			
		||||
\   'callback': 'ale#handlers#HandlePEP8Format',
 | 
			
		||||
\})
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										28
									
								
								doc/ale.txt
									
									
									
									
									
								
							
							
						
						
									
										28
									
								
								doc/ale.txt
									
									
									
									
									
								
							@ -598,6 +598,34 @@ g:ale_c_clang_options                                   *g:ale_c_clang_options*
 | 
			
		||||
 | 
			
		||||
  This variable can be change to modify flags given to clang.
 | 
			
		||||
 | 
			
		||||
-------------------------------------------------------------------------------
 | 
			
		||||
4.17. python-flake8                          *ale-linter-options-python-flake8*
 | 
			
		||||
 | 
			
		||||
g:ale_python_flake8_executable                 *g:ale_python_flake8_executable*
 | 
			
		||||
 | 
			
		||||
  Type: |String|
 | 
			
		||||
  Default: `'flake8'`
 | 
			
		||||
 | 
			
		||||
  This variable can be changed to modify the executable used for flake8.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
g:ale_python_flake8_args                             *g:ale_python_flake8_args*
 | 
			
		||||
 | 
			
		||||
  Type: |String|
 | 
			
		||||
  Default: `''`
 | 
			
		||||
 | 
			
		||||
  This variable can be changed to add command-line arguments to the flake8
 | 
			
		||||
  invocation.
 | 
			
		||||
 | 
			
		||||
For example, to dynamically switch between programs targeting Python 2 and
 | 
			
		||||
Python 3, you may want to set >
 | 
			
		||||
 | 
			
		||||
  let g:ale_python_flake8_executable = 'python3'   " or 'python' for Python 2
 | 
			
		||||
  let g:ale_python_flake8_args = '-m flake8'
 | 
			
		||||
 | 
			
		||||
after making sure it's installed for the appropriate Python versions (e.g.
 | 
			
		||||
`python3 -m pip install --user flake8`).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
===============================================================================
 | 
			
		||||
5. Commands/Keybinds                                             *ale-commands*
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user