simvx.ide.lint.runner

Linting and formatting subprocess runner.

The commands are configurable (IDESection.lint_command / format_command); the shipped defaults are ruff check and black.

Module Contents

Classes

LintRunner

Runs the configured lint and format commands and feeds diagnostics into State.

Data

log

API

simvx.ide.lint.runner.log

‘getLogger(…)’

class simvx.ide.lint.runner.LintRunner(state: simvx.ide.state.State, config: simvx.ide.config.Config)[source]

Runs the configured lint and format commands and feeds diagnostics into State.

Initialization

lint_file(path: str) list[simvx.ide.state.Diagnostic][source]

Run ruff check on path, parse JSON output, update state diagnostics.

format_file(path: str) bool[source]

Run the configured formatter on path. Returns True when it stands.

The formatter rewrites the file in place, so its result is re-read before the rewrite is allowed to stand. A formatter may emit any syntax the interpreter accepts, and the parser scenes are loaded through accepts less than that: ruff format at target-version py314 rewrites except (A, B): as PEP 758 except A, B:, which parso 0.8.7 cannot read, so a scene formatted on save keeps running and stops opening in the editor. When the result no longer parses, the file goes back to what it was and the refusal is reported as an error diagnostic, which is what puts it in the output panel.

lint_on_save(path: str)[source]

Called after a file is saved – runs lint and updates diagnostics.

format_on_save(path: str)[source]

Format path on save, but only when the format_on_save setting is enabled.