|
1 Introduction
|
-- |
|
|
1.1 Terminology notes
|
-- |
|
|
1.2 Guide notes
|
-- |
|
|
2 Source file basics
|
↓ |
|
|
2.1 File name
|
OuterTypeFilename
|
config
test
|
|
2.2 File encoding: UTF-8
|
explanation
|
|
|
2.3.1 Whitespace characters
|
FileTabCharacter
|
config
test
|
|
2.3.2 Special escape sequences
|
IllegalTokenText
|
config
test
|
|
2.3.3 Non-ASCII characters
|
AvoidEscapedUnicodeCharacters
|
config
test
|
|
3 Source file structure
|
EmptyLineSeparator
|
config
test
|
|
3.1 License or copyright information, if present
|
-- |
|
|
3.2 Package statement
|
LineLength
NoLineWrap
|
config
test
config
test
|
|
3.3 Import statements
|
↓ |
|
|
3.3.1 No wildcard imports
|
AvoidStarImport
|
config
test
|
|
3.3.2 No line-wrapping
|
LineLength
NoLineWrap
|
config
test
config
test
|
|
3.3.3 Ordering and spacing
|
CustomImportOrder
|
config
test
|
|
3.4 Class declaration
|
↓ |
|
|
3.4.1 Exactly one top-level class declaration
|
OneTopLevelClass
|
config
test
|
|
3.4.2 Class member ordering
|
-- |
|
|
3.4.2.1 Overloads: never split
|
OverloadMethodsDeclarationOrder
|
config
test
|
|
4 Formatting
|
-- |
|
|
4.1 Braces
|
↓ |
|
|
4.1.1 Braces are used where optional
|
NeedBraces
|
config
test
|
|
4.1.2 Nonempty blocks: K & R style
|
LeftCurly
RightCurly
|
config
test
config
test
|
|
4.1.3 Empty blocks: may be concise
|
EmptyBlock
EmptyCatchBlock
|
config
test
config
test
|
|
4.2 Block indentation: +2 spaces
|
Indentation
|
config
test
|
|
4.3 One statement per line
|
OneStatementPerLine
|
config
test
|
|
4.4 Column limit: 80 or 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
|
|
4.5 Line-wrapping
|
-- |
|
|
4.5.1 Where to break
|
OperatorWrap
SeparatorWrap
|
config
test
config
test
|
|
4.5.2 Indent continuation lines at least +4 spaces
|
Indentation
|
config
test
|
|
4.6 Whitespace
|
↓ |
|
|
4.6.1 Vertical Whitespace
|
EmptyLineSeparator
|
config
test
|
|
4.6.2 Horizontal whitespace
|
WhitespaceAround
GenericWhitespace
|
config
test
config
test
|
|
4.6.3 Horizontal alignment: never required
|
-- |
|
|
4.7 Grouping parentheses: recommended
|
-- |
|
|
4.8 Specific constructs
|
↓ |
|
|
4.8.1 Enum classes
|
-- |
|
|
4.8.2 Variable declarations
|
↓ |
|
|
4.8.2.1 One variable per declaration
|
MultipleVariableDeclarations
|
config
test
|
|
4.8.2.2 Declared when needed, initialized as soon as
possible
|
VariableDeclarationUsageDistance
|
config
test
|
|
4.8.3 Arrays
|
↓ |
|
|
4.8.3.1 Array initializers: can be "block-like"
|
-- |
|
|
4.8.3.2 No C-style array declarations
|
ArrayTypeStyle
|
config
test
|
|
4.8.4 Switch statements
|
-- |
|
|
4.8.4.1 Indentation
|
Indentation
|
config
test
|
|
4.8.4.2 Fall-through: commented
|
FallThrough
|
config
test
|
|
4.8.4.3 The default case is present
|
MissingSwitchDefault
|
config
test
|
|
4.8.5 Annotations
|
AnnotationLocation
|
config
test
|
|
4.8.6 Comments
|
↓ |
|
|
4.8.6.1 Block comment style
|
CommentsIndentation
|
config
test
|
|
|
4.8.7 Modifiers
|
ModifierOrder
|
config
test
|
|
4.8.8 Numeric Literals
|
UpperEll
|
config
test
|
|
5 Naming
|
↓ |
|
|
5.1 Rules common to all identifiers
|
"5.2 Rules of identifier type" already includes this rule.
|
|
|
5.2 Rules by identifier type
|
↓ |
|
|
5.2.1 Package names
|
PackageName
|
config
test
|
|
5.2.2 Class names
|
TypeName
|
config
test
|
|
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
|
|
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.
|
|
|
5.2.5 Non-constant field names
|
MemberName
|
config
test
|
|
5.2.6 Parameter names
|
ParameterName
CatchParameterName
|
config
test
config
test
|
|
5.2.7 Local variable names
|
LocalVariableName
|
config
test
|
|
5.2.8 Type variable names
|
MethodTypeParameterName
ClassTypeParameterName
InterfaceTypeParameterName
|
config
test
config
test
config
test
|
|
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
|
|
6 Programming Practices
|
↓ |
|
|
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
open or
look at another Class file.
|
|
|
6.2 Caught exceptions: not ignored
|
EmptyBlock
with option=text.
|
config
test
|
|
6.3 Static members: qualified using class
|
Proper validation require parsing other files, sources are not always available.
|
|
|
6.4 Finalizers: not used
|
NoFinalizer
|
config
test
|
|
7 Javadoc
|
↓ |
|
|
7.1 Formatting
|
↓ |
|
|
7.1.1 General form
|
SingleLineJavadoc
|
config
test
|
|
7.1.2 Paragraphs
|
JavadocParagraph
|
config
test
|
|
7.1.3 At-clauses
|
AtclauseOrder
JavadocTagContinuationIndentation
NonEmptyAtclauseDescription
|
config
test
config
test
config
test
|
|
7.2 The summary fragment
|
SummaryJavadoc
|
config
test
|
|
7.3 Where Javadoc is used
|
JavadocMethod
|
config
test
|
|
7.3.1 Exception: self-explanatory methods
|
JavadocMethod
|
config
test
|
|
7.3.2 Exception: overrides
|
JavadocMethod
Overrides are checked by presence of "@Override" annotation on method.
|
config
test
|