]> git.donarmstrong.com Git - perltidy.git/commitdiff
turn off -bli if -bar is set and issue warning
authorSteve Hancock <perltidy@users.sourceforge.net>
Sat, 16 Jan 2021 14:41:32 +0000 (06:41 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sat, 16 Jan 2021 14:41:32 +0000 (06:41 -0800)
lib/Perl/Tidy.pm
local-docs/BugLog.pod

index 828f20c4335c44efcdc9007c0560d0ec75f141a7..6c98498600f31219286d74e47474252cab7f9238 100644 (file)
@@ -3298,20 +3298,30 @@ sub check_options {
         $rOpts->{'indent-block-comments'} = 1;
     }
 
+    # -bar cannot be used with -bl or -bli; arbitrarily keep -bar
+    if ( $rOpts->{'opening-brace-always-on-right'} ) {
+
+        if ( $rOpts->{'opening-brace-on-new-line'} ) {
+            Warn(<<EOM);
+ Conflict: you specified both 'opening-brace-always-on-right' (-bar) and 
+  'opening-brace-on-new-line' (-bl).  Ignoring -bl.
+EOM
+            $rOpts->{'opening-brace-on-new-line'} = 0;
+        }
+        if ( $rOpts->{'brace-left-and-indent'} ) {
+            Warn(<<EOM);
+ Conflict: you specified both 'opening-brace-always-on-right' (-bar) and 
+  '--brace-left-and-indent' (-bli).  Ignoring -bli. 
+EOM
+            $rOpts->{'brace-left-and-indent'} = 0;
+        }
+    }
+
     # -bli flag implies -bl
     if ( $rOpts->{'brace-left-and-indent'} ) {
         $rOpts->{'opening-brace-on-new-line'} = 1;
     }
 
-    if (   $rOpts->{'opening-brace-always-on-right'}
-        && $rOpts->{'opening-brace-on-new-line'} )
-    {
-        Warn(<<EOM);
- Conflict: you specified both 'opening-brace-always-on-right' (-bar) and 
-  'opening-brace-on-new-line' (-bl).  Ignoring -bl. 
-EOM
-        $rOpts->{'opening-brace-on-new-line'} = 0;
-    }
 
     # it simplifies things if -bl is 0 rather than undefined
     if ( !defined( $rOpts->{'opening-brace-on-new-line'} ) ) {
index e60c435a294ede2dae3d2e886a33925c2075286a..5e281d49448d53bff123b317e7b96228c085c647 100644 (file)
@@ -2,6 +2,11 @@
 
 =over 4
 
+=item B<Turn off -bli if -bar is set>
+
+A conflict arises if both B<-bli> and B<-bar> are set. In this case a warning message
+is given and B<-bli> is turned off.
+
 =item B<Fixed blinker related to large -ci, short line length and -bbsbi=2 -bbsb=1>
 
 A blinking state was discovered in testing between the following two states