| 226 | } |
| 227 | |
| 228 | pub fn verification_presets_for_workspace(workspace: impl AsRef<Path>) -> Vec<VerificationPreset> { |
| 229 | let workspace = workspace.as_ref(); |
| 230 | let mut presets = Vec::new(); |
| 231 | |
| 232 | if workspace.join("Cargo.toml").is_file() { |
| 233 | presets.push(VerificationPreset::new( |
| 234 | "rust-default", |
| 235 | "rust", |
| 236 | "Rust cargo verification", |
| 237 | vec![ |
| 238 | VerificationCommand::required( |
| 239 | "rust:fmt", |
| 240 | "format", |
| 241 | "Check Rust formatting", |
| 242 | "cargo fmt -- --check", |
| 243 | ), |
| 244 | VerificationCommand::required( |
| 245 | "rust:check", |
| 246 | "type_check", |
| 247 | "Run Rust type checking", |
| 248 | "cargo check", |
| 249 | ), |
| 250 | VerificationCommand::required("rust:test", "test", "Run Rust tests", "cargo test"), |
| 251 | VerificationCommand::optional( |
| 252 | "rust:clippy", |
| 253 | "lint", |
| 254 | "Run Rust clippy lints", |
| 255 | "cargo clippy -- -D warnings", |
| 256 | ), |
| 257 | ], |
| 258 | )); |
| 259 | } |
| 260 | |
| 261 | if workspace.join("package.json").is_file() { |
| 262 | if let Some(preset) = node_verification_preset(workspace) { |
| 263 | presets.push(preset); |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | if workspace.join("pyproject.toml").is_file() || workspace.join("pytest.ini").is_file() { |
| 268 | let mut commands = Vec::new(); |
| 269 | if workspace.join("tests").is_dir() |
| 270 | || file_contains(&workspace.join("pyproject.toml"), "[tool.pytest") |
| 271 | || workspace.join("pytest.ini").is_file() |
| 272 | { |
| 273 | commands.push(VerificationCommand::required( |
| 274 | "python:test", |
| 275 | "test", |
| 276 | "Run Python tests", |
| 277 | "python -m pytest", |
| 278 | )); |
| 279 | } |
| 280 | if workspace.join("ruff.toml").is_file() |
| 281 | || workspace.join(".ruff.toml").is_file() |
| 282 | || file_contains(&workspace.join("pyproject.toml"), "[tool.ruff") |
| 283 | { |
| 284 | commands.push(VerificationCommand::optional( |
| 285 | "python:ruff", |