dense-analysis / ale

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

yamlfix configuration options are not used #4693

Open SKOHscripts opened 9 months ago

SKOHscripts commented 9 months ago

Information

VIM version

VIM - Vi IMproved 8.1 (2018 May 18, compilé Sep 27 2023 19:47:00)
Rustines incluses : 1-875, 878, 881, 883-884, 936, 948, 1046, 1365-1368, 1382, 1401, 4120, 4151-4152, 4214, 4218, 4397, 4428, 4899, 4919, 4921, 4977, 5023-5024, 805, 5043, 5063, 5126, 1858, 1873

YAMLFIX version

(ins)$ yamlfix --version
------------------------------------------------------------------
     yamlfix: 1.15.0
     Python: 3.7.3
     Platform: Linux-4.19.0-25-amd64-x86_64-with-debian-10.13
------------------------------------------------------------------

Operating System: Debian10

What went wrong

I just configured yamlfix usage with ale in order to fix common errors in yaml files. I went throught this process : https://lyz-code.github.io/yamlfix/#configure-environment-prefix to create some variables in my bashrc file:

# YAMLFIX config
export YAMLFIX_LINE_LENGTH="300"
export YAMLFIX_NONE_REPRESENTATION="null"
export YAMLFIX_SECTION_WHITELINES="1"
export YAMLFIX_COMMENTS_WHITELINES="1"
export YAMLFIX_EXPLICIT_START="false"
export YAMLFIX_quote_representation="'"

and configured this line in my vimrc file :

let g:ale_yaml_yamlfix_options = '--env-prefix "YAMLFIX_"'

These variables are not used at all and yamlfix continue to use default usage (adding "---" for example). Did I miss something ?

:ALEInfo

Expand ```vim Linter Variables: " Press Space to read :help for a setting let g:ale_yaml_ls_config = {} let g:ale_yaml_ls_executable = 'yaml-language-server' let g:ale_yaml_ls_use_global = 0 let g:ale_yaml_yamlfix_executable = 'yamlfix' let g:ale_yaml_yamlfix_options = '--env-prefix "YAMLFIX_"' let g:ale_yaml_yamlfix_use_global = 1 let g:ale_yaml_yamllint_executable = 'yamllint' let g:ale_yaml_yamllint_options = '' Global Variables: " Press Space to read :help for a setting 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_disable_lsp = 'auto' let g:ale_echo_cursor = 1 let g:ale_echo_msg_error_str = 'E' let g:ale_echo_msg_format = '[%linter%] [%severity%] %code: %%s' let g:ale_echo_msg_info_str = 'Info' let g:ale_echo_msg_warning_str = 'W' let g:ale_enabled = 1 let g:ale_fix_on_save = 1 let g:ale_fixers = {'*': ['remove_trailing_lines', 'trim_whitespace'], 'yaml': ['yamlfix'], 'python': ['add_blank_lines_for_python_control_statements', 'autopep8', 'black', 'yapf', 'pyflyby', 'autoimport']} let g:ale_history_enabled = 1 let g:ale_info_default_mode = 'preview' 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 = 1 let g:ale_lint_on_filetype_changed = 0 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'], 'rst': ['rstcheck'], 'yaml': ['yamllint'], 'gitcommit': ['gitlint'], 'python': ['pylama', 'bandit', 'cspell', 'flake8', 'flakehell', 'jedils', 'mypy', 'prospector', 'pycodestyle', 'pydocstyle', 'pyflakes', 'pylint', 'pylsp', 'pyre', 'pyright', 'refurb', 'ruff', 'unimport', 'vulture']} let g:ale_linters_explicit = 0 let g:ale_linters_ignore = {} let g:ale_list_vertical = v:null let g:ale_list_window_size = 5 let g:ale_loclist_msg_format = v:null 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 = v:null let g:ale_pattern_options = v:null let g:ale_pattern_options_enabled = v:null let g:ale_root = {} let g:ale_set_balloons = 0 let g:ale_set_highlights = 0 let g:ale_set_loclist = 0 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 = 'I' 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_type_map = {} let g:ale_use_neovim_diagnostics_api = 0 let g:ale_use_global_executables = v:null let g:ale_virtualtext_cursor = 'current' let g:ale_warn_about_trailing_blank_lines = 1 let g:ale_warn_about_trailing_whitespace = 1 Command History: (executable check - success) yamllint … (finished - exit code 1) ['/bin/bash', '-c', '''yamllint'' -f parsable ''/tmp/vZbWYpo/12/file.yaml'''] … (finished - exit code 0) ['/bin/bash', '-c', 'cd ''/home/directory'' && ''yamlfix'' --env-prefix "YAMLFIX_" - < ''/tmp/vZbWYpo/15/file.yaml'''] (started) ['/bin/bash', '-c', '''yamllint'' -f parsable ''/tmp/vZbWYpo/16/file.yaml'''] (finished - exit code 1) ['/bin/bash', '-c', '''yamllint'' -f parsable ''/tmp/vZbWYpo/17/file.yaml'''] … ```
deritter commented 6 months ago

YAMLFIX is already the default prefix, if you want to use that, you can simply skip the --env-prefix Parameter. If you want to use something different, don't include the '_' in --env-prefix. (--env-prefix "YAMLFIX")