| 1 |
################################################################################### |
| 2 |
# MARK FOWLER's PERL CRITIC FILE |
| 3 |
################################################################################### |
| 4 |
|
| 5 |
################################################################################### |
| 6 |
# GLOBAL SETTINGS |
| 7 |
|
| 8 |
severity=3 |
| 9 |
verbose=8 |
| 10 |
|
| 11 |
################################################################################### |
| 12 |
# PERL::CRITIC BUILTIN RULES |
| 13 |
|
| 14 |
[BuiltinFunctions::ProhibitBooleanGrep] |
| 15 |
# DONT'T ENABLE THIS |
| 16 |
# While there's better ways to write this, it's not easy to write when you can't |
| 17 |
# rely on List::Util et al being installed (i.e. when I'm targetting older perls) |
| 18 |
severity=1 |
| 19 |
|
| 20 |
[BuiltinFunctions::ProhibitComplexMappings] |
| 21 |
# DON'T ENABLE THIS |
| 22 |
# I don't want to prohibit writing multi line spanning maps. |
| 23 |
# While I think that *other* *people* shouldn't do this, I think that when I do it |
| 24 |
# it's fine. Hyprocritical? You betcha. |
| 25 |
severity=1 |
| 26 |
|
| 27 |
[BuiltinFunctions::ProhibitLvalueSubstr] |
| 28 |
# Force substr($x,$start,$len,$replacement) rather thatn substr($x,$start,$len) = $replacement |
| 29 |
# YES! |
| 30 |
severity=5 |
| 31 |
|
| 32 |
[BuiltinFunctions::ProhibitReverseSortBlock] |
| 33 |
# Force "reverse sort { $a cmp $b } ..." not "sort { $b cmp $a } ..." |
| 34 |
# YES! |
| 35 |
severity=5 |
| 36 |
|
| 37 |
[BuiltinFunctions::ProhibitSleepViaSelect] |
| 38 |
# prohibit writing select undef,undef,undef,0.25 to sleep |
| 39 |
# The only reason not to do this is the belief that it's not widely understood. |
| 40 |
# I think that it *is* widely understood. And the alternatives require using |
| 41 |
# a module that doesn't ship with older Perls. Therefore, don't do it. |
| 42 |
severity=1 |
| 43 |
|
| 44 |
[BuiltinFunctions::ProhibitStringyEval] |
| 45 |
# DON'T ENABLE THIS |
| 46 |
# This is a biggy. We probably shouldn't allow string eval at all, but the truth is |
| 47 |
# I know what I'm doing enough that if I used it, I meant it. The reasons for |
| 48 |
# disallowing it is purely to stop you accidentally using it when you meant eval { ... } |
| 49 |
# and since I don't do that, I'm going to leave this off. |
| 50 |
severity=1 |
| 51 |
|
| 52 |
[BuiltinFunctions::ProhibitStringySplit] |
| 53 |
# make it impossible to write split(":",$string) |
| 54 |
# YES! make it so you have to write split(/:/,$string) as that's what split(":",$string) does |
| 55 |
severity=5 |
| 56 |
|
| 57 |
[BuiltinFunctions::ProhibitUniversalCan] |
| 58 |
# Make it impossbile to write use UNIVERSAL::can($foo,...)? |
| 59 |
# YES! It breaks mocking. Use blessed($foo) && $foo->can(...) |
| 60 |
severity=5 |
| 61 |
|
| 62 |
[BuiltinFunctions::ProhibitUniversalIsa] |
| 63 |
# Make it impossbile to write use UNIVERSAL::isa($foo,...)? |
| 64 |
# YES! It breaks mocking. Use blessed($foo) && $foo->isa(...) |
| 65 |
severity=5 |
| 66 |
|
| 67 |
[BuiltinFunctions::ProhibitVoidGrep] |
| 68 |
# Stop using grep as a loop? |
| 69 |
# YES! use a "for" |
| 70 |
severity=5 |
| 71 |
|
| 72 |
[BuiltinFunctions::ProhibitVoidMap] |
| 73 |
# Stop using map as a loop? |
| 74 |
# YES! use a "for" |
| 75 |
severity=5 |
| 76 |
|
| 77 |
[BuiltinFunctions::RequireBlockGrep] |
| 78 |
# Force you to write grep { /foo/ } @_ not grep /foo/, @_ |
| 79 |
# YES! Everyone always gets the latter form wrong |
| 80 |
severity=5 |
| 81 |
|
| 82 |
[BuiltinFunctions::RequireBlockMap] |
| 83 |
# Force you to write map { foo($_) } @_ not map foo($_), @_ |
| 84 |
# YES! Everyone always gets the latter form wrong |
| 85 |
severity=5 |
| 86 |
|
| 87 |
[BuiltinFunctions::RequireGlobFunction] |
| 88 |
# Stop writing <*.pl> to get all files called *.pl? |
| 89 |
# YES! use glob("*.pl") instead. Or File::Find::Rule! |
| 90 |
severity=5 |
| 91 |
|
| 92 |
[BuiltinFunctions::RequireSimpleSortBlock] |
| 93 |
# Don't allow complex sort blocks? |
| 94 |
# YES! My sort blocks should be fairly straight forward |
| 95 |
severity=1 |
| 96 |
|
| 97 |
[ClassHierarchies::ProhibitAutoloading] |
| 98 |
# Stop writing AUTOLOADING code? |
| 99 |
# NO! It's a bad idea, but it's not something I'd do by accident |
| 100 |
severity=2 |
| 101 |
|
| 102 |
[ClassHierarchies::ProhibitExplicitISA] |
| 103 |
# Don't write @ISA=() write "use base" |
| 104 |
# NO! It stops our code being backwards compatible |
| 105 |
severity=2 |
| 106 |
|
| 107 |
[ClassHierarchies::ProhibitOneArgBless] |
| 108 |
# Don't let anyone write "return bless {};" |
| 109 |
# YES! That breaks inheritence |
| 110 |
severity=5 |
| 111 |
|
| 112 |
[CodeLayout::ProhibitHardTabs] |
| 113 |
# Don't allow tabs in your sourcecode? |
| 114 |
# YES! TABS are the work of the devil! |
| 115 |
severity=5 |
| 116 |
|
| 117 |
[CodeLayout::ProhibitParensWithBuiltins] |
| 118 |
# NO! Sometimes I need them for precidence |
| 119 |
severity=1 |
| 120 |
|
| 121 |
[CodeLayout::ProhibitQuotedWordLists] |
| 122 |
# Force qw(foo bar baz) rather than ("foo","bar","baz") |
| 123 |
# NO! sometimes I need this for lists that often contain non-ascii |
| 124 |
# parts but simply don't happen to in this particular example |
| 125 |
severity=1 |
| 126 |
|
| 127 |
[CodeLayout::ProhibitTrailingWhitespace] |
| 128 |
# ...probably a good idea |
| 129 |
severity=3 |
| 130 |
|
| 131 |
[CodeLayout::RequireConsistentNewlines] |
| 132 |
# don't allow people to mix \n and \r\n |
| 133 |
# YES! subversion should protect us from this so turn it on |
| 134 |
severity=5 |
| 135 |
|
| 136 |
[CodeLayout::RequireTrailingCommas] |
| 137 |
# force extra trailing commas in multiline lists |
| 138 |
# NO! This policy is too dumb to actually enforce that properly |
| 139 |
severity=1 |
| 140 |
|
| 141 |
[ControlStructures::ProhibitCStyleForLoops] |
| 142 |
# NO! If I use them, I need them. |
| 143 |
severity=1 |
| 144 |
|
| 145 |
[ControlStructures::ProhibitCascadingIfElse] |
| 146 |
# Force using a switch module instead? |
| 147 |
# NO! All the swtich modules suck. When we've all got 5.10 |
| 148 |
# with the inbuilt switch, we can start using this, but not until |
| 149 |
severity=1 |
| 150 |
|
| 151 |
[ControlStructures::ProhibitDeepNests] |
| 152 |
# Don't allow deep nests of code |
| 153 |
# ...probably a good idea, if annoying |
| 154 |
severity=3 |
| 155 |
|
| 156 |
[ControlStructures::ProhibitMutatingListFunctions] |
| 157 |
# Don't allow maps / grep to mutate the original elements |
| 158 |
# YES! people should use "for" for that |
| 159 |
severity=5 |
| 160 |
|
| 161 |
[ControlStructures::ProhibitPostfixControls] |
| 162 |
# Don't allow $foo if $bar; |
| 163 |
# NO! This makes my code more readable |
| 164 |
severity=1 |
| 165 |
|
| 166 |
[ControlStructures::ProhibitUnlessBlocks] |
| 167 |
# NO! Unless blocks increase readability |
| 168 |
severity=1 |
| 169 |
|
| 170 |
[ControlStructures::ProhibitUnreachableCode] |
| 171 |
# Checks for basic unreachable code (doesn't check for |
| 172 |
# if { return ... } else { return ...} unreachable) |
| 173 |
# YES! Writing stupid code should not be allowed |
| 174 |
severity=5 |
| 175 |
|
| 176 |
[ControlStructures::ProhibitUntilBlocks] |
| 177 |
# Stop writing until() { ... } |
| 178 |
# NO! this increases readability |
| 179 |
severity=1 |
| 180 |
|
| 181 |
[Documentation::RequirePodAtEnd] |
| 182 |
# Require all the pod at the end |
| 183 |
# NO! It should be throughout the code! |
| 184 |
severity=1 |
| 185 |
|
| 186 |
[Documentation::RequirePodSections] |
| 187 |
# Require the pod throughout your code? |
| 188 |
# YES! It should be throughout the code! |
| 189 |
lib_sections = NAME | SYNOPSIS | DESCRIPTION | AUTHOR | BUGS | SEE ALSO |
| 190 |
script_sections = NAME | SYNOPSIS | DESCRIPTION | AUTHOR | BUGS | SEE ALSO |
| 191 |
severity=5 |
| 192 |
|
| 193 |
[ErrorHandling::RequireCarping] |
| 194 |
# make us use carp and croak not warn or die |
| 195 |
# ...probably a good idea |
| 196 |
severity=3 |
| 197 |
|
| 198 |
[InputOutput::ProhibitBacktickOperators] |
| 199 |
# yes, we should be using open instead |
| 200 |
severity=4 |
| 201 |
|
| 202 |
[InputOutput::ProhibitBarewordFileHandles] |
| 203 |
# Use bare filehandles In my source code? |
| 204 |
# NO! That's just insane! |
| 205 |
severity=5 |
| 206 |
|
| 207 |
[InputOutput::ProhibitInteractiveTest] |
| 208 |
# This sounds like a bad idea. Let's deny it |
| 209 |
severity=5 |
| 210 |
|
| 211 |
[InputOutput::ProhibitJoinedReadline] |
| 212 |
# yeah, let's not be lazy and write this the proper way |
| 213 |
severity=4 |
| 214 |
|
| 215 |
[InputOutput::ProhibitOneArgSelect] |
| 216 |
# one arg selects are fine in my book |
| 217 |
severity=1 |
| 218 |
|
| 219 |
[InputOutput::ProhibitReadlineInForLoop] |
| 220 |
# this is just lazy. Don't allow it |
| 221 |
severity=5 |
| 222 |
|
| 223 |
[InputOutput::ProhibitTwoArgOpen] |
| 224 |
# two arg opens lead to security bugs. Get rid of them! |
| 225 |
severity=5 |
| 226 |
|
| 227 |
[InputOutput::RequireBracedFileHandleWithPrint] |
| 228 |
# Yeah, you should be encouraged to do this |
| 229 |
severity=3 |
| 230 |
|
| 231 |
[InputOutput::RequireCheckedClose] |
| 232 |
# you should *always* check closes, but I'm not too fussy |
| 233 |
severity=2 |
| 234 |
|
| 235 |
[InputOutput::RequireCheckedOpen] |
| 236 |
# you should *always* check opens |
| 237 |
severity=5 |
| 238 |
|
| 239 |
[Miscellanea::ProhibitFormats] |
| 240 |
# Formats suck |
| 241 |
severity=5 |
| 242 |
|
| 243 |
[Miscellanea::ProhibitTies] |
| 244 |
# Stop ties? NO! I LIKE TIES |
| 245 |
severity=1 |
| 246 |
|
| 247 |
[Miscellanea::RequireRcsKeywords] |
| 248 |
# require $Revision: 1890$? |
| 249 |
# NO! I know how to use the svn command thankyou |
| 250 |
severity=1 |
| 251 |
|
| 252 |
[Modules::ProhibitAutomaticExportation] |
| 253 |
# Prevent using @EXPORT and force @EXPORT_OK et al instead |
| 254 |
# NO! If I'm exporting, I mean it darnit |
| 255 |
severity=1 |
| 256 |
|
| 257 |
[Modules::ProhibitEvilModules] |
| 258 |
# Don't allow use of Acme modules |
| 259 |
modules=/Acme::/ |
| 260 |
|
| 261 |
[Modules::ProhibitExcessMainComplexity] |
| 262 |
# Don't allow me to write complex main code |
| 263 |
severity=3 |
| 264 |
|
| 265 |
[Modules::ProhibitMultiplePackages] |
| 266 |
# Don't let me write multiple packages |
| 267 |
# NO! I use this to declare error classes |
| 268 |
severity=1 |
| 269 |
|
| 270 |
[Modules::RequireBarewordIncludes] |
| 271 |
# Stop people writing "use 'foo'" with the quotes |
| 272 |
# YES! That's just crazy |
| 273 |
severity=1 |
| 274 |
|
| 275 |
[Modules::RequireEndWithOne] |
| 276 |
# End our code with 1; rather than "Club Sandwitch" |
| 277 |
# ...boring, but probably a good idea |
| 278 |
severity=3 |
| 279 |
|
| 280 |
[Modules::RequireExplicitPackage] |
| 281 |
# make sure that people start modules with "package ..." |
| 282 |
# YES...stops subtle bugs |
| 283 |
severity=5 |
| 284 |
|
| 285 |
[Modules::RequireFilenameMatchesPackage] |
| 286 |
# catch the annoying case where you have one filename |
| 287 |
# but accidentally put in another package name? |
| 288 |
# YES! There's no reason not to do this |
| 289 |
severity=5 |
| 290 |
|
| 291 |
[Modules::RequireVersionVar] |
| 292 |
# make us have a $VERSION in our modules? |
| 293 |
# ...probably a good idea |
| 294 |
severity=4 |
| 295 |
|
| 296 |
[NamingConventions::ProhibitAmbiguousNames] |
| 297 |
# varnames we're not allowed to use because theu're ambigious |
| 298 |
severity=5 |
| 299 |
forbid = last set left right no abstract contract record second close |
| 300 |
|
| 301 |
[NamingConventions::ProhibitMixedCaseSubs] |
| 302 |
# Don't allow camelcasing our subs? YES |
| 303 |
severity=5 |
| 304 |
|
| 305 |
[NamingConventions::ProhibitMixedCaseVars] |
| 306 |
# Don't allow camelcasing our vars? YES |
| 307 |
severity=5 |
| 308 |
|
| 309 |
[References::ProhibitDoubleSigils] |
| 310 |
# force people to write ${ @foo } rather than $@foo |
| 311 |
# YES! stops things being so darn confusing |
| 312 |
severity=5 |
| 313 |
|
| 314 |
[RegularExpressions::ProhibitCaptureWithoutTest] |
| 315 |
# force peopel to test if re captures produced output |
| 316 |
# YES! Don't forget this |
| 317 |
severity=5 |
| 318 |
|
| 319 |
[RegularExpressions::RequireExtendedFormatting] |
| 320 |
# force people to use /.../x |
| 321 |
# nope, causes warnings on 5.18 |
| 322 |
severity=1 |
| 323 |
|
| 324 |
[RegularExpressions::RequireLineBoundaryMatching] |
| 325 |
# force people to use /.../m |
| 326 |
# NO! I'm a perl programmer and find it confusing to use \A and \Z |
| 327 |
severity=1 |
| 328 |
|
| 329 |
[Subroutines::ProhibitAmpersandSigils] |
| 330 |
# force people to write "foo()" not "&foo()" |
| 331 |
# YES! |
| 332 |
severity=5 |
| 333 |
|
| 334 |
[Subroutines::ProhibitBuiltinHomonyms] |
| 335 |
# Prevent declaring "sub open {...}" and it's ilk |
| 336 |
# NO! because I might create an object like this and this module |
| 337 |
# is too dumb to realise that's what I'm doing |
| 338 |
severity=1 |
| 339 |
|
| 340 |
[Subroutines::ProhibitExcessComplexity] |
| 341 |
# Seems like a good idea |
| 342 |
severity=2 |
| 343 |
|
| 344 |
[Subroutines::ProhibitExplicitReturnUndef] |
| 345 |
# NO, if I say this I mean this |
| 346 |
severity=2 |
| 347 |
|
| 348 |
[Subroutines::ProhibitManyArgs] |
| 349 |
# disallow writing subroutines that take more than five args |
| 350 |
# ...probably a good idea |
| 351 |
severity=1 |
| 352 |
max_arguments=5 |
| 353 |
|
| 354 |
[Subroutines::ProhibitNestedSubs] |
| 355 |
# prevent people from writing non anonymous subs in subs |
| 356 |
# YES! This is totally unreadable |
| 357 |
severity=1 |
| 358 |
|
| 359 |
[Subroutines::ProhibitSubroutinePrototypes] |
| 360 |
# NO! I use this to create DSL |
| 361 |
severity=1 |
| 362 |
|
| 363 |
[Subroutines::ProtectPrivateSubs] |
| 364 |
# catch people doing Foo::Bar::_baz |
| 365 |
severity=5 |
| 366 |
allow=Encode::_utf8_on |
| 367 |
|
| 368 |
[Subroutines::RequireArgUnpacking] |
| 369 |
# NO, often I really mean it |
| 370 |
severity=1 |
| 371 |
|
| 372 |
[Subroutines::RequireFinalReturn] |
| 373 |
# make sure all subroutines exit with a return (or other) |
| 374 |
# ...this seems like a good idea |
| 375 |
severity=4 |
| 376 |
|
| 377 |
[TestingAndDebugging::ProhibitNoStrict] |
| 378 |
# make sure you can't turn strict off |
| 379 |
# allow overriding certain things though |
| 380 |
severity=5 |
| 381 |
allow = vars subs refs |
| 382 |
|
| 383 |
[TestingAndDebugging::ProhibitNoWarnings] |
| 384 |
# make sure you can't turn warnings off |
| 385 |
# allow overriding certain things though |
| 386 |
severity=5 |
| 387 |
allow = uninitialized once |
| 388 |
|
| 389 |
[TestingAndDebugging::ProhibitProlongedStrictureOverride] |
| 390 |
# make sure no strict isn't turned off for zillions of lines of code |
| 391 |
severity=5 |
| 392 |
statements = 10 |
| 393 |
# more than the default, but not enough for the entire program |
| 394 |
|
| 395 |
[TestingAndDebugging::RequireTestLabels] |
| 396 |
# ensure that out tests have labels |
| 397 |
# YES! I tend to leave these off, then get confused |
| 398 |
severity=5 |
| 399 |
|
| 400 |
[TestingAndDebugging::RequireUseStrict] |
| 401 |
# force use strict to be turned on |
| 402 |
severity=5 |
| 403 |
|
| 404 |
[TestingAndDebugging::RequireUseWarnings] |
| 405 |
# Yes, but I also want code that runs on 5.005 and so, so |
| 406 |
# low severity |
| 407 |
severity=2 |
| 408 |
|
| 409 |
[ValuesAndExpressions::ProhibitCommaSeparatedStatements] |
| 410 |
# catch where "," rather than ";" is used as a statement seperator (even by accident) |
| 411 |
# YES |
| 412 |
severity=5 |
| 413 |
|
| 414 |
[ValuesAndExpressions::ProhibitConstantPragma] |
| 415 |
# make people write $FOO = 2 rather than "use constant FOO => 2" |
| 416 |
# YES, as constants keep biting you in hashes |
| 417 |
severity=5 |
| 418 |
|
| 419 |
[ValuesAndExpressions::ProhibitEmptyQuotes] |
| 420 |
# make people write q{ } not ' ' for whitespace |
| 421 |
# NO, I find this harder to read as my brain thinks empty q{ } is a block |
| 422 |
severity=1 |
| 423 |
|
| 424 |
[ValuesAndExpressions::ProhibitEscapedCharacters] |
| 425 |
# make people write \N{DELETE} rather than \x7f |
| 426 |
# NO, since after all these years it's harder for me to read the names than the char codes |
| 427 |
severity=2 |
| 428 |
|
| 429 |
[ValuesAndExpressions::ProhibitImplicitNewlines] |
| 430 |
# don't let people put newlines in the middle of scripts! |
| 431 |
severity=5 |
| 432 |
|
| 433 |
[ValuesAndExpressions::ProhibitInterpolationOfLiterals] |
| 434 |
# disallow writing "foo" instead of 'foo' for literals |
| 435 |
# NO! I write things like "It's a bad idea" all the time! |
| 436 |
severity=1 |
| 437 |
|
| 438 |
[ValuesAndExpressions::ProhibitLeadingZeros] |
| 439 |
# disallow 0000123 |
| 440 |
# YES! I can never remember that this is actualy octal |
| 441 |
severity=5 |
| 442 |
|
| 443 |
[ValuesAndExpressions::ProhibitLongChainsOfMethodCalls] |
| 444 |
# disallow $a->b->c->d->e |
| 445 |
# NO! Good OO is often written like this |
| 446 |
severity=1 |
| 447 |
|
| 448 |
[ValuesAndExpressions::ProhibitMismatchedOperators] |
| 449 |
# disallow "if ($a == '123')" and "if ($a eq 123)" |
| 450 |
# YES! It's a warning anyway |
| 451 |
severity=5 |
| 452 |
|
| 453 |
[ValuesAndExpressions::ProhibitMixedBooleanOperators] |
| 454 |
# disallow "next if not ($a || $b)" (low and hight presidence booleans) |
| 455 |
# YES! Write readable code darnit |
| 456 |
severity=5 |
| 457 |
|
| 458 |
[ValuesAndExpressions::ProhibitNoisyQuotes] |
| 459 |
# NO, this makes you code hard to read |
| 460 |
severity=1 |
| 461 |
|
| 462 |
[ValuesAndExpressions::ProhibitQuotesAsQuotelikeOperatorDelimiters] |
| 463 |
# Disallow m"foo" and it's ilk |
| 464 |
# YES, this is just wrong |
| 465 |
severity=5 |
| 466 |
|
| 467 |
[ValuesAndExpressions::ProhibitVersionStrings] |
| 468 |
# disallow $foo = v1.2.3.4 |
| 469 |
# YES, this is just wrong |
| 470 |
severity=5 |
| 471 |
|
| 472 |
[ValuesAndExpressions::RequireInterpolationOfMetachars] |
| 473 |
# complain about '\t' et al (not '\\t' or "\t") |
| 474 |
# YES, since this can bite you if you're not careful |
| 475 |
severity=5 |
| 476 |
|
| 477 |
[ValuesAndExpressions::RequireNumberSeparators] |
| 478 |
# require that big numbers be written like 100_000 not 100000 |
| 479 |
severity=5 |
| 480 |
min_value = 10000 |
| 481 |
# the default, but hardcoded here |
| 482 |
|
| 483 |
[ValuesAndExpressions::RequireQuotedHeredocTerminator] |
| 484 |
# For heredoc terminators to be quoted like <<'HEREDOC' or <<"HEREDOC" |
| 485 |
# YES! Because it makes you clear if interpolation is happening or not |
| 486 |
severity=5 |
| 487 |
|
| 488 |
[ValuesAndExpressions::RequireUpperCaseHeredocTerminator] |
| 489 |
# force heredoc terminators to be UPPER_CASE |
| 490 |
# YES! It makes them readable |
| 491 |
severity=5 |
| 492 |
|
| 493 |
[Variables::ProhibitConditionalDeclarations] |
| 494 |
# stop people writing "my $foo = $bar if $baz" |
| 495 |
# YES! This is very confusing code |
| 496 |
severity=5 |
| 497 |
|
| 498 |
[Variables::ProhibitLocalVars] |
| 499 |
# While I agree with the ideas behind this, being not |
| 500 |
# able to write 'local $/' is confusing to me (I hate English.pm) |
| 501 |
severity=1 |
| 502 |
|
| 503 |
[Variables::ProhibitMatchVars] |
| 504 |
# Don't let people use $`, $& and $' |
| 505 |
# YES! use capturing, or in 5.10 /p and ${^PREMATCH} et al |
| 506 |
severity=5 |
| 507 |
|
| 508 |
[Variables::ProhibitPackageVars] |
| 509 |
# Not for this module. Maybe it was a good idea, but in this |
| 510 |
# case, back in 2003 we made the interface use package |
| 511 |
# vars, so there's little I can do here... |
| 512 |
severity=1 |
| 513 |
add_packages=Test::Builder Carp DBI |
| 514 |
|
| 515 |
[Variables::ProhibitPerl4PackageNames] |
| 516 |
# Don't allow people to write Foo'Bar'Baz not Foo::Bar::Baz |
| 517 |
# YES! This is just plain silly, and mucks up my editor |
| 518 |
severity=4 |
| 519 |
|
| 520 |
[Variables::ProhibitPunctuationVars] |
| 521 |
# Disallow $/ and force people to use English |
| 522 |
# NO! $/ makes more sense to me than the english name |
| 523 |
severity=1 |
| 524 |
|
| 525 |
[Variables::ProtectPrivateVars] |
| 526 |
# don't write $Foo::bar::_goo from another package |
| 527 |
# YES! infact, we shouldn't have those vars at all |
| 528 |
severity=5 |
| 529 |
|
| 530 |
[Variables::RequireInitializationForLocalVars] |
| 531 |
# Require people initilize local vars? |
| 532 |
# YES! Forgetting so is a bad mistake |
| 533 |
severity=5 |
| 534 |
|
| 535 |
[Variables::RequireLexicalLoopIterators] |
| 536 |
# Force people to use "for my $thingy (...)" with the my |
| 537 |
# YES! this is a common mistake! |
| 538 |
severity=5 |
| 539 |
|
| 540 |
[Variables::RequireLocalizedPunctuationVars] |
| 541 |
# Stop people changing $/ et all without localising them? |
| 542 |
# YES! Say _no_ to sideeffects |
| 543 |
severity=5 |
| 544 |
|
| 545 |
[Variables::RequireNegativeIndices] |
| 546 |
# make people write $foo[-1] rather than $foo[ $#foo - 1 ] ? |
| 547 |
# YES! I like my code readable |
| 548 |
severity=5 |
| 549 |
|
| 550 |
[Subroutines::ProhibitUnusedPrivateSubroutines] |
| 551 |
# NO, since I'm emulating moose I need to create private |
| 552 |
# method calls that are called dynamically |
| 553 |
severity=1 |
| 554 |
|
| 555 |
################################################################################### |
| 556 |
# PERL::CRITIC::MORE RULES |
| 557 |
|
| 558 |
#[CodeLayout::RequireASCII] |
| 559 |
# I hate unicode in source code. Use escapes damnit |
| 560 |
#severity=5 |
| 561 |
|