Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d69708f authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

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: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Acked-by: default avatarJonathan Corbet <corbet@lwn.net>
parent e1f319fe
Loading
Loading
Loading
Loading
+18 −3
Original line number Original line Diff line number Diff line
@@ -38,16 +38,31 @@ while (<IN>) {
	my $f = $1;
	my $f = $1;
	my $ln = $2;
	my $ln = $2;


	# Makefiles contain nasty expressions to parse docs
	# Makefiles and scripts contain nasty expressions to parse docs
	next if ($f =~ m/Makefile/);
	next if ($f =~ m/Makefile/ || $f =~ m/\.sh$/);

	# Skip this script
	# Skip this script
	next if ($f eq $scriptname);
	next if ($f eq $scriptname);


	if ($ln =~ m,\b(\S*)(Documentation/[A-Za-z0-9\_\.\,\~/\*\[\]\?+-]*),) {
	if ($ln =~ m,\b(\S*)(Documentation/[A-Za-z0-9\_\.\,\~/\*\[\]\?+-]*)(.*),) {
		my $prefix = $1;
		my $prefix = $1;
		my $ref = $2;
		my $ref = $2;
		my $base = $2;
		my $base = $2;
		my $extra = $3;

		# some file references are like:
		# /usr/src/linux/Documentation/DMA-{API,mapping}.txt
		# For now, ignore them
		next if ($extra =~ m/^{/);

		# Remove footnotes at the end like:
		# Documentation/devicetree/dt-object-internal.txt[1]
		$ref =~ s/(txt|rst)\[\d+]$/$1/;

		# Remove ending ']' without any '['
		$ref =~ s/\].*// if (!($ref =~ m/\[/));


		# Remove puntuation marks at the end
		$ref =~ s/[\,\.]+$//;
		$ref =~ s/[\,\.]+$//;


		my $fulref = "$prefix$ref";
		my $fulref = "$prefix$ref";