Apache9 commented on pull request #4312:
URL: https://github.com/apache/hbase/pull/4312#issuecomment-1085722000


   More changes:
   
   1. Add a format section in spotless to include all text files, specify 
trimTrailingWhitespace. But for java files, though I place the formats section 
after the java section, it will be executed before the java formatter, so the 
'pre' tag will still generate whitespaces, you need to run spotless:apply the 
second time to trim them.
   2. It should be a bug in the eclipse formatter as sometimes, if the 
condition statement in the 'if' condition section is wrapped, the indent of the 
following lines maybe wrong, like this:
   ```
   if (func(a,
         b) {
       ...
     } else if (func(a,
         b) {
       ...
       }
   ```
   
   Which is really annoying. So I change the config of 'Parentheses positions' 
for most elements to 'separate lines if wrapped'. In this way the indent will 
be correct. The code is like this
   ```
   if (shortCondition) {
     doSometing();
   }
   
   if (
     longCondition("       1        ")
       && longCondition("       2        ")
       && longCondition("       2        ")
   ) {
     doSometing();
   }
   
   while (shortCondition) {
     doSometing();
   }
   
   do {
     doSometing();
   } while (
     longCondition("       1        ")
       && longCondition("       2        ")
       && longCondition("       2        ")
   );
   
   if (mixedCondition1) {
     doSometing();
   }
   
   if (mixedCondition2) {
     doSometing();
   }
   
   if (mixedCondition3) {
     doSometing();
   }
   ```
   
   For me I think it is kinda acceptable.
   
   Let's see the result.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to