Search results for "module:Perl::Critic::Policy::ControlStructures::ProhibitUnlessBlocks"

Perl::Critic::Policy::ControlStructures::ProhibitUnlessBlocks - Write if(! $condition) instead of unless($condition). River stage three • 131 direct dependents • 386 total dependents

Conway discourages using "unless" because it leads to double-negatives that are hard to understand. Instead, reverse the logic and use "if". unless($condition) { do_something() } #not ok unless(! $no_flag) { do_something() } #really bad if( ! $condit...

PETDANCE/Perl-Critic-1.144 - 06 Dec 2022 04:59:59 UTC

Perl::Critic::Policy::CodeLayout::ProhibitIfIfSameLine - don't put if after if on same line River stage two • 5 direct dependents • 18 total dependents

This policy is part of the "Perl::Critic::Pulp" add-on. It asks you to not to write an "if" statement on the same line as a preceding "if". if ($x) { ... } if ($y) { # bad ... } if ($x) { ... } elsif ($y) { # was "elsif" intended ? ... } The idea is ...

KRYDE/Perl-Critic-Pulp-99 - 28 Feb 2021 08:34:14 UTC

Perl::Critic::Policy::ControlStructures::ProhibitNegativeExpressionsInUnlessAndUntilConditions - Don't use operators like not, !~, and le within until and unless. River stage three • 131 direct dependents • 386 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.144 - 06 Dec 2022 04:59:59 UTC
3 results (0.065 seconds)