You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by Atri Sharma <at...@gmail.com> on 2016/10/25 08:25:01 UTC

Checkstyle Stuff

Folks,

I am stuck in a Checkstyle issue for some new imports in a rule I
added. I used IntelliJ's auto ordering but somehow checkstyle still
does not seem happy with my order of imports.

Is there a specific configuration that I can use for avoiding this, or
a manual order that I can use to manually order my imports?

-- 
Regards,

Atri
l'apprenant

Re: Checkstyle Stuff

Posted by Atri Sharma <at...@gmail.com>.
Super,thanks

On Tue, Oct 25, 2016 at 9:19 PM, Julian Hyde <jh...@apache.org> wrote:
> I’ve never had the energy to maintain a pre-defined intellij format. But frankly I find it easy enough to set up intellij by checking a couple of check-boxes. (IIRC, we use pretty much the standard formatting, but disallow star imports, and indent “case” differently.)
>
> The key thing is to prevent intellij (or whatever IDE you use) from automatically reformatting code. Otherwise it will screw up a lot of code very quickly. And in fact one of the main goals of having a project code style is to prevent spurious diffs.
>
> I’ve found that once I’ve manually re-ordered the imports of a java file, intellij will do its best to keep that order when it adds future imports. Intellij always seems to want to put ‘com.google’ imports before ‘org.apache.calcite’, which is wrong, but once I fix that checkstyle is usually happy.
>
> I run ‘mvn validate' in emacs to quickly find and navigate to the errors:
>
>   $ emacs -nw --eval "(compile \"mvn -o -DskipTests validate | grep '^/'\")"
>
> Julian
>
>
>> On Oct 25, 2016, at 1:25 AM, Atri Sharma <at...@gmail.com> wrote:
>>
>> Folks,
>>
>> I am stuck in a Checkstyle issue for some new imports in a rule I
>> added. I used IntelliJ's auto ordering but somehow checkstyle still
>> does not seem happy with my order of imports.
>>
>> Is there a specific configuration that I can use for avoiding this, or
>> a manual order that I can use to manually order my imports?
>>
>> --
>> Regards,
>>
>> Atri
>> l'apprenant
>



-- 
Regards,

Atri
l'apprenant

Re: Checkstyle Stuff

Posted by Julian Hyde <jh...@apache.org>.
I’ve never had the energy to maintain a pre-defined intellij format. But frankly I find it easy enough to set up intellij by checking a couple of check-boxes. (IIRC, we use pretty much the standard formatting, but disallow star imports, and indent “case” differently.)

The key thing is to prevent intellij (or whatever IDE you use) from automatically reformatting code. Otherwise it will screw up a lot of code very quickly. And in fact one of the main goals of having a project code style is to prevent spurious diffs.

I’ve found that once I’ve manually re-ordered the imports of a java file, intellij will do its best to keep that order when it adds future imports. Intellij always seems to want to put ‘com.google’ imports before ‘org.apache.calcite’, which is wrong, but once I fix that checkstyle is usually happy.

I run ‘mvn validate' in emacs to quickly find and navigate to the errors:

  $ emacs -nw --eval "(compile \"mvn -o -DskipTests validate | grep '^/'\")" 

Julian

 
> On Oct 25, 2016, at 1:25 AM, Atri Sharma <at...@gmail.com> wrote:
> 
> Folks,
> 
> I am stuck in a Checkstyle issue for some new imports in a rule I
> added. I used IntelliJ's auto ordering but somehow checkstyle still
> does not seem happy with my order of imports.
> 
> Is there a specific configuration that I can use for avoiding this, or
> a manual order that I can use to manually order my imports?
> 
> -- 
> Regards,
> 
> Atri
> l'apprenant