Commit Graph

4074 Commits

Author SHA1 Message Date
Lars Kühne 62e2b65b9e Implementation for RFE #524650, regexp-disable line-length checking 2002-04-13 08:30:01 +00:00
Oliver Burn ed3e6a2428 Fixed bug where static variable checks were not taking into account the flags
to allow protected and package levels.
2002-04-12 12:23:14 +00:00
Oliver Burn 49314771b6 Fixed bug that allowed constant declarations to contain "__". 2002-04-07 09:16:43 +00:00
Oliver Burn da5d8c09d2 Fixed checkstyle errors. 2002-04-04 13:48:48 +00:00
Oliver Burn 46f7cfd92a Updated for new checks for whitespace around ()'s. 2002-04-04 13:46:44 +00:00
Oliver Burn 2b8786f133 Added checking for whitespace around ()'s. Currently checks for the format
of blah(p1, p2) and complains over blah( p1, p2 ).
2002-04-04 13:46:07 +00:00
Lars Kühne 0e0ca2bddf added failureProperty to ant task (RFE 534038) 2002-03-23 17:03:15 +00:00
Lars Kühne 190c0e5ca6 Fixed bug introduced during cleanup of duplicate code:
Reader cannot be reused by fallback lexer, it would
never see the characters that have been consumed before
the RecognitionException in the first parsing attempt.

Also added comment why the JDK 1.4 grammar is tried first.
2002-03-19 20:26:02 +00:00
Lars Kühne 08c03a7a57 added test for grammar fallback in Checker (assert as identifier) 2002-03-19 20:19:51 +00:00
Lars Kühne dd476d3368 fix for bug 528358, was introduced in revision 1.17 2002-03-19 19:35:09 +00:00
Lars Kühne 2a7c9dd831 added whitespace checks to assert statement 2002-03-19 06:16:22 +00:00
Oliver Burn b671e6bb1c Removed some duplicate code, as I also feel the pain. I like the patch, but
I question using the Java14 lexer/recognizer first. Is this because most of
the time it will succeed (especially with 1.4 source:-). Be great if a
comment could be added to the code.
2002-03-14 10:20:46 +00:00
Lars Kühne e2ec464f27 added support for jdk 1.4 assert statements
grammar changes inspired by John Pybus on the antlr-interest mailing list,
see http://groups.yahoo.com/group/antlr-interest/message/4968

the changes to Checker.java are not very clean, but I don't see a better
solution unless the ANTLR api is improved (compilationUnit() should be an
abstract member of Parser, error reporting should be pluggable)
2002-03-14 06:19:09 +00:00
Lars Kühne 6b51ac1580 added tests for Configuration serialization 2002-03-06 06:08:00 +00:00
Lars Kühne ec1e3e8349 fix for bug #522282, "Cache not invalidated upon param. change"
- all classes that contribute to Configuration are now Serializable
- use in-memory serialization to compute a hashcode of the Configuration
- store the hashcode in the cache file
- compare cached hashcode with current hashcode and invalidate cache accordingly
2002-03-05 20:53:04 +00:00
Oliver Burn 1a596b6827 Renamed anttasks.properties to checkstyletask.properties. A much clearer name. 2002-02-25 12:15:07 +00:00
Oliver Burn 47383398f8 Implemented checking for right curly checking '}'. This was much easier that
for the left. Just need to do the documentation now.
2002-02-23 06:16:55 +00:00
Lars Kühne d3af93d07b explicitly set tab width to 1 column
fixes RFE #520410 (support latest ANTLR versions)
2002-02-23 00:37:53 +00:00
Oliver Burn 07a9baacf9 Remove a global variable hack. 2002-02-22 04:21:14 +00:00
Oliver Burn 59ce3f31d7 Added support for brace checking on the keywords try, catch, finally, static.
What are not covered deliberately are labels and instance initializers.
2002-02-22 04:12:04 +00:00
Oliver Burn 41e2089574 Added support for - for, do, else, synchronized 2002-02-22 03:37:41 +00:00
Oliver Burn f4860ef3b4 Implemented brace checking for "if" and "while" 2002-02-22 03:11:36 +00:00
Oliver Burn 9943aefac7 Added support for setting the brace option for others + new tests. Now
check location of '{' on switch statements.
2002-02-21 23:37:59 +00:00
Oliver Burn fd24216f46 Now have '{' checking for methods and types. Also put in place the logic to
be able to check the others.
2002-02-21 22:43:55 +00:00
Oliver Burn c85ec6f26a Merged the Streamable interface into the AuditListener interface. Having them
separate served no real purpose at the moment, except to complicate the
implementation.
2002-02-20 23:19:08 +00:00
Oliver Burn 339a7f5475 Fixed a checkstyle error 2002-02-20 23:09:01 +00:00
Oliver Burn e10faf3315 First cut at doing left curly checking for methods. This is definitely a work
in progress that will change a lot as I add checking for other constructs. I
always tend to evolve to the general solution. :-)
2002-02-20 23:08:21 +00:00
Oliver Burn 1fd18cde7b Now support setting the left curly placement option for methods. I am
implementing this example first, before doing it for types, statics, arrays,
anon inners, etc.
2002-02-20 02:52:27 +00:00
Oliver Burn 14d5ead27a First cut at an options class for placement of left curly braces 2002-02-19 22:54:47 +00:00
Oliver Burn 048d0cdaf4 Changed the error reporting format for the modifier order check. In using the
feature, I found that it was very helpful to know which modifier to correct.
2002-02-19 22:52:49 +00:00
Oliver Burn 22885be800 Fixed checkstyle error 2002-02-19 22:39:35 +00:00
Oliver Burn 5e4b582734 Fixed the Javadoc comment. Not sure if the old style will create valid
output.
2002-02-18 00:37:04 +00:00
Oliver Burn b174220a66 Made Defn public so it can be reference outside the package 2002-02-16 22:13:59 +00:00
Lars Kühne faf76530d8 RFE #514033, check order of modifiers (implementation, test, and documentation) 2002-02-15 06:47:51 +00:00
Oliver Burn c9db9f82e2 Just some small refactoring 2002-02-11 05:38:09 +00:00
Lars Kühne 913028d7f2 Implementation, docs and test for RFE 438478, ignore multiple lines in header.
This change is compatible for command line, Ant, and API.

The API compatibility resulted in some deprecated methods in Configuration,
you can remove them if you think that API compatibility is not as
important as clean code.
2002-02-10 18:29:10 +00:00
Oliver Burn db84febeb5 Update the tests and documentation for checking whitespace around periods.
#493383
2002-02-09 13:18:30 +00:00
Oliver Burn 241c48750b Added a method to verify that a dot is correctly surrounded by whitespace. 2002-02-09 12:00:32 +00:00
Oliver Burn 7fa84f981c Made Checkstyle more "ant friendly" but having a anttasks.properties file.
This allows declaritions of the taskdef in ant 1.4+ as:

        <taskdef resource="anttasks.properties">
            <classpath refid="run.classpath"/>
        </taskdef>

Also, in a moment of madness, I re-indented the build.xml file to 4 spaces.
2002-02-09 11:03:56 +00:00
Oliver Burn a1dda4f264 Reordered the logic for ignoring lines. 2002-02-08 00:42:21 +00:00
Oliver Burn 1ca4d43ce8 <picky>Made mConfig final</picky> 2002-02-08 00:35:39 +00:00
Lars Kühne c7e7af8f7d added test for new feature 'headerfile regular expression support', rfe #499259
moved creation of Configuration to setUp() to ensure that
each test is run with a well known Configuration that is not
influenced by other tests.
2002-02-07 20:39:51 +00:00
Lars Kühne 6fc674d4bf new feature 'headerfile regular expression support, rfe #499259' 2002-02-07 20:34:11 +00:00
Oliver Burn fdd9ae8297 Incorporate patch from Andrew Lang to support having javadoc with the format:
/**
     * @param aTwo
     *     This is a multiline piece of javadoc
     **/

Also changes the wording of "is not proceeded with whitespace" to
"is not followed by whitespace". This makes things a tad clearer.
2002-02-07 05:25:30 +00:00
Oliver Burn d4f1261a61 Refactored the MethodSignature class to contain all the information. Also added
helper methods.
2002-02-06 23:15:05 +00:00
Oliver Burn ea01eaaa85 Just tweaked the style a bit to be consistent with else where. I kept the
braces on a new line though. ;-)
2002-02-06 21:55:08 +00:00
Oliver Burn 6df3e84393 Changed a comment to C++ style 2002-02-06 05:49:22 +00:00
Oliver Burn 9be48298c3 Fixed checkstyle errors 2002-02-06 05:37:26 +00:00
Lars Kühne 46667e3599 Added tests for allowProtected (old feature without tests), allowPackage, requirePackageHtml, methodPattern, localVarPattern 2002-02-05 20:40:50 +00:00
Lars Kühne c617457933 Implementation for RFEs 466756, 500378, 504964, 510441
Details:

466756 - Check for package.html:
 - new parameter requirePackageHtml, default is false

500378 - Check names of methods + local variables
 - new parameters methodPattern and localVarPattern,
   default is ^[a-z][a-zA-Z0-9]*$

504964 - no default access
510441 - allowprotect should incl. packageprivate (requests the same feature)
 - new parameter allowPackage, default is false

Sorry that I did not split this into separate patches, I had this in
my local tree as is and it would require too much work to split it.  I
think the changes are easy enough to review three feature
implementations in one go.
2002-02-05 20:22:02 +00:00
Oliver Burn b779f3c1da Updated to the LGPL and version 2.0. 2002-02-04 12:44:04 +00:00
Oliver Burn a5abed5101 Changed direct reference to getProject() 2002-01-28 22:15:08 +00:00
Lars Kühne 8e6328559e fix bug #508010, documentation and code are inconsistent 2002-01-24 18:34:47 +00:00
Oliver Burn 2b6c9c654a Added warning not to use this class outside of this package. 2002-01-23 12:42:01 +00:00
Oliver Burn 15c7162ea4 Refactored Checker to not take a PrintStream. All errors are not logged to
standard output.
2002-01-23 12:28:49 +00:00
Lars Kühne 45120a140e must be public, used as param in public method of Configuration 2002-01-22 05:23:25 +00:00
Oliver Burn f755213c9e tightened the scope 2002-01-22 01:05:22 +00:00
Oliver Burn d4e7792f24 Made public so can be used outside the package 2002-01-21 11:54:27 +00:00
Lars Kühne 2fdc69f6a9 include author email address, make class package visible instead of public 2002-01-20 08:49:03 +00:00
Lars Kühne 5a9a68e619 removed hashmarks from @see tags, they resulted in errors during javadoc generation 2002-01-20 08:27:55 +00:00
Oliver Burn f0d7921279 Added a default constructor to XMLLogger so it can be used by the ANT task.
Also updated build.xml to use the plain logger.
2002-01-15 23:51:49 +00:00
Oliver Burn 2727473656 Changed the defaults for member/static/parameter regexps to match the Sun coding
standard. The intent of this change is to make it easier for people to use
checkstyle out-of-the-box to check the Sun coding standard.
2002-01-15 12:54:03 +00:00
Lars Kühne d7de3bef0b Added tests to WS around DIV and MOD. All multiplicative expressions are now covered. 2002-01-15 06:04:46 +00:00
Oliver Burn 3af1c99a0c Removed support for assert keyword. It breaks the parser on legal java
prior to JDK 1.4.
2002-01-14 05:07:22 +00:00
Oliver Burn cb0fdf5428 Fixed a bug with JavaDoc checking in class/instance initialisers. 2002-01-14 04:33:15 +00:00
Oliver Burn 8d6fa332a9 Re-factored VerifierImpl to be called Verifier. The original intention of
the interface was to allow different verifiers to be swapped in. Considering
how much work would be required to create a verifier from scratch, people
are more likely to just want to extend VerifierImpl.
2002-01-14 02:56:15 +00:00
Oliver Burn f8ea4c69a2 Removed all evidence of the java.tree.g file. 2002-01-14 01:33:42 +00:00
Oliver Burn 1104baffa4 Moved the final tests out of java.tree.g. Yahoo! 2002-01-14 01:18:50 +00:00
Oliver Burn 5ab5020a27 Moved all the checking for {}'s into java.g. 2002-01-14 00:26:43 +00:00
Oliver Burn 8d1cba0676 Moved more tests into java.g and improved some tests. 2002-01-13 07:52:23 +00:00
Oliver Burn 3335cdeb4d Moved the reference checking to java.g 2002-01-13 06:34:38 +00:00
Oliver Burn a54d892da1 removed unused method reportIdentifier() 2002-01-13 05:02:06 +00:00
Oliver Burn 1c35230164 large refactoring of moving checking into java.g (from java.tree.g). Solved
all the hard problems - only some easy checks to migrate
2002-01-11 23:58:08 +00:00
Oliver Burn bd7cfcb3e5 Refactoring: removed unused methods reportStartMethodBlock() and
reportEndMethodBlock()
2002-01-11 13:45:54 +00:00
Oliver Burn 171df8e6e1 added a toString() method to help debugging 2002-01-11 13:42:55 +00:00
Oliver Burn b7157a9946 moved with tests into java.g 2002-01-11 12:26:23 +00:00
Oliver Burn 16d7e573b0 Moved the checking for ws around "if"s to java.g. Also refactored
calls to verifyWSAfterEnd() to use verifyWSAfterBegin() where
appropriate.
2002-01-11 11:56:55 +00:00
Oliver Burn 3188792cad Now have two methods for checking if ws around some text. One takes the column
where the text starts, and the other where the text ends. Needed because the
parser is different places either gives the start or the end.
2002-01-11 11:49:57 +00:00
Oliver Burn e3c3cdcea3 tightened up checking the STAR in multiplicativeExpression. Possible source of
a NPE reported by Lars.
2002-01-11 10:47:02 +00:00
Oliver Burn d16d3f310d <ignore>removed trailing whitespace</ignore> 2002-01-11 10:46:03 +00:00
Lars Kühne 75e9d8486e support jdk 1.4 assert statements, rfe 500122 2002-01-10 06:18:41 +00:00
Oliver Burn 047f8cef4b Started migrating the whitespace tests from java.tree.g to java.g 2002-01-09 15:06:03 +00:00
Oliver Burn 0b7bf27706 Now support ignoring whether whitespace is after a type cast. As requested by
Lars.
2002-01-08 04:18:02 +00:00
Lars Kühne c8756ab481 fix bug 499072, inner classes require author tag 2002-01-06 15:27:44 +00:00
Lars Kühne 9982fc546a javadoc checkscope tests 2002-01-06 12:53:48 +00:00
Lars Kühne 17d3b314bb javadoc checkscope implementation 2002-01-06 12:48:59 +00:00
Oliver Burn 7d82fd670a Added support to check that commas ';' in "for" statements are followed by
whitespace (ala the Sun coding standard).
2002-01-06 11:06:07 +00:00
Oliver Burn b7f1d0d1b7 Added support to check that commas ',' are followed by whitespace (ala the Sun
coding standard). This mainly involved refactoring the code I just wrote for
checking casts.
2002-01-06 10:31:32 +00:00
Oliver Burn edf2c95634 Made Checker & Configuration public so they can be used outside the package.
A requested feature to that Checkstyle can be integrated into IDE's like
NetBeans, JBuilder.
2002-01-06 07:40:36 +00:00
Oliver Burn d87ea06ebb Added support for checking the file length does not exceed a specified max. 2002-01-06 07:08:20 +00:00
Oliver Burn 637bf620e5 Support testing for the max method and constructor lengths 2002-01-06 06:40:19 +00:00
Oliver Burn 0957b67c1d Support setting the max method and constructor lengths 2002-01-06 06:30:29 +00:00
Oliver Burn efcb63fd74 Added support to check that casts are followed by whitespace, as recommended
in the Sun coding standard. Can be turned off with all other whitespace checks.
May want to specifically be able to turn off this feature.
2002-01-05 13:18:22 +00:00
Oliver Burn ad29236445 Included patch to check for whitespace around return statements. 2001-12-11 06:34:45 +00:00
Oliver Burn 518c2079d0 fixed (maybe?) a parse error 2001-12-10 02:22:25 +00:00
Oliver Burn 4fade39e72 patch for ignoring whitespace between Javadoc and declarations 2001-12-03 00:42:42 +00:00
Oliver Burn 82de45f06f Incorporate changes made to the ANTLR Java grammar 2001-11-26 12:25:45 +00:00
Oliver Burn 9a905be3a0 patch for checking more whitespace 2001-11-26 11:25:21 +00:00
Oliver Burn 7b4b37602e improved the tests 2001-11-03 10:40:15 +00:00
Oliver Burn fc3bd86681 cosmetic fixed 2001-11-02 12:38:09 +00:00
Oliver Burn 517e2450ca patch to ignore all javadoc and line length 2001-10-31 20:58:37 +00:00
Oliver Burn 85a53ccdaf making the default logger much more silent 2001-10-31 20:10:25 +00:00
Oliver Burn fb830fc73e fix checkstyle errors 2001-10-31 13:32:41 +00:00
Oliver Burn f8a69b0780 fix typos 2001-10-31 13:16:47 +00:00
Oliver Burn 403a3f70a3 patch to control ANT stopping the build on violations 2001-10-31 13:06:28 +00:00
Oliver Burn 030798a11d incorporate performance patch 2001-10-31 12:42:19 +00:00
Oliver Burn 1d21af32b9 first cut 2001-08-30 16:21:20 +00:00
Oliver Burn 0e3fe56436 started to incorporate logging events 2001-08-30 16:13:24 +00:00
Oliver Burn f34eba11cb improved technique to locate files 2001-08-30 13:09:57 +00:00
Oliver Burn a6df885ae1 included patch to be able to run unit tests from any directory. 2001-08-17 06:40:33 +00:00
Oliver Burn c4d036af76 removed debug statement 2001-08-17 03:18:14 +00:00
Oliver Burn 6c304950f6 added support for caching 2001-08-05 14:12:57 +00:00
Oliver Burn b3373646ee added support for yes,on,true for boolean properties 2001-08-05 07:41:59 +00:00
Oliver Burn d3f39e6b87 Added support for public member patterns. 2001-08-05 06:41:59 +00:00
Oliver Burn fa128598e1 start of changes for detecting unused variables 2001-08-05 05:18:58 +00:00
Oliver Burn b06dd9801e updated for the IgnoreBraces property 2001-07-02 06:42:29 +00:00
Oliver Burn be6d271ac3 added support for IgnoreBraces property 2001-07-02 06:23:24 +00:00
Oliver Burn ba46163e7c Added support for IgnoreWhitespace property. 2001-06-29 14:31:36 +00:00
Oliver Burn 9c56d57656 Implemented logic to detect package imports from the package itself. 2001-06-29 12:31:00 +00:00
Oliver Burn 69138e4022 refactored to use the new Configuration class. 2001-06-29 07:21:40 +00:00
Oliver Burn 3ded7a1155 refactoring to use a configuration object 2001-06-28 23:30:38 +00:00
Oliver Burn 20caaeb148 improved list 2001-06-28 13:12:12 +00:00
Oliver Burn f0f7f3e762 changed for release 1.2 2001-06-28 13:10:22 +00:00
Oliver Burn 0fd69594a4 first cut 2001-06-22 13:24:24 +00:00