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::ValuesAndExpressions::ProhibitEmptyQuotes - Write "q{}" 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

       Don't use quotes for an empty string or any string that is pure whitespace.  Instead, use "q{}" to
       improve legibility.  Better still, created named values like this.  Use the "x" operator to repeat
       characters.

           $message = '';      #not ok
           $message = "";      #not ok
           $message = "     "; #not ok

           $message = q{};     #better
           $message = q{     } #better

           $EMPTY = q{};
           $message = $EMPTY;      #best

           $SPACE = q{ };
           $message = $SPACE x 5;  #best

Name

       Perl::Critic::Policy::ValuesAndExpressions::ProhibitEmptyQuotes - Write "q{}" instead of "''".

See Also

       Perl::Critic::Policy::ValuesAndExpressions::ProhibitNoisyStrings

See Also