8000 fix(python): map ruff syntax errors to parse-error instead of a null smell by LiinaSuoniemi · Pull Request #69 · habit-hooks/habit-hooks · GitHub
[go: up one dir, main page]

Skip to content

fix(python): map ruff syntax errors to parse-error instead of a null smell - #69

Merged
devill merged 1 commit into
habit-hooks:mainfrom
LiinaSuoniemi:fix-python-syntax-error-to-parse-error
Jul 1, 2026
Merged

devill merged 1 commit into
habit-hooks:mainfrom
LiinaSuoniemi:fix-python-syntax-error-to-parse-error

Conversation

@LiinaSuoniemi
Copy link
Copy Markdown
Contributor

The bug

A Python file that ruff cannot parse comes out with a null smell instead of parse-error. It renders as ── None ──, so a broken file is surfaced but mislabelled, not coached as the parse error it is.

Root cause

ruff reports syntax errors with the code invalid-syntax. The python ruff sensor's map only knows the six lint codes it selects, so invalid-syntax falls through the map to null.

The TypeScript plugin already handles this: eslint:fatal maps to parse-error (see smell-vocabulary.md). Python was just missing its twin, and the catalogue already has parse-error (enforced).

The fix

Map ruff:invalid-syntax to parse-error in the python ruff sensor, so a broken file is coached as a parse error and matches the TS behaviour.

Tests

  • New case in python-plugin.spec.md: a syntax-error file comes out as parse-error from ruff:invalid-syntax.
  • Updated the mirrored sensor command in the existing "crashing ruff" stderr assertion so it stays in lockstep.
  • Added the matching row for ruff:invalid-syntax and parse-error in smell-vocabulary.md.

The Python suite is green. The Node and PHP sensor specs that fail in CI are pre-existing and unrelated to this change (the workflow installs Python only).

…smell

A file ruff cannot parse is reported with the code invalid-syntax, which the python sensor's map did not know, so it fell through to a null smell and rendered as None instead of being coached. Maps invalid-syntax to parse-error, matching the TS plugin where eslint fatal already maps to parse-error. Adds a spec test, keeps the mirrored command in the crashing-ruff assertion in lockstep, and adds the vocab table row.
@devill
devill changed the base branch from v1.0 to main July 1, 2026 19:03
@devill
devill merged commit 4f91822 into habit-hooks:main Jul 1, 2026
1 of 2 checks passed
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.

2 participants

0