Skip to content
This repository has been archived by the owner on Jul 6, 2023. It is now read-only.

Commit

Permalink
Merge pull request #264 from loveleif/4.1-code-style
Browse files Browse the repository at this point in the history
Introduce codestyle
  • Loading branch information
loveleif authored Oct 22, 2020
2 parents 147c0b9 + 08c9b2a commit 93d2e07
Show file tree
Hide file tree
Showing 127 changed files with 9,578 additions and 5,410 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ buildscript {

allprojects {
apply plugin: 'java'
apply plugin: 'checkstyle'

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand Down
111 changes: 111 additions & 0 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">

<module name="Checker">

<property name="charset" value="UTF-8"/>
<property name="fileExtensions" value="java"/>

<!-- Require license headers (GPL, AGPL or Apache 2.0) -->
<module name="RegexpSingleline">
<property name="format"
value="^(\s|\*)*Copyright \(c\) 2002-[0-9]{4} &quot;Neo4j,&quot;"/>
<property name="minimum" value="1"/>
<property name="maximum" value="1"/>
<property name="message" value="Missing, wrong or duplicated license header"/>
</module>

<!-- Prohibit tabs -->
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>

<!-- Require new line at the end of file -->
<module name="NewlineAtEndOfFile">
<property name="lineSeparator" value="lf_cr_crlf" />
</module>

<!-- Prohibit trailing spaces -->
<module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="minimum" value="0"/>
<property name="maximum" value="0"/>
<property name="message" value="Line has trailing spaces."/>
</module>

<!-- Prohibit consecutive empty lines (except the lines after package/import) -->
<module name="RegexpMultiline">
<property name="format" value="\n *(?!package )(?!import )[^\n]+\n{3,}"/>
<property name="message" value="Two or more consecutive empty lines"/>
</module>

<module name="LineLength">
<property name="fileExtensions" value="java" />
<property name="max" value="160"/>
<property name="ignorePattern" value="a href|href|http://|https://"/>
</module>

<module name="TreeWalker">

<module name="PackageDeclaration"/>
<module name="UpperEll"/>
<module name="ArrayTypeStyle"/>
<module name="MissingOverride"/>
<module name="EmptyStatement"/>
<module name="SuperFinalize"/>
<module name="EqualsHashCode"/>
<module name="ModifierOrder"/>
<module name="RedundantImport"/>
<module name="MissingSwitchDefault"/>
<module name="DefaultComesLast"/>
<module name="MethodParamPad"/>
<module name="TypecastParenPad"/>
<module name="EmptyCatchBlock">
<property name="exceptionVariableName" value="ignore|ignored"/>
</module>
<module name="AnnotationLocation">
<property name="allowSamelineMultipleAnnotations" value="false"/>
<property name="allowSamelineSingleParameterlessAnnotation" value="false"/>
<property name="allowSamelineParameterizedAnnotation" value="false"/>
</module>
<module name="UnnecessaryParentheses"/>
<module name="LeftCurly">
<property name="option" value="nl"/>
<property name="tokens" value="INTERFACE_DEF, CLASS_DEF, ANNOTATION_DEF, ENUM_DEF, CTOR_DEF, METHOD_DEF, ENUM_CONSTANT_DEF, LITERAL_WHILE, LITERAL_TRY, LITERAL_CATCH, LITERAL_FINALLY, LITERAL_SYNCHRONIZED, LITERAL_SWITCH, LITERAL_DO, LITERAL_IF, LITERAL_ELSE, LITERAL_FOR, STATIC_INIT, OBJBLOCK"/>
</module>
<module name="RightCurly">
<property name="option" value="alone"/>
</module>
<module name="NeedBraces"/>
<module name="RedundantModifier"/>
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyLambdas" value="true"/>
<property name="allowEmptyMethods" value="true"/>
</module>
<module name="OneStatementPerLine">
<property name="treatTryResourcesAsStatement" value="true"/>
</module>
<module name="ParenPad">
<property name="tokens"
value="ANNOTATION, ANNOTATION_FIELD_DEF, CTOR_CALL, CTOR_DEF, ENUM_CONSTANT_DEF, LITERAL_CATCH, LITERAL_DO, LITERAL_FOR, LITERAL_IF, LITERAL_NEW, LITERAL_SWITCH, LITERAL_SYNCHRONIZED, LITERAL_WHILE, RESOURCE_SPECIFICATION, SUPER_CTOR_CALL, LAMBDA, METHOD_DEF"/>
<property name="option" value="space"/>
</module>
<module name="AvoidStarImport"/>
<module name="GenericWhitespace"/>
<module name="ExplicitInitialization"/>

<!-- Included in mono repo but not worth it to introduce here at this moment
<module name="IllegalImport">
<property name="illegalPkgs" value="junit.framework"/>
</module>
-->

<module name="LocalVariableName">
<property name="allowOneCharVarInForLoop" value="true"/>
</module>
</module>

</module>
4 changes: 4 additions & 0 deletions cypher-shell/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,7 @@ dependencies {
testCompile "org.hamcrest:java-hamcrest:$hamcrestVersion"
testCompileOnly "com.google.code.findbugs:annotations:$findbugsVersion"
}

checkstyle {
toolVersion = '8.35'
}
Loading

0 comments on commit 93d2e07

Please sign in to comment.