Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 23 additions & 0 deletions clippy.toml
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" },
]
7 changes: 7 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,13 @@ impl App {
// Verify we're in a git repo first
let _git = GitService::discover()?;

// `hook_dir` runs under the Tokio runtime (`main` is `#[tokio::main]`
// and hook commands reach here via `app.run().await`), so this
// `std::process::Command` can block a worker thread. F-002 will
// migrate the hook / clipboard paths to `tokio::process::Command`;
// until then, allow the lint locally so the new clippy.toml rule
// does not block unrelated PRs.
#[allow(clippy::disallowed_methods)]
let output = std::process::Command::new("git")
.args(["rev-parse", "--git-dir"])
.output()?;
Expand Down
5 changes: 5 additions & 0 deletions tests/history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
//
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial

// 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.

use commitbee::services::history::{HistoryContext, HistoryService};

// ─── Subject Analysis (Pure Functions) ───────────────────────────────────────
Expand Down
5 changes: 5 additions & 0 deletions tests/porcelain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
//! deferred to a follow-up — it requires the full pipeline setup and belongs
//! in its own test file.

// Integration tests are synchronous and legitimately use `std::process::Command`
// to shell out to `git` / the `commitbee` binary; the `disallowed_methods` rule
// in clippy.toml targets async-context misuse, which does not apply here.
#![allow(clippy::disallowed_methods)]

use std::collections::BTreeMap;
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
Expand Down
Loading