Add checkstyle CI
This commit is contained in:
parent
503a2dd176
commit
e48761402f
4 changed files with 245 additions and 0 deletions
16
checkstyle-runner/Dockerfile
Normal file
16
checkstyle-runner/Dockerfile
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
FROM java:8-jdk
|
||||||
|
|
||||||
|
WORKDIR /checkstyle
|
||||||
|
|
||||||
|
ADD tubs_checks.xml /checkstyle
|
||||||
|
|
||||||
|
ENV CHECKSTYLE_VERSION=7.6.1
|
||||||
|
|
||||||
|
RUN curl -sLO https://sourceforge.net/projects/checkstyle/files/checkstyle/${CHECKSTYLE_VERSION}/checkstyle-${CHECKSTYLE_VERSION}-all.jar && mv checkstyle-${CHECKSTYLE_VERSION}-all.jar checkstyle.jar
|
||||||
|
|
||||||
|
# gitlab runner does not use entrypoint like this
|
||||||
|
# https://docs.gitlab.com/runner/executors/docker.html#the-entrypoint
|
||||||
|
#ENTRYPOINT ["java","-jar","checkstyle.jar","-c","tubs_checks.xml"]
|
||||||
|
|
||||||
|
# default option, use file names to check
|
||||||
|
#CMD ["-v"]
|
8
checkstyle-runner/gitlab-ci.yml
Normal file
8
checkstyle-runner/gitlab-ci.yml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
image: y0067212/checkstyle-ips
|
||||||
|
|
||||||
|
checkstyle:
|
||||||
|
script:
|
||||||
|
- java -jar checkstyle.jar -c tubs_checks.xml .
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- checkstyle/
|
205
checkstyle-runner/tubs_checks.xml
Normal file
205
checkstyle-runner/tubs_checks.xml
Normal file
|
@ -0,0 +1,205 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE module PUBLIC
|
||||||
|
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
|
||||||
|
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Checkstyle configuration that checks the sun coding conventions from:
|
||||||
|
|
||||||
|
- the Java Language Specification at
|
||||||
|
http://java.sun.com/docs/books/jls/second_edition/html/index.html
|
||||||
|
|
||||||
|
- the Sun Code Conventions at http://java.sun.com/docs/codeconv/
|
||||||
|
|
||||||
|
- the Javadoc guidelines at
|
||||||
|
http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
|
||||||
|
|
||||||
|
- the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
|
||||||
|
- some best practices
|
||||||
|
Checkstyle is very configurable. Be sure to read the documentation at
|
||||||
|
http://checkstyle.sf.net (or in your downloaded distribution).
|
||||||
|
Most Checks are configurable, be sure to consult the documentation.
|
||||||
|
To completely disable a check, just comment it out or delete it from the file.
|
||||||
|
Finally, it is worth reading the documentation.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<module name="Checker">
|
||||||
|
<!-- Checks that a package.html file exists for each package. -->
|
||||||
|
<!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml -->
|
||||||
|
<!-- <module name="PackageHtml"/> -->
|
||||||
|
<!-- Checks whether files end with a new line. -->
|
||||||
|
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
|
||||||
|
|
||||||
|
<!--module name="NewlineAtEndOfFile">
|
||||||
|
<property name="fileExtensions" value="java"/>
|
||||||
|
</module-->
|
||||||
|
|
||||||
|
<!-- Checks that property files contain the same keys. -->
|
||||||
|
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
|
||||||
|
<!--module name="Translation"/-->
|
||||||
|
|
||||||
|
<module name="FileLength"/>
|
||||||
|
<!-- keine tabs erlauben -->
|
||||||
|
<!--module name="FileTabCharacter">
|
||||||
|
<property name="eachLine" value="true"/>
|
||||||
|
</module-->
|
||||||
|
|
||||||
|
<!-- <module name="JavadocPackage"/> -->
|
||||||
|
|
||||||
|
<module name="TreeWalker">
|
||||||
|
<property name="tabWidth" value="4"/>
|
||||||
|
|
||||||
|
<!-- Strings werden nicht mit == oder != verglichen -->
|
||||||
|
<module name="StringLiteralEquality"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Checks for Javadoc comments. -->
|
||||||
|
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
|
||||||
|
|
||||||
|
<module name="JavadocStyle">
|
||||||
|
<property name="scope" value="private"/>
|
||||||
|
<property name="excludeScope" value="package"/>
|
||||||
|
<property name="checkFirstSentence" value="false"/>
|
||||||
|
<property name="checkEmptyJavadoc" value="true"/>
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<module name="JavadocMethod">
|
||||||
|
<property name="allowMissingPropertyJavadoc" value="true"/>
|
||||||
|
<property name="scope" value="package"/>
|
||||||
|
<property name="ignoreMethodNamesRegex" value="^main$"/>
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<module name="JavadocType">
|
||||||
|
<property name="authorFormat" value="^.+ [0-9]{7}\s+(Gruppe|[gG]roup)\s+[1-9][0-9]?[a-zA-Z]?" />
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<module name="JavadocVariable">
|
||||||
|
<property name="scope" value="public"/>
|
||||||
|
<property name="tokens" value="VARIABLE_DEF"/>
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<!-- Checks for Naming Conventions. -->
|
||||||
|
<!-- See http://checkstyle.sf.net/config_naming.html -->
|
||||||
|
<module name="ConstantName"/>
|
||||||
|
<!-- <module name="LocalFinalVariableName"/> -->
|
||||||
|
<module name="LocalVariableName"/>
|
||||||
|
<module name="MemberName"/>
|
||||||
|
<module name="MethodName"/>
|
||||||
|
<module name="ParameterName"/>
|
||||||
|
<module name="StaticVariableName"/>
|
||||||
|
<module name="TypeName"/>
|
||||||
|
|
||||||
|
<!-- Checks for Headers -->
|
||||||
|
<!-- See http://checkstyle.sf.net/config_header.html -->
|
||||||
|
<!-- <module name="Header"> -->
|
||||||
|
<!-- The follow property value demonstrates the ability -->
|
||||||
|
<!-- to have access to ANT properties. In this case it uses -->
|
||||||
|
<!-- the ${basedir} property to allow Checkstyle to be run -->
|
||||||
|
<!-- from any directory within a project. See property -->
|
||||||
|
<!-- expansion, -->
|
||||||
|
<!-- http://checkstyle.sf.net/config.html#properties -->
|
||||||
|
<!-- <property -->
|
||||||
|
<!-- name="headerFile" -->
|
||||||
|
<!-- value="${basedir}/java.header"/> -->
|
||||||
|
<!-- </module> -->
|
||||||
|
|
||||||
|
<!-- 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"/>
|
||||||
|
|
||||||
|
<!-- Checks for Size Violations. -->
|
||||||
|
<!-- See http://checkstyle.sf.net/config_sizes.html -->
|
||||||
|
|
||||||
|
<!-- module name="MethodLength"/ -->
|
||||||
|
|
||||||
|
<!-- Checks for whitespace -->
|
||||||
|
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
|
||||||
|
<!-- module name="EmptyForInitializerPad">
|
||||||
|
<property name="option" value="space"/>
|
||||||
|
</module -->
|
||||||
|
|
||||||
|
<!-- module name="EmptyForIteratorPad">
|
||||||
|
<property name="option" value="space"/>
|
||||||
|
</module -->
|
||||||
|
|
||||||
|
<module name="MethodParamPad"/>
|
||||||
|
<module name="NoWhitespaceAfter"/>
|
||||||
|
<module name="NoWhitespaceBefore"/>
|
||||||
|
<module name="OperatorWrap"/>
|
||||||
|
<module name="TypecastParenPad"/>
|
||||||
|
|
||||||
|
<module name="WhitespaceAfter"/>
|
||||||
|
<module name="WhitespaceAround"/>
|
||||||
|
|
||||||
|
<!-- Modifier Checks -->
|
||||||
|
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
|
||||||
|
<!-- module name="ModifierOrder"/ -->
|
||||||
|
|
||||||
|
<!-- 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="EmptyStatement"/>
|
||||||
|
<!-- <module name="EqualsHashCode"/> -->
|
||||||
|
<module name="IllegalInstantiation"/>
|
||||||
|
<module name="InnerAssignment"/>
|
||||||
|
<!-- module name="MissingSwitchDefault"/-->
|
||||||
|
<!-- module name="FallThrough"/-->
|
||||||
|
<module name="DefaultComesLast"/>
|
||||||
|
|
||||||
|
<module name="OneStatementPerLine"/>
|
||||||
|
<!-- <module name="StringLiteralEquality"/> -->
|
||||||
|
|
||||||
|
<!-- Checks for class design -->
|
||||||
|
<!-- See http://checkstyle.sf.net/config_design.html -->
|
||||||
|
<!-- <module name="DesignForExtension"/> -->
|
||||||
|
<module name="FinalClass"/>
|
||||||
|
<!-- <module name="FinalLocalVariable"/> -->
|
||||||
|
<!-- <module name="HideUtilityClassConstructor"/> -->
|
||||||
|
|
||||||
|
<module name="LineLength">
|
||||||
|
<property name="max" value="150"/>
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<module name="VisibilityModifier"/>
|
||||||
|
<!-- module name="DeclarationOrder"/ -->
|
||||||
|
<!-- <module name="RequireThis"/> -->
|
||||||
|
|
||||||
|
<!-- module name="RequireThis">
|
||||||
|
<property name="checkFields" value="false"/>
|
||||||
|
<property name="checkMethods" value="false"/>
|
||||||
|
</module -->
|
||||||
|
|
||||||
|
<!-- Miscellaneous other checks. -->
|
||||||
|
<!-- See http://checkstyle.sf.net/config_misc.html -->
|
||||||
|
<module name="ArrayTypeStyle"/>
|
||||||
|
<module name="GenericWhitespace"/>
|
||||||
|
|
||||||
|
<module name="TodoComment"/>
|
||||||
|
<module name="UpperEll"/>
|
||||||
|
|
||||||
|
<module name="Indentation"> <!-- einrueckung von 4 leerzeichen -->
|
||||||
|
<property name="basicOffset" value="4"/>
|
||||||
|
<property name="caseIndent" value="4"/>
|
||||||
|
</module>
|
||||||
|
|
||||||
|
<!-- <module name="CyclomaticComplexity"> -->
|
||||||
|
<!-- <property name="max" value="7"/> -->
|
||||||
|
<!-- </module> -->
|
||||||
|
|
||||||
|
<module name="IllegalCatch"/>
|
||||||
|
<module name="IllegalThrows"/>
|
||||||
|
|
||||||
|
</module>
|
||||||
|
</module>
|
16
notes.md
16
notes.md
|
@ -44,3 +44,19 @@
|
||||||
## (optional) sync script
|
## (optional) sync script
|
||||||
|
|
||||||
- (one-way) sync students and groups from [Stud.IP REST API](http://docs.studip.de/develop/Entwickler/RESTAPI) to [Gitlab REST API](https://docs.gitlab.com/ce/api/)
|
- (one-way) sync students and groups from [Stud.IP REST API](http://docs.studip.de/develop/Entwickler/RESTAPI) to [Gitlab REST API](https://docs.gitlab.com/ce/api/)
|
||||||
|
|
||||||
|
# Replicate (TODO: ansible playbook)
|
||||||
|
|
||||||
|
- install gitlab
|
||||||
|
- install docker
|
||||||
|
- copy gitlab.rb
|
||||||
|
- partially protected
|
||||||
|
- default project limit = 0
|
||||||
|
- shared runner for checkstyle
|
||||||
|
|
||||||
|
- protected runner for
|
||||||
|
|
||||||
|
+ setting protected tags
|
||||||
|
+ running jplag
|
||||||
|
|
||||||
|
- script for creating repos and groups
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue