dense-analysis / dense-analysis/ale
g:ale_python_yapf_options does not take effect
- Dominant language
- Vim Script
- Stars
- 14k
- Forks
- 1.5k
- Avg merge
- 17h 49m
- Merged PRs (30d)
- 1
Description
## Information
**VIM version**
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Dec 15 2019 23:02:11)
MS-Windows 64-bit GUI version with OLE support
Operating System: Windows 10
Python: 3.7.3 64Bit for Windows
## What went wrong
g:ale_python_yapf_options not in effect.
## Reproducing the bug
1. test file content:
```python
def flist(l=[1]):
l.append(1)
print(l)
a = [1, 2, 3, 4, 4, 5, 6, 6, 6, 76, 56, 54, 4, 34, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 4, 4, 4]
flist()
flist()
def sum_two_num(x, y):
"""add two num"""
return x + y
print("测试")
print(sum_two_num(1, 2))
```
Correct formatted text:
```python
E:\>yapf --style "{based_on_style: pep8, column_limit: 120}" E:\test2.py
def flist(l=[1]):
l.append(1)
print(l)
a = [1, 2, 3, 4, 4, 5, 6, 6, 6, 76, 56, 54, 4, 34, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 3, 4, 5, 6, 7, 8, 1, 2, 4, 4, 4]
flist()
flist()
def sum_two_num(x, y):
"""add two num"""
return x + y
print("测试")
print(sum_two_num(1, 2))
```
The result with ALEFix:
```python
def flist(l=[1]):
l.append(1)
print(l)
a = [
1, 2, 3, 4, 4, 5, 6, 6, 6, 76, 56, 54, 4, 34, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
2, 3, 4, 5, 6, 7, 8, 1, 2, 4, 4, 4
]
flist()
flist()
def sum_two_num(x, y):
"""add two num"""
return x + y
print("测试")
print(sum_two_num(1, 2))
```
### :ALEInfo
Current Filetype: python
Available Linters: ['bandit', 'flake8', 'mypy', 'prospector', 'pycodestyle', 'pydocstyle', 'pyflakes', 'pylama', 'pylint', 'pyls', 'pyre', 'vulture']
Enabled Linters: ['flake8', 'pyls']
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.
'reorder-python-imports' - Sort Python imports with reorder-python-imports.
'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_auto_pipenv = 0
let g:ale_python_autopep8_options = '--max-line-length 120 --experimental'
let g:ale_python_black_options = '--line-length 120'
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 = '--max-line-length=120 --ignore=E302,E305,E401,E741,F402,F841'
let g:ale_python_flake8_use_global = 0
let g:ale_python_pyls_auto_pipenv = 0
let g:ale_python_pyls_config = {'pyls': {'plugins': {'pycodestyle': {'ignore': ['E302', 'E305', 'E401', 'E741', 'F841'], 'enabled': v:false, 'max-line-length': 120}, 'flake8': {'ignore': ['E302', 'E305', 'E401', 'E741', 'F841'], 'enabled': v:false, 'max-line-length': 120}}, 'configurationSources': ['flake8']}}
let g:ale_python_pyls_executable = 'pyls'
let g:ale_python_pyls_use_global = 0
let g:ale_python_reorder_python_imports_executable = 'reorder-python-imports'
let g:ale_python_reorder_python_imports_options = ''
let g:ale_python_reorder_python_imports_use_global = 0
let g:ale_python_yapf_executable = 'yapf'
let g:ale_python_yapf_options = '--style "{based_on_style: pep8, column_limit: 120}"'
let g:ale_python_yapf_use_global = 0
Global Variables:
let g:ale_cache_executable_check_failures = v:null
let g:ale_change_sign_column_color = 0
let g:ale_command_wrapper = ''
let g:ale_completion_delay = 100
let g:ale_completion_enabled = 1
let g:ale_completion_max_suggestions = 100
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'Error'
let g:ale_echo_msg_format = '%code: %%s'
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 = {'typescript': ['prettier'], 'json': ['prettier'], 'javascript': ['prettier'], 'python': ['yapf', 'reorder-python-imports']}
let g:ale_history_enabled = 1
let g:ale_history_log_output = 1
let g:ale_keep_list_window_open = 0
let g:ale_lint_delay = 200
let g:ale_lint_on_enter = 1
let g:ale_lint_on_filetype_changed = 1
let g:ale_lint_on_insert_leave = 1
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'normal'
let g:ale_linter_aliases = {}
let g:ale_linters = {'vim': ['vint'], 'typescript': ['eslint', 'tsserver'], 'json': ['jsonlint'], 'javascript': ['eslint', 'tsserver'], 'python': ['flake8', 'pyls']}
let g:ale_linters_explicit = 0
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '%code: %%s'
let g:ale_lsp_root = {}
let g:ale_max_buffer_history_size = 20
let g:ale_max_signs = -1
let g:ale_maximum_file_size = v:null
let g:ale_open_list = 1
let g:ale_pattern_options = v:null
let g:ale_pattern_options_enabled = v:null
let g:ale_set_balloons = 1
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 = 1
let g:ale_sign_error = '>>'
let g:ale_sign_info = '--'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = '>>'
let g:ale_sign_style_warning = '--'
let g:ale_sign_warning = '--'
let g:ale_sign_highlight_linenrs = 0
let g:ale_statusline_format = v:null
let g:ale_type_map = {}
let g:ale_use_global_executables = v:null
let g:ale_virtualtext_cursor = 0
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1
Command History:
(executable check - success) flake8
(finished - exit code 0) 'cmd /s/c "flake8 --version"'
<<>>
3.7.9 (mccabe: 0.6.1, pycodestyle: 2.5.0, pyflakes: 2.1.1) CPython 3.7.3 on Windows
<<>>
(executable check - success) pyls
(finished - exit code 0) 'cmd /s/c "cd /d E:\ && flake8 --max-line-length=120 --ignore=E302,E305,E401,E741,F402,F841 --format=default --stdin-display-name E:\test2.py - < C:\Users\ADMINI~1\AppData\Local\Temp\VIBFF9C.tmp\test2.py"'
<<>>
(started) 'cmd /s/c "pyls"'
(finished - exit code 0) 'cmd /s/c "yapf < C:\Users\ADMINI~1\AppData\Local\Temp\VICA98B.tmp\test2.py"'
(finished - exit code 0) 'cmd /s/c "reorder-python-imports - < C:\Users\ADMINI~1\AppData\Local\Temp\VIDAAD4.tmp\test2.py"'
(finished - exit code 0) 'cmd /s/c "cd /d E:\ && flake8 --max-line-length=120 --ignore=E302,E305,E401,E741,F402,F841 --format=default --stdin-display-name E:\test2.py - < C:\Users\ADMINI~1\AppData\Local\Temp\VIEAB81.tmp\test2.py"'
<<>>
(finished - exit code 0) 'cmd /s/c "cd /d E:\ && flake8 --max-line-length=120 --ignore=E302,E305,E401,E741,F402,F841 --format=default --stdin-display-name E:\test2.py - < C:\Users\ADMINI~1\AppData\Local\Temp\VIFB2B5.tmp\test2.py"'
<<>>
----
You see that I set `let g:ale_python_yapf_options = '--style "{based_on_style: pep8, column_limit: 120}"'`, but it still use default max line length 80.
Contributor guide
Assessment
This issue has not been assessed yet.