Skip to content

Add linting and checking into the repo#7

Merged
jacomago merged 6 commits into
ChannelFinder:mainfrom
jacomago:claude/add-clippy-ci-checks-dJG8X
Feb 24, 2026
Merged

Add linting and checking into the repo#7
jacomago merged 6 commits into
ChannelFinder:mainfrom
jacomago:claude/add-clippy-ci-checks-dJG8X

Conversation

@jacomago
Copy link
Copy Markdown
Contributor

This adds cargo clippy and ruff checking to the pre-commit and check it in ci.

Fix all warnings surfaced by `cargo clippy --workspace --all-targets`:

- reccaster: `props: props` → shorthand, `{ return; }` → `{}` on
  WouldBlock, `while let` → `if let` (never_loop), three `recid: recid`
  → shorthand, `if let Err(_) =` → `.is_err()`, trailing `return`
- pyreccaster: `Python` → `Python<'_>` (mismatched-lifetime-syntaxes)
- basic-reccaster: remove bare `use tracing_subscriber` (single-component-path-imports)

https://claude.ai/code/session_01V61zGHMt1gkkK8pjTLUxT2
Add [workspace.lints] to the root Cargo.toml so lint levels are
declared once and enforced consistently across local builds, clippy
runs, and CI — no CLI flags required:

  [workspace.lints.rust]
  missing_docs = "deny"

  [workspace.lints.clippy]
  all = { level = "deny", priority = -1 }

Each member crate opts in with `[lints] workspace = true`.

Note: clippy.toml configures lint *behaviours* (thresholds, etc.);
[workspace.lints] is the correct mechanism for lint *levels*.

https://claude.ai/code/session_01V61zGHMt1gkkK8pjTLUxT2
Document all public items in the wire and reccaster crates:
- wire: crate-level doc, all structs/enums/variants/methods
- reccaster: crate-level doc, Reccaster struct, new/run methods, pub mod record
- reccaster::record: Record struct, fields, and Record::new

Suppress missing_docs for the pyreccaster FFI crate and the
basic-reccaster example binary with #![allow(missing_docs)], as
documenting internal bindings and example code provides little value.

https://claude.ai/code/session_01V61zGHMt1gkkK8pjTLUxT2
Run `cargo fmt --all` across the workspace. Key reformatting:
- wire/src/codec.rs: wrap long encode/decode match arms
- reccaster/src/lib.rs: reflow long struct-literal lines and match arms
- pyreccaster/src/lib.rs: reflow long lines in impl blocks
- Remaining files: trailing whitespace and minor alignment fixes

https://claude.ai/code/session_01V61zGHMt1gkkK8pjTLUxT2
@jacomago jacomago self-assigned this Feb 23, 2026
@jacomago jacomago force-pushed the claude/add-clippy-ci-checks-dJG8X branch from ecb5c04 to 1b0cd4d Compare February 23, 2026 15:03
Configure ruff (linter) and mypy (type checker) in pyreccaster/pyproject.toml:
- ruff: line-length 120, select E/F/I, ignore E501 on long literal lines
- mypy: strict mode enabled

Fix violations surfaced by those tools:
- test_all.py: add missing imports, fix bare `except`, remove unused vars
- __init__.py: add explicit re-export to satisfy mypy's implicit-reexport rule

https://claude.ai/code/session_01V61zGHMt1gkkK8pjTLUxT2
Add .pre-commit-config.yaml that runs on every commit:
- trailing-whitespace, end-of-file-fixer, check-yaml (pre-commit-hooks)
- ruff (lint) and ruff-format for Python
- mypy for Python type checking
- cargo fmt --check (formatting gate)
- cargo clippy --workspace --all-targets (lint gate)

Simplify .github/workflows/rust.yml: replace separate fmt/clippy/build
jobs with a single pre-commit job (runs the same hooks as locally) plus
a dedicated test job, ensuring local and CI checks stay in sync.

Also fix trailing whitespace in README.md and .gitlab-ci.yml, detected
by the new trailing-whitespace hook.

https://claude.ai/code/session_01V61zGHMt1gkkK8pjTLUxT2
@jacomago jacomago force-pushed the claude/add-clippy-ci-checks-dJG8X branch from 1b0cd4d to 56f6ca2 Compare February 23, 2026 16:12
exclude = ["test.py"]

[tool.ruff.lint]
select = ["E", "F", "I", "UP", "B", "RUF"]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about adding UP (pyupgrde) option here

@jacomago jacomago merged commit 6d6b52f into ChannelFinder:main Feb 24, 2026
38 checks passed
@jacomago jacomago deleted the claude/add-clippy-ci-checks-dJG8X branch February 24, 2026 11:30
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.

3 participants