[jbosstools-issues] [JBoss JIRA] (JBIDE-24797) Code formatter: define and hook code formatting enforcement for github PRs

Dmitrii Bocharov (JIRA) issues at jboss.org
Wed Aug 30 10:20:00 EDT 2017


    [ https://issues.jboss.org/browse/JBIDE-24797?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13456318#comment-13456318 ] 

Dmitrii Bocharov commented on JBIDE-24797:
------------------------------------------

[~adietish] one more thing we may consider to look at as a fmt-maven-plugin: https://github.com/coveo/fmt-maven-plugin
For example CHE team applied it once for the whole project: https://github.com/eclipse/che/pull/5851. Just one big pr will format everything. And then there will be checks during the build. If there are unformated files then build would fail and you need to run fmt:format - and it'll do everything for you. I'm sure there must an option not fail the build, but format code on the fly.

[~adietish][~jeffmaury][~rob.stryker][~nickboldt] wdyt?

> Code formatter: define and hook code formatting enforcement for github PRs
> --------------------------------------------------------------------------
>
>                 Key: JBIDE-24797
>                 URL: https://issues.jboss.org/browse/JBIDE-24797
>             Project: Tools (JBoss Tools)
>          Issue Type: Enhancement
>          Components: devdoc
>    Affects Versions: 4.5.0.Final
>            Reporter: Andre Dietisheim
>            Assignee: Dmitrii Bocharov
>             Fix For: 4.5.1.AM2
>
>
> Code formatting differs across developers. We should be at least consistent since odd formatting makes reading code more difficult for obvious reasons.
> The most prominent differences I am aware of are
> * use spaces vs tabs
> * differences in formatting "if statements" (as displayed [here|https://github.com/jbosstools/jbosstools-openshift/pull/1536/files#diff-2aee3d4adef72e336d1730c1427a38a0L179]):
> {code}
> if(XX){
> {code}
> vs
> {code}
> if (XX) {
> {code}
> * insonsitent code identations like displayed [here|https://github.com/jbosstools/jbosstools-openshift/pull/1535/files#diff-51a43116dc03db69ba28ae6aa212b932L242]:
> {code}
>     public void method() {
>  int i = 0;
>  i++;
>       i +=2;
> {code}
> * odd identations of whole anonymous classes as displayed [here|https://github.com/jbosstools/jbosstools-openshift/pull/1531/files#diff-2aee3d4adef72e336d1730c1427a38a0R234]
> {code}
>              class Listener {
> int i = 0;
>  public void method()        {
>              }
>    }
> {code}
>  * multiple empty lines for no obvious reason like shown [here|https://github.com/jbosstools/jbosstools-openshift/pull/1535/files#diff-01c4863bc31948052342aedc6a09d290L87]
> {code}
> public class ZZ {
>     int i = 0;
>    i++
> }
> {code}



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jbosstools-issues mailing list