Skip to content

Commit

Permalink
Merge pull request #212 from serokell/Sorokin-Anton/#208-remove-exess…
Browse files Browse the repository at this point in the history
…ive-newlines

[#208] Remove exessive newlines from output
  • Loading branch information
Sorokin-Anton authored Nov 4, 2022
2 parents b498650 + 1476bd3 commit 7dd5c4c
Show file tree
Hide file tree
Showing 18 changed files with 3 additions and 127 deletions.
4 changes: 2 additions & 2 deletions src/Xrefcheck/Command.hs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ defaultAction Options{..} = do
fmt [int||
=== Repository data ===

#{indentF 2 (build repoInfo)}
#{indentF 2 (build repoInfo)}\
|]

unless (null scanErrs) . reportScanErrs $ sortBy (compare `on` seFile) scanErrs
Expand All @@ -89,7 +89,7 @@ defaultAction Options{..} = do
Nothing | null scanErrs -> fmtLn "All repository links are valid."
Nothing -> exitFailure
Just (toList -> verifyErrs) -> do
fmt "\n\n"
unless (null scanErrs) $ fmt "\n"
reportVerifyErrs verifyErrs
exitFailure
where
Expand Down
1 change: 0 additions & 1 deletion src/Xrefcheck/Scan.hs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ instance Given ColorMode => Buildable ScanError where

⛀ #{seDescription}


|]

data ScanErrorDescription
Expand Down
4 changes: 1 addition & 3 deletions src/Xrefcheck/Verify.hs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ instance (Given ColorMode, Buildable a) => Buildable (WithReferenceLoc a) where
In file #{styleIfNeeded Faint (styleIfNeeded Bold wrlFile)}
bad #{wrlReference}
#{wrlItem}

|]

data VerifyError
Expand Down Expand Up @@ -160,7 +159,7 @@ instance Given ColorMode => Buildable VerifyError where
| otherwise ->
[int||
⛀ Anchor '#{anchor}' is not present, did you mean:
#{indentF 4 $ blockListF similar}
#{indentF 4 $ blockListF similar}\
|]

AmbiguousAnchorRef file anchor fileAnchors ->
Expand Down Expand Up @@ -229,7 +228,6 @@ instance Given ColorMode => Buildable VerifyError where
ExternalResourceSomeError err ->
[int||
⛂ #{err}

|]

data RetryAfter = Date UTCTime | Seconds (Time Second)
Expand Down
11 changes: 0 additions & 11 deletions tests/golden/check-anchors/check-anchors.bats
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ load '../helpers'
@test "We report ambiguous anchor references" {
to_temp xrefcheck -r ambiguous-anchors
assert_diff - <<EOF
=== Invalid references found ===
➥ In file ambiguous-anchors/a.md
Expand All @@ -32,7 +30,6 @@ assert_diff - <<EOF
Use of ambiguous anchors is discouraged because the target
can change silently while the document containing it evolves.
➥ In file ambiguous-anchors/b.md
bad reference (relative) at src:7:1-48:
- text: "ambiguous anchor in other file"
Expand All @@ -49,16 +46,13 @@ assert_diff - <<EOF
Use of ambiguous anchors is discouraged because the target
can change silently while the document containing it evolves.
Invalid references dumped, 2 in total.
EOF
}

@test "We report references to non-existing anchors, giving hints about similar ones" {
to_temp xrefcheck -r non-existing-anchors
assert_diff - <<EOF
=== Invalid references found ===
➥ In file non-existing-anchors/a.md
Expand All @@ -71,8 +65,6 @@ assert_diff - <<EOF
- h1 (header I) at src:6:1-4
- h2 (header II) at src:8:1-5
➥ In file non-existing-anchors/a.md
bad reference (current file) at src:14:1-18:
- text: "broken"
Expand All @@ -82,8 +74,6 @@ assert_diff - <<EOF
⛀ Anchor 'heading' is not present, did you mean:
- the-heading (header I) at src:10:1-13
➥ In file non-existing-anchors/a.md
bad reference (current file) at src:16:1-31:
- text: "broken"
Expand All @@ -92,7 +82,6 @@ assert_diff - <<EOF
⛀ Anchor 'really-unique-anchor' is not present
Invalid references dumped, 3 in total.
EOF
}
1 change: 0 additions & 1 deletion tests/golden/check-autolinks/check-autolinks.bats
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ assert_diff - <<EOF
- anchors:
[]
All repository links are valid.
EOF
}
9 changes: 0 additions & 9 deletions tests/golden/check-cli/check-cli.bats
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ load '../helpers'
to_temp xrefcheck --root .

assert_diff - <<EOF
=== Invalid references found ===
➥ In file to-ignore/broken-link.md
Expand All @@ -58,7 +56,6 @@ load '../helpers'
⛀ File does not exist:
./one/two/three
Invalid references dumped, 1 in total.
EOF
}
Expand All @@ -67,8 +64,6 @@ EOF
to_temp xrefcheck --root ././///././././//./

assert_diff - <<EOF
=== Invalid references found ===
➥ In file to-ignore/broken-link.md
Expand All @@ -80,7 +75,6 @@ EOF
⛀ File does not exist:
./one/two/three
Invalid references dumped, 1 in total.
EOF
}
Expand All @@ -89,8 +83,6 @@ EOF
to_temp xrefcheck

assert_diff - <<EOF
=== Invalid references found ===
➥ In file to-ignore/broken-link.md
Expand All @@ -102,7 +94,6 @@ EOF
⛀ File does not exist:
./one/two/three
Invalid references dumped, 1 in total.
EOF
}
Expand Down
3 changes: 0 additions & 3 deletions tests/golden/check-footnotes/expected.gold
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


=== Invalid references found ===

➥ In file broken-link-in-footnote/file-with-footnote-with-broken-link.md
Expand All @@ -11,5 +9,4 @@
⛀ File does not exist:
broken-link-in-footnote/notExists


Invalid references dumped, 1 in total.
3 changes: 0 additions & 3 deletions tests/golden/check-git/check-git.bats
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ load '../helpers'
to_temp xrefcheck

assert_diff - <<EOF
=== Invalid references found ===
➥ In file git.md
Expand All @@ -54,7 +52,6 @@ load '../helpers'
⛀ File does not exist:
a.md
Invalid references dumped, 1 in total.
EOF
}
4 changes: 0 additions & 4 deletions tests/golden/check-ignore/check-ignore.bats
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ load '../helpers'
⛀ Annotation "ignore all" must be at the top of markdown or right after comments at the top
Scan errors dumped, 1 in total.
EOF
}
Expand All @@ -61,10 +60,8 @@ EOF
⛀ Annotation "ignore all" must be at the top of markdown or right after comments at the top
Scan errors dumped, 1 in total.
=== Invalid references found ===
➥ In file check-ignore.md
Expand All @@ -76,7 +73,6 @@ Scan errors dumped, 1 in total.
⛀ File does not exist:
./referenced-file.md
Invalid references dumped, 1 in total.
EOF
}
Expand Down
3 changes: 0 additions & 3 deletions tests/golden/check-ignore/expected.gold
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@


=== Scan errors found ===

➥ In file ./to-ignore/inner-directory/broken_annotation.md
scan error at src:9:1-29:

⛀ Annotation "ignore all" must be at the top of markdown or right after comments at the top


Scan errors dumped, 1 in total.
10 changes: 0 additions & 10 deletions tests/golden/check-ignoreExternalRefsTo/expected.gold
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


=== Invalid references found ===

➥ In file check-ignoreExternalRefsTo.md
Expand All @@ -10,8 +8,6 @@

⛂ InternalException (HostCannotConnect "localhost" [Network.Socket.connect: <socket: N>: does not exist (Connection refused)])



➥ In file check-ignoreExternalRefsTo.md
bad reference (external) at src:9:10-45:
- text: "team"
Expand All @@ -20,8 +16,6 @@

⛂ InternalException (HostCannotConnect "127.0.0.1" [Network.Socket.connect: <socket: N>: does not exist (Connection refused)])



➥ In file check-ignoreExternalRefsTo.md
bad reference (external) at src:11:10-44:
- text: "blog"
Expand All @@ -30,8 +24,6 @@

⛂ ConnectionFailure Network.Socket.connect: <socket: N>: does not exist (Connection refused)



➥ In file check-ignoreExternalRefsTo.md
bad reference (external) at src:13:10-44:
- text: "labs"
Expand All @@ -40,6 +32,4 @@

⛂ ConnectionFailure Network.Socket.connect: <socket: N>: does not exist (Connection refused)



Invalid references dumped, 4 in total.
9 changes: 0 additions & 9 deletions tests/golden/check-ignoreLocalRefsTo/expected.gold
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


=== Invalid references found ===

➥ In file check-ignoreLocalRefsTo.md
Expand All @@ -11,7 +9,6 @@
⛀ File does not exist:
./one/a.md


➥ In file check-ignoreLocalRefsTo.md
bad reference (absolute) at src:9:1-26:
- text: "glob wildcard"
Expand All @@ -21,7 +18,6 @@
⛀ File does not exist:
./two/b.md


➥ In file check-ignoreLocalRefsTo.md
bad reference (absolute) at src:11:1-39:
- text: "recursive directory glob"
Expand All @@ -31,7 +27,6 @@
⛀ File does not exist:
./three/c.md


➥ In file check-ignoreLocalRefsTo.md
bad reference (absolute) at src:13:1-51:
- text: "recursive nested directory glob"
Expand All @@ -41,7 +36,6 @@
⛀ File does not exist:
./three/four/d.md


➥ In file check-ignoreLocalRefsTo.md
bad reference (absolute) at src:15:1-59:
- text: "another recursive nested directory glob"
Expand All @@ -51,7 +45,6 @@
⛀ File does not exist:
./three/five/e.md


➥ In file one/file.md
bad reference (relative) at src:7:1-58:
- text: "check ignoreLocalRefsTo are relative to the root"
Expand All @@ -61,7 +54,6 @@
⛀ File does not exist:
one/a.md


➥ In file one/file.md
bad reference (relative) at src:9:1-23:
- text: "one more"
Expand All @@ -71,5 +63,4 @@
⛀ File does not exist:
one/../two/b.md


Invalid references dumped, 7 in total.
3 changes: 0 additions & 3 deletions tests/golden/check-ignoreRefsFrom/check-ignoreRefsFrom.bats
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ load '../helpers'
to_temp xrefcheck -c config-directory.yaml

assert_diff - <<EOF
=== Invalid references found ===
➥ In file ignoreRefsFrom/inner-directory/bad-reference.md
Expand All @@ -45,7 +43,6 @@ load '../helpers'
⛀ File does not exist:
./no-file.md
Invalid references dumped, 1 in total.
EOF
}
7 changes: 0 additions & 7 deletions tests/golden/check-images/expected.gold
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
- anchors:
[]




=== Invalid references found ===

➥ In file check-images.md
Expand All @@ -42,7 +39,6 @@

⛂ Resource unavailable (404 Not Found)


➥ In file check-images.md
bad reference (external) at src:16:1-33:
- text: "bad image ref 2"
Expand All @@ -51,7 +47,6 @@

⛂ Resource unavailable (404 Not Found)


➥ In file check-images.md
bad reference (relative) at src:20:1-34:
- text: "bad image ref 3"
Expand All @@ -61,7 +56,6 @@
⛀ File does not exist:
3.png


➥ In file check-images.md
bad reference (relative) at src:21:1-33:
- text: "bad image ref 4"
Expand All @@ -71,5 +65,4 @@
⛀ File does not exist:
4.png


Invalid references dumped, 4 in total.
Loading

0 comments on commit 7dd5c4c

Please sign in to comment.