-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[misc] Added new checkstyle rules introduced in recent versions of the Checkstyle tool #9
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,6 +48,10 @@ | |
<property name="message" value="No @author tag allowed"/> | ||
</module> | ||
|
||
<module name="RegexpSingleline"> | ||
<property name="format" value="\s+$"/> | ||
</module> | ||
|
||
<!-- We cannot use this rule as it fails on our license headers, considering them as copy-pastes! | ||
<module name="StrictDuplicateCode"/> | ||
--> | ||
|
@@ -87,10 +91,14 @@ | |
|
||
<module name="BooleanExpressionComplexity"/> | ||
|
||
<!-- This is a good metric but checkstyle doesn't allow to remove JDK's base classes | ||
from the new count thus making this check unusable IMO | ||
<module name="ClassDataAbstractionCoupling"/> | ||
--> | ||
<module name="ClassDataAbstractionCoupling"> | ||
<property name="excludedClasses" value="boolean, byte, char, double, float, int, long, short, void, | ||
Boolean, Byte, Character, Double, Float, Integer, Long, Short, Void, | ||
Object, Class, String, StringBuffer, StringBuilder, | ||
ArrayIndexOutOfBoundsException, Exception, RuntimeException, IllegalArgumentException, IllegalStateException, IndexOutOfBoundsException, NullPointerException, Throwable, SecurityException, UnsupportedOperationException, | ||
List, ArrayList, Deque, Queue, LinkedList, Set, HashSet, SortedSet, TreeSet, Map, HashMap, SortedMap, TreeMap, | ||
ConcurrentHashMap, ConcurrentLinkedDeque, ConcurrentLinkedQueue, DelayQueue, FutureTask, LinkedBlockinDeque, LinkedBlockinQueue, Phaser, PriorityBlockingQueue, RejectedExecutionException, SynchronousQueue"/> | ||
</module> | ||
|
||
<module name="ClassFanOutComplexity"> | ||
<property name="excludedClasses" value="boolean, byte, char, double, float, int, long, short, void, | ||
|
@@ -131,6 +139,8 @@ | |
|
||
<module name="EmptyStatement"/> | ||
|
||
<module name="EqualsAvoidNull"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prefer |
||
|
||
<module name="EqualsHashCode"/> | ||
|
||
<module name="ExecutableStatementCount"/> | ||
|
@@ -145,6 +155,8 @@ | |
|
||
<!--module name="FinalParameters"/--> | ||
|
||
<module name="GenericWhitespace"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whitespace should not be used inside generics markers. |
||
|
||
<!-- Avoid finalizers (this will not find violations that contain linebreaks) --> | ||
<module name="RegexpSinglelineJava"> | ||
<property name="format" value="((public)|(protected))\s+void\s+finalize\(\s*\)"/> | ||
|
@@ -176,7 +188,12 @@ | |
|
||
<!--module name="ImportControl"/--> | ||
|
||
<!--module name="ImportOrder"/--> | ||
<module name="ImportOrder"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enforce import groups and alphabetical ordering inside each group. |
||
<property name="groups" value="java,javax,org,com"/> | ||
<property name="ordered" value="true"/> | ||
<property name="separated" value="true"/> | ||
<property name="option" value="bottom"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All static imports are placed at the bottom. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see how these properties affect static imports, but in any case, the current code style (at least for Eclipse) keeps the static imports at the top, before all the regular imports. Is there a good reason to change the position? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sergiu, you added the I'm not against putting static imports at the bottom, but I want to understand why keeping them at the top is wrong (as it used to be in Eclipse at least without the
I can understand that this puts "something" at the bottom but I don't see why "something" is necessarily "static imports". But anyway, this is just the syntax of Eclipse import order files, cryptic for me. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added it to comply with our documented Java code style. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see that the IntelliJ IDEA default is to put static imports at the bottom, so I think the current rule exists because Vincent proposed as a standard what was happening in his IDE. |
||
</module> | ||
|
||
<module name="Indentation"/> | ||
|
||
|
@@ -223,6 +240,8 @@ | |
|
||
<module name="MemberName"/> | ||
|
||
<module name="MethodCount"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. At most 100 methods in a class. |
||
|
||
<module name="MethodLength"/> | ||
|
||
<!-- Allow for UI methods generated by idea --> | ||
|
@@ -232,8 +251,14 @@ | |
|
||
<module name="MethodParamPad"/> | ||
|
||
<module name="MethodTypeParameterName"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Generics parameters should be one uppercase letter only. |
||
|
||
<!--module name="MissingCtor"/--> | ||
|
||
<!--module name="MissingDeprecated"/--> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This forces us to add a JavaDoc, which we don't want. It would be nice if it only worked the other way around, force the presence of the annotation if the javadoc tag is present. |
||
|
||
<module name="MissingOverride"/> | ||
|
||
<module name="MissingSwitchDefault"/> | ||
|
||
<module name="ModifiedControlVariable"/> | ||
|
@@ -250,12 +275,20 @@ | |
|
||
<module name="NeedBraces"/> | ||
|
||
<module name="NestedForDepth"> | ||
<property name="max" value="2"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checkstyle default is 1, I increased it. |
||
</module> | ||
|
||
<module name="NestedIfDepth"> | ||
<property name="max" value="2"/> | ||
</module> | ||
|
||
<module name="NestedTryDepth"/> | ||
|
||
<!--module name="NoClone"/--> | ||
|
||
<!--module name="NoFinalizer"/--> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have both clone and finalize methods in some classes. I'd rather enable these two rules and add exceptions where needed, WDYT? |
||
|
||
<module name="NoWhitespaceAfter"> | ||
<property name="tokens" value="BNOT, DEC, DOT, INC, LNOT, UNARY_MINUS, UNARY_PLUS"/> | ||
</module> | ||
|
@@ -264,8 +297,16 @@ | |
|
||
<module name="NPathComplexity"/> | ||
|
||
<module name="OneStatementPerLine"/> | ||
|
||
<module name="OperatorWrap"/> | ||
|
||
<module name="OuterTypeFilename"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checks that the outer type name and the file name match. Useful for non-public classes, which I think @cjdelisle would like to use. |
||
|
||
<module name="OuterTypeNumber"/> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Only one top level class allowed in a file. |
||
|
||
<module name="PackageAnnotation"/> | ||
|
||
<module name="PackageDeclaration"/> | ||
|
||
<module name="PackageName"/> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Disallow trailing white space.