aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/documentation-file-ref-check
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-06-14 09:47:29 -0400
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2018-06-15 17:10:01 -0400
commit2d69708f9c08067735672908507894374bebb379 (patch)
tree237faab2a141f1c6ffe85d43bc67e47628d0cd03 /scripts/documentation-file-ref-check
parente1f319fe4d537da79691f1a1da7a20147de33047 (diff)
scripts/documentation-file-ref-check: get rid of false-positives
Now that the number of broken refs are smaller, improve the logic that gets rid of false-positives. Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Acked-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'scripts/documentation-file-ref-check')
-rwxr-xr-xscripts/documentation-file-ref-check21
1 files changed, 18 insertions, 3 deletions
diff --git a/scripts/documentation-file-ref-check b/scripts/documentation-file-ref-check
index d132f756d31d..047f463cdf4b 100755
--- a/scripts/documentation-file-ref-check
+++ b/scripts/documentation-file-ref-check
@@ -38,16 +38,31 @@ while (<IN>) {
38 my $f = $1; 38 my $f = $1;
39 my $ln = $2; 39 my $ln = $2;
40 40
41 # Makefiles contain nasty expressions to parse docs 41 # Makefiles and scripts contain nasty expressions to parse docs
42 next if ($f =~ m/Makefile/); 42 next if ($f =~ m/Makefile/ || $f =~ m/\.sh$/);
43
43 # Skip this script 44 # Skip this script
44 next if ($f eq $scriptname); 45 next if ($f eq $scriptname);
45 46
46 if ($ln =~ m,\b(\S*)(Documentation/[A-Za-z0-9\_\.\,\~/\*\[\]\?+-]*),) { 47 if ($ln =~ m,\b(\S*)(Documentation/[A-Za-z0-9\_\.\,\~/\*\[\]\?+-]*)(.*),) {
47 my $prefix = $1; 48 my $prefix = $1;
48 my $ref = $2; 49 my $ref = $2;
49 my $base = $2; 50 my $base = $2;
51 my $extra = $3;
52
53 # some file references are like:
54 # /usr/src/linux/Documentation/DMA-{API,mapping}.txt
55 # For now, ignore them
56 next if ($extra =~ m/^{/);
57
58 # Remove footnotes at the end like:
59 # Documentation/devicetree/dt-object-internal.txt[1]
60 $ref =~ s/(txt|rst)\[\d+]$/$1/;
61
62 # Remove ending ']' without any '['
63 $ref =~ s/\].*// if (!($ref =~ m/\[/));
50 64
65 # Remove puntuation marks at the end
51 $ref =~ s/[\,\.]+$//; 66 $ref =~ s/[\,\.]+$//;
52 67
53 my $fulref = "$prefix$ref"; 68 my $fulref = "$prefix$ref";