Google's Java Style Checkstyle Coverage

Useful information

This coverage report was created for Google Java Style( cached page), version of 23 May 2018, current as of 07 May 2019

Checkstyle's html report for Guava library

Checkstyle configuration for 'Google Java Style'

Legend

"--" - There is no rule in this paragraph.
"↓" - This paragraph is the high-level point of some group.
- Existing Check covers all requirements from Google.
- Existing Check covers some part of requirements from Google.
- Requirements are not possible to check by Checkstyle at all.

Coverage table

ATTENTION: Links to config and test in following table reference to latest (not released yet) config. Config might be slightly different from what we have in latest release. Please always use config that is embedded to jar or use a custom version copied from one that matches your checkstyle version.

Google's Java Style Rule Checkstyle Check Applied to config
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.3.4 No static import for classes That validation could not be checked by Checkstyle. It's need information from another class(java file). But Checkstyle have no way to open or look at another java file.
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
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
4.3 One statement per line OneStatementPerLine config
test
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
4.5 Line-wrapping --
4.5.1 Where to break OperatorWrap

SeparatorWrap

MethodParamPad
config
test
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
Blank lines between two consecutive fields are optional. This exception is not satisfied
config
test
4.6.2 Horizontal whitespace WhitespaceAround

GenericWhitespace

MethodParamPad

ParenPad

WhitespaceAfter

NoWhitespaceBefore

NoWhitespaceBeforeCaseDefaultColon

Between a type annotation and "[]" or "..." cannot be checked yet and actually "NoWhitespaceBefore" configuration checks the opposite for ellipsis. This will be addressed in the issue #6707.
config
test
config
test
config
test
config
test
config
test
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 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
"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
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

LambdaParameterName

RecordComponentName
config
test
config
test
config
test
config
test
5.2.7 Local variable names LocalVariableName
PatternVariableName
config
test config
test
5.2.8 Type variable names MethodTypeParameterName
ClassTypeParameterName
InterfaceTypeParameterName RecordTypeParameterName
config
test
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 to 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 Recent update for guide that clarify requirements will be addressed at #4052
InvalidJavadocPosition
config
test config
test
7.1.2 Paragraphs JavadocParagraph RequireEmptyLineBeforeBlockTagGroup config
test config
test
7.1.3 Block tags AtclauseOrder

JavadocTagContinuationIndentation

NonEmptyAtclauseDescription
config
test
config
test
config
test
7.2 The summary fragment SummaryJavadoc config
test
7.3 Where Javadoc is used MissingJavadocType MissingJavadocMethod JavadocMethod config
test config
test config
test
7.3.1 Exception: self-explanatory methods MissingJavadocMethod JavadocMethod config
test config
test
7.3.2 Exception: overrides MissingJavadocMethod JavadocMethod
Overrides are checked by presence of "@Override" annotation on method.
config
test config
test
7.3.4 Non-required Javadoc InvalidJavadocPosition config
test

Suppressions

It is possible to suppress some violations by embeded filters SuppressionFilter, SuppressionXpathFilter, SuppressWithNearbyCommentFilter, SuppressionCommentFilter and SuppressWarningsFilter.

Location of config file for SuppressionFilter can be defined by system property org.checkstyle.google.suppressionfilter.config (default value is checkstyle-suppressions.xml).

Location of config file for SuppressionXpathFilter can be defined by system property org.checkstyle.google.suppressionxpathfilter.config (default value is checkstyle-xpath-suppressions.xml).

To suppress a check in the next line of code using SuppressWithNearbyCommentFilterprecede the line of code with // CHECKSTYLE.SUPPRESS: NameOfTheCheck (replace NameOfTheCheck with the actual check to be suppressed).

To suppress a check on a block of code using SuppressionCommentFilter add // CHECKSTYLE.OFF: NameOfTheCheck before the beginning of the code block and // CHECKSTYLE.ON: NameOfTheCheck after the end of the code block (replace NameOfTheCheck with the actual check to be suppressed).

To suppress a check using SuppressWarningsFilter use Java's@SuppressWarnings({"checkstyle:name_of_the_check", ...}) annotation. Each value passed in the array parameter must meet the format checkstyle:name_of_the_check where the checkstyle: is optional and name_of_the_check is the actual name of check to be suppressed in lowercase format.

For more details please review exact configuration of Filters in google_checks.xml: SuppressionFilter, SuppressionXpathFilter SuppressWithNearbyCommentFilter, SuppressionCommentFilter, SuppressWarningsFilter,