diff options
author | Jani Nikula <jani.nikula@intel.com> | 2017-10-09 18:26:15 +0300 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2017-10-12 11:07:42 -0600 |
commit | e8939222dced668fc5cae02b0b601af069801107 (patch) | |
tree | 96a0758ef47ea1a5f876a87abf28b0849780a656 /scripts/documentation-file-ref-check | |
parent | 8d73c512e648bee83b912733876b9b4071353265 (diff) | |
download | linux-next-e8939222dced668fc5cae02b0b601af069801107.tar.gz |
Documentation: add script and build target to check for broken file references
Add a simple script and build target to do a treewide grep for
references to files under Documentation, and report the non-existing
file in stderr. It tries to take into account punctuation not part of
the filename, and wildcards, but there are bound to be false positives
too. Mostly seems accurate though.
We've moved files around enough to make having this worthwhile.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'scripts/documentation-file-ref-check')
-rwxr-xr-x | scripts/documentation-file-ref-check | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/documentation-file-ref-check b/scripts/documentation-file-ref-check new file mode 100755 index 000000000000..bc1659900e89 --- /dev/null +++ b/scripts/documentation-file-ref-check @@ -0,0 +1,15 @@ +#!/bin/sh +# Treewide grep for references to files under Documentation, and report +# non-existing files in stderr. + +for f in $(git ls-files); do + for ref in $(grep -ho "Documentation/[A-Za-z0-9_.,~/*+-]*" "$f"); do + # presume trailing . and , are not part of the name + ref=${ref%%[.,]} + + # use ls to handle wildcards + if ! ls $ref >/dev/null 2>&1; then + echo "$f: $ref" >&2 + fi + done +done |