Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ jobs:
- uses: rustsec/audit-check@v1.4.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
# Keep in sync with the documented, justified exceptions in audit.toml —
# this action does not read that file itself, only this input.
ignore: RUSTSEC-2026-0098,RUSTSEC-2026-0099,RUSTSEC-2026-0104,RUSTSEC-2025-0119,RUSTSEC-2024-0388,RUSTSEC-2024-0436,RUSTSEC-2025-0134,RUSTSEC-2026-0258,RUSTSEC-2026-0009
2 changes: 2 additions & 0 deletions .github/workflows/benchmark-latency.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ jobs:
body: summary
});
} catch (error) {
// Fork PRs get a read-only GITHUB_TOKEN and can't post comments;
// don't fail the whole job just because the summary couldn't be posted.
core.warning(
`Could not post the latency budget comment (this is expected ` +
`for pull requests from forks, which get a read-only token): ` +
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/fuzzing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ on:
- '.github/workflows/fuzzing.yml'
- 'Cargo.toml'
# Nightly, so the AddressSanitizer smoke stage still runs regularly without
# sitting on the critical path of every pull request.
# sitting on the critical path of every pull request. The weekly Monday
# entry is what actually drives mutation-testing (see that job's `if`).
schedule:
- cron: '0 3 * * *'
- cron: '30 2 * * 1'

# Allow manual dispatch with configurable fuzz duration.
workflow_dispatch:
Expand All @@ -34,8 +36,6 @@ on:
description: 'Number of proptest cases per property'
required: false
default: '1000'
schedule:
- cron: '30 2 * * 1'

# Cancel in-progress runs when a new commit is pushed to the same branch.
concurrency:
Expand Down
56 changes: 39 additions & 17 deletions CODE_STYLE_STANDARDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -481,27 +481,49 @@ cargo clippy -- -W clippy::needless_clone

### Project-Specific Allowances

The StarForge project allows these clippy rules in specific circumstances. See `src/main.rs` for the global allowlist:
**There is no crate-wide lint allowlist.** `src/lib.rs` and `src/main.rs` used to
carry a blanket `#![allow(dead_code, unused, clippy::all)]`, and `Cargo.toml`
carried a matching `[lints]` table — together these silenced essentially every
default Clippy lint group (correctness, suspicious, style, complexity, perf)
across the *entire* ~40k-line crate, not just the handful of patterns the
comments claimed to cover. That's exactly backwards: it hid real bugs (see
below) behind the same blanket that was meant to excuse a few CLI functions
with many arguments.

Every remaining `#[allow(...)]` in the codebase is now **scoped to the single
item that needs it** — a function, struct, or field — with a comment
immediately above explaining *why*:

```rust
#![allow(
dead_code, // Some plugin infrastructure code is unused until plugins load it
clippy::needless_range_loop, // Sometimes more readable than alternatives
clippy::redundant_closure, // Used intentionally for clarity in some cases
clippy::too_many_arguments, // Complex CLI commands require many arguments
clippy::type_complexity, // Some type definitions are inherently complex
clippy::unnecessary_lazy_evaluations // Some expressions are evaluated for side effects
)]
// Each parameter is an independent, named input (CLI flags / distinct config
// values); bundling them into a struct here would add indirection without
// reducing real complexity.
#[allow(clippy::too_many_arguments)]
async fn monitor_contract(
contract_id: &str,
events_filter: Option<&str>,
// ...
) -> Result<()> {
```

**When to add to this allowlist:**
- Only for **unavoidable** patterns
- Document *why* with a comment
- Discuss with maintainers before merging

```rust
#![allow(clippy::too_many_arguments)] // Contract CLI requires many parameters for optimization context
```
**When to add a scoped allow:**
- Only on the specific item that triggers it — never on a module, and never
crate-wide.
- Only for patterns that are genuinely **unavoidable or clearly intentional**
for that one item, not as a shortcut past a warning you haven't looked at.
- Always with a comment explaining *why*, not just restating the lint name.
- `dead_code` is the one lint where "unavoidable" usually means "not wired up
yet, but deleting it isn't this change's call to make" — that's a valid
reason, but say so explicitly rather than leaving the allow unexplained.

**What restoring this signal found:** with the blanket removed,
`cargo clippy --all-features` went from silently clean to over 2000
warnings — 94% of them were the single mechanical `uninlined_format_args`
style lint (fixed via `cargo clippy --fix`), but the rest included real
defects the blanket had been hiding, e.g. a constructed template changelog
entry that was built and then silently discarded (`changelog: None` instead
of `Some(changelog)`) and unreachable branches. Local, documented exceptions
don't have that failure mode: each one is small enough to actually read.

**When NOT to add:**
- "I don't want to refactor" — do the refactor
Expand Down
23 changes: 0 additions & 23 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,6 @@ name = "starforge"
path = "src/lib.rs"
crate-type = ["cdylib", "rlib"]

# Package-wide lint policy. These lints are intentionally relaxed for the crate
# (including integration tests, which use lightweight mock structs and helpers).
# Centralizing them here keeps `cargo clippy --all-targets -- -D warnings` green.
[lints.rust]
dead_code = "allow"
unused_imports = "allow"
unused_variables = "allow"

[lints.clippy]
needless_range_loop = "allow"
redundant_closure = "allow"
too_many_arguments = "allow"
type_complexity = "allow"
unnecessary_lazy_evaluations = "allow"
items_after_test_module = "allow"
needless_borrow = "allow"
needless_borrows_for_generic_args = "allow"
empty_line_after_doc_comments = "allow"
doc_overindented_list_items = "allow"
expect_fun_call = "allow"
useless_vec = "allow"
single_match = "allow"

[dependencies]
clap = { version = "=4.4.18", features = ["derive", "color"] }
serde = { version = "1.0", features = ["derive"] }
Expand Down
Loading
Loading