[OTHER] Enable more checks in checkstyle
What would you like to share?
#5110 introduced checkstyle. The config file has some of the rules commented out. It might a good idea to introduce some of them and discuss why the other ones are not needed in this repository.
List of checks which should be introduced
Few of the obvious checks, which should be introduced:
- [x] ConstantName (#5139 by @marysiuniq)
- [x] LocalFinalVariableName (#5172 by @CodaBlurd)
- [x] LocalVariableName (#5191 by @cpu-pixel)
- [x] MemberName (#5193 by @cpu-pixel)
- [x] MethodName (#5182 by @CodaBlurd)
- [x] ParameterName (#5196 by @CodaBlurd)
- [x] StaticVariableName (#5173 by @vaibhav9t1)
- [x] TypeName (#5214 by @StarDxxx)
- [x] AvoidStarImport (#5141)
- [x] ModifierOrder (#5132 by @marysiuniq)
- [x] RedundantModifier (#5140)
- [x] EmptyStatement (#5120)
- [x] MultipleVariableDeclarations (#5175 by @vaibhav9t1)
- [x] HideUtilityClassConstructor (#5147)
- [x] ArrayTypeStyle (#5145)
- [x] InvalidJavadocPosition (#5237 by @samuelfac)
- [x] OperatorWrap (#5212 by @StarDxxx)
- [x] ParenPad (#5226 by @samuelfac)
- [x] EqualsHashCode (#5157 by @CodaBlurd)
- [x] InnerAssignment (#5162 by @CodaBlurd)
- [x] FinalClass (#5154 by @CodaBlurd)
- [x] MissingSwitchDefault (#5179 by @BamaCharanChhandogi)
- [x] NeedBraces (#5227 by @samuelfac)
- [x] AvoidNestedBlocks (#5228 by @samuelfac)
- [x] WhitespaceAround (#5241)
- [ ] TodoComment
(@siriak, @BamaCharanChhandogi feel free to edit the list above)
Additional information
How to contribute
- select one check form the list above such that no one else is working on (and is not done yet),
- write a comment "Hey, I am working on
XYZ", whereXYZis your selected check, - in your fork, please create a branch like enable_XYZ,
- uncomment the
XYZcheck in thecheckstyle.xml, - run
mvn checkstyle:checkand fix all of the errors - please keep your changes minimal, - commit your changes with a message like "style: enable
XYZin checkstyle", - create a pull-request and mention this issue by writing something like "Related to #5119".
I will work on EmptyStatement.
Hey, I will be working on ModifierOrder.
Now, I will be working on ConstantName.
I will work on RedundantModifier.
I will slowly work on AvoidStarImport.
Hey, I will be working on MethodName
I will work on ArrayTypeStyle.
I will work on HideUtilityClassConstructor.
@siriak, @BamaCharanChhandogi I have extended the list of obvious checks. Please have a look and edit the list if needed.
Hi, I will be working on FinalClass.
I will work on EqualsHashCode.
I will work on InnerAssignment.
I will work on LocalFinalVariableName.
Hey, I will work StaticVariableName.
Hi, I will work on MultipleVariableDeclarations.
I will work on MissingSwitchDefault
I will work on MethodName.
Hey, I'll be working on LocalVariableName. Additionally, I think LocalFinalVariableName is wrongly marked and checked as LocalVariableName.
Additionally, I think
LocalFinalVariableNameis wrongly marked and checked asLocalVariableName.
@cpu-pixel Thanks for spotting that!
Hey, I'll be working on TypeName.
I'll be working on MemberName.
I will work on ParameterName.
I will work on .OperatorWrap
I will work on .TypeName.
I will work on ParenPad.
I will work on NeedBraces
I will work on AvoidNestedBlocks
I will work on InvalidJavadocPosition
WhitespaceAround it conflicts with clang-format. When I create the spaces clang-format undoes it and causes an error in the checkstyle.
WhitespaceAroundit conflicts withclang-format. When I create the spaces clang-format undoes it and causes an error in the checkstyle.
Please have a look at #5241.
But you are right: some of the checks (like GenericWhitespace, NoWhitespaceAfter) conflict the current clang-format config.