Skip to content

[Tracking] Remove all clippy cognitive_complexity and too_many_lines suppressions #225

@mukeshblackhat

Description

@mukeshblackhat

Master tracking issue for the workspace-wide refactor effort to remove all #[allow(clippy::cognitive_complexity)] and #[allow(clippy::too_many_lines)] suppressions.

Goal

The workspace Cargo.toml sets cognitive_complexity and too_many_lines to warn globally. Over time, functions that exceeded the thresholds gained #[allow(...)] suppressions. This tracking issue coordinates refactoring each one so the suppressions can be removed without raising global thresholds.

How to pick one up

Each child ticket contains:

  • What the function does in plain English
  • Specific extraction proposals with proposed function signatures
  • Suggested unit tests for new helpers
  • Acceptance criteria checklist

Pattern to follow (see merged PRs): #187, #188, #189, #190, #191

  1. Checkout branch from main: refactor/<file>-cognitive-complexity-<issue#>
  2. Extract helpers per the ticket
  3. Add unit tests for new code (pure/extracted logic)
  4. Remove the #[allow(...)] suppression
  5. Run make lint and make test — both must be green
  6. Open a PR with Closes #<issue> so this master issue's task list ticks automatically

Progress

Resolved (5)

Already merged — kept here for pattern reference:

Open — coast-daemon/src/handlers/ (5)

- [ ] #205
- [ ] #206
- [ ] #207
- [ ] #208
- [ ] #209

Open — coast-daemon/src/api/ (9 tickets, 13 suppressions)

- [ ] #210
- [ ] #211
- [ ] #212
- [ ] #213
- [ ] #214
- [ ] #215
- [ ] #216
- [ ] #217
- [ ] #218

Open — coast-daemon/src/ root (4 tickets, 8 suppressions)

- [ ] #219
- [ ] #220
- [ ] #221
- [ ] #222

Open — coast-docker/src/ (2)

- [ ] #223
- [ ] #224

Suppression count

Location Files Suppressions Status
coast-daemon/src/handlers/ 5 5 Open
coast-daemon/src/api/ 9 13 Open
coast-daemon/src/ (root) 4 8 Open
coast-docker/src/ 2 2 Open
Total open 20 27
Resolved 5 5 Done
Grand total 25 32

Notes for contributors

  • DRY strictly. Several functions share patterns (e.g., stats collectors across ws_stats.rs, ws_service_stats.rs, ws_host_service_stats.rs; inner daemon health checks across checkout.rs, stop.rs, unassign.rs). Extract shared helpers into common modules where it makes sense.
  • Don't lower clippy thresholds — fix the code, not the lint config.
  • Don't expand the public API — all extracted helpers should stay private unless the issue explicitly says otherwise.
  • Contracts stay stable — the original function signature must not change.
  • Write tests for new code. Existing end-to-end tests usually cover the extracted-verbatim parts; add focused unit tests for pure/new logic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions