Skip to content

Commit 0aa3b0c

Browse files
committed
ci: enforce clippy warnings as errors in CI
Changes: - Changed workspace lints from warn to deny for all clippy categories (all, pedantic, cargo, nursery) to enforce code quality in CI - Fixed clippy warnings in test code: - significant_drop_tightening: Explicit lock drop in mcp-introspector - case_sensitive_file_extension_comparisons: Use Path API in mcp-codegen - float_cmp: Use epsilon comparison in mcp-wasm-runtime - needless_collect: Use iterator directly in mcp-examples - branches_sharing_code: Refactor shared return in mcp-examples - unnecessary_map_or: Use is_some_and in mcp-codegen - Added too_many_lines to allowed lints for comprehensive examples/tests - Removed redundant clippy warn directives from mcp-skill-generator All 501 tests passing. Clippy clean with exit code 0.
1 parent 4f64e99 commit 0aa3b0c

File tree

7 files changed

+20
-22
lines changed

7 files changed

+20
-22
lines changed

Cargo.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,17 @@ unsafe_op_in_unsafe_fn = "deny"
121121
unused_lifetimes = "warn"
122122

123123
[workspace.lints.clippy]
124-
# Note: Temporarily relaxed for Phase 7.1 - will be re-enabled in follow-up
125-
all = { level = "warn", priority = -1 }
126-
pedantic = { level = "warn", priority = -1 }
127-
cargo = { level = "warn", priority = -1 }
128-
nursery = { level = "warn", priority = -1 }
124+
# Deny all clippy warnings by default to enforce code quality in CI
125+
all = { level = "deny", priority = -1 }
126+
pedantic = { level = "deny", priority = -1 }
127+
cargo = { level = "deny", priority = -1 }
128+
nursery = { level = "deny", priority = -1 }
129129

130130
# Allow specific lints that are too strict or have false positives
131131
needless_borrows_for_generic_args = { level = "allow", priority = 10 }
132132
multiple_crate_versions = { level = "allow", priority = 10 } # Common with transitive dependencies
133133
cargo_common_metadata = { level = "allow", priority = 10 } # Not required for internal workspace crates
134+
too_many_lines = { level = "allow", priority = 10 } # Allow comprehensive examples and tests
134135

135136
[profile.release]
136137
opt-level = 3

crates/mcp-codegen/tests/integration_test.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,11 @@ fn test_generated_typescript_is_syntactically_valid() {
310310
let generated = generator.generate(&server_info).unwrap();
311311

312312
for file in &generated.files {
313-
if file.path.ends_with(".ts") {
313+
if std::path::Path::new(&file.path)
314+
.extension()
315+
.and_then(|ext| ext.to_str())
316+
.is_some_and(|ext| ext.eq_ignore_ascii_case("ts"))
317+
{
314318
// Basic TypeScript syntax checks
315319
let content = &file.content;
316320

crates/mcp-examples/examples/performance_test.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,12 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
304304
// Exit with appropriate code
305305
if passed == total {
306306
println!("Performance test: SUCCESS\n");
307-
Ok(())
308307
} else {
309308
println!("Performance test: PARTIAL (some targets missed)\n");
310309
println!("Note: This is acceptable for development builds.");
311310
println!(" Run with --release for production performance.\n");
312-
Ok(())
313311
}
312+
Ok(())
314313
}
315314

316315
/// Creates a minimal demo WASM module for testing.

crates/mcp-examples/tests/integration_test.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,11 @@ fn test_codegen_generates_expected_files() {
114114
assert!(has_types, "Should generate types.ts");
115115

116116
// Should generate tool files
117-
let tool_files: Vec<_> = generated
118-
.files
119-
.iter()
120-
.filter(|f| f.path.contains("tools/"))
121-
.collect();
122117
assert!(
123-
!tool_files.is_empty(),
118+
generated
119+
.files
120+
.iter()
121+
.any(|f| f.path.contains("tools/")),
124122
"Should generate tool implementation files"
125123
);
126124
}

crates/mcp-introspector/tests/integration_test.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,9 @@ async fn test_concurrent_introspector_access() {
226226
for i in 0..10 {
227227
let introspector_clone = Arc::clone(&introspector);
228228
let handle = tokio::spawn(async move {
229-
{
230-
let intro = introspector_clone.lock().await;
231-
assert_eq!(intro.server_count(), 0);
232-
}
229+
let intro = introspector_clone.lock().await;
230+
assert_eq!(intro.server_count(), 0);
231+
drop(intro); // Explicitly drop lock before returning
233232
i
234233
});
235234
handles.push(handle);

crates/mcp-skill-generator/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,6 @@
125125
//! Tokio and multi-threaded environments.
126126
127127
#![warn(missing_docs)]
128-
#![warn(clippy::all)]
129-
#![warn(clippy::pedantic)]
130-
#![warn(clippy::cargo)]
131128

132129
pub mod skill_template;
133130
pub mod types;

crates/mcp-wasm-runtime/tests/performance_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,5 +373,5 @@ fn test_cache_statistics() {
373373
let (hits, total, rate) = cache.hit_rate();
374374
assert_eq!(hits, 5);
375375
assert_eq!(total, 10);
376-
assert_eq!(rate, 50.0); // 5/10 = 50%
376+
assert!((rate - 50.0).abs() < f64::EPSILON); // 5/10 = 50%
377377
}

0 commit comments

Comments
 (0)