![](images/anchor.png) |
1 Introduction
|
-- |
|
![](images/anchor.png) |
1.1 Terminology notes
|
-- |
|
![](images/anchor.png) |
1.2 Guide notes
|
-- |
|
![](images/anchor.png) |
2 Source file basics
|
↓ |
|
![](images/anchor.png) |
2.1 File name
|
OuterTypeFilename
|
config
test
|
![](images/anchor.png) |
2.2 File encoding: UTF-8
|
explanation
|
|
![](images/anchor.png) |
2.3.1 Whitespace characters
|
FileTabCharacter
|
config
test
|
![](images/anchor.png) |
2.3.2 Special escape sequences
|
IllegalTokenText
|
config
test
|
![](images/anchor.png) |
2.3.3 Non-ASCII characters
|
AvoidEscapedUnicodeCharacters
|
config
test
|
![](images/anchor.png) |
3 Source file structure
|
EmptyLineSeparator
|
config
test
|
![](images/anchor.png) |
3.1 License or copyright information, if present
|
-- |
|
![](images/anchor.png) |
3.2 Package statement
|
LineLength
NoLineWrap
|
config
test
config
test
|
![](images/anchor.png) |
3.3 Import statements
|
↓ |
|
![](images/anchor.png) |
3.3.1 No wildcard imports
|
AvoidStarImport
|
config
test
|
![](images/anchor.png) |
3.3.2 No line-wrapping
|
LineLength
NoLineWrap
|
config
test
config
test
|
![](images/anchor.png) |
3.3.3 Ordering and spacing
|
CustomImportOrder
|
config
test
|
![](images/anchor.png) |
3.3.4 No static import for classes
|
That validation could not be checked by Checkstyle. It's
need infromation from another class(java file). But Checkstyle
have no way to open or look at another java file.
|
|
![](images/anchor.png) |
3.4 Class declaration
|
↓ |
|
![](images/anchor.png) |
3.4.1 Exactly one top-level class declaration
|
OneTopLevelClass
|
config
test
|
![](images/anchor.png) |
3.4.2 Class member ordering
|
-- |
|
![](images/anchor.png) |
3.4.2.1 Overloads: never split
|
OverloadMethodsDeclarationOrder
|
config
test
|
![](images/anchor.png) |
4 Formatting
|
-- |
|
![](images/anchor.png) |
4.1 Braces
|
↓ |
|
![](images/anchor.png) |
4.1.1 Braces are used where optional
|
NeedBraces
|
config
test
|
![](images/anchor.png) |
4.1.2 Nonempty blocks: K & R style
|
LeftCurly
RightCurly
|
config
test
config
test
|
![](images/anchor.png) |
4.1.3 Empty blocks: may be concise
|
EmptyBlock
EmptyCatchBlock
|
config
test
config
test
|
![](images/anchor.png) |
4.2 Block indentation: +2 spaces
|
Indentation
The rule "A line is never broken adjacent to the arrow in a lambda,
except that a break may come immediately after the arrow if the body
of the lambda consists of a single unbraced expression" will be
addressed in the issue
#4006.
|
config
test
|
![](images/anchor.png) |
4.3 One statement per line
|
OneStatementPerLine
|
config
test
|
![](images/anchor.png) |
4.4 Column limit: 100
|
LineLength
We can detect URL with protocol type as http://, https:// etc.
JSNI
could not be detected right now, but might be possible after comments and
javadoc support appear in Checkstyle
|
config
test
|
![](images/anchor.png) |
4.5 Line-wrapping
|
-- |
|
![](images/anchor.png) |
4.5.1 Where to break
|
OperatorWrap
SeparatorWrap
MethodParamPad
|
config
test
config
test
config
test
|
![](images/anchor.png) |
4.5.2 Indent continuation lines at least +4 spaces
|
Indentation
|
config
test
|
![](images/anchor.png) |
4.6 Whitespace
|
↓ |
|
![](images/anchor.png) |
4.6.1 Vertical Whitespace
|
EmptyLineSeparator
Blank lines between two consecutive fields are optional.
This exception is not satisfied
|
config
test
|
![](images/anchor.png) |
4.6.2 Horizontal whitespace
|
WhitespaceAround
GenericWhitespace
MethodParamPad
ParenPad
NoWhitespaceBefore
|
config
test
config
test
config
test
config
test
config
test
|
![](images/anchor.png) |
4.6.3 Horizontal alignment: never required
|
-- |
|
![](images/anchor.png) |
4.7 Grouping parentheses: recommended
|
-- |
|
![](images/anchor.png) |
4.8 Specific constructs
|
↓ |
|
![](images/anchor.png) |
4.8.1 Enum classes
|
-- |
|
![](images/anchor.png) |
4.8.2 Variable declarations
|
↓ |
|
![](images/anchor.png) |
4.8.2.1 One variable per declaration
|
MultipleVariableDeclarations
|
config
test
|
![](images/anchor.png) |
4.8.2.2 Declared when needed
|
VariableDeclarationUsageDistance
|
config
test
|
![](images/anchor.png) |
4.8.3 Arrays
|
↓ |
|
![](images/anchor.png) |
4.8.3.1 Array initializers: can be "block-like"
|
-- |
|
![](images/anchor.png) |
4.8.3.2 No C-style array declarations
|
ArrayTypeStyle
|
config
test
|
![](images/anchor.png) |
4.8.4 Switch statements
|
-- |
|
![](images/anchor.png) |
4.8.4.1 Indentation
|
Indentation
|
config
test
|
![](images/anchor.png) |
4.8.4.2 Fall-through: commented
|
FallThrough
|
config
test
|
![](images/anchor.png) |
4.8.4.3 The default case is present
|
MissingSwitchDefault
"Exception: enum type may omit the default statement group"
requirement can not be covered as we can not distinguish types,
enum values may look the same as static final String constants.
|
config
test
|
![](images/anchor.png) |
4.8.5 Annotations
|
AnnotationLocation
|
config
test
|
![](images/anchor.png) |
4.8.6 Comments
|
↓ |
|
![](images/anchor.png) |
4.8.6.1 Block comment style
|
CommentsIndentation
|
config
test
|
|
![](images/anchor.png) |
4.8.7 Modifiers
|
ModifierOrder
|
config
test
|
![](images/anchor.png) |
4.8.8 Numeric Literals
|
UpperEll
|
config
test
|
![](images/anchor.png) |
5 Naming
|
↓ |
|
![](images/anchor.png) |
5.1 Rules common to all identifiers
|
"5.2 Rules of identifier type" already includes this rule.
|
|
![](images/anchor.png) |
5.2 Rules by identifier type
|
↓ |
|
![](images/anchor.png) |
5.2.1 Package names
|
PackageName
|
config
test
|
![](images/anchor.png) |
5.2.2 Class names
|
TypeName
|
config
test
|
![](images/anchor.png) |
5.2.3 Method names
|
MethodName
No ability to distinguish verb at the beginning of name, no
way distinguish Test method from others so "_" is allowed in names
|
config
test
|
![](images/anchor.png) |
5.2.4 Constant names
|
Every constant is a static final field, but not all static final
fields are constants - impossible to check such rule.
|
|
![](images/anchor.png) |
5.2.5 Non-constant field names
|
MemberName
|
config
test
|
![](images/anchor.png) |
5.2.6 Parameter names
|
ParameterName
CatchParameterName
|
config
test
config
test
|
![](images/anchor.png) |
5.2.7 Local variable names
|
LocalVariableName
|
config
test
|
![](images/anchor.png) |
5.2.8 Type variable names
|
MethodTypeParameterName
ClassTypeParameterName
InterfaceTypeParameterName
|
config
test
config
test
config
test
|
![](images/anchor.png) |
5.3 Camel case: defined
|
AbbreviationAsWordInName
Non covered: Some words are ambiguously hyphenated in the English
language. No way to distinguish "YouTubeImporter" or
"YoutubeImporter".
|
config
test
|
![](images/anchor.png) |
6 Programming Practices
|
↓ |
|
![](images/anchor.png) |
6.1 @Override: always used
|
That validation could not be checked by Checkstyle. It's
need to
take a look as parent class. But Checkstyle have no way to
open or
look at another Class file.
|
|
![](images/anchor.png) |
6.2 Caught exceptions: not ignored
|
EmptyBlock
with option=text.
|
config
test
|
![](images/anchor.png) |
6.3 Static members: qualified using class
|
Proper validation require parsing other files, sources
are not always available.
|
|
![](images/anchor.png) |
6.4 Finalizers: not used
|
NoFinalizer
|
config
test
|
![](images/anchor.png) |
7 Javadoc
|
↓ |
|
![](images/anchor.png) |
7.1 Formatting
|
↓ |
|
![](images/anchor.png) |
7.1.1 General form
|
SingleLineJavadoc
Recent update for guide that clarify requirements will be addressed at
#4052
|
config
test
|
![](images/anchor.png) |
7.1.2 Paragraphs
|
JavadocParagraph
|
config
test
|
![](images/anchor.png) |
7.1.3 Block tags
|
AtclauseOrder
JavadocTagContinuationIndentation
NonEmptyAtclauseDescription
|
config
test
config
test
config
test
|
![](images/anchor.png) |
7.2 The summary fragment
|
SummaryJavadoc
|
config
test
|
![](images/anchor.png) |
7.3 Where Javadoc is used
|
JavadocMethod
|
config
test
|
![](images/anchor.png) |
7.3.1 Exception: self-explanatory methods
|
JavadocMethod
|
config
test
|
![](images/anchor.png) |
7.3.2 Exception: overrides
|
JavadocMethod
Overrides are checked by presence of "@Override" annotation on method.
|
config
test
|
![](images/anchor.png) |
7.3.4 Non-required Javadoc
|
-- |
|