This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
podcheck: Reduce fals positives for L<> message
authorKarl Williamson <public@khwilliamson.com>
Sun, 19 Jun 2011 19:06:22 +0000 (13:06 -0600)
committerKarl Williamson <public@khwilliamson.com>
Tue, 21 Jun 2011 13:59:02 +0000 (07:59 -0600)
podcheck looks for things like "See C<INSTALL>" and flags them as
perhaps L<> should have been used instead.  It was giving false
positives for things like "if you do x, you should see C<foo>".  This
catches those.

t/porting/known_pod_issues.dat
t/porting/podcheck.t

index 3407ef8..fc03178 100644 (file)
@@ -221,7 +221,6 @@ pod/perlembed.pod   Verbatim line length including indents exceeds 80 by    27
 pod/perlfaq2.pod       Verbatim line length including indents exceeds 80 by    1
 pod/perlfaq4.pod       Verbatim line length including indents exceeds 80 by    16
 pod/perlfaq5.pod       Verbatim line length including indents exceeds 80 by    40
-pod/perlfaq6.pod       ? Should you be using L<...> instead of 2
 pod/perlfaq6.pod       Verbatim line length including indents exceeds 80 by    36
 pod/perlfaq7.pod       Verbatim line length including indents exceeds 80 by    7
 pod/perlfaq8.pod       Verbatim line length including indents exceeds 80 by    20
@@ -242,7 +241,7 @@ pod/perlhpux.pod    Verbatim line length including indents exceeds 80 by    2
 pod/perlhurd.pod       Verbatim line length including indents exceeds 80 by    2
 pod/perlintern.pod     ? Should you be using L<...> instead of 5
 pod/perlintern.pod     Verbatim line length including indents exceeds 80 by    26
-pod/perlinterp.pod     ? Should you be using L<...> instead of 3
+pod/perlinterp.pod     ? Should you be using L<...> instead of 1
 pod/perlinterp.pod     Verbatim line length including indents exceeds 80 by    1
 pod/perlintro.pod      Verbatim line length including indents exceeds 80 by    11
 pod/perliol.pod        Verbatim line length including indents exceeds 80 by    8
@@ -265,7 +264,6 @@ pod/perlos2.pod     Apparent broken link    7
 pod/perlos2.pod        Apparent internal link is missing its forward slash     3
 pod/perlos2.pod        Verbatim line length including indents exceeds 80 by    22
 pod/perlos390.pod      Verbatim line length including indents exceeds 80 by    11
-pod/perlpacktut.pod    ? Should you be using L<...> instead of 1
 pod/perlpacktut.pod    Verbatim line length including indents exceeds 80 by    6
 pod/perlperf.pod       Verbatim line length including indents exceeds 80 by    154
 pod/perlpodspec.pod    Verbatim line length including indents exceeds 80 by    9
index 262b31b..dc358f3 100644 (file)
@@ -655,17 +655,27 @@ package My::Pod::Checker {      # Extend Pod::Checker
 
         # If looks like a reference to other documentation by containing the
         # word 'See' and then a likely pod directive, warn.
-
-        while ($paragraph =~ m{ \b See \s+
-                                ( ( [^L] ) <
-                                ( [^<]*? )  # The not-< excludes nested C<L<...
-                                > )
+        while ($paragraph =~ m{
+                                ( (?: \w+ \s+ )* )  # The phrase before, if any
+                                \b [Ss]ee \s+
+                                ( ( [^L] )
+                                  <
+                                  ( [^<]*? )  # The not < excludes nested C<L<...
+                                  >
+                                )
                                 ( \s+ (?: under | in ) \s+ L< )?
-                            }ixg) {
-            my $construct = $1;     # The whole thing
-            my $type = $2;
-            my $interior = $3;
-            my $trailing = $4;      # After the whole thing ending in "L<"
+                            }xg) {
+            my $prefix = $1 // "";
+            my $construct = $2;     # The whole thing, like C<...>
+            my $type = $3;
+            my $interior = $4;
+            my $trailing = $5;      # After the whole thing ending in "L<"
+
+            # If the full phrase is something like, "you might see C<", or
+            # similar, it really isn't a reference to a link.  The ones I saw
+            # all had the word "you" in them; and the "you" wasn't the
+            # beginning of a sentence.
+            if ($prefix !~ / \b you \b /x) {
 
             # Now, find what the module or man page name within the construct
             # would be if it actually has L<> syntax.  If it doesn't have that
@@ -703,6 +713,7 @@ package My::Pod::Checker {      # Extend Pod::Checker
                     parameter => $construct
                 });
             }
+            }
         }
         while ($paragraph =~ m/$C_path_re/g) {
             my $construct = $1;