VIM version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Sep 19 2018 09:43:59)
Included patches: 1
Operating System: CentOS 7
Current Filetype: python
Available Linters: ['flake8', 'mypy', 'prospector', 'pycodestyle', 'pyflakes', 'pylint', 'pyls', 'pyre', 'vulture']
Enabled Linters: ['flake8', 'mypy', 'pylint']
Suggested Fixers:
'add_blank_lines_for_python_control_statements' - Add blank lines before control statements.
'autopep8' - Fix PEP8 issues with autopep8.
'black' - Fix PEP8 issues with black.
'isort' - Sort Python imports with isort.
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.
'yapf' - Fix Python files with yapf.
Linter Variables:
let g:ale_python_flake8_auto_pipenv = 0
let g:ale_python_flake8_change_directory = 1
let g:ale_python_flake8_executable = 'flake8'
let g:ale_python_flake8_options = ''
let g:ale_python_flake8_use_global = 0
let g:ale_python_mypy_auto_pipenv = 0
let g:ale_python_mypy_executable = 'mypy'
let g:ale_python_mypy_ignore_invalid_syntax = 0
let g:ale_python_mypy_options = ''
let g:ale_python_mypy_use_global = 0
let g:ale_python_pylint_auto_pipenv = 0
let g:ale_python_pylint_change_directory = 1
let g:ale_python_pylint_executable = 'pylint'
let g:ale_python_pylint_options = ''
let g:ale_python_pylint_use_global = 0
Global Variables:
let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = v:null
let g:ale_command_wrapper = v:null
let g:ale_completion_delay = v:null
let g:ale_completion_enabled = 0
let g:ale_completion_max_suggestions = v:null
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
let g:ale_echo_msg_info_str = 'Info'
let g:ale_echo_msg_warning_str = 'Warning'
let g:ale_enabled = 1
let g:ale_fix_on_save = 0
let g:ale_fixers = {'javascript': ['eslint']}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = v:null
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 0
let g:ale_lint_on_filetype_changed = 0
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'always'
let g:ale_lint_on_insert_leave = 0
let g:ale_linter_aliases = {}
let g:ale_linters = {'javascript': ['standard']}
let g:ale_linters_explicit = 0
let g:ale_list_window_size = v:null
let g:ale_list_vertical = v:null
let g:ale_loclist_msg_format = v:null
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = v:null
let g:ale_maximum_file_size = v:null
let g:ale_open_list = v:null
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_set_balloons = 0
let g:ale_set_highlights = 1
let g:ale_set_loclist = 1
let g:ale_set_quickfix = 0
let g:ale_set_signs = 1
let g:ale_sign_column_always = v:null
let g:ale_sign_error = v:null
let g:ale_sign_info = v:null
let g:ale_sign_offset = v:null
let g:ale_sign_style_error = v:null
let g:ale_sign_style_warning = v:null
let g:ale_sign_warning = v:null
let g:ale_statusline_format = v:null
let g:ale_type_map = v:null
let g:ale_use_global_executables = v:null
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
Command History:
Error detected while processing function ale#Lint[34]..ale#engine#RunLinters[14]..
xecutable[1]..ale_linters#python#flake8#GetExecutable[1]..ale#Var:
line 4:
E716: Key not present in Dictionary: ale_python_auto_pipenv
+1
same issue, how to solve it?
Error detected while processing function ale#events#LintOnEnter[5]..ale#Queue[49]..ale#Lint[34]..ale#engine#RunLinters[14]..<SNR>174_RunLinter[4]..ale#linter#GetExecutable[1]..ale_lin
ters#python#flake8#GetExecutable[1]..ale#Var:
line 4:
E716: Key not present in Dictionary: ale_python_auto_pipenv
E116: Invalid arguments for function get(l:vars, l:full_name, g:[l:full_name])
E15: Invalid expression: get(l:vars, l:full_name, g:[l:full_name])
HEAD^1 (e82bcdb) won't have this bug.The offending lines seem to be, from ale_linters/python/flake8.vim:
function! ale_linters#python#flake8#GetExecutable(buffer) abort
if (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_flake8_auto_pipenv'))
\ && ale#python#PipenvPresent(a:buffer)
return 'pipenv'
endif
...
The call to ale#Var(a:buffer, 'python_auto_pipenv') fails because that parameter has not been set yet; it is set in the file autoload/ale/python.vim, but the autoloading of that script has not yet been triggered when python linters are first invoked.
Possible solutions:
ale#python#auto_pipenv instead. This would trigger the autoload, but would either be a very special case, or (for consistency) require a larger redesign of the Set and Var mechanism and the documented config interface, so I guess it's not really an option. python_auto_pipenv at the top of each ale_linters/python/[linter].vim file.ale_linters#python#[linter]#GetExecutable() such that it deliberately triggers the requisite autoload before looking up the variable. For example, the condition could be reordered: if ale#python#PipenvPresent(a:buffer)
\ && (ale#Var(a:buffer, 'python_auto_pipenv') || ale#Var(a:buffer, 'python_flake8_auto_pipenv'))
...
Another option is to move the call to ale#python#FindExecutable() (from further down in the function) up to the top. In either case one ends up always calling a function that is only actually needed in one of three branches.
Just set values for the variables. I'll do that now.
Fixed. All of your solutions above were more complex than they needed to be, we just needed to set a default for the option in plugin/ale.vim.
This fixed me. Thank you.
Most helpful comment
Fixed. All of your solutions above were more complex than they needed to be, we just needed to set a default for the option in
plugin/ale.vim.