Skip to content

ratchet(types): fix invalid-parameter-default + enforce the rule#1288

Merged
tomchop merged 1 commit into
mainfrom
ratchet/optional-param-defaults
Jul 13, 2026
Merged

ratchet(types): fix invalid-parameter-default + enforce the rule#1288
tomchop merged 1 commit into
mainfrom
ratchet/optional-param-defaults

Conversation

@tomchop

@tomchop tomchop commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Second ty ratchet PR — the first that flips a rule to error.

What

All 15 invalid-parameter-default diagnostics were internal function signatures with a None default on a non-optional annotation:

  • tags: List[str] = Nonetags: List[str] | None = None (the observable/entity/indicator save/create/find helpers)
  • host/port/username/password/database: str|int = None in ArangoYetiConnector.connect
  • user: "user.User" = None in connect/filter/the interface
  • get_plugins_list(task_class: Task = Task)type[Task] (the param is a class, used in issubclass)

None are request/response models or FastAPI endpoint parameters, so these are annotation-only — no runtime behavior, no OpenAPI/wire change (frontend-safe).

Ratchet

With the rule at zero, invalid-parameter-default moves from warn to error in [tool.ty.rules]. It's now enforced — a future arg: list = None fails CI.

Verification

  • ty: invalid-parameter-default 15 → 0, rule enforced at error, ty check --exit-zero-on-warning exits 0.
  • All three unittest suites pass; ruff clean.

All 15 instances were internal function signatures using a `None` default on a
non-optional annotation (`tags: List[str] = None`, `host: str = None`, etc.),
plus one where the annotation should have been `type[Task]` (the param is a
class, used in `issubclass`). None are request/response models or endpoint
parameters, so these are annotation-only changes — no runtime or OpenAPI impact.

With the rule at zero, flip `invalid-parameter-default` from "warn" to "error"
in [tool.ty.rules] so it stays fixed. First full ratchet step (fix + enforce).
@tomchop tomchop merged commit 122a146 into main Jul 13, 2026
4 checks passed
@tomchop tomchop deleted the ratchet/optional-param-defaults branch July 13, 2026 18:12
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.

1 participant