Skip to content

fix(ci): cargo fmt + allow clippy too_many_arguments on trades routes#93

Open
hardyjosh wants to merge 1 commit intomainfrom
2026-04-25-fix-ci
Open

fix(ci): cargo fmt + allow clippy too_many_arguments on trades routes#93
hardyjosh wants to merge 1 commit intomainfrom
2026-04-25-fix-ci

Conversation

@hardyjosh
Copy link
Copy Markdown
Contributor

@hardyjosh hardyjosh commented Apr 25, 2026

Motivation

Main is red and has been for the last several runs. Two latent issues:

  1. `cargo fmt --check` fails on `src/routes/orders/get_by_owner.rs:80` and `get_by_token.rs:98` — long single-line `super::quote_result_to_io_ratio` calls were merged un-formatted.
  2. Once fmt is fixed, `clippy::too_many_arguments` fires on `get_trades_by_address` (8/7) and `get_taker_trades` (9/7) in `src/routes/trades.rs`. CI currently never reaches this step because fmt fails first, but it surfaces immediately on any branch that fixes fmt.

This PR unblocks the whole stack — it sits at the bottom so #78 (and any other in-flight branches) inherit a green base instead of having to carry the bandage themselves.

Solution

  • Reformatted the two `get_by_*` files with `cargo fmt --all`.
  • Added `#[allow(clippy::too_many_arguments)]` (with a one-line justification) to the two Rocket route handlers. Their arity is dictated by the `&State<…>` they need to read; this is structural and not refactorable without splitting the handler.

No behaviour change.

Checks

By submitting this for review, I'm confirming I've done the following:

  • added comprehensive test coverage for any changes in logic (n/a — no logic change)
  • made this PR as small as possible
  • linked any relevant issues or PRs
  • included screenshots (if this involves a change to a front-end/dashboard)

Summary by CodeRabbit

  • Refactor
    • Internal code restructuring for improved readability and maintainability. Linting improvements applied to enhance code quality.

Two pre-existing main issues blocking CI:

1. `cargo fmt --check` fails on `src/routes/orders/get_by_owner.rs` and
   `get_by_token.rs` — long single-line `super::quote_result_to_io_ratio`
   calls were merged un-formatted.
2. `clippy::too_many_arguments` fires on `get_trades_by_address` (8/7) and
   `get_taker_trades` (9/7). These are Rocket route handlers; their arity
   is dictated by the `&State<…>` they need to read, not arbitrary.

The clippy lint hasn't surfaced on main because fmt fails first and CI exits;
once fmt passes the clippy errors will appear. Allowing the lint locally on the
two handlers, with a comment explaining why, is the least-invasive fix.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c031f3db-db14-476f-b6fa-858074056262

📥 Commits

Reviewing files that changed from the base of the PR and between b1ebea3 and f8c754b.

📒 Files selected for processing (3)
  • src/routes/orders/get_by_owner.rs
  • src/routes/orders/get_by_token.rs
  • src/routes/trades.rs

📝 Walkthrough

Walkthrough

Three Rust source files undergo code reformatting and linting adjustments: multi-line restructuring of quote_result_to_io_ratio calls in order route handlers and Clippy allowance attributes added to trade route handlers. All changes preserve existing functionality.

Changes

Cohort / File(s) Summary
Order Routes Refactoring
src/routes/orders/get_by_owner.rs, src/routes/orders/get_by_token.rs
Multi-line reformatting of quote_result_to_io_ratio invocations and their arguments for improved readability; logic and behavior remain unchanged.
Trade Routes Linting
src/routes/trades.rs
Addition of #[allow(clippy::too_many_arguments)] attributes to get_trades_by_address and get_taker_trades handlers.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • PR #53: Introduced the process_get_orders_by_owner logic and IO ratio computation that is now being reformatted in this PR's changes to get_by_owner.rs.
  • PR #52: Directly modified the same quote_result_to_io_ratio call sites in both order route files that are undergoing structural reformatting here.

Suggested reviewers

  • 0xgleb
  • JuaniRios

Poem

🐰 A hop, a format, code so clean,
Multi-lines make logic serene,
Clippy whispers "too many args,"
We silence it with gentle regards,
Same function, prettier sight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changes: cargo fmt formatting and clippy allowances on trades routes, matching the PR's dual objectives.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 2026-04-25-fix-ci

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor Author

hardyjosh commented Apr 25, 2026


How to use the Graphite Merge Queue

Add the label add-to-gt-merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

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