Skip to content

Releases: jarl-hoyem/pyrigor

v0.14.0

Choose a tag to compare

@jarl-hoyem jarl-hoyem released this 05 Oct 21:43

v0.14.0

JSON output is now the v2 diagnostics document, replacing v1. Consumers must select behaviour by schema_version.

Changed

  • All checkers and output use canonical findings with original-byte positions, enclosing symbols and suppressed findings (#269). Human summaries say "findings" rather than "violations".
  • A path with no representable file name now stops the run with exit code 2 before any file is read, and names every such path (#345).
  • Schema-rejected characters in finding messages, symbol names and operational errors are shown as visible escapes in human and JSON output, so an affected file no longer stops the run (#344).

Removed

  • The --show-fixes flag, which never reached the fixer.

Fixed

  • PYR406 now resolves quoted return annotations, names declared global, and names bound in alternative if and match arms (#277, #276, #279).
  • --fix reports source-file write errors without a traceback and continues with other files; output order no longer depends on directory enumeration order (#350).

Performance: about 15% slower on the standard library than v0.13.1, from the v2 model. Findings are identical on the standard library and on Home Assistant.

Full details in CHANGELOG.md.

v0.13.1

Choose a tag to compare

@jarl-hoyem jarl-hoyem released this 18 Sep 09:26

pyrigor 0.13.1

A fix release for --fix and for JSON output. If you used --fix from
0.13.0, upgrade before running it again: it could rewrite functions
PYR402 never reported, and place its separator inside a string.

Fixed

  • --fix and --diff now change only what PYR402 reports and keeps.
    They previously rewrote any signature they judged eligible themselves,
    including a method with a single parameter after self, which PYR402
    does not flag, and they ignored suppression comments. Rewriting
    def __eq__(self, other) that way makes every comparison raise
    TypeError.
  • --fix and --diff place the keyword-only separator correctly when a
    string above the function contains a character that str.splitlines()
    treats as a line break and Python's parser does not, such as U+2028 or
    a form feed. The separator could land inside that string, and the
    result still parsed, so nothing caught it.
  • --output-format=json no longer crashes the whole run, or reports a
    wrong column, in that same situation. One awkward file could end the
    run with no output at all, losing the findings of every other file.
    This affected every release since 0.10.0.

Details in #286,
#290 and
#295.

v0.13.0

Choose a tag to compare

@jarl-hoyem jarl-hoyem released this 05 Sep 11:03

pyrigor 0.13.0

This is the first release that can modify your code. --fix writes to
disk. It is opt-in, it refuses to run without naming PYR402 explicitly,
and --diff previews exactly the same change without writing.

Added

  • Added --fix and --diff for the safe PYR402 keyword-only argument
    fix. Both require an explicit --select=PYR402, and ordinary linting
    stays read-only.
  • Fixes preserve bytes. A UTF-8 byte order mark, CRLF endings, and files
    with mixed endings all survive untouched apart from the inserted
    keyword-only separator.
  • Documented how to show diagnostics in an editor without a plugin,
    covering PyCharm File Watchers, Vim and Neovim, Emacs, Visual Studio
    Code and Sublime Text. pyrigor already writes the generic
    file:line:column: message format, so this is configuration rather
    than an integration.

Fixed

  • Fixed PYR406 resolving deleted local names to outer functions.

v0.12.0

Choose a tag to compare

@jarl-hoyem jarl-hoyem released this 28 Aug 20:32

pyrigor 0.12.0

Added

  • Documented PYR207: frozen constant containers.
  • Documented PYR208: closed typed dictionaries.
  • Documented PYR209: sentinel builtins instead of hand-rolled object() sentinels.
  • Added adversarial testing across CLI behavior, checker semantics, suppression handling, and error paths.

Fixed

  • Hardened PYR406 return-value analysis across lexical bindings, imports, redefinitions, classes, comprehensions, and nested scopes.
  • Fixed PyCharm inspection tooling to preserve settings and validate its configurable inspection path.

Changed

  • Expanded CI and pre-commit quality checks, developer tooling, and release verification support.

v0.11.0

Choose a tag to compare

@jarl-hoyem jarl-hoyem released this 26 Aug 13:14

Added

  • Added native, repeatable --exclude PATH support.
  • Exclusions apply to individual files, directories, recursively discovered files, and explicitly supplied paths.
  • Added comprehensive CLI and manual-test coverage.
  • Updated the WIP pre-commit self-check to exercise native exclusions.

Refs #33

v0.10.0

Choose a tag to compare

@jarl-hoyem jarl-hoyem released this 25 Aug 20:50

JSON diagnostics for editor and tooling integrations

Pyrigor can now emit schema-validated v1 JSON diagnostics:

pyrigor --output-format=json path/

The output includes:

- Rule diagnostics with source locations and metadata
- Severity and fixability classifications
- Suppression summaries
- Structured read and parse errors
- A published JSON schema for consumers

The default human-readable output is unchanged.

## Validation

- 168 tests passed
- 100% branch coverage
- Full pre-commit suite passed
- pyscn clone scan completed

v0.9.0

Choose a tag to compare

@jarl-hoyem jarl-hoyem released this 23 Aug 16:49

Changed

  • CLI argument parsing (--version/-V, --select, paths) now uses the standard library's argparse instead of hand-rolled sys.argv scanning (#51). Real behavior improvements: --select PYR401 (space-separated) now works, previously only --select=PYR401 was recognized. An unrecognized flag is now an error immediately instead of being silently treated as a path. Also --help is now available.
  • --only renamed to --select, matching ruff's naming convention (#68). Same behavior, no deprecated alias — pyrigor has no users yet.

Added

  • Severity (error/warning/info, matching the Language Server Protocol's own DiagnosticSeverity naming rather than inventing pyrigor-specific terms) added to every rule's RuleInfo, accessible via Rule.PYRxxx.severity. Graded by consequence severity if the underlying pattern's bug actually occurs, not by how likely that is — see DECISIONS.md's "Severity" entry for the full per-rule reasoning.
  • --ignore=CODE,CODE flag, the rule-axis opposite of --select (#69). Excludes specific rules while running every other one; combines with --select (start from its set, remove --ignore's codes) the same way ruff's own select/ignore combine. A combination that leaves no rules to check errors immediately.

Full Changelog: v0.8.0...v0.9.0

v0.8.0

Choose a tag to compare

@jarl-hoyem jarl-hoyem released this 20 Aug 10:33

Fixed

  • pyrigor's CLI output hardcoded "Function" for every violation, even ones that are not functions — a PYR301 violation on an annotated variable printed Function 'x' ... instead of Variable 'x' .... Violation now carries a context_kind, set correctly per node type (Function/Variable/Call). Closes #11.

Changed

  • Suppression comments drop the colon after "pyrigor": # pyrigor: CODE # reason → # pyrigor CODE # reason. The colon form collided with ruff's ERA001 (commented-out-code) when a suppression comment sat on its own line, since pyrigor: 402 parses as valid Python (a bare annotation) and ERA001 flags any standalone comment that parses. This is a permanent syntax change, not a temporary workaround — existing colon-based comments will stop suppressing (they now print a near-miss warning instead of silently doing nothing, so the break is visible, not silent). Closes #46.

Minor bump, not patch: the suppression-syntax change is a deliberate, permanent break to public syntax, which this project's own versioning policy treats as "shifts what pyrigor is usable for."

v0.7.4

Choose a tag to compare

@jarl-hoyem jarl-hoyem released this 19 Aug 14:15

Fixed

  • pyrigor double-counted files and violations when the same file was reachable through two different path arguments (an overlapping directory argument, a relative versus absolute form) — for example pyrigor $(git diff --name-only) . in a CI script. _collect_python_files() now deduplicates by each file’s resolved path while keeping its first-seen string form for output. Closes #8.
  • --only= given a second time was silently treated as a path instead of erroring — pyrigor --only=PYR401 --only=PYR402 file.py dropped the second rule code entirely and produced a confusing "no such file" warning. A repeated --only= flag now errors immediately (exit code 2) instead. Closes #10.
  • Suppression comments were matched against each candidate line’s raw text via the regular expression, with no awareness of Python’s lexical structure. A string or docstring literal whose contents happened to exactly match # pyrigor: CODE # reason syntax could silently suppress a real violation on that line, since regular expression over raw text cannot distinguish a genuine comment from text that merely looks like one inside a string. Suppression matching now tokenizes the source and only considers genuine comment tokens. Closes #41.

v0.7.3

Choose a tag to compare

@jarl-hoyem jarl-hoyem released this 18 Aug 19:56

pyrigor v0.7.3

Suppression comments can now go on the line above a violation, or anywhere within a multi-line statement's own span.

Changes since v0.7.2

  • Added: # pyrigor: CODE # reason suppression comments may now also
    go on the line directly above a violation, or anywhere within a
    multi-line statement's own span — not just the violation's exact
    starting line. Fixes two real gaps: a long, descriptive name plus
    the mandatory reason not fitting on one line, and a same-line-only
    comment silently failing to suppress on a multi-line statement.

Install

pip install pyrigor