-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'jorgeorpinel' into 2020-02-03
- Loading branch information
Showing
15 changed files
with
417 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
- id: dead-url | ||
name: Dead URL Checker | ||
entry: scripts/link-check.sh | ||
language: script | ||
types: [text] | ||
description: This hook searches for problematic URLs. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
http://127.0.0.1:10000/devstoreaccount1; | ||
http://localhost:3000/ | ||
https://$ | ||
https://api.github.com/repos/$ | ||
https://blog.$ | ||
https://discuss.$ | ||
https://dvc.org/some.link | ||
https://example.com/data.txt | ||
https://example.com/path/to/data | ||
https://example.com/path/to/data.csv | ||
https://example.com/path/to/dir | ||
https://github.com/$ | ||
https://github.com/dataversioncontrol/myrepo.git | ||
https://github.com/example/registry | ||
https://github.com/iterative/dvc.org/blob/master/public$ | ||
https://github.com/iterative/dvc/releases/download/$ | ||
https://github.com/myaccount/myproject.git | ||
https://myendpoint.com | ||
https://object-storage.example.com | ||
https://www.youtube.com/embed/$ | ||
https://accounts.google.com/o/oauth2/auth | ||
http://ogp.me/ns# | ||
https://remote.dvc.org/get-started | ||
https://drive.google.com/drive/folders/0AIac4JZqHhKmUk9PDA | ||
http://millionsongdataset.com/pages/getting-dataset/#subset | ||
https://circleci.com/gh/iterative/dvc.org | ||
https://s3-us-east-2.amazonaws.com/dvc-s3-repo/ | ||
https://www.katacoda.com/loodse/courses/docker/docker-02-install | ||
https://www.katacoda.com/loodse/courses/dvc/dvc-01-install | ||
https://marketplace.visualstudio.com/items?itemName=stkb.rewrap | ||
https://www.kaggle.com/rtatman/kerneld4769833fe | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
(find pages/ public/static/docs/ src/ .github/ -name '*.md' -o -name '*.js' && ls *.md *.js) \ | ||
| xargs -n1 -P8 $(dirname "$0")/link-check.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
set -euxo pipefail | ||
$(dirname "$0")/link-check.sh <(git diff origin/master -U0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env bash | ||
# Check HTTP status codes of links in the given files. | ||
# Success: 2xx, Errors: 4xx/5xx, Warnings: anything else. | ||
# Redirects (3xx) are followed. | ||
# Usage: | ||
# link-check.sh [<files>] | ||
set -euo pipefail | ||
|
||
base_url="${CHECK_LINKS_RELATIVE_URL:-https://dvc.org}" | ||
exclude="${CHECK_LINKS_EXCLUDE_LIST:-$(dirname $0)/exclude-links.txt}" | ||
[ -f "$exclude" ] && exclude="$(cat $exclude)" | ||
|
||
finder(){ # expects list of files | ||
# explicit links not in markdown | ||
pcregrep -o '(?<!\]\()https?://[^\s<>{}"'"'"'`]+' "$@" | ||
# explicit links in markdown | ||
pcregrep -o '(?<=\])\(https?://[^[\]\s]+\)' "$@" | pcregrep -o '\((?:[^)(]*(?R)?)*+\)' | pcregrep -o '(?<=\().*(?=\))' | ||
# relative links in markdown | ||
sed -nr 's/.*]\((\/[^)[:space:]]+).*/\1/p' "$@" | xargs -n1 -II echo ${base_url}I | ||
# relative links in html | ||
sed -nr 's/.*href=["'"'"'](\/[^"'"'"']+?)["'"'"'].*/\1/p' "$@" | xargs -n1 -II echo ${base_url}I | ||
} | ||
checker(){ # expects list of urls | ||
errors=0 | ||
for url in "$@"; do | ||
status="$(curl -IL -w '%{http_code}' -so /dev/null "$url")" | ||
case "$status" in | ||
2??) | ||
# success | ||
;; | ||
[45]??) | ||
echo | ||
echo " ERROR:$status:$url" >&2 | ||
errors=$(($errors + 1)) | ||
;; | ||
*) | ||
echo | ||
echo " WARNING:$status:$url" >&2 | ||
;; | ||
esac | ||
done | ||
return $errors | ||
} | ||
|
||
fails=0 | ||
for file in "$@"; do | ||
echo -n "$file:" | ||
prev=$fails | ||
checker $(finder "$file" | sort -u | comm -23 - <(echo "$exclude" | sort -u)) || fails=$(($fails + 1)) | ||
[ $prev -eq $fails ] && echo OK | ||
done | ||
[ $fails -eq 0 ] || echo -e "ERROR:$fails failures\n---" >&2 | ||
exit $fails |
Oops, something went wrong.