| 1 | package Perl::Critic::Community; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | our $VERSION = 'v1.0.4'; | ||
| 7 | |||
| 8 | 1; | ||
| 9 | |||
| 10 | =head1 NAME | ||
| 11 | |||
| 12 | Perl::Critic::Community - Community-inspired Perl::Critic policies | ||
| 13 | |||
| 14 | =head1 SYNOPSIS | ||
| 15 | |||
| 16 | $ perlcritic --theme community script.pl | ||
| 17 | $ perlcritic --theme community lib/ | ||
| 18 | |||
| 19 | # .perlcriticrc | ||
| 20 | theme = community | ||
| 21 | severity = 1 | ||
| 22 | |||
| 23 | =head1 DESCRIPTION | ||
| 24 | |||
| 25 | A set of L<Perl::Critic> policies to enforce the practices generally | ||
| 26 | recommended by subsets of the Perl community, particularly on | ||
| 27 | L<IRC|perlcommunity/IRC>. Formerly known as L<Perl::Critic::Freenode>. Because | ||
| 28 | this policy "theme" is designed to be used with zero configuration on the | ||
| 29 | command line, some duplication will occur if it is used in combination with | ||
| 30 | core L<Perl::Critic> policies. | ||
| 31 | |||
| 32 | =head1 AFFILIATION | ||
| 33 | |||
| 34 | This module has no functionality, but instead contains documentation for this | ||
| 35 | distribution and acts as a means of pulling other modules into a bundle. All of | ||
| 36 | the Policy modules contained herein will have an "AFFILIATION" section | ||
| 37 | announcing their participation in this grouping. | ||
| 38 | |||
| 39 | =head1 POLICIES | ||
| 40 | |||
| 41 | =over | ||
| 42 | |||
| 43 | =item L<Perl::Critic::Policy::Community::AmpersandSubCalls> | ||
| 44 | |||
| 45 | Don't use C<&> to call subroutines | ||
| 46 | |||
| 47 | =item L<Perl::Critic::Policy::Community::ArrayAssignAref> | ||
| 48 | |||
| 49 | Don't assign an anonymous arrayref to an array | ||
| 50 | |||
| 51 | =item L<Perl::Critic::Policy::Community::BarewordFilehandles> | ||
| 52 | |||
| 53 | Don't use bareword filehandles other than built-ins | ||
| 54 | |||
| 55 | =item L<Perl::Critic::Policy::Community::ConditionalDeclarations> | ||
| 56 | |||
| 57 | Don't declare variables conditionally | ||
| 58 | |||
| 59 | =item L<Perl::Critic::Policy::Community::ConditionalImplicitReturn> | ||
| 60 | |||
| 61 | Don't end a subroutine with a conditional block | ||
| 62 | |||
| 63 | =item L<Perl::Critic::Policy::Community::DeprecatedFeatures> | ||
| 64 | |||
| 65 | Avoid features that have been deprecated or removed from Perl | ||
| 66 | |||
| 67 | =item L<Perl::Critic::Policy::Community::DiscouragedModules> | ||
| 68 | |||
| 69 | Various modules discouraged from use | ||
| 70 | |||
| 71 | =item L<Perl::Critic::Policy::Community::DollarAB> | ||
| 72 | |||
| 73 | Don't use C<$a> or C<$b> as variable names outside C<sort()> | ||
| 74 | |||
| 75 | =item L<Perl::Critic::Policy::Community::Each> | ||
| 76 | |||
| 77 | Don't use C<each()> to iterate through a hash | ||
| 78 | |||
| 79 | =item L<Perl::Critic::Policy::Community::EmptyReturn> | ||
| 80 | |||
| 81 | Don't use C<return> with no arguments | ||
| 82 | |||
| 83 | =item L<Perl::Critic::Policy::Community::IndirectObjectNotation> | ||
| 84 | |||
| 85 | Don't call methods indirectly | ||
| 86 | |||
| 87 | =item L<Perl::Critic::Policy::Community::LexicalForeachIterator> | ||
| 88 | |||
| 89 | Don't use undeclared foreach loop iterators | ||
| 90 | |||
| 91 | =item L<Perl::Critic::Policy::Community::LoopOnHash> | ||
| 92 | |||
| 93 | Don't loop over hashes | ||
| 94 | |||
| 95 | =item L<Perl::Critic::Policy::Community::ModPerl> | ||
| 96 | |||
| 97 | Don't use C<mod_perl> to write web applications | ||
| 98 | |||
| 99 | =item L<Perl::Critic::Policy::Community::MultidimensionalArrayEmulation> | ||
| 100 | |||
| 101 | Don't use multidimensional array emulation | ||
| 102 | |||
| 103 | =item L<Perl::Critic::Policy::Community::OpenArgs> | ||
| 104 | |||
| 105 | Always use the three-argument form of C<open()> | ||
| 106 | |||
| 107 | =item L<Perl::Critic::Policy::Community::OverloadOptions> | ||
| 108 | |||
| 109 | Don't use L<overload> without specifying a bool overload and enabling fallback | ||
| 110 | |||
| 111 | =item L<Perl::Critic::Policy::Community::PackageMatchesFilename> | ||
| 112 | |||
| 113 | Module files should declare a package matching the filename | ||
| 114 | |||
| 115 | =item L<Perl::Critic::Policy::Community::POSIXImports> | ||
| 116 | |||
| 117 | Don't use L<POSIX> without specifying an import list | ||
| 118 | |||
| 119 | =item L<Perl::Critic::Policy::Community::PreferredAlternatives> | ||
| 120 | |||
| 121 | Various modules with preferred alternatives | ||
| 122 | |||
| 123 | =item L<Perl::Critic::Policy::Community::Prototypes> | ||
| 124 | |||
| 125 | Don't use function prototypes | ||
| 126 | |||
| 127 | =item L<Perl::Critic::Policy::Community::SplitQuotedPattern> | ||
| 128 | |||
| 129 | Quote the split() pattern argument with regex slashes | ||
| 130 | |||
| 131 | =item L<Perl::Critic::Policy::Community::StrictWarnings> | ||
| 132 | |||
| 133 | Always use L<strict> and L<warnings>, or a module that imports these | ||
| 134 | |||
| 135 | =item L<Perl::Critic::Policy::Community::Threads> | ||
| 136 | |||
| 137 | Interpreter-based threads are officially discouraged | ||
| 138 | |||
| 139 | =item L<Perl::Critic::Policy::Community::Wantarray> | ||
| 140 | |||
| 141 | Don't write context-sensitive functions using C<wantarray()> | ||
| 142 | |||
| 143 | =item L<Perl::Critic::Policy::Community::WarningsSwitch> | ||
| 144 | |||
| 145 | Scripts should not use the C<-w> switch on the shebang line | ||
| 146 | |||
| 147 | =item L<Perl::Critic::Policy::Community::WhileDiamondDefaultAssignment> | ||
| 148 | |||
| 149 | Don't use C<while> with implicit assignment to C<$_> | ||
| 150 | |||
| 151 | =back | ||
| 152 | |||
| 153 | =head1 CONFIGURATION AND ENVIRONMENT | ||
| 154 | |||
| 155 | All policies included are in the "community" theme. See the L<Perl::Critic> | ||
| 156 | documentation for how to make use of this. | ||
| 157 | |||
| 158 | =head1 AUTHOR | ||
| 159 | |||
| 160 | Dan Book, C<dbook@cpan.org> | ||
| 161 | |||
| 162 | =head1 CONTRIBUTORS | ||
| 163 | |||
| 164 | =over | ||
| 165 | |||
| 166 | =item Graham Knop (haarg) | ||
| 167 | |||
| 168 | =item H.Merijn Brand (Tux) | ||
| 169 | |||
| 170 | =item John SJ Anderson (genehack) | ||
| 171 | |||
| 172 | =item Matt S Trout (mst) | ||
| 173 | |||
| 174 | =item William Taylor (willt) | ||
| 175 | |||
| 176 | =back | ||
| 177 | |||
| 178 | =head1 COPYRIGHT AND LICENSE | ||
| 179 | |||
| 180 | Copyright 2015, Dan Book. | ||
| 181 | |||
| 182 | This library is free software; you may redistribute it and/or modify it under | ||
| 183 | the terms of the Artistic License version 2.0. | ||
| 184 | |||
| 185 | =head1 SEE ALSO | ||
| 186 | |||
| 187 | L<Perl::Critic> |