1Perl::Critic::AnnotatioUns(e3r)Contributed Perl DocumentPaetrilo:n:Critic::Annotation(3)
2
3
4

NAME

6       Perl::Critic::Annotation - A "## no critic" annotation in a document.
7

SYNOPSIS

9         use Perl::Critic::Annotation;
10         $annotation = Perl::Critic::Annotation->new( -element => $no_critic_ppi_element );
11
12         $bool = $annotation->disables_line( $number );
13         $bool = $annotation->disables_policy( $policy_object );
14         $bool = $annotation->disables_all_policies();
15
16         ($start, $end) = $annotation->effective_range();
17         @disabled_policy_names = $annotation->disabled_policies();
18

DESCRIPTION

20       "Perl::Critic::Annotation" represents a single "## no critic"
21       annotation in a <PPI:Document>.  The Annotation takes care of parsing
22       the annotation and keeps track of which lines and Policies it affects.
23       It is intended to encapsulate the details of the no-critic annotations,
24       and to provide a way for Policy objects to interact with the
25       annotations (via a Perl::Critic::Document).
26

INTERFACE SUPPORT

28       This is considered to be a non-public class.  Its interface is subject
29       to change without notice.
30

CLASS METHODS

32       create_annotations( -doc => $doc )
33           Given a Perl::Critic::Document, finds all the "## no critic"
34           annotations and constructs a new "Perl::Critic::Annotation" for
35           each one and returns them.  The order of the returned objects is
36           not defined.  It is generally expected that clients will use this
37           interface rather than calling the "Perl::Critic::Annotation"
38           constructor directly.
39

CONSTRUCTOR

41       "new( -element => $ppi_annotation_element )"
42           Returns a reference to a new Annotation object.  The -element
43           argument is required and should be a "PPI::Token::Comment" that
44           conforms to the "## no critic" syntax.
45

METHODS

47       "disables_line( $line )"
48           Returns true if this Annotation disables $line for any (or all)
49           Policies.
50
51       "disables_policy( $policy_object )"
52       "disables_policy( $policy_name )"
53           Returns true if this Annotation disables $polciy_object or
54           $policy_name at any (or all) lines.
55
56       "disables_all_policies()"
57           Returns true if this Annotation disables all Policies at any (or
58           all) lines.  If this method returns true, "disabled_policies" will
59           return an empty list.
60
61       "effective_range()"
62           Returns a two-element list, representing the first and last line
63           numbers where this Annotation has effect.
64
65       "disabled_policies()"
66           Returns a list of the names of the Policies that are affected by
67           this Annotation.  If this list is empty, then it means that all
68           Policies are affected by this Annotation, and
69           "disables_all_policies()" should return true.
70
71       "element()"
72           Returns the PPI::Element where this annotation started.  This is
73           typically an instance of PPI::Token::Comment.
74

AUTHOR

76       Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>
77
79       Copyright (c) 2005-2011 Imaginative Software Systems.  All rights
80       reserved.
81
82       This program is free software; you can redistribute it and/or modify it
83       under the same terms as Perl itself.  The full text of this license can
84       be found in the LICENSE file included with this module.
85
86
87
88perl v5.16.3                      2014-06-09       Perl::Critic::Annotation(3)
Impressum