Assign a ranking tier to a file path. Lower tier = higher priority. Source implementation files rank above tests, config, build scripts, docs, and generated files.
(path: &str)
| 445 | /// Lower tier = higher priority. Source implementation files rank above |
| 446 | /// tests, config, build scripts, docs, and generated files. |
| 447 | fn path_tier(path: &str) -> usize { |
| 448 | // Tier 0: primary source directories |
| 449 | let source_prefixes = ["src/", "lib/", "pkg/", "internal/", "cmd/", "app/"]; |
| 450 | for prefix in &source_prefixes { |
| 451 | if path.starts_with(prefix) { |
| 452 | // Demote test files even within src/ |
| 453 | if is_test_path(path) { |
| 454 | return 2; |
| 455 | } |
| 456 | return 0; |
| 457 | } |
| 458 | } |
| 459 | |
| 460 | // Tier 1: other code files (root-level .rs/.py/.cpp etc.) |
| 461 | let code_extensions = [ |
| 462 | ".rs", ".go", ".py", ".ts", ".js", ".cpp", ".cc", ".c", ".h", ".hpp", ".java", ".kt", |
| 463 | ".swift", ".rb", ".cs", |
| 464 | ]; |
| 465 | if code_extensions.iter().any(|ext| path.ends_with(ext)) { |
| 466 | if is_test_path(path) { |
| 467 | return 2; |
| 468 | } |
| 469 | return 1; |
| 470 | } |
| 471 | |
| 472 | // Tier 2: test files |
| 473 | if is_test_path(path) { |
| 474 | return 2; |
| 475 | } |
| 476 | |
| 477 | // Tier 3: docs and markdown |
| 478 | if path.ends_with(".md") || path.starts_with("docs/") || path.starts_with("doc/") { |
| 479 | return 3; |
| 480 | } |
| 481 | |
| 482 | // Tier 4: build scripts, config, CI, generated files |
| 483 | let low_priority = [ |
| 484 | "buildscripts/", |
| 485 | "build/", |
| 486 | ".github/", |
| 487 | "ci/", |
| 488 | "scripts/", |
| 489 | "debian/", |
| 490 | "rpm/", |
| 491 | "packaging/", |
| 492 | "vendor/", |
| 493 | "third_party/", |
| 494 | "node_modules/", |
| 495 | "target/", |
| 496 | ]; |
| 497 | if low_priority.iter().any(|p| path.starts_with(p)) { |
| 498 | return 4; |
| 499 | } |
| 500 | if path.ends_with(".yml") |
| 501 | || path.ends_with(".yaml") |
| 502 | || path.ends_with(".toml") |
| 503 | || path.ends_with(".json") |
| 504 | || path.ends_with(".xml") |
no test coverage detected