logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Perl::Critic::Policy::Documentation::RequireLinkedURLs - use L<> markup on URLs in POD

Description

       This policy is part of the "Perl::Critic::Pulp" add-on.  It asks you to put "L<>" markup on URLs in POD
       text in Perl 5.8 and higher.

           use 5.008;

           =head1 HOME PAGE

           http://foo.org/mystuff/index.html      # bad

           L<http://foo.org/mystuff/index.html>   # good

       "L<>" markup gives clickable links in "pod2html" and similar formatters, and even in the plain text
       formatters may give "<http://...>" style angles around the URL which is a semi-conventional way to
       delimit from surrounding text and in particular from an immediately following comma or period.

       This is only cosmetic and on that basis this policy is low severity and under the "cosmetic" theme (see
       "POLICY THEMES" in Perl::Critic).

       Only plain text parts of the POD are considered.  Verbatim paragraphs cannot have "L<>" markup (and it's
       usually a mistake to put it there, as per "ProhibitVerbatimMarkup").

           This is verbatim text,

               http://somewhere.com      # ok in verbatim

   Perl5.8
       "L<http://...>" linking of URLs is new in the Perl 5.8 POD specification.  It comes out badly from the
       formatters in earlier Perl where the "/" is taken to be a section delimiter.  For that reason this policy
       only applies if there's an explicit "use 5.008" or higher in the code.

           use 5.005;

           =item C<http://foo.org>       # ok when don't have Perl 5.8 L<>

   BadURLs
       Some obvious intentional dummy URLs like "L<http://example.com>" are ignored.  They're examples and won't
       go anywhere as a clickable link.  You might like to put "C<>" on them for a typeface, but that is not
       required by this policy.  Currently ignored URL variations are like

           http://example.comhttp://foo.com
           https://foo.org
           ftp://bar.org.auhttp://quux.com.auhttp://xyzzy.co.ukhttp://foo.co.nzhttp://host:port
           http://...

       A URL is anything starting "http://", "https://", "ftp://", "news://" or "nntp://".

   BeginBlocks
       Text in any "=begin :foo" block is checked since ":" means POD markup and it's likely URLs can be
       helpfully linked there, even if it's only for some particular formatter.

       Other "=begin" blocks are ignored since "L<>" there will not normally be possible or desirable.

   Disabling
       If you don't care about this, if for instance it's hard enough to get your programmers to write
       documentation at all without worrying about markup, then disable "RequireLinkedURLs" from your
       ~/.perlcriticrc file in the usual way (see "CONFIGURATION" in Perl::Critic),

           [-Documentation::RequireLinkedURLs]

Home Page

Name

       Perl::Critic::Policy::Documentation::RequireLinkedURLs - use L<> markup on URLs in POD

See Also

       Perl::Critic::Pulp, Perl::Critic, Perl::Critic::Policy::Documentation::RequirePodLinksIncludeText

See Also