Skip to content

ci(examples): lint examples in CI and pre-commit - #188

Merged
MarTrepodi merged 2 commits into
developfrom
ci/lint-examples
Oct 13, 2026
Merged

MarTrepodi merged 2 commits into
developfrom
ci/lint-examples

Conversation

@MarTrepodi

Copy link
Copy Markdown
Collaborator

Summary

Both the pre-commit ruff hook (exclude: ^examples/) and the CI ruff check step skipped examples/, so 28 lint findings had built up there unseen. This clears them and lints examples/ from now on.

  • Unused imports and import order (13 findings): applied ruff's safe --fix for F401 and I001. Only unused imports are removed, and each removed name has no remaining reference in its file.
  • Dead variable (1 finding): removed fetch_times from examples/Async/streaming_guild_roster_advanced.py. It was created and never read.
  • Illustrative results (14 findings): these F841 hits assign a call's result to a named variable to show what the call returns, for example units = await cl.get_game_data(items=DataItems.UNITS). Ruff's unsafe fix would remove that teaching value, so this PR adds "examples/**" = ["F841"] to per-file-ignores with its own comment. It sits apart from the "address incrementally" entries because it's intended policy, not a backlog item. F841 still applies everywhere else.
  • Lint coverage: removed the exclude from the pre-commit ruff hook and added examples/ to the CI ruff check paths, matching the format check.

Test plan

  • uv run ruff check src/ tests/ examples/ parity/ passes
  • uv run ruff format --check src/ tests/ examples/ parity/ passes
  • uvx pre-commit run --all-files passes
  • All example scripts compile (py_compile)
  • A probe file under src/ still triggers F841, so the ignore is scoped to examples/

🤖 Generated with Claude Code

MarTrepodi and others added 2 commits October 13, 2026 10:37
Applies ruff's safe fixes for F401 and I001 in the examples, and drops
the never-read fetch_times list in streaming_guild_roster_advanced.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
examples/ was excluded from ruff check, so its findings were never seen.
The remaining F841 hits assign a call's result to a named variable to
show what the call returns, so ignore F841 under examples/ only and lint
the rest of the directory in both the pre-commit hook and the CI job.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added documentation Improvements or additions to documentation ci Changes related to continuous integration processes dependencies Updates to package dependency libraries labels Oct 13, 2026
@MarTrepodi
MarTrepodi merged commit b9990ed into develop Oct 13, 2026
16 checks passed
@MarTrepodi
MarTrepodi deleted the ci/lint-examples branch October 13, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Changes related to continuous integration processes dependencies Updates to package dependency libraries documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant