dense-analysis / ale

Check syntax in Vim/Neovim asynchronously and fix files, with Language Server Protocol (LSP) support
BSD 2-Clause "Simplified" License
13.58k stars 1.44k forks source link

Presence of pyproject.toml prevents lint on save. #2923

Open ghost opened 4 years ago

ghost commented 4 years ago

Information

VIM version

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 06 2019 17:31:41)
Included patches: 1-1453   

Ubuntu 18.0.4

What went wrong

vimrc contains ALE config specifying that python files should be subjected to black and isort on save. This works correctly. When pyproject.toml is added to a project, ALE stops running isort and black on save, flake8 still runs asynchronously as expected. pyproject.toml is only required to specify flake8 config, and therefore made no mention of black or isort. Adding [tool.black] and [tool.isort] (with no config since none is necessary) made no difference.

So:

[tool.flake8]
max-line-length = 119

and

[tool.flake8]
max-line-length = 119

[tool.black]

[tool.isort]

both give the same effect.

Deleting pyproject.toml altogether, results in lint on save working as expected.

:ALEInfo

Current Filetype: python Available Linters: ['bandit', 'flake8', 'mypy', 'prospector', 'pycodestyle', 'pydocstyle', 'pyflakes', 'pylama', 'pylint', 'pyls', 'pyre', 'vulture'] Enabled Linters: ['flake8', '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. '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_black_auto_pipenv = 0 let g:ale_python_black_change_directory = 1 let g:ale_python_black_executable = 'black' let g:ale_python_black_options = '' let g:ale_python_black_use_global = 0 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_isort_executable = 'isort' let g:ale_python_isort_options = '' let g:ale_python_isort_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 let g:ale_python_pylint_use_msg_id = 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 = 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 = 1 let g:ale_fixers = {'scss': ['prettier'], 'latex': ['chktex'], 'html': ['prettier'], '*': ['remove_trailing_lines', 'trim_whitespace'], 'javascript': ['eslint'], 'htmldjango': ['prettier'], 'rust': ['rustfmt'], 'python': ['isort', 'black']} 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'], 'tex': ['chktex', 'vale'], 'latex': ['chktex'], 'rust': ['rls'], 'javascript': ['eslint', 'prettier'], 'htmldjango': ['prettier'], 'text': ['vale'], 'python': ['flake8', 'pylint']} 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 = '[%linter%] %s [%severity%]' 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 = 0 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 = 0 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:

chrisberks commented 4 years ago

I'm not sure if this is related to the bug you're seeing, but Flake8 doesn't support pyproject.toml. https://flake8.pycqa.org/en/latest/user/configuration.html#configuration-locations https://gitlab.com/pycqa/flake8/-/issues/428