Fix the coverage, git, and Clojure bugs, and bring CRAP under 10.

A path in a built-in coverage command is one argument, a failed custom coverage command does not read a stale report, and git failures exit with git's status. The Clojure reader honors discards, metadata, and character literals. Long functions are split so every score is under 10 except the option switch.
This commit is contained in:
Robert C. Martin
2026-10-03 17:27:59 -05:00
parent f0cb973110
commit 9f1bead298
20 changed files with 1287 additions and 513 deletions
+7 -1
View File
@@ -1,4 +1,6 @@
from crapper.languages.rust import functions_in_source
from pathlib import Path
from crapper.languages.rust import _file_modules, functions_in_source
SOURCE = """
pub fn choose(x: i32) -> i32 {
@@ -80,6 +82,10 @@ def test_module_paths_outside_the_usual_layout(tmp_path):
assert bare[0].name == "bare"
def test_a_file_outside_the_crate_root_uses_the_crate_name():
assert _file_modules("/tmp/loose.rs", "demo", Path("/projects/demo")) == ["demo"]
def test_nested_module_path(tmp_path):
(tmp_path / "Cargo.toml").write_text(
'[package]\nname = "demo"\nversion = "0.1.0"\n',