All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Linux Doc Mailing List <linux-doc@vger.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>
Subject: [PATCH 1/7] scripts: documentation-file-ref-check: improve :doc: handling
Date: Sat, 22 Feb 2020 10:00:01 +0100	[thread overview]
Message-ID: <dd46ed78051d084f238d031722861b65d24196dc.1582361737.git.mchehab+huawei@kernel.org> (raw)
In-Reply-To: <cover.1582361737.git.mchehab+huawei@kernel.org>

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>
---
 scripts/documentation-file-ref-check | 11 +++++++++--
 1 file 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;
 
-- 
2.24.1


  reply	other threads:[~2020-02-22  9:00 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-22  9:00 [PATCH 0/7] Some cross-reference fixes due to fixes renames Mauro Carvalho Chehab
2020-02-22  9:00 ` Mauro Carvalho Chehab [this message]
2020-02-22  9:00 ` [PATCH 2/7] docs: dt: fix several broken references due to renames Mauro Carvalho Chehab
2020-02-22  9:00   ` Mauro Carvalho Chehab
2020-02-22  9:00   ` Mauro Carvalho Chehab
2020-02-22  9:00   ` Mauro Carvalho Chehab
2020-02-24  0:07   ` Andrew Jeffery
2020-02-24  0:07     ` Andrew Jeffery
2020-02-24  0:07     ` Andrew Jeffery
2020-02-24  0:07     ` Andrew Jeffery
2020-02-24 13:02   ` Dan Murphy
2020-02-24 13:02     ` Dan Murphy
2020-02-24 13:02     ` Dan Murphy
2020-02-24 13:02     ` Dan Murphy
2020-02-24 14:55   ` Amit Kucheria
2020-02-24 14:55     ` Amit Kucheria
2020-02-24 14:55     ` Amit Kucheria
2020-02-24 14:55     ` Amit Kucheria
2020-02-24 14:55     ` Amit Kucheria
2020-02-24 18:14   ` Rob Herring
2020-02-24 18:14     ` Rob Herring
2020-02-24 18:14     ` Rob Herring
2020-02-24 18:14     ` Rob Herring
2020-02-24 18:14     ` Rob Herring
2020-02-27  9:16   ` Daniel Lezcano
2020-02-27  9:16     ` Daniel Lezcano
2020-02-27  9:16     ` Daniel Lezcano
2020-02-27  9:16     ` Daniel Lezcano
2020-02-22  9:00 ` [PATCH 3/7] docs: fix broken references to text files Mauro Carvalho Chehab
2020-02-22  9:00   ` Mauro Carvalho Chehab
2020-02-22  9:00   ` Mauro Carvalho Chehab
2020-02-22  9:00   ` Mauro Carvalho Chehab
2020-02-22  9:00   ` Mauro Carvalho Chehab
2020-02-22  9:00   ` Mauro Carvalho Chehab
2020-02-22 17:51   ` Daniel Vetter
2020-02-22 17:51     ` Daniel Vetter
2020-02-22 17:51     ` Daniel Vetter
2020-02-22 17:51     ` Daniel Vetter
2020-02-22 17:51     ` Daniel Vetter
2020-02-22 17:51     ` Daniel Vetter
2020-02-22 17:51     ` Daniel Vetter
2020-02-24  9:26   ` Federico Vaga
2020-02-24  9:26     ` Federico Vaga
2020-02-24  9:26     ` Federico Vaga
2020-02-24  9:26     ` Federico Vaga
2020-02-24  9:26     ` Federico Vaga
2020-02-24  9:26     ` Federico Vaga
2020-03-25  2:42   ` Stephen Boyd
2020-03-25  2:42     ` Stephen Boyd
2020-03-25  2:42     ` Stephen Boyd
2020-03-25  2:42     ` Stephen Boyd
2020-03-25  2:42     ` Stephen Boyd
2020-03-25  2:42     ` Stephen Boyd
2020-02-22  9:00 ` [PATCH 4/7] docs: adm1177: fix a broken reference Mauro Carvalho Chehab
2020-02-22 15:48   ` Guenter Roeck
2020-02-22  9:00 ` [PATCH 5/7] docs: fix broken references for ReST files that moved around Mauro Carvalho Chehab
2020-02-22  9:00   ` Mauro Carvalho Chehab
2020-02-23  8:12   ` Paolo Bonzini
2020-02-23  8:12     ` Paolo Bonzini
2020-02-22  9:00 ` [PATCH 6/7] docs: remove nompx kernel parameter and intel_mpx from index.rst Mauro Carvalho Chehab
2020-02-24 17:30   ` Dave Hansen
2020-02-25 10:06     ` Jonathan Corbet
2020-02-22  9:00 ` [PATCH 7/7] docs: gpu: i915.rst: fix warnings due to file renames Mauro Carvalho Chehab
2020-02-22  9:00   ` [Intel-gfx] " Mauro Carvalho Chehab
2020-02-22  9:00   ` Mauro Carvalho Chehab
2020-02-25 23:36   ` Rodrigo Vivi
2020-02-25 23:36     ` [Intel-gfx] " Rodrigo Vivi
2020-02-25 23:36     ` Rodrigo Vivi
2020-02-25 10:05 ` [PATCH 0/7] Some cross-reference fixes due to fixes renames Jonathan Corbet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dd46ed78051d084f238d031722861b65d24196dc.1582361737.git.mchehab+huawei@kernel.org \
    --to=mchehab+huawei@kernel.org \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.