diff options
Diffstat (limited to 'scripts/documentation-file-ref-check')
-rwxr-xr-x | scripts/documentation-file-ref-check | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/scripts/documentation-file-ref-check b/scripts/documentation-file-ref-check index 7784c54aa38b..68083f2f1122 100755 --- a/scripts/documentation-file-ref-check +++ b/scripts/documentation-file-ref-check @@ -12,7 +12,7 @@ use Getopt::Long qw(:config no_auto_abbrev); # to mention a past documentation file, for example, to give credits for # the original work. my %false_positives = ( - "Documentation/scsi/scsi_mid_low_api.txt" => "Documentation/Configure.help", + "Documentation/scsi/scsi_mid_low_api.rst" => "Documentation/Configure.help", "drivers/vhost/vhost.c" => "Documentation/virtual/lguest/lguest.c", ); @@ -24,8 +24,8 @@ my $help = 0; my $fix = 0; my $warn = 0; -if (! -d ".git") { - printf "Warning: can't check if file exists, as this is not a git tree"; +if (! -e ".git") { + printf "Warning: can't check if file exists, as this is not a git tree\n"; exit 0; } @@ -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; @@ -87,6 +94,9 @@ while (<IN>) { # Makefiles and scripts contain nasty expressions to parse docs next if ($f =~ m/Makefile/ || $f =~ m/\.sh$/); + # It doesn't make sense to parse hidden files + next if ($f =~ m#/\.#); + # Skip this script next if ($f eq $scriptname); @@ -137,6 +147,7 @@ while (<IN>) { if ($f =~ m/tools/) { my $path = $f; $path =~ s,(.*)/.*,$1,; + $path =~ s,testing/selftests/bpf,bpf/bpftool,; next if (grep -e, glob("$path/$ref $path/../$ref $path/$fulref")); } |