-
-
Notifications
You must be signed in to change notification settings - Fork 1
F-018: chore: add clippy.toml with disallowed-methods / disallowed-macros #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # SPDX-FileCopyrightText: 2026 Sephyi <me@sephy.io> | ||
| # | ||
| # SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial | ||
|
|
||
| # Minimal, pragmatic clippy config to catch common anti-patterns at lint time. | ||
| # | ||
| # Keep this file small. Each rule should have a clear justification in its | ||
| # `reason` so reviewers understand why the flagged call was blocked. | ||
|
|
||
| # Disallow sync `std::process::Command` — the async pipeline must not block the | ||
| # tokio runtime. Use `tokio::process::Command` or wrap in | ||
| # `tokio::task::spawn_blocking` at async call-sites. Synchronous contexts | ||
| # (integration tests, CLI bootstrap before the runtime starts) may allow this | ||
| # lint locally with `#[allow(clippy::disallowed_methods)]` and a comment. | ||
| disallowed-methods = [ | ||
| { path = "std::process::Command::new", reason = "prefer tokio::process::Command or spawn_blocking in async contexts" }, | ||
| ] | ||
|
|
||
| # Disallow the `dbg!` macro — leftover debug scaffolding should never ship. | ||
| # Use `tracing::{debug,trace}` for durable diagnostics. | ||
| disallowed-macros = [ | ||
| { path = "std::dbg", reason = "leftover debug scaffolding; remove before committing" }, | ||
| ] |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,11 @@ | |||||||||||||||||
| // | ||||||||||||||||||
| // SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial | ||||||||||||||||||
|
|
||||||||||||||||||
| // Integration tests are synchronous and legitimately use `std::process::Command` | ||||||||||||||||||
| // to build git fixtures in tempdirs; the `disallowed_methods` rule in | ||||||||||||||||||
| // clippy.toml targets async-context misuse, which does not apply here. | ||||||||||||||||||
| #![allow(clippy::disallowed_methods)] | ||||||||||||||||||
|
Comment on lines
+5
to
+8
|
||||||||||||||||||
| // Integration tests are synchronous and legitimately use `std::process::Command` | |
| // to build git fixtures in tempdirs; the `disallowed_methods` rule in | |
| // clippy.toml targets async-context misuse, which does not apply here. | |
| #![allow(clippy::disallowed_methods)] | |
| // Keep `clippy::disallowed_methods` enabled for this file. If a synchronous | |
| // helper needs `std::process::Command` to build git fixtures in a tempdir, | |
| // allow it narrowly at that specific helper or call site with a short | |
| // justification rather than silencing the lint for async tests as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The justification comment is inaccurate: this code runs under the Tokio runtime (main is
#[tokio::main]andCommands::Hookis handled insideapp.run().await), sostd::process::Commandhere can still block a runtime worker thread. Either update the comment to reflect the actual execution context and why blocking is acceptable temporarily, or (preferably) move the blocking call behindspawn_blocking/tokio::process::Commandso the new lint remains meaningful in production code paths.