Skip to content

Commit

Permalink
Add a script to identify dead links in released CS
Browse files Browse the repository at this point in the history
  • Loading branch information
righettod committed Jan 7, 2019
1 parent b94ff5f commit 784fc3f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Linter audit result file
linter-result.out
# Audit result files
*.out
4 changes: 1 addition & 3 deletions .markdownlinkcheck.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"ignorePatterns": [{
"pattern": "^/assets/"
}],
"ignorePatterns": [],
"httpHeaders": [{
"urls": [
"https://", "http://"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ The file **.markdownlint.json** define the central validation policy applied at

Details about rules is [here](https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md).

The file **.markdownlinkcheck.json** define the configuration used to validate using this [tool](https://github.com/tcort/markdown-link-check), at TravisCI level, all HTTP/HTTPS links used in cheat sheets.
The file **.markdownlinkcheck.json** define the configuration used to validate using this [tool](https://github.com/tcort/markdown-link-check), at TravisCI level, all HTTP, HTTPS and relatives links used in cheat sheets.

# Migration tasks list

Expand Down
14 changes: 14 additions & 0 deletions scripts/Apply_Link_Check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
# Script in charge of auditing the released cheatsheets MD files
# in order to detect dead links
cd ../cheatsheets
find . -name \*.md -exec markdown-link-check -c ../.markdownlinkcheck.json {} \; 1>../link-check-result.out 2>&1
errors=`grep -c "ERROR:" ../link-check-result.out`
content=`cat ../link-check-result.out`
if [[ $errors != "0" ]]
then
echo "[!] Error(s) found by the Links validator: $errors CS have dead links !"
exit $errors
else
echo "[+] No error found by the Links validator."
fi

0 comments on commit 784fc3f

Please sign in to comment.