-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add checkstyle rules #241
Open
jasta
wants to merge
1
commit into
facebook:main
Choose a base branch
from
jasta:checkstyle
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add checkstyle rules #241
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE suppressions PUBLIC | ||
"-//Puppy Crawl//DTD Suppressions 1.1//EN" | ||
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd"> | ||
|
||
<suppressions> | ||
<suppress checks="[a-zA-Z0-9]*" files="R\.java" /> | ||
</suppressions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE module PUBLIC | ||
"-//Puppy Crawl//DTD Check Configuration 1.2//EN" | ||
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd"> | ||
|
||
<module name="Checker"> | ||
<module name="SuppressionFilter"> | ||
<property name="file" value="checkstyle-suppressions.xml" /> | ||
</module> | ||
|
||
<module name="NewlineAtEndOfFile"/> | ||
<module name="FileLength"/> | ||
<module name="FileTabCharacter"/> | ||
|
||
<!-- Trailing spaces --> | ||
<module name="RegexpSingleline"> | ||
<property name="format" value="\s+$"/> | ||
<property name="message" value="Line has trailing spaces."/> | ||
</module> | ||
|
||
<!-- Space after 'for' and 'if' --> | ||
<module name="RegexpSingleline"> | ||
<property name="format" value="^\s*(for|if)\b[^ ]"/> | ||
<property name="message" value="Space needed before opening parenthesis."/> | ||
</module> | ||
|
||
<!-- For each spacing --> | ||
<module name="RegexpSingleline"> | ||
<property name="format" value="^\s*for \(.*?([^ ]:|:[^ ])"/> | ||
<property name="message" value="Space needed around ':' character."/> | ||
</module> | ||
|
||
<module name="TreeWalker"> | ||
<!-- Checks for Javadoc comments. --> | ||
<!-- See http://checkstyle.sf.net/config_javadoc.html --> | ||
<!--module name="JavadocMethod"/--> | ||
<!--module name="JavadocType"/--> | ||
<!--module name="JavadocVariable"/--> | ||
<module name="JavadocStyle"/> | ||
|
||
|
||
<!-- Checks for Naming Conventions. --> | ||
<!-- See http://checkstyle.sf.net/config_naming.html --> | ||
<!--<module name="ConstantName"/>--> | ||
<module name="LocalFinalVariableName"/> | ||
<module name="LocalVariableName"> | ||
<property name="format" value="^([a-z][a-zA-Z0-9]*|N)$" /> | ||
</module> | ||
<module name="MemberName"/> | ||
<module name="MethodName"/> | ||
<module name="PackageName"/> | ||
<module name="ParameterName"/> | ||
<module name="StaticVariableName"/> | ||
<module name="TypeName"/> | ||
|
||
|
||
<!-- Checks for imports --> | ||
<!-- See http://checkstyle.sf.net/config_import.html --> | ||
<module name="AvoidStarImport"/> | ||
<module name="IllegalImport"/> | ||
<!-- defaults to sun.* packages --> | ||
<module name="RedundantImport"/> | ||
<module name="UnusedImports"> | ||
<property name="processJavadoc" value="true"/> | ||
</module> | ||
|
||
|
||
<!-- Checks for Size Violations. --> | ||
<!-- See http://checkstyle.sf.net/config_sizes.html --> | ||
<module name="LineLength"> | ||
<property name="max" value="100"/> | ||
</module> | ||
<module name="MethodLength"> | ||
<property name="max" value="200"/> | ||
</module> | ||
|
||
|
||
<!-- Checks for whitespace --> | ||
<!-- See http://checkstyle.sf.net/config_whitespace.html --> | ||
<module name="GenericWhitespace"/> | ||
<!--<module name="EmptyForIteratorPad"/>--> | ||
<module name="MethodParamPad"/> | ||
<!--<module name="NoWhitespaceAfter"/>--> | ||
<!--<module name="NoWhitespaceBefore"/>--> | ||
<module name="OperatorWrap"> | ||
<property name="option" value="eol" /> | ||
</module> | ||
<module name="ParenPad"/> | ||
<module name="TypecastParenPad"/> | ||
<module name="WhitespaceAfter"> | ||
<property name="tokens" value="COMMA, SEMI" /> | ||
</module> | ||
<module name="WhitespaceAround"/> | ||
|
||
|
||
<!-- Modifier Checks --> | ||
<!-- See http://checkstyle.sf.net/config_modifiers.html --> | ||
<module name="ModifierOrder"/> | ||
<module name="RedundantModifier"/> | ||
|
||
|
||
<!-- Checks for blocks. You know, those {}'s --> | ||
<!-- See http://checkstyle.sf.net/config_blocks.html --> | ||
<module name="AvoidNestedBlocks"/> | ||
<!--module name="EmptyBlock"/--> | ||
<module name="LeftCurly"/> | ||
<!--<module name="NeedBraces"/>--> | ||
<module name="RightCurly"/> | ||
|
||
|
||
<!-- Checks for common coding problems --> | ||
<!-- See http://checkstyle.sf.net/config_coding.html --> | ||
<!--module name="AvoidInlineConditionals"/--> | ||
<module name="CovariantEquals"/> | ||
<module name="EmptyStatement"/> | ||
<!--<module name="EqualsAvoidNull"/>--> | ||
<module name="EqualsHashCode"/> | ||
<!--module name="HiddenField"/--> | ||
<module name="IllegalInstantiation"/> | ||
<!--module name="InnerAssignment"/--> | ||
<!--module name="MagicNumber"/--> | ||
<!--module name="MissingSwitchDefault"/--> | ||
<module name="RedundantThrows"/> | ||
<module name="SimplifyBooleanExpression"/> | ||
<module name="SimplifyBooleanReturn"/> | ||
|
||
<!-- Checks for class design --> | ||
<!-- See http://checkstyle.sf.net/config_design.html --> | ||
<!--module name="DesignForExtension"/--> | ||
<!--<module name="FinalClass"/>--> | ||
<module name="HideUtilityClassConstructor"/> | ||
<module name="InterfaceIsType"/> | ||
<!--module name="VisibilityModifier"/--> | ||
|
||
|
||
<!-- Miscellaneous other checks. --> | ||
<!-- See http://checkstyle.sf.net/config_misc.html --> | ||
<module name="ArrayTypeStyle"/> | ||
<!--module name="FinalParameters"/--> | ||
<!--module name="TodoComment"/--> | ||
<module name="UpperEll"/> | ||
</module> | ||
</module> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
configFile
should be configured using therootDir
project variabletoolVersion
(note that some Gradle versions are incompatible with same checkstyle versions. e.g. Gradle v2.5 isn't playing nice with checkstyle v6.8)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also you should probably put this block into the
allprojects
block above to apply the plugin to all subprojects