Denovo1998 opened a new issue, #20967: URL: https://github.com/apache/pulsar/issues/20967
### Search before asking - [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar. ### Motivation **When I was reading the source code, I found some problems in the code format. Most of this is code from a long time ago, maybe we should add some CheckStyle rules?** **1.missing spaces** <img width="600" alt="Snipaste_2023-08-09_22-35-26" src="https://github.com/apache/pulsar/assets/54846009/4ea3d51c-1506-4d48-8e97-6ba70ee823a4"> <img width="600" alt="Snipaste_2023-08-09_22-32-35" src="https://github.com/apache/pulsar/assets/54846009/12deac54-1667-4220-a2e5-6106c2d769aa"> **2.Indent of wrong length** <img width="600" alt="Snipaste_2023-08-09_22-38-26" src="https://github.com/apache/pulsar/assets/54846009/3a885170-2dc7-4d49-9fdb-71cbdc5d8d5f"> <img width="600" alt="Snipaste_2023-08-09_22-37-13" src="https://github.com/apache/pulsar/assets/54846009/6651c22f-4af1-4d24-8101-b799ec2fcc9c"> <img width="600" alt="Snipaste_2023-08-09_22-36-38" src="https://github.com/apache/pulsar/assets/54846009/f28309a1-afae-425d-b489-9f96b98d2d5b"> **I counted a lot of code with these problems:** <img width="600" alt="Snipaste_2023-08-09_22-38-09" src="https://github.com/apache/pulsar/assets/54846009/b599040a-57c1-4240-a5be-11603fcea495"> ### Solution 1.change `WhitespaceAround` ```xml <module name="WhitespaceAround"> <!-- Checks that various tokens are surrounded by whitespace. This includes most binary operators and keywords followed by regular or curly braces. --> <property name="ignoreEnhancedForColon" value="false" /> <property name="tokens" value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, DO_WHILE, EQUAL, GE, GT, LAND, LAMBDA, LE, LITERAL_ASSERT, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY, LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN, NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, SL, SLIST, SL_ASSIGN, SR, SR_ASSIGN, STAR, STAR_ASSIGN, TYPE_EXTENSION_AND"/> <property name="severity" value="error"/> </module> ``` 2.add this rule ```xml <module name="Indentation"> <property name="throwsIndent" value="8" /> <property name="lineWrappingIndentation" value="8" /> </module> ``` ### Alternatives _No response_ ### Anything else? Other discussions on code styles: https://lists.apache.org/thread/qoqg33wpl5099c3dwcb1ry0gn4mr7z4q ### Are you willing to submit a PR? - [X] I'm willing to submit a PR! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
