Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1093134yba; Wed, 24 Apr 2019 15:00:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXUKFKDgnEeNhi5jqMAP3Ap+xYMD/QtB8zdXWxNe785htgX7mefFOpHvpj3OWm5EQ8OZtP X-Received: by 2002:a62:1815:: with SMTP id 21mr35935597pfy.107.1556143258974; Wed, 24 Apr 2019 15:00:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556143258; cv=none; d=google.com; s=arc-20160816; b=aw8Hndqp0lNE9NWukq7ymiIiVLRdG0GIu2Mv2eGDS7kb4e4a6uv8RBK5NXf6LltegZ XP+vSeZlk4FBTcsr6PS8I+Gq/VosO2rpJDiDrYMVZFnO516jt2hyUAWDBMy9ZM/vfy9M bNb8AKriRPpI/gvMc77Fj1oNML3/IUAw7IMNo8wH+llycqTvYUi8oqraTZoTHr+GsPLm QWI6Rn0S5++dGRHf9wIyyT484W0Tyxb5NTZq/8meWsGOgJPIi1srANsK/E9kGb40tFq+ yGBpMIvn49waUJH3B1IgVcTeR5VUtcRMasg+wItwtb6idvU4e05mGcrL0FSpPnr4Fu2k B7aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=nKRPLk1JuXTP2gJdgLMa+pdnLmDfJdy9v3pxOLqRwSM=; b=ZlOJs5WBLL3sdsIqeFi129FqrpZM5lcBzUm8ZytIFeGQED526w88n5RD/tbfsITVOC vd5p/FQTjobe3g8qv+J04sS1Y1soV8HLYdfbs6ETLLgm/7Lp/yCE2vyjJd+JnI7vj3vL E0QfFAYWUL+gfBEvtRIUEHcOvq6E70ue7/QVxcIa59yK2kizVLbr1bXgBvNpguqs2Sok x2BnDvB9JP17RwjDvS8MLycxsvfnPr8/90yOfGEM/+AjJSrj02hikYmJU9Sf6i0RdPYq AfkmffGkslzD1Fhjviio85zQMwKIpP0REtsDHxZoN7xzOXt8aMgIAskjpymCsMv1Y7Ls ow8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="DYJft/RP"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u7si12488154pgi.450.2019.04.24.15.00.42; Wed, 24 Apr 2019 15:00:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="DYJft/RP"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732320AbfDXQZo (ORCPT + 99 others); Wed, 24 Apr 2019 12:25:44 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:56078 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727469AbfDXQZn (ORCPT ); Wed, 24 Apr 2019 12:25:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=Sender:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=nKRPLk1JuXTP2gJdgLMa+pdnLmDfJdy9v3pxOLqRwSM=; b=DYJft/RPGPWfqUn2StdzdHOM6 rI4b+HMvd06qApKr/I9IR2CMOkTu00LHZvfOvIq/9QiQvYKayULAISUMDvI66cL9VFy8Mep3YGYx6 L0c2I8Xd1CfwubxoLSaayLnG9C/UkBaoaubRrcUbLHBQAUwjNWsM/FlmY7+5z5zu5vq+Gq+VOztN8 vm0GmQilwGvCBBmQ22GoHoKJWUVe766oPwQjbwO5MT+FQGEmNMUuCBit6MYU45MMh5iQGRH+HYS5F 8UfVwsKj4dX/1xRy2fvYRTE4+TY5UOH9LGL1z+OaigHQh+yfa6yQ3VJB2zl/7V0KP/aStbaiSd/aF GUq+RP8OA==; Received: from 177.17.136.231.dynamic.adsl.gvt.net.br ([177.17.136.231] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hJKiN-0001aS-6t; Wed, 24 Apr 2019 16:25:43 +0000 Received: from mchehab by bombadil.infradead.org with local (Exim 4.92) (envelope-from ) id 1hJKiI-0002xA-IK; Wed, 24 Apr 2019 13:25:38 -0300 From: Mauro Carvalho Chehab To: Linux Doc Mailing List Cc: Mauro Carvalho Chehab , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org, Jonathan Corbet Subject: [PATCH] scripts/documentation-file-ref-check: detect broken :doc:`foo` Date: Wed, 24 Apr 2019 13:25:33 -0300 Message-Id: X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As we keep migrating documents to ReST, we're starting to see more of such tags. Right now, all such tags are pointing to a documentation file, but regressions may be introduced. So, add a check for such kind of issues as well. Signed-off-by: Mauro Carvalho Chehab --- scripts/documentation-file-ref-check | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/scripts/documentation-file-ref-check b/scripts/documentation-file-ref-check index f47ef26754fa..01cf36e3840c 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); my %broken_ref; +my $doc_fix = 0; + +open IN, "git grep ':doc:\`' Documentation/|" + or die "Failed to run git grep"; +while () { + next if (!m,^([^:]+):.*\:doc\:\`([^\`]+)\`,); + + my $d = $1; + my $doc_ref = $2; + + my $f = $doc_ref; + + $d =~ s,(.*/).*,$1,; + $f =~ s,.*\<([^\>]+)\>,$1,; + + $f ="$d$f.rst"; + + next if (grep -e, glob("$f")); + + if ($fix && !$doc_fix) { + print STDERR "\nWARNING: Currently, can't fix broken :doc:`` fields\n"; + } + $doc_fix++; + + print STDERR "$f: :doc:`$doc_ref`\n"; +} +close IN; + open IN, "git grep 'Documentation/'|" or die "Failed to run git grep"; while () { @@ -103,6 +131,7 @@ while () { } } } +close IN; exit 0 if (!$fix); -- 2.20.1