[jbosstools-dev] [devtools-team] Checkstyle proposal

André Dietisheim adietish at redhat.com
Thu Aug 11 05:33:56 EDT 2016


On 08/03/2016 10:00 PM, Dmitrii Bocharov wrote:
> Good part of the day, team!
> While reviewing someone's code or just looking through it while 
> coding, i often want to correct the style of the code: insert a space 
> or divide the line in two. I understand that it is really an 
> idealistic niggle and a matter of taste, but some things really annoy.

+1, same to me.
This being said there are a few gotchas:
- if we dont want to duplicate Eclipse formatter and checkstyle rules 
we'd have to find a way to share there. Even though I believe that this 
isnt a big show stopper. Once done you wont change these often.
- we also have to commit the Eclipse code formatter we're using. Ideally 
we'd have a way to facilitate workspace setup so that this wont get 
another additional step 
(http://stackoverflow.com/questions/17703706/any-way-to-automate-eclipse-workspace-setup): 

   * Oomph 
(https://timdelbruegger.wordpress.com/2015/08/16/automating-project-specific-eclipse-setups-with-oomph/) 
?
   * PSF?
   * Workspace mechanics?

We have a jira covering code formatters and checkers: 
https://issues.jboss.org/browse/JBIDE-22439

> In my opinion it is a good practice to have agreements about the code 
> formatting. Luckily, there is a mechanism in IDEs and usually 
> checkstyle.xml-s are committed and then just imported by everybody. 
> This is an example of our Red Hat colleagues from EAP team (they're 
> just sitting next to me): 
> https://github.com/wildfly/wildfly-core/tree/master/ide-configs/eclipse
> Of course if we apply such a checkstyle to one of our plugins, that 
> didn't have it before, it'll be a real mess. So i think it's better to 
> use it only for the files, where we correct the code. Soon we'll cover 
> a big part of the code like this.
> Moreover, there is a maven checkstyle plugin: 
> http://maven.apache.org/plugins/maven-checkstyle-plugin/. However, i 
> suppose it makes sense to include it some time later when most of the 
> code will be formatted and that will help to cover the rest.
>
> So the proposal is to do the following for plugins, that don't have 
> such thing (didn't check all of them, but the ones, i'm working on - 
> don't):
> 1) To create a checkstyle.xml file
> 2) Commit it (for every plugin or just in jbosstools-devdoc, for 
> example) and add information about it to the Contribution part of the 
> plugins' descriptions
> 3) All contributors should add it to their Eclipses
> 4) Make remarks about code style in PRs.
> 5*) configure maven checkstyle plugin in org.jboss.tools.parent (or in 
> every plugin)
>
> Best regards,
> Dmitrii



More information about the jbosstools-dev mailing list