fix: add --all to cargo fmt in script/test and autoformat codebase
cargo fmt without --all fails with "Failed to find targets" in workspace repos. This was blocking every story's gates. Also ran cargo fmt --all to fix all existing formatting issues. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -142,7 +142,10 @@ pub fn write_merge_failure(path: &Path, reason: &str) -> Result<(), String> {
|
||||
fs::read_to_string(path).map_err(|e| format!("Failed to read story file: {e}"))?;
|
||||
|
||||
// Produce a YAML-safe inline quoted string: collapse newlines, escape inner quotes.
|
||||
let escaped = reason.replace('"', "\\\"").replace('\n', " ").replace('\r', "");
|
||||
let escaped = reason
|
||||
.replace('"', "\\\"")
|
||||
.replace('\n', " ")
|
||||
.replace('\r', "");
|
||||
let yaml_value = format!("\"{escaped}\"");
|
||||
|
||||
let updated = set_front_matter_field(&contents, "merge_failure", &yaml_value);
|
||||
@@ -288,7 +291,10 @@ pub fn check_unmet_deps(project_root: &Path, stage_dir: &str, story_id: &str) ->
|
||||
Ok(c) => c,
|
||||
Err(_) => return Vec::new(),
|
||||
};
|
||||
let deps = match parse_front_matter(&contents).ok().and_then(|m| m.depends_on) {
|
||||
let deps = match parse_front_matter(&contents)
|
||||
.ok()
|
||||
.and_then(|m| m.depends_on)
|
||||
{
|
||||
Some(d) => d,
|
||||
None => return Vec::new(),
|
||||
};
|
||||
@@ -333,7 +339,10 @@ fn dep_is_done(project_root: &Path, dep_number: u32) -> bool {
|
||||
fn dep_is_archived(project_root: &Path, dep_number: u32) -> bool {
|
||||
let prefix = format!("{dep_number}_");
|
||||
let exact = dep_number.to_string();
|
||||
let dir = project_root.join(".huskies").join("work").join("6_archived");
|
||||
let dir = project_root
|
||||
.join(".huskies")
|
||||
.join("work")
|
||||
.join("6_archived");
|
||||
if let Ok(entries) = fs::read_dir(&dir) {
|
||||
for entry in entries.flatten() {
|
||||
let path = entry.path();
|
||||
@@ -365,7 +374,10 @@ pub fn check_archived_deps(project_root: &Path, stage_dir: &str, story_id: &str)
|
||||
Ok(c) => c,
|
||||
Err(_) => return Vec::new(),
|
||||
};
|
||||
let deps = match parse_front_matter(&contents).ok().and_then(|m| m.depends_on) {
|
||||
let deps = match parse_front_matter(&contents)
|
||||
.ok()
|
||||
.and_then(|m| m.depends_on)
|
||||
{
|
||||
Some(d) => d,
|
||||
None => return Vec::new(),
|
||||
};
|
||||
@@ -434,7 +446,10 @@ pub fn write_blocked_in_content(contents: &str) -> String {
|
||||
|
||||
/// Write or update `merge_failure` in story content (pure function).
|
||||
pub fn write_merge_failure_in_content(contents: &str, reason: &str) -> String {
|
||||
let escaped = reason.replace('"', "\\\"").replace('\n', " ").replace('\r', "");
|
||||
let escaped = reason
|
||||
.replace('"', "\\\"")
|
||||
.replace('\n', " ")
|
||||
.replace('\r', "");
|
||||
let yaml_value = format!("\"{escaped}\"");
|
||||
set_front_matter_field(contents, "merge_failure", &yaml_value)
|
||||
}
|
||||
@@ -465,9 +480,7 @@ pub fn parse_unchecked_todos(contents: &str) -> Vec<String> {
|
||||
.lines()
|
||||
.filter_map(|line| {
|
||||
let trimmed = line.trim();
|
||||
trimmed
|
||||
.strip_prefix("- [ ] ")
|
||||
.map(|text| text.to_string())
|
||||
trimmed.strip_prefix("- [ ] ").map(|text| text.to_string())
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
@@ -486,7 +499,10 @@ workflow: tdd
|
||||
"#;
|
||||
|
||||
let meta = parse_front_matter(input).expect("front matter");
|
||||
assert_eq!(meta.name.as_deref(), Some("Establish the TDD Workflow and Gates"));
|
||||
assert_eq!(
|
||||
meta.name.as_deref(),
|
||||
Some("Establish the TDD Workflow and Gates")
|
||||
);
|
||||
assert_eq!(meta.coverage_baseline, None);
|
||||
}
|
||||
|
||||
@@ -566,7 +582,11 @@ workflow: tdd
|
||||
fn clear_front_matter_field_updates_file() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let path = tmp.path().join("story.md");
|
||||
std::fs::write(&path, "---\nname: Test\nmerge_failure: \"bad\"\n---\n# Story\n").unwrap();
|
||||
std::fs::write(
|
||||
&path,
|
||||
"---\nname: Test\nmerge_failure: \"bad\"\n---\n# Story\n",
|
||||
)
|
||||
.unwrap();
|
||||
clear_front_matter_field(&path, "merge_failure").unwrap();
|
||||
let contents = std::fs::read_to_string(&path).unwrap();
|
||||
assert!(!contents.contains("merge_failure"));
|
||||
@@ -854,5 +874,4 @@ workflow: tdd
|
||||
// 99 doesn't exist anywhere.
|
||||
assert!(!dep_is_archived(tmp.path(), 99));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user