From: Steve Hancock <perltidy@users.sourceforge.net>
Date: Wed, 30 Aug 2023 02:06:59 +0000 (-0700)
Subject: activate RegularExpressions::ProhibitComplexRegexes
X-Git-Tag: 20230701.04~11
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=94e52635cb8ab1f9934e19d0196acc0d63a02129;p=perltidy.git

activate RegularExpressions::ProhibitComplexRegexes

Had to use a large count. First tried to use ##no critic but hit PC bugs
---

diff --git a/.perlcriticrc b/.perlcriticrc
index a96aa5c0..4d1edd25 100644
--- a/.perlcriticrc
+++ b/.perlcriticrc
@@ -15,7 +15,7 @@
 # rigid rules.
 
 # I have found the '## no critic' method for locally deactivating specific
-# policies with comments to be very troublesome to use.
+# policies to be too buggy to use.
 
 # severity = 1 gives the most strict checking.
 severity = 1
@@ -101,8 +101,10 @@ max_nests=9
 
 # There is one complex regex in Tokenizer.pm for scanning numbers. It is
 # well commented and easy to read, and any changes would make it harder
-# to read. So we have to skip this.
-[-RegularExpressions::ProhibitComplexRegexes]
+# to read. But rather than deactivate this policy, I have adjusted the
+# maximum number of characters to let this regex pass.
+[RegularExpressions::ProhibitComplexRegexes]
+max_characters=250
 
 # A problem with ReqireExtendedFormatting is that it makes things needlessly
 # complex when matching things like line feeds and carriage returns. So
diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm
index 47bbaaaf..d40b2b06 100644
--- a/lib/Perl/Tidy/Formatter.pm
+++ b/lib/Perl/Tidy/Formatter.pm
@@ -7457,8 +7457,6 @@ sub set_ci {
         #---------------------------------
         # The next token after a ';' and label (type 'J') starts a new stmt
         # The ci after a C-style for ';' (type 'f') is handled similarly.
-        # TODO: There is type 'f' redundant coding in sub respace which can
-        # be removed if this becomes the standard routine for computing ci.
         elsif ( $type eq ';' || $type eq 'J' || $type eq 'f' ) {
             $ci_next = 0;
             if ( $is_closing_type{$last_type} ) { $ci_this = $ci_last }