Java icon indicating copy to clipboard operation
Java copied to clipboard

[OTHER] Enable more checks in checkstyle

Open vil02 opened this issue 1 year ago • 40 comments

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

  1. select one check form the list above such that no one else is working on (and is not done yet),
  2. write a comment "Hey, I am working on XYZ", where XYZ is your selected check,
  3. in your fork, please create a branch like enable_XYZ,
  4. uncomment the XYZ check in the checkstyle.xml,
  5. run mvn checkstyle:check and fix all of the errors - please keep your changes minimal,
  6. commit your changes with a message like "style: enable XYZ in checkstyle",
  7. create a pull-request and mention this issue by writing something like "Related to #5119".

vil02 avatar Apr 25 '24 15:04 vil02

I will work on EmptyStatement.

vil02 avatar Apr 26 '24 06:04 vil02

Hey, I will be working on ModifierOrder.

marysiuniq avatar May 01 '24 10:05 marysiuniq

Now, I will be working on ConstantName.

marysiuniq avatar May 02 '24 15:05 marysiuniq

I will work on RedundantModifier.

vil02 avatar May 03 '24 18:05 vil02

I will slowly work on AvoidStarImport.

vil02 avatar May 04 '24 13:05 vil02

Hey, I will be working on MethodName

VedSansare89 avatar May 06 '24 12:05 VedSansare89

I will work on ArrayTypeStyle.

vil02 avatar May 06 '24 17:05 vil02

I will work on HideUtilityClassConstructor.

vil02 avatar May 07 '24 19:05 vil02

@siriak, @BamaCharanChhandogi I have extended the list of obvious checks. Please have a look and edit the list if needed.

vil02 avatar May 09 '24 10:05 vil02

Hi, I will be working on FinalClass.

CodaBlurd avatar May 10 '24 13:05 CodaBlurd

I will work on EqualsHashCode.

CodaBlurd avatar May 11 '24 10:05 CodaBlurd

I will work on InnerAssignment.

CodaBlurd avatar May 15 '24 10:05 CodaBlurd

I will work on LocalFinalVariableName.

CodaBlurd avatar May 22 '24 10:05 CodaBlurd

Hey, I will work StaticVariableName.

vaibhav9t1 avatar May 24 '24 11:05 vaibhav9t1

Hi, I will work on MultipleVariableDeclarations.

vaibhav9t1 avatar May 25 '24 15:05 vaibhav9t1

I will work on MissingSwitchDefault

BamaCharanChhandogi avatar May 25 '24 18:05 BamaCharanChhandogi

I will work on MethodName.

CodaBlurd avatar May 27 '24 02:05 CodaBlurd

Hey, I'll be working on LocalVariableName. Additionally, I think LocalFinalVariableName is wrongly marked and checked as LocalVariableName.

cpu-pixel avatar May 28 '24 14:05 cpu-pixel

Additionally, I think LocalFinalVariableName is wrongly marked and checked as LocalVariableName.

@cpu-pixel Thanks for spotting that!

vil02 avatar May 28 '24 14:05 vil02

Hey, I'll be working on TypeName.

SAIVARDHAN15 avatar May 29 '24 07:05 SAIVARDHAN15

I'll be working on MemberName.

cpu-pixel avatar May 29 '24 15:05 cpu-pixel

I will work on ParameterName.

CodaBlurd avatar May 30 '24 10:05 CodaBlurd

I will work on .OperatorWrap

StarDxxx avatar Jun 07 '24 09:06 StarDxxx

I will work on .TypeName.

StarDxxx avatar Jun 08 '24 09:06 StarDxxx

I will work on ParenPad.

samuelfac avatar Jun 13 '24 16:06 samuelfac

I will work on NeedBraces

samuelfac avatar Jun 13 '24 16:06 samuelfac

I will work on AvoidNestedBlocks

samuelfac avatar Jun 13 '24 17:06 samuelfac

I will work on InvalidJavadocPosition

samuelfac avatar Jun 18 '24 09:06 samuelfac

WhitespaceAround it conflicts with clang-format. When I create the spaces clang-format undoes it and causes an error in the checkstyle.

samuelfac avatar Jun 19 '24 08:06 samuelfac

WhitespaceAround it conflicts with clang-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.

vil02 avatar Jun 19 '24 08:06 vil02