Skip to content

Commit fd7fbff

Browse files
committed
fix: cover fixDiscovered formatDiagnostics call for codecov/patch
Add TestE2E_Fix_Discovered_UnfixableDiagnostic, which runs fix in discovery mode with a file that has an unfixable MDS017 diagnostic. After the fix pass, the diagnostic remains and formatDiagnostics is called in fixDiscovered (line 855), closing the only uncovered patch line from the previous commit. https://claude.ai/code/session_018673HUFUK6ceA9YyxH3HKg
1 parent 0a4472d commit fd7fbff

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

cmd/mdsmith/e2e_coverage_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,3 +756,21 @@ func TestE2E_Check_Stdin_Quiet(t *testing.T) {
756756
assert.NotContains(t, stderr, "MDS006",
757757
"expected no diagnostic output with --quiet stdin, got: %s", stderr)
758758
}
759+
760+
// =============================================================
761+
// fixDiscovered with unfixable diagnostics (non-quiet)
762+
// =============================================================
763+
764+
func TestE2E_Fix_Discovered_UnfixableDiagnostic(t *testing.T) {
765+
dir := t.TempDir()
766+
isolateDir(t, dir)
767+
// trailing-punctuation in heading is unfixable; trailing spaces are fixable.
768+
// After fix, MDS017 remains → formatDiagnostics is called in fixDiscovered.
769+
writeFixture(t, dir, ".mdsmith.yml", "rules:\n no-trailing-punctuation: true\n no-trailing-spaces: true\n")
770+
writeFixture(t, dir, "dirty.md", "# Title!\n\nHello \n")
771+
772+
_, stderr, exitCode := runBinaryInDir(t, dir, "", "fix", "--no-color")
773+
assert.Equal(t, 1, exitCode, "expected exit 1 (unfixable diagnostic), got %d", exitCode)
774+
assert.Contains(t, stderr, "MDS017",
775+
"expected MDS017 diagnostic in stderr, got: %s", stderr)
776+
}

0 commit comments

Comments
 (0)