Updating our ruff.toml to enforce recent py coding style(s) #87

Open
opened 2026-03-11 23:43:16 +00:00 by goodboy · 1 comment

From claude just after it wrote the new config in ba728ae0aa,

● Here's the summary of the new ruff.toml config and what it catches:

  Rules added

  ┌──────┬───────┬──────────┬───────────────────────────────────────────────┐
  │ Rule │ Count │ Fixable? │               What it enforces                │
  ├──────┼───────┼──────────┼───────────────────────────────────────────────┤
  │ D213 │ 131   │ yes      │ Summary on 2nd line after ''' (not same line) │
  ├──────┼───────┼──────────┼───────────────────────────────────────────────┤
  │ D205 │ 411   │ no       │ Blank line between summary and description    │
  ├──────┼───────┼──────────┼───────────────────────────────────────────────┤
  │ D204 │ 106   │ yes      │ 1 blank line after class docstring            │
  ├──────┼───────┼──────────┼───────────────────────────────────────────────┤
  │ D202 │ 4     │ yes      │ No blank lines after function docstring       │
  ├──────┼───────┼──────────┼───────────────────────────────────────────────┤
  │ D403 │ 4     │ yes      │ Capitalize first word                         │
  ├──────┼───────┼──────────┼───────────────────────────────────────────────┤
  │ W291 │ 14    │ no       │ Trailing whitespace                           │
  ├──────┼───────┼──────────┼───────────────────────────────────────────────┤
  │ W293 │ 1     │ yes      │ Blank line with whitespace                    │
  └──────┴───────┴──────────┴───────────────────────────────────────────────┘

  704 total violations, 274 auto-fixable with ruff check --fix.

  Key design decisions

  - D1xx excluded — "missing docstring" rules would be extremely noisy on the existing
  codebase
  - D3xx excluded — D300 enforces """ which conflicts with piker's '''; the formatter's
  quote-style = "single" handles quote conversion instead
  - D200 ignored — piker always uses multiline docstrings, even for short ones
  - D203 ignored — conflicts with D211 (piker: no blank line before class docstrings)
  - D212 ignored — conflicts with D213 (piker: summary on second line)
  - docstring-code-format enabled with 67-char width for code examples inside docstrings

  The big one is D213 — this is what flags the """summary on first line""" → '''\nsummary
   on second line\n''' conversion you've been doing across the codebase. Unfortunately
  D205 (blank line between summary + description) is not auto-fixable, so those 411
  violations need manual attention or a scripted fix.
From `claude` just after it wrote the new config in https://www.pikers.dev/pikers/piker/commit/ba728ae0aafb5e4ed26b622a5287a63e51b30fbf, ``` ● Here's the summary of the new ruff.toml config and what it catches: Rules added ┌──────┬───────┬──────────┬───────────────────────────────────────────────┐ │ Rule │ Count │ Fixable? │ What it enforces │ ├──────┼───────┼──────────┼───────────────────────────────────────────────┤ │ D213 │ 131 │ yes │ Summary on 2nd line after ''' (not same line) │ ├──────┼───────┼──────────┼───────────────────────────────────────────────┤ │ D205 │ 411 │ no │ Blank line between summary and description │ ├──────┼───────┼──────────┼───────────────────────────────────────────────┤ │ D204 │ 106 │ yes │ 1 blank line after class docstring │ ├──────┼───────┼──────────┼───────────────────────────────────────────────┤ │ D202 │ 4 │ yes │ No blank lines after function docstring │ ├──────┼───────┼──────────┼───────────────────────────────────────────────┤ │ D403 │ 4 │ yes │ Capitalize first word │ ├──────┼───────┼──────────┼───────────────────────────────────────────────┤ │ W291 │ 14 │ no │ Trailing whitespace │ ├──────┼───────┼──────────┼───────────────────────────────────────────────┤ │ W293 │ 1 │ yes │ Blank line with whitespace │ └──────┴───────┴──────────┴───────────────────────────────────────────────┘ 704 total violations, 274 auto-fixable with ruff check --fix. Key design decisions - D1xx excluded — "missing docstring" rules would be extremely noisy on the existing codebase - D3xx excluded — D300 enforces """ which conflicts with piker's '''; the formatter's quote-style = "single" handles quote conversion instead - D200 ignored — piker always uses multiline docstrings, even for short ones - D203 ignored — conflicts with D211 (piker: no blank line before class docstrings) - D212 ignored — conflicts with D213 (piker: summary on second line) - docstring-code-format enabled with 67-char width for code examples inside docstrings The big one is D213 — this is what flags the """summary on first line""" → '''\nsummary on second line\n''' conversion you've been doing across the codebase. Unfortunately D205 (blank line between summary + description) is not auto-fixable, so those 411 violations need manual attention or a scripted fix. ```
goodboy changed title from Updating our `ruff.toml` to enforce recent py styles to Updating our `ruff.toml` to enforce recent py coding style(s) 2026-03-11 23:43:34 +00:00
Poster
Owner

From claude just after it wrote the new config in d40a19ae4c and after i told him to think about using https://agentskills.io/skill-creation/using-scripts#one-off-commands,

/lint skill

  .claude/skills/lint/SKILL.md — user-invocable skill, invoke with /lint

  .claude/skills/lint/scripts/check.py — pure-stdlib Python script that:
  - Default: checks only staged .py files (via git diff --cached)
  - --all: checks full piker/ tree
  - --fix: auto-fixes fixable violations
  - --diff: previews fixes as unified diff (dry-run)
  - --stats: shows per-rule violation counts
  - Calls ruff from $PATH — works with nixpkgs, nvim-bundled, or pip-installed ruff
  - Prints a clear error with install options if ruff isn't found
From claude just after it wrote the new config in https://www.pikers.dev/pikers/piker/commit/d40a19ae4c3d123fe57faf12b939b10bfe214dbe and after i told him to think about using https://agentskills.io/skill-creation/using-scripts#one-off-commands, ``` /lint skill .claude/skills/lint/SKILL.md — user-invocable skill, invoke with /lint .claude/skills/lint/scripts/check.py — pure-stdlib Python script that: - Default: checks only staged .py files (via git diff --cached) - --all: checks full piker/ tree - --fix: auto-fixes fixable violations - --diff: previews fixes as unified diff (dry-run) - --stats: shows per-rule violation counts - Calls ruff from $PATH — works with nixpkgs, nvim-bundled, or pip-installed ruff - Prints a clear error with install options if ruff isn't found ```
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: pikers/piker#87
There is no content yet.