You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Pengcheng Xiong <px...@apache.org> on 2015/09/30 23:03:48 UTC

code style in Calcite

Hi all,

     I was about to upload a new patch in Calcite and it seems that I got a
bunch of style errors:

/Users/pxiong/Projects/calcite/incubator-calcite/core/src/main/java/org/apache/calcite/rel/rules/SortUnionTransposeRule.java:57:
Line matches the illegal pattern 'Trailing whitespace'.
/Users/pxiong/Projects/calcite/incubator-calcite/core/src/main/java/org/apache/calcite/rel/rules/SortUnionTransposeRule.java:61:7:
'if' is not followed by whitespace.

   I am sorry that I could not find any information for code style on the
webpage of http://calcite.incubator.apache.org/docs/howto.html. Could any
of you direct me to the place where I can find the code style template for
Eclipse developers for Calcite? Thanks.

Best
Pengcheng

Re: code style in Calcite

Posted by Jacques Nadeau <ja...@apache.org>.
Recommendation working on Calcite code in Eclipse: turn on the save actions
for removing trailnig space and line length formatting (80)

On Thu, Oct 1, 2015 at 12:59 AM, Julian Hyde <jh...@apache.org> wrote:

> I don’t use Eclipse so I can’t help with Eclipse code style. Calcite’s
> style is fairly close to Google’s guidelines, so maybe you can find a
> formatter that implements the Google style. But then again, please don’t
> submit a patch that has a lot of whitespace changes…
>
> Checkstyle doesn’t reformat code, it just tells you what you’ve done
> wrong. I find the messages fairly intuitive, but I’ll explain the ones you
> hit:
>
> >
> /Users/pxiong/Projects/calcite/incubator-calcite/core/src/main/java/org/apache/calcite/rel/rules/SortUnionTransposeRule.java:57:
> > Line matches the illegal pattern 'Trailing whitespace’.
>
> This means that there are 1 or more spaces at the end of a line. There
> should be none.
>
> >
> /Users/pxiong/Projects/calcite/incubator-calcite/core/src/main/java/org/apache/calcite/rel/rules/SortUnionTransposeRule.java:61:7:
> > 'if' is not followed by whitespace.
>
> There must be one space between ‘if’ and ‘(‘. This ensures that ‘if’
> doesn’t look like a function call.
>
> Julian
>
>

Re: code style in Calcite

Posted by Julian Hyde <jh...@apache.org>.
I don’t use Eclipse so I can’t help with Eclipse code style. Calcite’s style is fairly close to Google’s guidelines, so maybe you can find a formatter that implements the Google style. But then again, please don’t submit a patch that has a lot of whitespace changes…

Checkstyle doesn’t reformat code, it just tells you what you’ve done wrong. I find the messages fairly intuitive, but I’ll explain the ones you hit:

> /Users/pxiong/Projects/calcite/incubator-calcite/core/src/main/java/org/apache/calcite/rel/rules/SortUnionTransposeRule.java:57:
> Line matches the illegal pattern 'Trailing whitespace’.

This means that there are 1 or more spaces at the end of a line. There should be none.

> /Users/pxiong/Projects/calcite/incubator-calcite/core/src/main/java/org/apache/calcite/rel/rules/SortUnionTransposeRule.java:61:7:
> 'if' is not followed by whitespace.

There must be one space between ‘if’ and ‘(‘. This ensures that ‘if’ doesn’t look like a function call.

Julian