]> git.donarmstrong.com Git - perltidy.git/commitdiff
add trailing commas to multiline hash lists
authorSteve Hancock <perltidy@users.sourceforge.net>
Sun, 7 Jan 2024 18:05:21 +0000 (10:05 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sun, 7 Jan 2024 18:05:21 +0000 (10:05 -0800)
lib/Perl/Tidy.pm
lib/Perl/Tidy/Tokenizer.pm
lib/Perl/Tidy/VerticalAligner.pm
perltidyrc

index 983af14a44a35c9b741de9eff15afe89d750b276..fc9ba6abbed54beab209f0b483f010255df51216 100644 (file)
@@ -5288,7 +5288,7 @@ sub Win_OS_Type {
             1  => "XP/.Net",
             2  => "Win2003",
             51 => "NT3.51",
-        }
+        },
     }->{$id}->{$minor};
 
     # If $os is undefined, the above code is out of date.  Suggested updates
index 47ffbaeccf2c076b317f7d486373160eebe8acfc..17b058cebc84b0a864ae15a7d394d8bbfda324d3 100644 (file)
@@ -2784,7 +2784,7 @@ EOM
                         last_nonblank_i => $last_nonblank_i,
                         rpretoken_map   => $rtoken_map,
                         rpretoken_type  => $rtoken_type,
-                        input_line      => $input_line
+                        input_line      => $input_line,
                     }
                 );
                 return 1;
@@ -2806,7 +2806,7 @@ EOM
                     last_nonblank_i => $last_nonblank_i,
                     rpretoken_map   => $rtoken_map,
                     rpretoken_type  => $rtoken_type,
-                    input_line      => $input_line
+                    input_line      => $input_line,
                 }
             );
             if ( $i_tok == 0 ) {
@@ -7715,7 +7715,7 @@ sub scan_id_do {
                     type            => $type,
                     rtokens         => $rtokens,
                     rtoken_map      => $rtoken_map,
-                    max_token_index => $max_token_index
+                    max_token_index => $max_token_index,
                 }
             );
             $id_scan_state = EMPTY_STRING;
index 04d9afe666658598f60f8f389b7984d81ee9326c..6799d28d4a9deae0255953b8ced4e6272165f09b 100644 (file)
@@ -2295,7 +2295,7 @@ sub sweep_left_to_right {
             rtodo       => \@todo,
             rmax_move   => \%max_move,
             short_pad   => $short_pad,
-            group_level => $group_level
+            group_level => $group_level,
         }
     );
     return;
@@ -3371,7 +3371,7 @@ sub match_line_pairs {
                                 tok_m       => $tok_m,
                                 pat         => $pat,
                                 pat_m       => $pat_m,
-                                pad         => $pad
+                                pad         => $pad,
                             }
                         );
                         if ($match_code) {
index 682b86d4a63ae8d64e108b4e1234e714d4c6ac8d..4c3fb243123e782a3306c1feb532bd1435fce1b8 100644 (file)
@@ -1,12 +1,20 @@
-# perltidyrc file for perltidy
-# Note that this is not named .perltidyrc because that would interfere
-# with testing. This has to be requested with -pro=perltidyrc
+# perltidyrc file for perltidy itself
+# Note:
+# - This is not named .perltidyrc because that could interfere
+#   with testing. This has to be requested with -pro=perltidyrc
+# - Formatting without these parameters remains stable, so it is not
+#   necessary to format with these parameters every time. But it should
+#   be done before a commit.
 
 # warnings
 --warning-output
 --warn-missing-else
 --warn-variable-types='*'
 
-# add sub names to closing brace
+# add comment with sub name to closing sub brace
 --closing-side-comments
 --closing-side-comment-list='sub'
+
+# add trailing commas to last item of a bare hash list
+--want-trailing-commas='h'
+--add-trailing-commas