User Tool : Checkstyle
#1
Posted 16 March 2005 - 04:52 PM
Create home directory for checkstyle, for example: "C:\Checkstyle"
Download and place into it "checkstyle-all-3.4.jar" (or latest version) and "sun_checks.xml"
see google
Step 2:
-Create New User Tool named "checkstyle"
- Select 'DOS Command'
- Enter "java -jar checkstyle-all-3.4.jar -c sun_checks.xml -r $[FilePath]"
- Set home directory of checkstyle as "Initial Directory"
- "Capture Output" and "Save all documents first" are good options.
Ready!
Current selected file will be checked on click.
If "Capture Output" is selected, output of checkstyle will be
shown in "General Output" view and lines are linked with Editor (great!)
At last, create customized icon for this user tool (if you work with mouse)
#2
Posted 16 March 2005 - 09:21 PM
#3
Posted 17 March 2005 - 07:20 AM
"Overview
Checkstyle is a development tool to help programmers write Java code that adheres to a coding standard. It automates the process of checking Java code to spare humans of this boring (but important) task. This makes it ideal for projects that want to enforce a coding standard.
Checkstyle is highly configurable and can be made to support almost any coding standard. An example configuration file is supplied supporting the Sun Code Conventions. As well, other sample configuration files are supplied for other well known conventions. "
Source:
http://checkstyle.sourceforge.net/
google is your friend :)
#4
Posted 17 March 2005 - 08:39 AM
I'd rather hear your opinion about Checksyle... That means a lot more than just some text describing what it does :-)
#5
Posted 17 March 2005 - 01:53 PM
{
doThis();
}
else
{
doThat();
}
I think, if everyboby in team generates code in some format, the project works better.
#6
Posted 17 March 2005 - 02:01 PM
So it's not really a thing for me, untill now I have always worked alone :-)
#7
Posted 19 March 2005 - 02:37 AM
{
doThis();
}
else
{
doThat();
}
I think, if everyboby in team generates code in some format, the project works better.
This sounds potentially useful. Would you recommend it for a single programmer (not on a development team) as well?
#8
Posted 19 March 2005 - 08:18 AM
Yes, I think also for a single programmers may be that tool useful.
For example, it warns, if you write like this:
public int id;
public int getId() {
return this.id;
}
}
#9
Posted 19 March 2005 - 12:30 PM
#10
Posted 19 March 2005 - 04:28 PM
#11
Posted 19 March 2005 - 10:33 PM
#12
Posted 20 March 2005 - 06:36 PM
Yeah well, it's not very hard to learn how to code in a proper way... In the beginning you just have to get used to it :-)
#14
Posted 22 March 2005 - 11:35 AM
The problem now is that it reports many lines as having more than 80 chars, for it counts each tab as 8 columns instead of 4. Anyone knows how to have Checkstyle count each tab as 4 columns?
#15
Posted 22 March 2005 - 05:12 PM
The problem now is that it reports many lines as having more than 80 chars, for it counts each tab as 8 columns instead of 4. Anyone knows how to have Checkstyle count each tab as 4 columns?
module "TreeWalker" have a property named "tabWidth"
You can set value of that property to "4":
<property name="tabWidth" value="4"/>
</module>
I use spaces for indenting.
And I'v heard Jakarta team also :)
#16
Posted 25 March 2005 - 01:44 PM
#17
Posted 31 March 2005 - 10:18 AM
I've tried to find out the "sun_checks.xml" file but...I'm getting troubles to find..
Somebody could put a link to this file to download it?...
I've been looking through Sun official site but...nothing...
I proud any link...
Thanks!
Create home directory for checkstyle, for example: "C:\Checkstyle"
Download and place into it "checkstyle-all-3.4.jar" (or latest version) and "sun_checks.xml"
see google
Step 2:
-Create New User Tool named "checkstyle"
- Select 'DOS Command'
- Enter "java -jar checkstyle-all-3.4.jar -c sun_checks.xml -r $[FilePath]"
- Set home directory of checkstyle as "Initial Directory"
- "Capture Output" and "Save all documents first" are good options.
Ready!
Current selected file will be checked on click.
If "Capture Output" is selected, output of checkstyle will be
shown in "General Output" view and lines are linked with Editor (great!)
At last, create customized icon for this user tool (if you work with mouse)
#19
Posted 31 March 2005 - 03:45 PM
=:-)
#20
Posted 31 March 2005 - 06:17 PM
I think if i manage my style while wrting the code, that would be easier than looking at all those messages i got from the style checker.
Anyways this was my idea, others might find it much helpfull.












