Clear fmt/clippy lints and add CI with both checks enforcing by gregoryStarr · Pull Request #2 · astralisone/Selecta · GitHub
Skip to content

Clear fmt/clippy lints and add CI with both checks enforcing - #2

Open
gregoryStarr wants to merge 3 commits into
mainfrom
assistant/brave-cannon-koe20a
Open

gregoryStarr wants to merge 3 commits into
mainfrom
assistant/brave-cannon-koe20a

Conversation

@gregoryStarr

Copy link
Copy Markdown
Collaborator

Clears every rustfmt and clippy warning in the crate, then adds a CI workflow where both checks are blocking.

Commits

1. style: apply cargo fmt across the crate — mechanical rustfmt pass over src/, no logic changes. Kept separate so the formatting churn doesn't obscure the fixes that follow.

2. fix(lints): clear all clippy warnings

Lint File Fix
manual_is_multiple_of src/analyze.rs:174 n.is_multiple_of(emit_every)
manual_abs_diff src/keys.rs:48 a.abs_diff(b)
explicit_counter_loop src/features.rs:63 drive the frame index with .enumerate()
too_many_arguments ×2 src/main.rs (cmd_top, cmd_compat) targeted #[allow]

The first two came from cargo clippy --fix; both rewrites are semantically identical.

For explicit_counter_loop, the frames local was read only by the frames > 4 guard and incremented at the end of the loop body, so enumerate()'s index is identical at every use.

For too_many_arguments, I went with a scoped #[allow] plus a one-line comment rather than a parameter struct. Both functions mirror their Command::Top / Command::Compat clap variants 1:1 — the enum variant already is the parameter struct, so a wrapper would duplicate those fields and add a field-by-field copy in the dispatch arm without removing anything. The allows sit on the two functions only; there is no crate-level allow.

3. ci: add workflow with enforcing fmt and clippy checks — see the note below.

Note on scope

The task this branch came from described editing .github/workflows/ci.yml to remove continue-on-error: true from existing "Format (advisory)" / "Clippy (advisory)" steps. This repo has no .github/ directory — there was no workflow and no advisory steps to promote. The workflow is therefore added directly in the enforcing end state, which matches the stated goal:

  • Format — cargo fmt --package rekordbox-analyzer -- --check
  • Clippy — cargo clippy --package rekordbox-analyzer --all-targets -- -D warnings
  • Test — cargo test --package rekordbox-analyzer --all-targets

No continue-on-error anywhere; clippy runs with -D warnings.

The task also referred to the package as track2mix (lib track2mix_core, plus a track2mix-tauri crate). The actual names are rekordbox-analyzer (lib rekordbox_analyzer, bin rekordbox-analyzer) and selecta-tauri; the rename hasn't landed on main. I used the real names. If the rename is meant to happen, it's a separate change.

Every step is scoped to the rekordbox-analyzer package — selecta-tauri under src-tauri/ is skipped because it links against GTK/WebKit system libraries not present on the Linux runner.

Verification

All run locally on the final tree:

Command Exit
cargo fmt --package rekordbox-analyzer -- --check 0
cargo clippy --package rekordbox-analyzer --all-targets -- -D warnings 0
cargo test --package rekordbox-analyzer --all-targets 0 — 4 passed

One correction to the original task notes: the crate does not have zero tests. src/keys.rs already has a #[cfg(test)] mod tests with 4 passing Camelot tests. src/features.rs does still have none, so that remains the obvious place to add coverage — not done here, as it wasn't part of this task.


Generated by Claude Code

Mechanical rustfmt pass over src/. No logic changes — kept as a separate
commit so the formatting churn doesn't obscure the clippy fixes that follow.

Verified with `cargo check --package rekordbox-analyzer --all-targets` and
`cargo test --package rekordbox-analyzer` (4 tests pass).
- analyze.rs: use `n.is_multiple_of(emit_every)` instead of `n % x == 0`
- keys.rs: use `a.abs_diff(b)` instead of the manual if/else
- features.rs: drive the frame counter with `.enumerate()` rather than a
  manually incremented `frames` local. The counter was only read by the
  `frames > 4` guard and bumped at the end of the body, so enumerate's
  index is identical at every use.
- main.rs: targeted `#[allow(clippy::too_many_arguments)]` on cmd_top and
  cmd_compat. Their parameters mirror the corresponding clap `Command`
  variants 1:1, so a wrapper struct would only duplicate those fields.
  Scoped to the two functions — no crate-level allow.

`cargo clippy --package rekordbox-analyzer --all-targets -- -D warnings`
and `cargo fmt --package rekordbox-analyzer -- --check` both exit 0;
4 tests pass.
The repo had no .github/ directory, so there were no advisory steps to
promote — this adds the workflow directly in the enforcing end state:

- Format: `cargo fmt --package rekordbox-analyzer -- --check`
- Clippy: `cargo clippy --package rekordbox-analyzer --all-targets -- -D warnings`
- Test:   `cargo test --package rekordbox-analyzer --all-targets`

Neither check is advisory: no continue-on-error anywhere, and clippy runs
with -D warnings. The tree passes all three as of the preceding two commits.

Scoped to the rekordbox-analyzer package throughout; the selecta-tauri
workspace member is skipped because it needs GTK/WebKit system libraries
that aren't present on the Linux runner.

Copy link
Copy Markdown
Collaborator Author

Rust check is failing for an infrastructure reason, not this diff

The Rust job on 7178c0f fails 2–3 seconds after starting, having executed zero steps — it never reaches actions/checkout, let alone any cargo command. Job output is empty and the logs 404 rather than returning content.

I re-ran it once (attempt 2, job 109731059241): identical, 2 seconds, no steps, failed.

Why this isn't this PR's failure

The same pathology predates this branch and reproduces on code this diff doesn't touch:

Run Branch Workflow file Rust job
1 assistant/brave-bardeen-ebiwjn (#1) #1's ci.yml run-level failure in 3s
2 (attempt 2) assistant/brave-bardeen-ebiwjn (#1) #1's ci.yml 2s, no steps
3 assistant/brave-bardeen-ebiwjn (#1) #1's ci.yml run-level failure in 3s
4 attempt 1 this branch this PR's ci.yml 3s, no steps
4 attempt 2 this branch this PR's ci.yml 2s, no steps

All 4 runs this workflow has ever had, on two different branches with two entirely different ci.yml files, failed the same way. There is no green baseline anywhere in the repo's Actions history. Since the job dies before checkout, nothing in the Rust source or in the step commands can be the cause.

Runners are not simply unavailable — in run 2 the Frontend job ran for 38s while Rust and Site both died in 2s.

The three commands the workflow runs all pass locally

On this branch's head, on ubuntu, rustc 1.94.1:

Command Exit
cargo fmt --package rekordbox-analyzer -- --check 0
cargo clippy --package rekordbox-analyzer --all-targets -- -D warnings 0
cargo test --package rekordbox-analyzer --all-targets 0 — 4 passed

What I can't do from here

I have no fix to port — there's no passing run to compare against and the logs aren't retrievable, so I can't root-cause past "the job never started." This looks like a repository- or account-level Actions problem (runner provisioning, an allowed-actions policy, or Actions billing/minutes). That needs someone with access to the repo's Actions settings and the account's billing page; it isn't fixable from a commit.

My one permitted re-run is spent. I'll keep watching this PR and will re-check rather than re-run again.


Generated by Claude Code

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.

2 participants