Perl::Critic::Policy::RegularExpressions::ProhibitSingleCharAlternation - Use [abc] instead of a. River stage three • 113 direct dependents • 455 total dependents

Character classes (like "[abc]") are significantly faster than single character alternations (like "(?:a|b|c)"). This policy complains if you have more than one instance of a single character in an alternation. So "(?:a|the)" is allowed, but "(?:a|e|...

PETDANCE/Perl-Critic-1.134 - 23 May 2019 02:52:21 GMT

Perl::Critic::Policy::ValuesAndExpressions::ProhibitEscapedCharacters - Write "\N{DELETE}" instead of "\x7F", etc. River stage three • 113 direct dependents • 455 total dependents

Escaped numeric values are hard to read and debug. Instead, use named values. The syntax is less compact, but dramatically more readable. $str = "\x7F\x06\x22Z"; # not ok use charnames ':full'; $str = "\N{DELETE}\N{ACKNOWLEDGE}\N{CANCEL}Z"; # ok...

PETDANCE/Perl-Critic-1.134 - 23 May 2019 02:52:21 GMT

Perl::Critic::Exception::Configuration::Option::Global::ParameterValue - A problem with the value of a global parameter. River stage three • 113 direct dependents • 455 total dependents

A representation of a problem found with the value of a global parameter, whether from a .perlcriticrc, another profile file, or command line....

PETDANCE/Perl-Critic-1.134 - 23 May 2019 02:52:21 GMT

Perl::Critic::Exception::Configuration::Option::Global::ExtraParameter - The configuration referred to a non-existent global option. River stage three • 113 direct dependents • 455 total dependents

A representation of the configuration attempting to specify a value for an option that Perl::Critic doesn't have, whether from a .perlcriticrc, another profile file, or command line....

PETDANCE/Perl-Critic-1.134 - 23 May 2019 02:52:21 GMT

Perl::Critic::Policy::Variables::ProhibitAugmentedAssignmentInDeclaration - Do not write my $foo .= 'bar'; . River stage three • 113 direct dependents • 455 total dependents

Variable declarations that also do initialization with '=' are common. Perl also allows you to use operators like '.=', '+=', etc., but it it is more clear to not do so. my $foo .= 'bar'; # same as my $foo = 'bar'; our $foo *= 2; # same as our $foo =...

PETDANCE/Perl-Critic-1.134 - 23 May 2019 02:52:21 GMT

Perl::Critic::Policy::ValuesAndExpressions::ProhibitMixedBooleanOperators - Write !$foo && $bar instead of not $foo && $bar or $baz. River stage three • 113 direct dependents • 455 total dependents

Conway advises against combining the low-precedence booleans ( "and or not" ) with the high-precedence boolean operators ( "&& || !" ) in the same expression. Unless you fully understand the differences between the high and low-precedence operators, ...

PETDANCE/Perl-Critic-1.134 - 23 May 2019 02:52:21 GMT

Perl::Critic::Policy::ValuesAndExpressions::ProhibitCommaSeparatedStatements - Don't use the comma operator as a statement separator. River stage three • 113 direct dependents • 455 total dependents

Perl's comma statement separator has really low precedence, which leads to code that looks like it's using the comma list element separator not actually doing so. Conway suggests that the statement separator not be used in order to prevent this situa...

PETDANCE/Perl-Critic-1.134 - 23 May 2019 02:52:21 GMT

Perl::Critic::Policy::ValuesAndExpressions::RequireInterpolationOfMetachars - Warns that you might have used single quotes when you really wanted double-quotes. River stage three • 113 direct dependents • 455 total dependents

This policy warns you if you use single-quotes or "q//" with a string that has unescaped metacharacters that may need interpolation. Its hard to know for sure if a string really should be interpolated without looking into the symbol table. This polic...

PETDANCE/Perl-Critic-1.134 - 23 May 2019 02:52:21 GMT

Perl::Critic::Policy::ValuesAndExpressions::ProhibitInterpolationOfLiterals - Always use single quotes for literal strings. River stage three • 113 direct dependents • 455 total dependents

Don't use double-quotes or "qq//" if your string doesn't require interpolation. This saves the interpreter a bit of work and it lets the reader know that you really did intend the string to be literal. print "foobar"; #not ok print 'foobar'; #ok prin...

PETDANCE/Perl-Critic-1.134 - 23 May 2019 02:52:21 GMT

Perl::Critic::Policy::ValuesAndExpressions::ProhibitLongChainsOfMethodCalls - Long chains of method calls indicate tightly coupled code. River stage three • 113 direct dependents • 455 total dependents

A long chain of method calls usually indicates that the code knows too much about the interrelationships between objects. If the code is able to directly navigate far down a network of objects, then when the network changes structure in the future, t...

PETDANCE/Perl-Critic-1.134 - 23 May 2019 02:52:21 GMT

Perl::Critic::Policy::ControlStructures::ProhibitLabelsWithSpecialBlockNames - Don't use labels that are the same as the special block names. River stage three • 113 direct dependents • 455 total dependents

When using one of the special Perl blocks "BEGIN", "END", "CHECK", "INIT", and "UNITCHECK", it is easy to mistakenly add a colon to the end of the block name. E.g.: # a BEGIN block that gets executed at compile time. BEGIN { <...code...> } # an ordin...

PETDANCE/Perl-Critic-1.134 - 23 May 2019 02:52:21 GMT

Perl::Critic::Policy::ValuesAndExpressions::RequireQuotedHeredocTerminator - Write print <<'THE_END' or print <<"THE_END" . River stage three • 113 direct dependents • 455 total dependents

Putting single or double-quotes around your HEREDOC terminator make it obvious to the reader whether the content is going to be interpolated or not. print <<END_MESSAGE; #not ok Hello World END_MESSAGE print <<'END_MESSAGE'; #ok Hello World END_MESSA...

PETDANCE/Perl-Critic-1.134 - 23 May 2019 02:52:21 GMT

Perl::Critic::Policy::ValuesAndExpressions::RequireUpperCaseHeredocTerminator - Write <<'THE_END'; instead of <<'theEnd'; . River stage three • 113 direct dependents • 455 total dependents

For legibility, HEREDOC terminators should be all UPPER CASE letters (and numbers), without any whitespace. Conway also recommends using a standard prefix like "END_" but this policy doesn't enforce that. print <<'the End'; #not ok Hello World the En...

PETDANCE/Perl-Critic-1.134 - 23 May 2019 02:52:21 GMT

Perl::Critic::Policy::TestingAndDebugging::ProhibitProlongedStrictureOverride - Don't turn off strict for large blocks of code. River stage three • 113 direct dependents • 455 total dependents

Every agrees that "use strict" is the first step to writing maintainable code in Perl. However, sometimes "strict" is a little too strict. In those cases, you can turn it off briefly with a "no strict" directive. This policy checks that "no strict" i...

PETDANCE/Perl-Critic-1.134 - 23 May 2019 02:52:21 GMT

Perl::Critic::Policy::ValuesAndExpressions::ProhibitQuotesAsQuotelikeOperatorDelimiters - Don't use quotes (', ", `) as delimiters for the quote-like operators. River stage three • 113 direct dependents • 455 total dependents

With the obvious exception of using single-quotes to prevent interpolation, using quotes with the quote-like operators kind of defeats the purpose of them and produces obfuscated code, causing problems for future maintainers and their editors/IDEs. $...

PETDANCE/Perl-Critic-1.134 - 23 May 2019 02:52:21 GMT

Perl::Critic::Policy::ValuesAndExpressions::ProhibitSpecialLiteralHeredocTerminator - Don't write print <<'__END__' . River stage three • 113 direct dependents • 455 total dependents

Using one of Perl's special literals as a HEREDOC terminator could be confusing to tools that try to parse perl. print <<'__END__'; #not ok Hello world __END__ print <<'__END_OF_WORLD__'; #ok Goodbye world! __END_OF_WORLD__ The special literals that ...

PETDANCE/Perl-Critic-1.134 - 23 May 2019 02:52:21 GMT

Perl::Critic::Policy::ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions - Don't use operators like not, !~, and le within until and unless. River stage three • 113 direct dependents • 455 total dependents

until ($foo ne 'blah') { #not ok ... } while ($foo eq 'blah') { #ok ... } A number of people have problems figuring out the meaning of doubly negated expressions. "unless" and "until" are both negative constructs, so any negative (e.g. "!~") or rever...

PETDANCE/Perl-Critic-1.134 - 23 May 2019 02:52:21 GMT

197 results (0.075 seconds)