diff options
author | Mauro Carvalho Chehab <mchehab+huawei@kernel.org> | 2020-02-22 10:00:01 +0100 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2020-02-25 03:01:05 -0700 |
commit | 290d5388993eb40b9d5632aefb864cf1012a2bcc (patch) | |
tree | a722324effb16cf0e9d7419f0effb5e68c03a12f | |
parent | 43e96ef8b70c50f6054f20b8c357ee5881592082 (diff) |
scripts: documentation-file-ref-check: improve :doc: handling
There are some issues at the script with regards to :doc:
tags:
- It doesn't escape files under Documentation/sphinx,
leading to false positives;
- It doesn't handle root URLs, like :doc:`/x86/boot`;
- It doesn't output the file with a bad reference.
Address those things, in order to remove false positives
from the list of problems.
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
-rwxr-xr-x | scripts/documentation-file-ref-check | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/scripts/documentation-file-ref-check b/scripts/documentation-file-ref-check index 7784c54aa38b..997202a18ddb 100755 --- a/scripts/documentation-file-ref-check +++ b/scripts/documentation-file-ref-check @@ -51,7 +51,9 @@ open IN, "git grep ':doc:\`' Documentation/|" or die "Failed to run git grep"; while (<IN>) { next if (!m,^([^:]+):.*\:doc\:\`([^\`]+)\`,); + next if (m,sphinx/,); + my $file = $1; my $d = $1; my $doc_ref = $2; @@ -60,7 +62,12 @@ while (<IN>) { $d =~ s,(.*/).*,$1,; $f =~ s,.*\<([^\>]+)\>,$1,; - $f ="$d$f.rst"; + if ($f =~ m,^/,) { + $f = "$f.rst"; + $f =~ s,^/,Documentation/,; + } else { + $f = "$d$f.rst"; + } next if (grep -e, glob("$f")); @@ -69,7 +76,7 @@ while (<IN>) { } $doc_fix++; - print STDERR "$f: :doc:`$doc_ref`\n"; + print STDERR "$file: :doc:`$doc_ref`\n"; } close IN; |