Re: unused local variables
"Arnaud Roques" <[email protected]>
| Newsgroups | gmane.comp.java.audit.checkstyle.user |
|---|---|
| Message-ID | <000f01c90ce4$99e41bf0$3d380237@CLERMONTP147> |
Hello, I have created two checkers: <module name="cs.UnusedLocalVariable" /> This checker detects unused local variable. <module name="cs.TooEarlyVariableDeclaration" /> This checker detects several things about variable declaration. Examples: int i = 0, j = 4; // Error: Declare variables on separate lines int i; i = 4; // those two lines can be merged into "int i = 4" int i = 0; // this affectation is useless i = 4; int i; // Declare variable as close as possible to where they are used [A lot of code that does not use i] i = 6; I've attached the "cs.jar" file that is needed to used thoses checkers. (sources are included). The checkers have *not* been extensively tested, so use them with care. Hope this helps! Arnaud Roques ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Checkstyle-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/checkstyle-user
cs.jar
(application/octet-stream, 7.7 KB) - not displayed