Skip to content

Convert ruff and pycodestyle character columns to byte columns - #5175

Open
jayhemnani9910 wants to merge 1 commit into
dense-analysis:masterfrom
jayhemnani9910:ruff-character-columns
Open

jayhemnani9910 wants to merge 1 commit into
dense-analysis:masterfrom
jayhemnani9910:ruff-character-columns

Conversation

@jayhemnani9910

Copy link
Copy Markdown

ruff (location.column in 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. With

y = ("é",undefined_name)

pycodestyle reports E231 at column 9 and ALE puts it on the " before the comma; ruff reports F821 for print("é", 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 with ale#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_name and 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.

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.
@jayhemnani9910
jayhemnani9910 requested a review from w0rp as a code owner October 29, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant