diff --git a/src/Xrefcheck/Command.hs b/src/Xrefcheck/Command.hs index 12ee272e..6a13c5b2 100644 --- a/src/Xrefcheck/Command.hs +++ b/src/Xrefcheck/Command.hs @@ -86,7 +86,9 @@ defaultAction Options{..} = do { cNetworking = addNetworkingOptions (cNetworking config) oNetworkingOptions } verifyRepo rw fullConfig oMode oRoot repoInfo - whenJust (nonEmpty copyPasteErrors) reportCopyPasteErrors + whenJust (nonEmpty copyPasteErrors) $ \errs -> do + reportCopyPasteErrors errs + fmt "\n" case verifyErrors verifyRes of Nothing | null scanErrs -> fmtLn "All repository links are valid." Nothing -> exitFailure diff --git a/tests/golden/check-copy-paste/expected.gold b/tests/golden/check-copy-paste/expected.gold index 796b4c73..544e7a94 100644 --- a/tests/golden/check-copy-paste/expected.gold +++ b/tests/golden/check-copy-paste/expected.gold @@ -23,26 +23,67 @@ - anchor: - ➥ In file second-file.md - reference (relative) at src:24:1-29: + reference (relative) at src:23:1-33: + - text: "fubarw" + - link: ./nonexistent-file.md + - anchor: - + is possibly a bad copy paste of + reference (relative) at src:24:1-36: + - text: "nonexfile" + - link: ./nonexistent-file.md + - anchor: - + + ➥ In file second-file.md + reference (relative) at src:25:1-30: - text: "fdw" - - link: ./first-file.md - - anchor: chor + - link: ./nonexistent-file.md + - anchor: - is possibly a bad copy paste of - reference (relative) at src:23:1-32: - - text: "ff-cho" - - link: ./first-file.md - - anchor: chor + reference (relative) at src:24:1-36: + - text: "nonexfile" + - link: ./nonexistent-file.md + - anchor: - ➥ In file second-file.md - reference (external) at src:29:1-28: + reference (external) at src:30:1-28: - text: "gitlab" - link: https://github.com - anchor: - is possibly a bad copy paste of - reference (external) at src:28:1-28: + reference (external) at src:29:1-28: - text: "github" - link: https://github.com - anchor: - -Possible copy/paste errors dumped, 4 in total. -All repository links are valid. +Possible copy/paste errors dumped, 5 in total. + +=== Invalid references found === + + ➥ In file second-file.md + bad reference (relative) at src:23:1-33: + - text: "fubarw" + - link: ./nonexistent-file.md + - anchor: - + + File does not exist: + nonexistent-file.md + + ➥ In file second-file.md + bad reference (relative) at src:24:1-36: + - text: "nonexfile" + - link: ./nonexistent-file.md + - anchor: - + + File does not exist: + nonexistent-file.md + + ➥ In file second-file.md + bad reference (relative) at src:25:1-30: + - text: "fdw" + - link: ./nonexistent-file.md + - anchor: - + + File does not exist: + nonexistent-file.md + +Invalid references dumped, 3 in total. diff --git a/tests/golden/check-copy-paste/second-file.md b/tests/golden/check-copy-paste/second-file.md index 02f4d554..171c55e4 100644 --- a/tests/golden/check-copy-paste/second-file.md +++ b/tests/golden/check-copy-paste/second-file.md @@ -20,8 +20,9 @@ -[ ff-cho](./first-file.md#chor) -[ fdw](./first-file.md#chor) +[ fubarw](./nonexistent-file.md) +[ nonexfile](./nonexistent-file.md) +[ fdw](./nonexistent-file.md)