diff options
Diffstat (limited to 'scripts/documentation-file-ref-check')
-rwxr-xr-x | scripts/documentation-file-ref-check | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/documentation-file-ref-check b/scripts/documentation-file-ref-check index ad9db6821824..63e9542656f1 100755 --- a/scripts/documentation-file-ref-check +++ b/scripts/documentation-file-ref-check | |||
@@ -30,6 +30,34 @@ print "Finding broken references. This may take a while... " if ($fix); | |||
30 | 30 | ||
31 | my %broken_ref; | 31 | my %broken_ref; |
32 | 32 | ||
33 | my $doc_fix = 0; | ||
34 | |||
35 | open IN, "git grep ':doc:\`' Documentation/|" | ||
36 | or die "Failed to run git grep"; | ||
37 | while (<IN>) { | ||
38 | next if (!m,^([^:]+):.*\:doc\:\`([^\`]+)\`,); | ||
39 | |||
40 | my $d = $1; | ||
41 | my $doc_ref = $2; | ||
42 | |||
43 | my $f = $doc_ref; | ||
44 | |||
45 | $d =~ s,(.*/).*,$1,; | ||
46 | $f =~ s,.*\<([^\>]+)\>,$1,; | ||
47 | |||
48 | $f ="$d$f.rst"; | ||
49 | |||
50 | next if (grep -e, glob("$f")); | ||
51 | |||
52 | if ($fix && !$doc_fix) { | ||
53 | print STDERR "\nWARNING: Currently, can't fix broken :doc:`` fields\n"; | ||
54 | } | ||
55 | $doc_fix++; | ||
56 | |||
57 | print STDERR "$f: :doc:`$doc_ref`\n"; | ||
58 | } | ||
59 | close IN; | ||
60 | |||
33 | open IN, "git grep 'Documentation/'|" | 61 | open IN, "git grep 'Documentation/'|" |
34 | or die "Failed to run git grep"; | 62 | or die "Failed to run git grep"; |
35 | while (<IN>) { | 63 | while (<IN>) { |
@@ -38,6 +66,9 @@ while (<IN>) { | |||
38 | my $f = $1; | 66 | my $f = $1; |
39 | my $ln = $2; | 67 | my $ln = $2; |
40 | 68 | ||
69 | # On linux-next, discard the Next/ directory | ||
70 | next if ($f =~ m,^Next/,); | ||
71 | |||
41 | # Makefiles and scripts contain nasty expressions to parse docs | 72 | # Makefiles and scripts contain nasty expressions to parse docs |
42 | next if ($f =~ m/Makefile/ || $f =~ m/\.sh$/); | 73 | next if ($f =~ m/Makefile/ || $f =~ m/\.sh$/); |
43 | 74 | ||
@@ -100,6 +131,7 @@ while (<IN>) { | |||
100 | } | 131 | } |
101 | } | 132 | } |
102 | } | 133 | } |
134 | close IN; | ||
103 | 135 | ||
104 | exit 0 if (!$fix); | 136 | exit 0 if (!$fix); |
105 | 137 | ||