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 ruff format.

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. Nothing a working formatter emits should fail to compile, which is exactly why the check is worth keeping: a formatter that is broken, misconfigured or handed a file it mis-tokenises writes over the user’s source with something that will not run. When the result no longer compiles, 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.