You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by Willem Jiang <wi...@gmail.com> on 2008/04/30 06:04:13 UTC

Building the code with the CheckStyle

Hi Team,

I'd like to enable the CheckStyle when build the camel code.

There are lots of benefits which we can get from CheckStyle:
1.Finding out if we are missing the ASF header in the java file.
2 Making our codes more consistent ( not including any tab character 
which will cause bad formate).
3.Excluding the useless import package.
...

All you have to do is install the CheckStyle pluging in Eclipse , and it 
should be same with the Intellij :)

Any thought?

Willem



Re: Building the code with the CheckStyle

Posted by James Strachan <ja...@gmail.com>.
2008/4/30 Willem Jiang <wi...@gmail.com>:
> Hi James,
>
>  After googling with the "IntelliJ Checkstyle" , I found there are lots of
> Checkstyle plugins for IDE[1].
>  Maybe checkstyle-idea[2] is an option for you :)
>
>  [1]http://checkstyle.sourceforge.net/
>  [2]http://code.google.com/p/checkstyle-idea/

Coolio thanks - the next step is to figure out how to configure one of
the plugins in exactly the same code style rules as the one used for
eclipse + maven :)

I remember trying for a little while with ServiceMix / CXF and finding
it a bit tricky :)
-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Re: Building the code with the CheckStyle

Posted by Willem Jiang <wi...@gmail.com>.
Hi James,

After googling with the "IntelliJ Checkstyle" , I found there are lots 
of Checkstyle plugins for IDE[1].
Maybe checkstyle-idea[2] is an option for you :)

[1]http://checkstyle.sourceforge.net/
[2]http://code.google.com/p/checkstyle-idea/

Willem


James Strachan wrote:
> I've suffered heaps of pain with servicemix and cxf as often the
> checkstyle rules only work with eclipse and I use IntelliJ
>
> So I'd be -1 from making these mandatory - until we figure out an easy
> way to configure *both* eclipse and IntelliJ.
>
> Also I'm with Claus on the 80 character limitation which is from a few
> decades ago. 160 is fine :)
>
>
> 2008/4/30 Willem Jiang <wi...@gmail.com>:
>   
>> Hi Team,
>>
>>  I'd like to enable the CheckStyle when build the camel code.
>>
>>  There are lots of benefits which we can get from CheckStyle:
>>  1.Finding out if we are missing the ASF header in the java file.
>>  2 Making our codes more consistent ( not including any tab character which
>> will cause bad formate).
>>  3.Excluding the useless import package.
>>  ...
>>
>>  All you have to do is install the CheckStyle pluging in Eclipse , and it
>> should be same with the Intellij :)
>>
>>  Any thought?
>>
>>  Willem
>>
>>
>>
>>     
>
>
>
>   


Re: Building the code with the CheckStyle

Posted by Willem Jiang <wi...@gmail.com>.
Hi Claus,

I do not like the eclipse's auto formate for the long lines either.
But with help of  Checkstyle plugin, I still get help for writing a 
better formate code, special for the ASF header checking.

BTW
I will commit a buildingtools module to help the Maven Checkstyle plugin 
to apply the rule and exculde the files (the generated codes etc) which 
we do not want to validate with Checkstyle.
When you run the mvn install -Psourcecheck (this profile will not be 
active by default) you will build the code with the Checkstyle 
validation first.
If every one is OK for the building code with Checkstyle validation 
first , I will set the profile to be default active profile.

Willem

Claus Ibsen wrote:
> I will like to change my vote to -1
>
> It is a must for me that the line breaks does not stays at 80.
> Even better checkstyle should not change line breaks at all. A human is much better at aligning the lines in normal and special cases.
>
> I have seen toons of code where it would indent a string concat to a new line with heaps of spaces, eg
>
> Logger.debug("This is a long string outputting something and its breaked" + myobject);
>
> Would then become
> Logger.debug(
>           "This is a long string outputting something and its breaked" +
>           myobject)
>
> And it should work out-of-the-box with Maven so it can generate a report.
> Using this we are not dependent on either IDEA or Eclipse. And the checkstyle rules should be a file that we have checked in SVN so the plugins in Eclipse or IDEA can use this rule file.
>
>
>
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> -----Original Message-----
> From: James Strachan [mailto:james.strachan@gmail.com] 
> Sent: 30. april 2008 12:04
> To: camel-dev@activemq.apache.org
> Subject: Re: Building the code with the CheckStyle
>
> I've suffered heaps of pain with servicemix and cxf as often the
> checkstyle rules only work with eclipse and I use IntelliJ
>
> So I'd be -1 from making these mandatory - until we figure out an easy
> way to configure *both* eclipse and IntelliJ.
>
> Also I'm with Claus on the 80 character limitation which is from a few
> decades ago. 160 is fine :)
>
>
> 2008/4/30 Willem Jiang <wi...@gmail.com>:
>   
>> Hi Team,
>>
>>  I'd like to enable the CheckStyle when build the camel code.
>>
>>  There are lots of benefits which we can get from CheckStyle:
>>  1.Finding out if we are missing the ASF header in the java file.
>>  2 Making our codes more consistent ( not including any tab character which
>> will cause bad formate).
>>  3.Excluding the useless import package.
>>  ...
>>
>>  All you have to do is install the CheckStyle pluging in Eclipse , and it
>> should be same with the Intellij :)
>>
>>  Any thought?
>>
>>  Willem
>>
>>
>>
>>     
>
>
>
>   


RE: Building the code with the CheckStyle

Posted by Claus Ibsen <ci...@silverbullet.dk>.
I will like to change my vote to -1

It is a must for me that the line breaks does not stays at 80.
Even better checkstyle should not change line breaks at all. A human is much better at aligning the lines in normal and special cases.

I have seen toons of code where it would indent a string concat to a new line with heaps of spaces, eg

Logger.debug("This is a long string outputting something and its breaked" + myobject);

Would then become
Logger.debug(
          "This is a long string outputting something and its breaked" +
          myobject)

And it should work out-of-the-box with Maven so it can generate a report.
Using this we are not dependent on either IDEA or Eclipse. And the checkstyle rules should be a file that we have checked in SVN so the plugins in Eclipse or IDEA can use this rule file.



Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: James Strachan [mailto:james.strachan@gmail.com] 
Sent: 30. april 2008 12:04
To: camel-dev@activemq.apache.org
Subject: Re: Building the code with the CheckStyle

I've suffered heaps of pain with servicemix and cxf as often the
checkstyle rules only work with eclipse and I use IntelliJ

So I'd be -1 from making these mandatory - until we figure out an easy
way to configure *both* eclipse and IntelliJ.

Also I'm with Claus on the 80 character limitation which is from a few
decades ago. 160 is fine :)


2008/4/30 Willem Jiang <wi...@gmail.com>:
> Hi Team,
>
>  I'd like to enable the CheckStyle when build the camel code.
>
>  There are lots of benefits which we can get from CheckStyle:
>  1.Finding out if we are missing the ASF header in the java file.
>  2 Making our codes more consistent ( not including any tab character which
> will cause bad formate).
>  3.Excluding the useless import package.
>  ...
>
>  All you have to do is install the CheckStyle pluging in Eclipse , and it
> should be same with the Intellij :)
>
>  Any thought?
>
>  Willem
>
>
>



-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Re: Building the code with the CheckStyle

Posted by James Strachan <ja...@gmail.com>.
I've suffered heaps of pain with servicemix and cxf as often the
checkstyle rules only work with eclipse and I use IntelliJ

So I'd be -1 from making these mandatory - until we figure out an easy
way to configure *both* eclipse and IntelliJ.

Also I'm with Claus on the 80 character limitation which is from a few
decades ago. 160 is fine :)


2008/4/30 Willem Jiang <wi...@gmail.com>:
> Hi Team,
>
>  I'd like to enable the CheckStyle when build the camel code.
>
>  There are lots of benefits which we can get from CheckStyle:
>  1.Finding out if we are missing the ASF header in the java file.
>  2 Making our codes more consistent ( not including any tab character which
> will cause bad formate).
>  3.Excluding the useless import package.
>  ...
>
>  All you have to do is install the CheckStyle pluging in Eclipse , and it
> should be same with the Intellij :)
>
>  Any thought?
>
>  Willem
>
>
>



-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Re: Building the code with the CheckStyle

Posted by Willem Jiang <wi...@gmail.com>.
FYI, I just committed a buildingtools module (copying from CXF), so you 
could run the Checkstyle with -Psourcecheck.

Willem

Hiram Chirino wrote:
> agree with enabling via a profile.
>
> On Wed, Apr 30, 2008 at 1:07 PM, Bruce Snyder <br...@gmail.com> wrote:
>   
>> On Tue, Apr 29, 2008 at 10:04 PM, Willem Jiang <wi...@gmail.com> wrote:
>>  > Hi Team,
>>  >
>>  >  I'd like to enable the CheckStyle when build the camel code.
>>  >
>>  >  There are lots of benefits which we can get from CheckStyle:
>>  >  1.Finding out if we are missing the ASF header in the java file.
>>  >  2 Making our codes more consistent ( not including any tab character which
>>  > will cause bad formate).
>>  >  3.Excluding the useless import package.
>>  >  ...
>>  >
>>  >  All you have to do is install the CheckStyle pluging in Eclipse , and it
>>  > should be same with the Intellij :)
>>  >
>>  >  Any thought?
>>
>>  -1 to making them mandatory. Bury them in a profile so that they can
>>  be run optionally. We've had waaaaay too much pain from Checkstyle
>>  being mandatory in SMX and CXF.
>>
>>  Bruce
>>  --
>>  perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>>  );'
>>
>>  Apache ActiveMQ - http://activemq.org/
>>  Apache Camel - http://activemq.org/camel/
>>  Apache ServiceMix - http://servicemix.org/
>>  Apache Geronimo - http://geronimo.apache.org/
>>
>>  Blog: http://bruceblog.org/
>>
>>     
>
>
>
>   


Re: Building the code with the CheckStyle

Posted by Hiram Chirino <hi...@hiramchirino.com>.
agree with enabling via a profile.

On Wed, Apr 30, 2008 at 1:07 PM, Bruce Snyder <br...@gmail.com> wrote:
>
> On Tue, Apr 29, 2008 at 10:04 PM, Willem Jiang <wi...@gmail.com> wrote:
>  > Hi Team,
>  >
>  >  I'd like to enable the CheckStyle when build the camel code.
>  >
>  >  There are lots of benefits which we can get from CheckStyle:
>  >  1.Finding out if we are missing the ASF header in the java file.
>  >  2 Making our codes more consistent ( not including any tab character which
>  > will cause bad formate).
>  >  3.Excluding the useless import package.
>  >  ...
>  >
>  >  All you have to do is install the CheckStyle pluging in Eclipse , and it
>  > should be same with the Intellij :)
>  >
>  >  Any thought?
>
>  -1 to making them mandatory. Bury them in a profile so that they can
>  be run optionally. We've had waaaaay too much pain from Checkstyle
>  being mandatory in SMX and CXF.
>
>  Bruce
>  --
>  perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
>  );'
>
>  Apache ActiveMQ - http://activemq.org/
>  Apache Camel - http://activemq.org/camel/
>  Apache ServiceMix - http://servicemix.org/
>  Apache Geronimo - http://geronimo.apache.org/
>
>  Blog: http://bruceblog.org/
>



-- 
Regards,
Hiram

Blog: http://hiramchirino.com

Open Source SOA
http://open.iona.com

Re: Building the code with the CheckStyle

Posted by Bruce Snyder <br...@gmail.com>.
On Tue, Apr 29, 2008 at 10:04 PM, Willem Jiang <wi...@gmail.com> wrote:
> Hi Team,
>
>  I'd like to enable the CheckStyle when build the camel code.
>
>  There are lots of benefits which we can get from CheckStyle:
>  1.Finding out if we are missing the ASF header in the java file.
>  2 Making our codes more consistent ( not including any tab character which
> will cause bad formate).
>  3.Excluding the useless import package.
>  ...
>
>  All you have to do is install the CheckStyle pluging in Eclipse , and it
> should be same with the Intellij :)
>
>  Any thought?

-1 to making them mandatory. Bury them in a profile so that they can
be run optionally. We've had waaaaay too much pain from Checkstyle
being mandatory in SMX and CXF.

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache Camel - http://activemq.org/camel/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/

Blog: http://bruceblog.org/

Re: Building the code with the CheckStyle

Posted by Willem Jiang <wi...@gmail.com>.
Hi Claus,

I used the Eclipse to find out the CS errors, you may need run mvn 
-Psetup.eclipse first to setup the CS rule first (It is 
trunk/etc/activemq-checkstyle.xml).
And you also need to install the CS plugin first.

You can find some information about how to set up eclipse here [1]

[1]http://cwiki.apache.org/CXF/setting-up-eclipse.html

Willem

Claus Ibsen wrote:
> Hi Willem
>
> +1
>
> I have wondered how you ran the checkstyle check since you have been checking and fixing this quite often on the code base.
>
> I wanted to be able to do it also before committing so the code was checked beforehand.
>
> Should we use a custom checkstyle rules? The default ones are a bit to greedy/oldish with eg. with max 80 char lines. This is kind late 80tish now that we all have widescreen laptops or 24" monitors with 1600x2000 
>
> The unused imports can IDEA also easility spot. And in fact it has a great library for all kind of code tests that can spot problems.
>
>
> Med venlig hilsen
>  
> Claus Ibsen
> ......................................
> Silverbullet
> Skovsgårdsvænget 21
> 8362 Hørning
> Tlf. +45 2962 7576
> Web: www.silverbullet.dk
> -----Original Message-----
> From: Willem Jiang [mailto:willem.jiang@gmail.com] 
> Sent: 30. april 2008 06:04
> To: camel-dev@activemq.apache.org
> Subject: Building the code with the CheckStyle 
>
> Hi Team,
>
> I'd like to enable the CheckStyle when build the camel code.
>
> There are lots of benefits which we can get from CheckStyle:
> 1.Finding out if we are missing the ASF header in the java file.
> 2 Making our codes more consistent ( not including any tab character 
> which will cause bad formate).
> 3.Excluding the useless import package.
> ...
>
> All you have to do is install the CheckStyle pluging in Eclipse , and it 
> should be same with the Intellij :)
>
> Any thought?
>
> Willem
>
>
>
>   


RE: Building the code with the CheckStyle

Posted by Claus Ibsen <ci...@silverbullet.dk>.
Hi Willem

+1

I have wondered how you ran the checkstyle check since you have been checking and fixing this quite often on the code base.

I wanted to be able to do it also before committing so the code was checked beforehand.

Should we use a custom checkstyle rules? The default ones are a bit to greedy/oldish with eg. with max 80 char lines. This is kind late 80tish now that we all have widescreen laptops or 24" monitors with 1600x2000 

The unused imports can IDEA also easility spot. And in fact it has a great library for all kind of code tests that can spot problems.


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: Willem Jiang [mailto:willem.jiang@gmail.com] 
Sent: 30. april 2008 06:04
To: camel-dev@activemq.apache.org
Subject: Building the code with the CheckStyle 

Hi Team,

I'd like to enable the CheckStyle when build the camel code.

There are lots of benefits which we can get from CheckStyle:
1.Finding out if we are missing the ASF header in the java file.
2 Making our codes more consistent ( not including any tab character 
which will cause bad formate).
3.Excluding the useless import package.
...

All you have to do is install the CheckStyle pluging in Eclipse , and it 
should be same with the Intellij :)

Any thought?

Willem