0

I use ALE to check coding style, but I want to ignore the warning type:line too long, like this picture: enter image description here

And I find the related setting g:ale_exclude_highlights, this is its explanation in :help ale :

g:ale_exclude_highlights                             g:ale_exclude_highlights
                                                     b:ale_exclude_highlights

  Type: List
  Default: []

  A list of regular expressions for matching against highlight messages to
  remove. For example:

  " Do not highlight messages matching strings like these.
  let b:ale_exclude_highlights = ['line too long', 'foo.*bar']

So,

  1. I put let g:ale_exclude_highlights = ['line-too-long', 'line too long', 'Line too long', 'E501'] in ~/.vimrc,
  2. then open vim again,
  3. then check the above settings by :echo g:ale_exclude_highlights.

But the warning highlight still arise.

My question is: How to set the ALE configuration g:ale_exclude_highlights?

PS. & UPDATE: MY ALE Config(find in ::ALEInfo)

Current Filetype: python 
Available Linters: ['bandit', 'cspell', 'flake8', 'flakehell', 'jedils', 'mypy', 'prospector', 'pycln', 'pycodestyle', 'pydocstyle', 'pyflakes', 'pylama', 'pylint', 'pylsp', 'pyre', 'pyright', 'refurb', 'ruff', 'unimport', vulture'] 
Enabled Linters: ['flake8', 'pylint'] 
Ignored Linters: [] 
2
  • Could you tell us what is the language/filetype of the corresponding buffer? Could you tell us what is the linter you are using? Feb 26 at 9:17
  • @Vivian De Smedt Thank you for your remind, I've update some related info in the end of question. Feb 26 at 13:57

1 Answer 1

1

I'm not sure it applies to lines (see this ALE issue).

I suppose the best is to configure the underlying linter.

For the flake8 linter I have in ~/.flake8:

[flake8]
max-line-length = 125
ignore = 
    # E203: whitespace before ':'
    E203,
    # E501: line too long
    E501,
1
  • Thank you for replying, can I ask how to configure the underlying checker. Feb 26 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.