In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to use CheckStyle, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
Some of the check here have a common property tokens, which means the scope of the check application, for example, the length of the check method, the normal method may have up to 150 lines, while the constructor can have up to 60 lines. At this point, although the check of MethodLength is also used, it can be distinguished by the attribute tokens, as shown in the snippet of the xml file:
The tokens that applies MethodLength,*** twice is defined as METHOD_DEF, the common method; the second tokens is defined as CTOR_DEF, that is, the constructor, and a different value, 60, is defined here. In this way, CheckStyle can implement different check policies depending on the type of method. CheckStyle also defines a large number of tokens types such as CTOR_DEF, which are applied to tokens in different check, which are defined in the com.puppycrawl.tools.checkstyle.api.TokenTypes class. These Tokens are actually some signs when the source code files are split, similar to the syntax analysis in compilation, the principle of CheckStyle should be to compare the pre-set code writing strategies to the contents of these Tokens after parsing the source code, and give the results of the comparison. There are many TokenTypes classes, so I won't list them one by one here.
The following is a description of the specific check. These check can be divided into 15 categories, as follows:
= CHECK STYLE =
-Annotation correlation in Annotations-JDK5 (not expanded)
-Block Checks-Code block dependent
-Class Design-related to class design
-Coding-coding correlation
-Duplicate Code-redundant cod
-Headers-header of the source file
-Imports-introduce package dependency
-Javadoc Comments-JavaDoc related
-Metrics-complexity analysis
-Miscellaneous-other
-Modifiers-modifier dependent
-Naming Conventions-naming convention
-Regexp-regular expression correlation
-Size Violations-related to file size
-Whitespace-related to whitespace processing
= =
Thank you for reading this article carefully. I hope the article "how to use CheckStyle" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.