logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Perl::Critic::Policy::ControlStructures::ProhibitUntilBlocks - Write "while(! $condition)" instead of

Affiliation

       This Policy is part of the core Perl::Critic distribution.

Author

       Jeffrey Ryan Thalhammer <jeff@imaginative-software.com>

Configuration

       This Policy is not configurable except for the standard options.

Description

       Conway discourages using "until" because it leads to double-negatives that are hard to understand.
       Instead, reverse the logic and use "while".

           until($condition)     { do_something() } #not ok
           until(! $no_flag)     { do_something() } #really bad
           while( ! $condition)  { do_something() } #ok

       This Policy only covers the block-form of "until".  For the postfix variety, see
       "ProhibitPostfixControls".

Name

       Perl::Critic::Policy::ControlStructures::ProhibitUntilBlocks - Write "while(! $condition)" instead of
       "until($condition)".

See Also

       Perl::Critic::Policy::ControlStructures::ProhibitPostfixControls

See Also