diff options
author | Karl Williamson <public@khwilliamson.com> | 2011-06-19 13:06:22 -0600 |
---|---|---|
committer | Karl Williamson <public@khwilliamson.com> | 2011-06-21 07:59:02 -0600 |
commit | 4e9f7dd477c008212183d561d3dcd2e53ab9e6b2 (patch) | |
tree | f687c57a83bfaae760038b1221e63effc479200c /t | |
parent | ef9064984ca79d3b1d4b82db4aae4bc02bbd517d (diff) | |
download | perl-4e9f7dd477c008212183d561d3dcd2e53ab9e6b2.tar.gz |
podcheck: Reduce fals positives for L<> message
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.
Diffstat (limited to 't')
-rw-r--r-- | t/porting/known_pod_issues.dat | 4 | ||||
-rw-r--r-- | t/porting/podcheck.t | 31 |
2 files changed, 22 insertions, 13 deletions
diff --git a/t/porting/known_pod_issues.dat b/t/porting/known_pod_issues.dat index 3407ef8664..fc03178d32 100644 --- a/t/porting/known_pod_issues.dat +++ b/t/porting/known_pod_issues.dat @@ -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 diff --git a/t/porting/podcheck.t b/t/porting/podcheck.t index 262b31b776..dc358f3459 100644 --- a/t/porting/podcheck.t +++ b/t/porting/podcheck.t @@ -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; |