Apache9 commented on pull request #3913:
URL: https://github.com/apache/hbase/pull/3913#issuecomment-997140226
> > For me I do not like to have a left '{' and right '}' on the same line,
unless there is nothing inside the '{}'.
>
> Oh interesting, so you prefer
>
> ```java
> if (foo == null) return null;
> ```
>
> over my proposed,
>
> ```java
> if (foo == null) { return null; }
> ```
>
> ? I think adding the surrounding '{}' makes good from a bad situation.
>
> > So I suggest we just keep the old style, I do not think this is a
blocker? Just update the formatter and do a format.
>
> We have a little bit of everything -- I don't think any of this is a
blocker.
>
> > And to end the checkstyle war, do you have any interest to introduce the
spotless plugin to our project? It can format all the java files with a ecplise
formatter file, add headers, and could even format files other than java.
>
> I don't know Spotless... This looks promising. Its maven support is almost
as good as gradle. I don't find IDE support for Spotless. There's a guide on
exporting a spotless config to an eclipse format file, but this won't stay up
to date with changes to the authoritative config source. So what does Spotless
get us that Checkstyle doesn't?
Ah yes, if we want to write a one line if I prefer
`if (foo == null) return null;`
But since now the best practise is to always have '{}' for a code block then
I prefer we just do not write one line if any more...
On spotless, a `mvn spotless:apply` can format everything for you, so we do
not need to depend on the different IDE settings for our developers, just do a
`mvn spotless:apply` before committing. And we could add a `mvn spotless:check`
stage in our pre commit check to confirm that `mvn spotless:apply` is called
before preparing the PR. And on IDE support, spotless supports you provide a
eclipse formattter file and it will format all the files with the rules in this
formatter file.
For me, the problem here is that, a full reformat on the project will make
later 'git blame' more difficult to trace the modification history of a file...
--
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]