]> git.donarmstrong.com Git - perltidy.git/commitdiff
add devel mode arg count check on subs with >6 args
authorSteve Hancock <perltidy@users.sourceforge.net>
Wed, 21 Feb 2024 14:51:34 +0000 (06:51 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Wed, 21 Feb 2024 14:51:34 +0000 (06:51 -0800)
lib/Perl/Tidy/Formatter.pm
lib/Perl/Tidy/Tokenizer.pm

index 6ad41bc0d0943d118d5687346698a9d6686d34fa..6ba3791319e7406101dd4e986b96658dba65f303 100644 (file)
@@ -24586,8 +24586,13 @@ sub break_lines_inner_loop {
         $line_count,
         $rbond_strength_to_go,
         $saw_good_break,
+
     ) = @_;
 
+    if ( DEVEL_MODE && ( my $count = @_ ) != ( my $expected_count = 8 ) ) {
+        Fault("arg count $count expected to be $expected_count\n");
+    }
+
     # Given:
     #   $i_begin               = first index of range
     #   $i_last_break          = index of previous break
@@ -32549,6 +32554,10 @@ sub make_paren_name {
 
         ) = @_;
 
+        if ( DEVEL_MODE && ( my $count = @_ ) != ( my $expected_count = 9 ) ) {
+            Fault("arg count $count expected to be $expected_count\n");
+        }
+
         #--------------------------------------------------------------
         # This routine makes any necessary adjustments to get the final
         # indentation of a line in the Formatter.
@@ -33063,6 +33072,10 @@ sub make_paren_name {
 
         ) = @_;
 
+        if ( DEVEL_MODE && ( my $count = @_ ) != ( my $expected_count = 10 ) ) {
+            Fault("arg count $count expected to be $expected_count\n");
+        }
+
         my $adjust_indentation         = 0;
         my $default_adjust_indentation = $adjust_indentation;
         my $terminal_type              = $types_to_go[$i_terminal];
@@ -33593,6 +33606,10 @@ sub set_vertical_tightness_flags {
 
     ) = @_;
 
+    if ( DEVEL_MODE && ( my $count = @_ ) != ( my $expected_count = 9 ) ) {
+        Fault("arg count $count expected to be $expected_count\n");
+    }
+
     # Define vertical tightness controls for the nth line of a batch.
     # Note: do not call this sub for a block comment or if
     # $rOpts_freeze_whitespace is set.
index 12885e704266ac25313fdae89cdfe35e32c9e45f..c39e2fa09eb4f92206156fa0a388b58f1c29f97a 100644 (file)
@@ -7744,6 +7744,11 @@ sub scan_bare_identifier_do {
         $max_token_index
 
     ) = @_;
+
+    if ( DEVEL_MODE && ( my $count = @_ ) != ( my $expected_count = 8 ) ) {
+        $self->Fault("arg count $count expected to be $expected_count\n");
+    }
+
     my $i_begin = $i;
     my $package = undef;
 
@@ -7979,6 +7984,11 @@ sub scan_id_do {
         $max_token_index
 
     ) = @_;
+
+    if ( DEVEL_MODE && ( my $count = @_ ) != ( my $expected_count = 8 ) ) {
+        $self->Fault("arg count $count expected to be $expected_count\n");
+    }
+
     use constant DEBUG_NSCAN => 0;
     my $type = EMPTY_STRING;
     my ( $i_beg, $pos_beg );
@@ -8859,8 +8869,13 @@ sub do_scan_package {
             $max_token_index,
             $expecting,
             $container_type
+
         ) = @_;
 
+        if ( DEVEL_MODE && ( my $count = @_ ) != ( my $expected_count = 8 ) ) {
+            $self->Fault("arg count $count expected to be $expected_count\n");
+        }
+
         # return flag telling caller to split the pretoken
         my $split_pretoken_flag;
 
@@ -10093,9 +10108,22 @@ sub find_here_doc {
     #   $i - unchanged if not here doc,
     #    or index of the last token of the here target
     #   $saw_error - flag noting unbalanced quote on here target
-    my ( $self, $expecting, $i, $rtokens, $rtoken_type, $rtoken_map,
-        $max_token_index )
-      = @_;
+    my (
+
+        $self,
+
+        $expecting,
+        $i,
+        $rtokens,
+        $rtoken_type,
+        $rtoken_map,
+        $max_token_index
+
+    ) = @_;
+
+    if ( DEVEL_MODE && ( my $count = @_ ) != ( my $expected_count = 7 ) ) {
+        $self->Fault("arg count $count expected to be $expected_count\n");
+    }
 
     my $ibeg                 = $i;
     my $found_target         = 0;
@@ -10225,6 +10253,7 @@ sub do_quote {
     my (
 
         $self,
+
         $i,
         $in_quote,
         $quote_character,
@@ -10239,9 +10268,8 @@ sub do_quote {
 
     ) = @_;
 
-    if ( DEVEL_MODE && @_ != ( my $my_count = 12 ) ) {
-        my $count = @_;
-        $self->Fault("arg count $count expected to be $my_count\n");
+    if ( DEVEL_MODE && ( my $count = @_ ) != ( my $expected_count = 12 ) ) {
+        $self->Fault("arg count $count expected to be $expected_count\n");
     }
 
     my $quoted_string;
@@ -10348,6 +10376,7 @@ sub follow_quoted_string {
     my (
 
         $self,
+
         $i_beg,
         $in_quote,
         $rtokens,
@@ -10359,6 +10388,10 @@ sub follow_quoted_string {
 
     ) = @_;
 
+    if ( DEVEL_MODE && ( my $count = @_ ) != ( my $expected_count = 9 ) ) {
+        $self->Fault("arg count $count expected to be $expected_count\n");
+    }
+
     my ( $tok, $end_tok );
     my $i             = $i_beg - 1;
     my $quoted_string = EMPTY_STRING;