Skip to content

Commit 930d08d

Browse files
author
Mohammod Al Amin Ashik
committed
ci: Add Clippy to pre-commit hooks and fix linting issues
- Add cargo clippy to pre-commit hook and validate script - Fix derivable_impls warning in HostingType enum - Update documentation to reflect clippy check - Update both bash and PowerShell hook versions This ensures clippy warnings are caught before commit, matching CI requirements.
1 parent da3d861 commit 930d08d

3 files changed

Lines changed: 5 additions & 8 deletions

File tree

.github/GIT_HOOKS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The pre-commit hook automatically runs before each commit to validate:
88

99
### **Rust Validation**
1010
- Formats Rust code with `cargo fmt`
11+
- Runs `cargo clippy --workspace -- -D warnings` to catch linting issues
1112
- Runs `cargo check --workspace` to verify compilation
1213
- Automatically adds formatted files to the commit
1314

@@ -42,6 +43,7 @@ To test the validation without committing:
4243
pnpm validate
4344

4445
# Or individually
46+
cargo clippy --workspace -- -D warnings
4547
cargo check --workspace
4648
pnpm typecheck
4749
```

crates/mcpmux-core/src/domain/server.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,20 +192,15 @@ pub enum Badge {
192192
}
193193

194194
/// Where the server runs
195-
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
195+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
196196
#[serde(rename_all = "lowercase")]
197197
pub enum HostingType {
198+
#[default]
198199
Local,
199200
Remote,
200201
Hybrid,
201202
}
202203

203-
impl Default for HostingType {
204-
fn default() -> Self {
205-
Self::Local
206-
}
207-
}
208-
209204
/// Installation complexity level
210205
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
211206
#[serde(rename_all = "lowercase")]

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"format": "prettier --write . && cargo fmt --all",
3232
"format:check": "prettier --check . && cargo fmt --all --check",
3333
"typecheck": "pnpm -r typecheck",
34-
"validate": "cargo check --workspace && pnpm typecheck",
34+
"validate": "cargo fmt --all && cargo clippy --workspace -- -D warnings && cargo check --workspace && pnpm typecheck",
3535
"clean": "pnpm -r clean && cargo clean"
3636
},
3737
"devDependencies": {

0 commit comments

Comments
 (0)