Repository navigation
Convert ruff and pycodestyle character columns to byte columns - #5175
Open
jayhemnani9910 wants to merge 1 commit into
Open
jayhemnani9910 wants to merge 1 commit into
jayhemnani9910 wants to merge 1 commit into
Conversation
ruff and pycodestyle report columns in characters, and ALE uses them as byte offsets, so on a line with a multibyte character before the problem the highlight starts too early. Set vcol like the flake8 handler does.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ruff (
location.columnin its JSON output) and pycodestyle report columns in characters, but their handlers pass them as byte columns, so on a line with a multibyte character before the problem the column is off by one byte per extra byte. Withpycodestyle reports E231 at column 9 and ALE puts it on the
"before the comma; ruff reports F821 forprint("é", undefined_name)at column 12, which ALE puts on the space before the name. Both handlers now set'vcol': 1, as the flake8 and flakehell handlers do, so the engine converts the column withale#util#Col.pyflakes and pylint already report byte offsets, so their handlers are left alone.
Checked in Neovim 0.11 with ruff 0.16.10 and pycodestyle from PyPI: before, col 12 (ruff) and col 9 (pycodestyle); after, col 13 and col 10, on
undefined_nameand on the comma. The handler tests are updated for the new key; I didn't run the Vader suite locally (no Docker image/vader checkout here), so CI is the first run of those.