Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Last update broke chktex linting for LaTeX it is needed to go back to reflog HEAD@{5} to have it back. #4712

Closed
wcazzola opened this issue Jan 22, 2024 · 9 comments · Fixed by #4725
Labels

Comments

@wcazzola
Copy link

wcazzola commented Jan 22, 2024

Information

VIM version

VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Jan 16 2024 00:00:00)
Included patches: 1-31

Operating System: Linux Fedora 38

What went wrong

I use ALE installed via Plug. Today I updated it to the last release. This has broken the linting of LaTeX files with chktex. Better it works (checking :ALEInfo) but it is not copied in the lopen window and you can't navigate to the error.

To solve the issue I went back on the git repo with
git checkout HEAD@{number}

The first one working is HEAD@{5}
Since the value 5 depends on which revision you are on the one working has this extra information

Previous HEAD position was 8922478 Add biome support for javascript (#4701)
HEAD is now at 9a23ec1 Ruff use json-lines output format (#4656)

Reproducing the bug

  1. update ALE plugin to the last version
  2. be sure chktex is one the chosen linter for LaTeX with let g:ale_linters = { 'latex' : ['chktex'] } or similar in your .vimrc
  3. create a file test.tex with content
    \documentclass{article}
    \begin{document}
    hello, () (
    \end{document}
  4. This files has at least two problems normally showed by chktex/ALE
    • line 4 W: No match found for '('. (15)
    • line 5 W: Number of '(' doesn't match the number of ')'! (17)
      But with the last revision they are not shown neither in the lopen window that is empty nor as annotations in the code nor as a symbol in the left column

:ALEInfo

Expand

Current Filetype: tex
Available Linters: ['alex', 'chktex', 'cspell', 'lacheck', 'proselint', 'redpen', 'texlab', 'textlint', 'vale', 'writegood']
Linter Aliases:
'writegood' -> ['write-good']
Enabled Linters: ['chktex', 'proselint']
Ignored Linters: []
Suggested Fixers:
'latexindent' - Indent code within environments, commands, after headings and within special code blocks.
'remove_trailing_lines' - Remove all blank lines at the end of a file.
'textlint' - Fix text files with textlint --fix
'trim_whitespace' - Remove all trailing whitespace characters at the end of every line.

Linter Variables:
let g:ale_tex_chktex_executable = 'chktex'
let g:ale_tex_chktex_options = '-I'

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 = 50
let g:ale_disable_lsp = 1
let g:ale_echo_cursor = 1
let g:ale_echo_msg_error_str = 'E'
let g:ale_echo_msg_format = '[%linter%]% 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 = 0
let g:ale_fixers = {'*': ['remove_trailing_lines', 'trim_whitespace'], 'javascript': ['eslint']}
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 = 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 = 0
let g:ale_lint_on_save = 1
let g:ale_lint_on_text_changed = 'always'
let g:ale_linter_aliases = {}
let g:ale_linters = {'sh': ['shellcheck', 'shell'], 'cpp': ['gcc', 'clang'], 'text': ['vale', 'proselint', 'writegood'], 'latex': ['chktex', 'vale', 'proselint', 'writegood'], 'kotlin': ['kotlinc'], 'ada': ['gcc'], 'bash': ['shellcheck', 'bashate', 'shell'], 'ocaml': ['merlin'], 'erlang': ['dialyzer', 'erlc'], 'python': ['pylint', 'flake8', 'mypy'], 'tex': ['chktex', 'proselint'], 'pony': ['ponyc'], 'java': ['eclipselsp', 'checkstyle'], 'idris': ['idris'], 'scala': ['metals', 'fsc'], 'elixir': ['elixir', 'dialyxir', 'mix']}
let g:ale_linters_explicit = 0
let g:ale_linters_ignore = {}
let g:ale_list_vertical = 0
let g:ale_list_window_size = 10
let g:ale_loclist_msg_format = '[%linter%]% code:% %s'
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_root = {}
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 = 'I'
let g:ale_sign_offset = 1000000
let g:ale_sign_style_error = 'S✘'
let g:ale_sign_style_warning = 'S▶'
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 = 'all'
let g:ale_warn_about_trailing_blank_lines = 1
let g:ale_warn_about_trailing_whitespace = 1

Command History:

(executable check - success) chktex
(finished - exit code 2) ['/usr/bin/bash', '-c', '''chktex'' -v0 -p stdin -q -s TabSize=1 -l ''.chktexrc'' -I < ''/tmp/vSLSNYi/4/prova.tex''']

<<>>
stdinTabSize=134TabSize=111TabSize=137TabSize=1You should avoid spaces after parenthesis.
stdinTabSize=182TabSize=179TabSize=118TabSize=1Use either `` or '' as an alternative to "'. stdinTabSize=134TabSize=110TabSize=115TabSize=1No match found for ('.
stdinTabSize=1144TabSize=11TabSize=117TabSize=1Number of `(' doesn't match the number of `)'!
<<>>

(executable check - success) proselint
(finished - exit code 1) ['/usr/bin/bash', '-c', 'proselint ''/tmp/vSLSNYi/5/prova.tex''']

<<>>

(finished - exit code 2) ['/usr/bin/bash', '-c', '''chktex'' -v0 -p stdin -q -s TabSize=1 -l ''.chktexrc'' -I < ''/tmp/vSLSNYi/13/prova.tex''']

<<>>
stdinTabSize=14TabSize=112TabSize=137TabSize=1You should avoid spaces after parenthesis.
stdinTabSize=14TabSize=111TabSize=115TabSize=1No match found for ('. stdinTabSize=17TabSize=11TabSize=117TabSize=1Number of (' doesn't match the number of `)'!
<<>>

(finished - exit code 1) ['/usr/bin/bash', '-c', 'proselint ''/tmp/vSLSNYi/14/prova.tex''']

<<>>

(finished - exit code 2) ['/usr/bin/bash', '-c', '''chktex'' -v0 -p stdin -q -s TabSize=1 -l ''.chktexrc'' -I < ''/tmp/vSLSNYi/15/prova.tex''']

<<>>
stdinTabSize=14TabSize=112TabSize=137TabSize=1You should avoid spaces after parenthesis.
stdinTabSize=14TabSize=111TabSize=115TabSize=1No match found for ('. stdinTabSize=17TabSize=11TabSize=117TabSize=1Number of (' doesn't match the number of `)'!
<<>>

(finished - exit code 1) ['/usr/bin/bash', '-c', 'proselint ''/tmp/vSLSNYi/16/prova.tex''']

<<>>

@wcazzola wcazzola added the bug label Jan 22, 2024
@hsanson
Copy link
Contributor

hsanson commented Feb 5, 2024

This PR #4661 caused the issue. Specifically this line: https://github.com/dense-analysis/ale/blob/master/ale_linters/tex/chktex.vim#L13

Removing that line seems to fix the issue.

@wcazzola
Copy link
Author

wcazzola commented Feb 5, 2024

Thank you for digging the issue. Can you fix it in? So that it will propagate with the next update?

@wcazzola
Copy link
Author

wcazzola commented Feb 16, 2024

Today I updated my plugins and it seems the problem is still there. Since the problem has been investigated and a solution found can be merged to the master? Or can be PR 4661 definitively reverted? Thank you.

@Jorenar
Copy link
Contributor

Jorenar commented Feb 24, 2024

I'm not even sure how I let that typo get there, but the fix is to replace -s with -S in line 13

@wcazzola
Copy link
Author

thank you

@hsanson
Copy link
Contributor

hsanson commented Feb 25, 2024

@Jorengarenar I believe we are not using the same chktex tool since there is no -S option supported on my chktex. This PR cases no output from chktex:

(executable check - success) chktex
(finished - exit code 1) ['/bin/bash', '-c', '''chktex'' -v0 -p stdin -q -S TabSize=1 -I < ''/tmp/nvim.ryujin/99CfNd/2/test.tex''']

<<<NO OUTPUT RETURNED>>>

Using small -s uses TabSize=1 as splitchar that is correct according to documentation of chktex but causes ALE to break:

(executable check - success) chktex
(finished - exit code 2) ['/bin/bash', '-c', '''chktex'' -v0 -p stdin -q -s TabSize=1 -I < ''/tmp/nvim.ryujin/6X7MzX/2/test.tex''']

<<<OUTPUT STARTS>>>
stdinTabSize=13TabSize=116TabSize=137TabSize=1You should avoid spaces after parenthesis.
stdinTabSize=13TabSize=115TabSize=115TabSize=1No match found for `('.
stdinTabSize=14TabSize=11TabSize=117TabSize=1Number of `(' doesn't match the number of `)'!
<<<OUTPUT ENDS>>>

Chktex help:

ChkTeX v1.7.6 - Copyright 1995-96 Jens T. Berger Thielemann.
Compiled with PCRE regex support.        

 -s  --splitchar : String used to split fields when doing -v0

I will move forward merging #4725 to remove this -s/-S option altogether.

@Jorenar
Copy link
Contributor

Jorenar commented Feb 25, 2024

@hsanson
Indeed, version 1.7.6 (2016-09-09) doesn't have -S option, which was added in version 1.7.7 (2022-10-17).
I'll add a check to test -S option availability.

@wcazzola
Copy link
Author

my chktex v1.7.8 has both switches with really different meanings:

  • -S --set : Read it's argument as if from chktexrc.
    e.g., -S TabSize=8 will override the TabSize.
  • -s --splitchar : String used to split fields when doing -v0

I don't know which should be the expected behavior but to avoid any mispelling/misinterpretations I would suggest to use the long version of the switch.

@hsanson
Copy link
Contributor

hsanson commented Feb 26, 2024

I merged #4725 to fix the issue affecting users, including me. We can add the -S flag as long as it is optional via configuration or auto-detection of chktex version.

For those that need this flag they can use the g:ale_tex_chktex_options or chktexrc configuration to add it. Also note that according to the manual TabSize is by default 8 so not sure why this was needed on first place and that the -S flag does not seem documented:

hsanson pushed a commit that referenced this issue Feb 26, 2024
#4727)

* Fix '-s' to be '-S' when setting 'TabSize=1' for chktex

Fixes #4712
Closes #4725

* Check if chktex's -S option is available

* Check chktex version instead of trying -S option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants