Code style guideline for Scala

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Code style guideline for Scala

Chiwan Park-2
Hi All,

I’m reviewing some pull requests written in Scala. While reviewing, I think that scala style checker is too loose and documentation about code style guideline in wiki [1] is poor. The code style for Scala doesn’t seems unified as that for Java.

I suggest upgrading version of scalastyle-maven-plugin to 0.7.0, adding some rules such as NoWhitespaceBeforeLeftBracketChecker, EnsureSingleSpaceAfterTokenChecker, IndentationChecker, and MagicNumberChecker and updating the documentation in wiki.

I hope to discuss the code style for Scala. How think you about this?

Regards,
Chiwan Park

[1] https://cwiki.apache.org/confluence/display/FLINK/Coding+Guidelines+for+Scala
Reply | Threaded
Open this post in threaded view
|

Re: Code style guideline for Scala

Stephan Ewen
Hi!

I very much support that. A bit stricter rules in the style checkers lead
to more uniform and better readable code. We can have stricter rules both
in Java and Scala.

Note that the hardest part of adding the style checks is actually adjusting
all the existing code that violates the style.

The best approach would probably be for someone to make a suggestion what
should go into the checkstyle, and then reiterate on it.

Greetings,
Stephan




On Sun, Aug 16, 2015 at 12:14 PM, Chiwan Park <[hidden email]> wrote:

> Hi All,
>
> I’m reviewing some pull requests written in Scala. While reviewing, I
> think that scala style checker is too loose and documentation about code
> style guideline in wiki [1] is poor. The code style for Scala doesn’t seems
> unified as that for Java.
>
> I suggest upgrading version of scalastyle-maven-plugin to 0.7.0, adding
> some rules such as NoWhitespaceBeforeLeftBracketChecker,
> EnsureSingleSpaceAfterTokenChecker, IndentationChecker, and
> MagicNumberChecker and updating the documentation in wiki.
>
> I hope to discuss the code style for Scala. How think you about this?
>
> Regards,
> Chiwan Park
>
> [1]
> https://cwiki.apache.org/confluence/display/FLINK/Coding+Guidelines+for+Scala
Reply | Threaded
Open this post in threaded view
|

Re: Code style guideline for Scala

Sachin Goel
We should also write up a matching configuration file to be used in the
IDEs and provide it with the source. This might help in reducing any style
mistakes due to a reformat, which is actually very helpful with spaces
around braces and operators. Especially with Scala, indentations and
continuation etc. can be hard to get exactly right [At least that was my
experience].

All in all, big plus one to this.

-- Sachin Goel
Computer Science, IIT Delhi
m. +91-9871457685

On Sun, Aug 16, 2015 at 7:36 PM, Stephan Ewen <[hidden email]> wrote:

> Hi!
>
> I very much support that. A bit stricter rules in the style checkers lead
> to more uniform and better readable code. We can have stricter rules both
> in Java and Scala.
>
> Note that the hardest part of adding the style checks is actually adjusting
> all the existing code that violates the style.
>
> The best approach would probably be for someone to make a suggestion what
> should go into the checkstyle, and then reiterate on it.
>
> Greetings,
> Stephan
>
>
>
>
> On Sun, Aug 16, 2015 at 12:14 PM, Chiwan Park <[hidden email]>
> wrote:
>
> > Hi All,
> >
> > I’m reviewing some pull requests written in Scala. While reviewing, I
> > think that scala style checker is too loose and documentation about code
> > style guideline in wiki [1] is poor. The code style for Scala doesn’t
> seems
> > unified as that for Java.
> >
> > I suggest upgrading version of scalastyle-maven-plugin to 0.7.0, adding
> > some rules such as NoWhitespaceBeforeLeftBracketChecker,
> > EnsureSingleSpaceAfterTokenChecker, IndentationChecker, and
> > MagicNumberChecker and updating the documentation in wiki.
> >
> > I hope to discuss the code style for Scala. How think you about this?
> >
> > Regards,
> > Chiwan Park
> >
> > [1]
> >
> https://cwiki.apache.org/confluence/display/FLINK/Coding+Guidelines+for+Scala
>
Reply | Threaded
Open this post in threaded view
|

Re: Code style guideline for Scala

Stephan Ewen
+1 for formatting templates for Eclipse and IntelliJ.

On Sun, Aug 16, 2015 at 6:06 PM, Sachin Goel <[hidden email]>
wrote:

> We should also write up a matching configuration file to be used in the
> IDEs and provide it with the source. This might help in reducing any style
> mistakes due to a reformat, which is actually very helpful with spaces
> around braces and operators. Especially with Scala, indentations and
> continuation etc. can be hard to get exactly right [At least that was my
> experience].
>
> All in all, big plus one to this.
>
> -- Sachin Goel
> Computer Science, IIT Delhi
> m. +91-9871457685
>
> On Sun, Aug 16, 2015 at 7:36 PM, Stephan Ewen <[hidden email]> wrote:
>
> > Hi!
> >
> > I very much support that. A bit stricter rules in the style checkers lead
> > to more uniform and better readable code. We can have stricter rules both
> > in Java and Scala.
> >
> > Note that the hardest part of adding the style checks is actually
> adjusting
> > all the existing code that violates the style.
> >
> > The best approach would probably be for someone to make a suggestion what
> > should go into the checkstyle, and then reiterate on it.
> >
> > Greetings,
> > Stephan
> >
> >
> >
> >
> > On Sun, Aug 16, 2015 at 12:14 PM, Chiwan Park <[hidden email]>
> > wrote:
> >
> > > Hi All,
> > >
> > > I’m reviewing some pull requests written in Scala. While reviewing, I
> > > think that scala style checker is too loose and documentation about
> code
> > > style guideline in wiki [1] is poor. The code style for Scala doesn’t
> > seems
> > > unified as that for Java.
> > >
> > > I suggest upgrading version of scalastyle-maven-plugin to 0.7.0, adding
> > > some rules such as NoWhitespaceBeforeLeftBracketChecker,
> > > EnsureSingleSpaceAfterTokenChecker, IndentationChecker, and
> > > MagicNumberChecker and updating the documentation in wiki.
> > >
> > > I hope to discuss the code style for Scala. How think you about this?
> > >
> > > Regards,
> > > Chiwan Park
> > >
> > > [1]
> > >
> >
> https://cwiki.apache.org/confluence/display/FLINK/Coding+Guidelines+for+Scala
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Code style guideline for Scala

Chiwan Park-2
Okay, I’ll create a JIRA issue covered this topic.

Regards,
Chiwan Park

> On Aug 17, 2015, at 1:17 AM, Stephan Ewen <[hidden email]> wrote:
>
> +1 for formatting templates for Eclipse and IntelliJ.
>
> On Sun, Aug 16, 2015 at 6:06 PM, Sachin Goel <[hidden email]>
> wrote:
>
>> We should also write up a matching configuration file to be used in the
>> IDEs and provide it with the source. This might help in reducing any style
>> mistakes due to a reformat, which is actually very helpful with spaces
>> around braces and operators. Especially with Scala, indentations and
>> continuation etc. can be hard to get exactly right [At least that was my
>> experience].
>>
>> All in all, big plus one to this.
>>
>> -- Sachin Goel
>> Computer Science, IIT Delhi
>> m. +91-9871457685
>>
>> On Sun, Aug 16, 2015 at 7:36 PM, Stephan Ewen <[hidden email]> wrote:
>>
>>> Hi!
>>>
>>> I very much support that. A bit stricter rules in the style checkers lead
>>> to more uniform and better readable code. We can have stricter rules both
>>> in Java and Scala.
>>>
>>> Note that the hardest part of adding the style checks is actually
>> adjusting
>>> all the existing code that violates the style.
>>>
>>> The best approach would probably be for someone to make a suggestion what
>>> should go into the checkstyle, and then reiterate on it.
>>>
>>> Greetings,
>>> Stephan
>>>
>>>
>>>
>>>
>>> On Sun, Aug 16, 2015 at 12:14 PM, Chiwan Park <[hidden email]>
>>> wrote:
>>>
>>>> Hi All,
>>>>
>>>> I’m reviewing some pull requests written in Scala. While reviewing, I
>>>> think that scala style checker is too loose and documentation about
>> code
>>>> style guideline in wiki [1] is poor. The code style for Scala doesn’t
>>> seems
>>>> unified as that for Java.
>>>>
>>>> I suggest upgrading version of scalastyle-maven-plugin to 0.7.0, adding
>>>> some rules such as NoWhitespaceBeforeLeftBracketChecker,
>>>> EnsureSingleSpaceAfterTokenChecker, IndentationChecker, and
>>>> MagicNumberChecker and updating the documentation in wiki.
>>>>
>>>> I hope to discuss the code style for Scala. How think you about this?
>>>>
>>>> Regards,
>>>> Chiwan Park
>>>>
>>>> [1]
>>>>
>>>
>> https://cwiki.apache.org/confluence/display/FLINK/Coding+Guidelines+for+Scala
>>>
>>




Reply | Threaded
Open this post in threaded view
|

Re: Code style guideline for Scala

Till Rohrmann
Good initiative Chiwan. +1 for a more unified code style.

On Tue, Aug 18, 2015 at 10:25 AM, Chiwan Park <[hidden email]> wrote:

> Okay, I’ll create a JIRA issue covered this topic.
>
> Regards,
> Chiwan Park
>
> > On Aug 17, 2015, at 1:17 AM, Stephan Ewen <[hidden email]> wrote:
> >
> > +1 for formatting templates for Eclipse and IntelliJ.
> >
> > On Sun, Aug 16, 2015 at 6:06 PM, Sachin Goel <[hidden email]>
> > wrote:
> >
> >> We should also write up a matching configuration file to be used in the
> >> IDEs and provide it with the source. This might help in reducing any
> style
> >> mistakes due to a reformat, which is actually very helpful with spaces
> >> around braces and operators. Especially with Scala, indentations and
> >> continuation etc. can be hard to get exactly right [At least that was my
> >> experience].
> >>
> >> All in all, big plus one to this.
> >>
> >> -- Sachin Goel
> >> Computer Science, IIT Delhi
> >> m. +91-9871457685
> >>
> >> On Sun, Aug 16, 2015 at 7:36 PM, Stephan Ewen <[hidden email]> wrote:
> >>
> >>> Hi!
> >>>
> >>> I very much support that. A bit stricter rules in the style checkers
> lead
> >>> to more uniform and better readable code. We can have stricter rules
> both
> >>> in Java and Scala.
> >>>
> >>> Note that the hardest part of adding the style checks is actually
> >> adjusting
> >>> all the existing code that violates the style.
> >>>
> >>> The best approach would probably be for someone to make a suggestion
> what
> >>> should go into the checkstyle, and then reiterate on it.
> >>>
> >>> Greetings,
> >>> Stephan
> >>>
> >>>
> >>>
> >>>
> >>> On Sun, Aug 16, 2015 at 12:14 PM, Chiwan Park <[hidden email]>
> >>> wrote:
> >>>
> >>>> Hi All,
> >>>>
> >>>> I’m reviewing some pull requests written in Scala. While reviewing, I
> >>>> think that scala style checker is too loose and documentation about
> >> code
> >>>> style guideline in wiki [1] is poor. The code style for Scala doesn’t
> >>> seems
> >>>> unified as that for Java.
> >>>>
> >>>> I suggest upgrading version of scalastyle-maven-plugin to 0.7.0,
> adding
> >>>> some rules such as NoWhitespaceBeforeLeftBracketChecker,
> >>>> EnsureSingleSpaceAfterTokenChecker, IndentationChecker, and
> >>>> MagicNumberChecker and updating the documentation in wiki.
> >>>>
> >>>> I hope to discuss the code style for Scala. How think you about this?
> >>>>
> >>>> Regards,
> >>>> Chiwan Park
> >>>>
> >>>> [1]
> >>>>
> >>>
> >>
> https://cwiki.apache.org/confluence/display/FLINK/Coding+Guidelines+for+Scala
> >>>
> >>
>
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Code style guideline for Scala

Chiwan Park-2
Creating a JIRA issue [1] is done.

Regards,
Chiwan Park

[1] https://issues.apache.org/jira/browse/FLINK-2539


> On Aug 18, 2015, at 5:28 PM, Till Rohrmann <[hidden email]> wrote:
>
> Good initiative Chiwan. +1 for a more unified code style.
>
> On Tue, Aug 18, 2015 at 10:25 AM, Chiwan Park <[hidden email]> wrote:
>
>> Okay, I’ll create a JIRA issue covered this topic.
>>
>> Regards,
>> Chiwan Park
>>
>>> On Aug 17, 2015, at 1:17 AM, Stephan Ewen <[hidden email]> wrote:
>>>
>>> +1 for formatting templates for Eclipse and IntelliJ.
>>>
>>> On Sun, Aug 16, 2015 at 6:06 PM, Sachin Goel <[hidden email]>
>>> wrote:
>>>
>>>> We should also write up a matching configuration file to be used in the
>>>> IDEs and provide it with the source. This might help in reducing any
>> style
>>>> mistakes due to a reformat, which is actually very helpful with spaces
>>>> around braces and operators. Especially with Scala, indentations and
>>>> continuation etc. can be hard to get exactly right [At least that was my
>>>> experience].
>>>>
>>>> All in all, big plus one to this.
>>>>
>>>> -- Sachin Goel
>>>> Computer Science, IIT Delhi
>>>> m. +91-9871457685
>>>>
>>>> On Sun, Aug 16, 2015 at 7:36 PM, Stephan Ewen <[hidden email]> wrote:
>>>>
>>>>> Hi!
>>>>>
>>>>> I very much support that. A bit stricter rules in the style checkers
>> lead
>>>>> to more uniform and better readable code. We can have stricter rules
>> both
>>>>> in Java and Scala.
>>>>>
>>>>> Note that the hardest part of adding the style checks is actually
>>>> adjusting
>>>>> all the existing code that violates the style.
>>>>>
>>>>> The best approach would probably be for someone to make a suggestion
>> what
>>>>> should go into the checkstyle, and then reiterate on it.
>>>>>
>>>>> Greetings,
>>>>> Stephan
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Sun, Aug 16, 2015 at 12:14 PM, Chiwan Park <[hidden email]>
>>>>> wrote:
>>>>>
>>>>>> Hi All,
>>>>>>
>>>>>> I’m reviewing some pull requests written in Scala. While reviewing, I
>>>>>> think that scala style checker is too loose and documentation about
>>>> code
>>>>>> style guideline in wiki [1] is poor. The code style for Scala doesn’t
>>>>> seems
>>>>>> unified as that for Java.
>>>>>>
>>>>>> I suggest upgrading version of scalastyle-maven-plugin to 0.7.0,
>> adding
>>>>>> some rules such as NoWhitespaceBeforeLeftBracketChecker,
>>>>>> EnsureSingleSpaceAfterTokenChecker, IndentationChecker, and
>>>>>> MagicNumberChecker and updating the documentation in wiki.
>>>>>>
>>>>>> I hope to discuss the code style for Scala. How think you about this?
>>>>>>
>>>>>> Regards,
>>>>>> Chiwan Park
>>>>>>
>>>>>> [1]
>>>>>>
>>>>>
>>>>
>> https://cwiki.apache.org/confluence/display/FLINK/Coding+Guidelines+for+Scala
>>>>>
>>