Formatting in *.gradle files

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Formatting in *.gradle files

Jacques Le Roux
Administrator
Hi,

This is mostly for Taher but concern all of us.

I noticed several times that we don't always format *.gradle files following the Java Code Conventions we follow for the rest (ie *.java and *.groovy)

https://cwiki.apache.org/confluence/display/OFBADMIN/Coding+Conventions

We should use the same for *.gradle file. I think we can easily infer how to indent new idioms following "old" Java else we can add
http://www.groovy-lang.org/style-guide.html

Jacques

Reply | Threaded
Open this post in threaded view
|

Re: Formatting in *.gradle files

Jacques Le Roux
Administrator
In Eclipse, after checking the Minimalist Gradle Editor, The Gradle Build Script editor and the Groovy Editor have no formatting options,
I tried to automatically format common.gradle (which is actually well formatted) using the Java editor and the result is worse (less legible)

Index: common.gradle
===================================================================
--- common.gradle    (revision 1761976)
+++ common.gradle    (working copy)
@@ -33,14 +33,8 @@
          applyFunction file("${rootDir}/specialpurpose/"+component.@"component-location")
      }

-    file("${rootDir}/themes").eachDir { component ->
-        applyFunction(component)
-    }
-    file("${rootDir}/hot-deploy").eachDir { component ->
-        applyFunction(component)
-    }
+    file("${rootDir}/themes").eachDir { component -> applyFunction(component) }
+    file("${rootDir}/hot-deploy").eachDir { component -> applyFunction(component) }
  }

-ext{
-    iterateOverActiveComponents = this.&iterateOverActiveComponents
-}
\ No newline at end of file
+ext{ iterateOverActiveComponents = this.&iterateOverActiveComponents }

===================================================================

So we need to do it by hand, and wait for an hypothetical formatter https://stackoverflow.com/questions/23273098/formatting-build-gradle-automatically

Fortunately the main build.gradle seems mostly well formatted :)

Jacques


Le 22/09/2016 à 19:04, Jacques Le Roux a écrit :

> Hi,
>
> This is mostly for Taher but concern all of us.
>
> I noticed several times that we don't always format *.gradle files following the Java Code Conventions we follow for the rest (ie *.java and *.groovy)
>
> https://cwiki.apache.org/confluence/display/OFBADMIN/Coding+Conventions
>
> We should use the same for *.gradle file. I think we can easily infer how to indent new idioms following "old" Java else we can add
> http://www.groovy-lang.org/style-guide.html
>
> Jacques
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Formatting in *.gradle files

Jacques Le Roux
Administrator
In reply to this post by Jacques Le Roux
This seems basically done with r1761998, not much was actually needed

Jacques

Le 22/09/2016 à 19:04, Jacques Le Roux a écrit :

> Hi,
>
> This is mostly for Taher but concern all of us.
>
> I noticed several times that we don't always format *.gradle files following the Java Code Conventions we follow for the rest (ie *.java and *.groovy)
>
> https://cwiki.apache.org/confluence/display/OFBADMIN/Coding+Conventions
>
> We should use the same for *.gradle file. I think we can easily infer how to indent new idioms following "old" Java else we can add
> http://www.groovy-lang.org/style-guide.html
>
> Jacques
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Formatting in *.gradle files

Nicolas Malin-2
In reply to this post by Jacques Le Roux
Yes I like


Le 22/09/2016 à 19:04, Jacques Le Roux a écrit :

> Hi,
>
> This is mostly for Taher but concern all of us.
>
> I noticed several times that we don't always format *.gradle files
> following the Java Code Conventions we follow for the rest (ie *.java
> and *.groovy)
>
> https://cwiki.apache.org/confluence/display/OFBADMIN/Coding+Conventions
>
> We should use the same for *.gradle file. I think we can easily infer
> how to indent new idioms following "old" Java else we can add
> http://www.groovy-lang.org/style-guide.html
>
> Jacques
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Formatting in *.gradle files

Jacques Le Roux
Administrator
Hi Nicolas,

If you are interested by adding http://www.groovy-lang.org/style-guide.html, please confirm in the "Groovy Style guide" thread

Thanks!

Jacques


Le 23/09/2016 à 21:43, Nicolas Malin a écrit :

> Yes I like
>
>
> Le 22/09/2016 à 19:04, Jacques Le Roux a écrit :
>> Hi,
>>
>> This is mostly for Taher but concern all of us.
>>
>> I noticed several times that we don't always format *.gradle files following the Java Code Conventions we follow for the rest (ie *.java and *.groovy)
>>
>> https://cwiki.apache.org/confluence/display/OFBADMIN/Coding+Conventions
>>
>> We should use the same for *.gradle file. I think we can easily infer how to indent new idioms following "old" Java else we can add
>> http://www.groovy-lang.org/style-guide.html
>>
>> Jacques
>>
>>
>
>