Skip to content

Commit

Permalink
Added itm java codeformat and .gitlab-ci.yml (#153)
Browse files Browse the repository at this point in the history
* update snapshot workflow

* Update gh action workflows

* Fix snapshot workflow

* Update snapshot workflow

* Bump version to 1.17.2-SNAPSHOT

* delete application-test.yaml

* Add renovate.json (#27)

* policy-as-code update (#39)

policy-as-code updated

* Use default itm codeformatting (#26)

* Fixed 13h vehicle counting not displayed correctly

* Create .gitlab-ci.yml

* revert version
  • Loading branch information
vermali authored Jul 11, 2024
1 parent 3a45d63 commit 4af4fd1
Show file tree
Hide file tree
Showing 215 changed files with 23,834 additions and 18,536 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ jobs:
uses: actions/checkout@v3

- name: Advance Security Policy as Code
uses: advanced-security/policy-as-code@v2.1.2
uses: advanced-security/policy-as-code@v2.4.1
with:
policy: GeekMasher/security-queries
policy-path: policies/default.yml

token: ${{ secrets.ACCESS_TOKEN }}

argvs: '--disable-dependabot --disable-secret-scanning --disable-code-scanning'
policy: it-at-m/policy-as-code
policy-path: default.yaml
token: ${{ secrets.GITHUB_TOKEN }}
argvs: "--disable-dependabot --disable-secret-scanning --disable-code-scanning --display"

build-maven:
needs: compliance
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/build_feature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
- name: Build with Maven
run: mvn -B verify "-Dspring-boot.run.jvmArguments=-Dfile.encoding=UTF-8" -DskipTests=true

- uses: gacts/github-slug@v1
id: slug

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

Expand All @@ -40,4 +43,4 @@ jobs:
with:
context: .
push: true
tags: itatm/dave-frontend:${{ github.ref_name }}
tags: itatm/dave-frontend:${{ steps.slug.outputs.branch-name-slug }}
25 changes: 18 additions & 7 deletions .github/workflows/snapshot_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
current_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "Current version: $current_version"
if [ "${{ github.event.inputs.version }}" == "none" ]; then
new_version="$current_version-SNAPSHOT"
new_version="$current_version"
elif [ "${{ github.event.inputs.version }}" == "major" ]; then
new_version=$(echo $current_version | awk -F. -v OFS=. '{$1=$1+1; $2=0; $3=0; print $0"-SNAPSHOT"}')
elif [ "${{ github.event.inputs.version }}" == "minor" ]; then
Expand All @@ -35,11 +35,14 @@ jobs:
echo "New version: $new_version"
mvn -B versions:set -DnewVersion=$new_version
mvn -B versions:set -DnewVersion=$new_version -DprocessAllModules
git config --global user.email "github-actions@github.com"
git config --global user.name "GitHub Actions"
git add **/pom.xml
git commit -m "Bump version to $new_version"
git push
if [ "${{ github.event.inputs.version }}" != "none" ]; then
git config --global user.email "github-actions@github.com"
git config --global user.name "GitHub Actions"
git add pom.xml
git add **/pom.xml
git commit -m "Bump version to $new_version"
git push
fi
echo "::set-output name=new_version::$new_version"
- name: Set up JDK 11
Expand Down Expand Up @@ -74,4 +77,12 @@ jobs:
with:
context: .
push: true
tags: itatm/dave-frontend:${{ steps.set-version.outputs.new_version }}
tags: itatm/dave-frontend:${{ steps.set-version.outputs.new_version }}

- name: Docker Hub Description
uses: peter-evans/dockerhub-description@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_KEY }}
repository: itatm/dave-frontend
short-description: Das DAVe-Datenportal bietet einen Zugriff auf die Zählungen und ermöglicht Datenanalyse.
10 changes: 10 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
variables:
INCLUDE_CICD_REF_BRANCH:
value: "main"
description: "Welcher Branch soll für die Pipeline genutzt werden?"

include:
- project: "$INCLUDE_CICD_PROJECT"
ref: "$INCLUDE_CICD_REF_BRANCH"
file:
- "$INCLUDE_CICD_GITLAB_PROD_YML"
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ If you have a suggestion that would make this better, please open an issue with
Push to the Branch (git push origin feature/AmazingFeature)
Open a Pull Request

### Coding Conventions

We use the [itm-java-codeformat](https://github.com/it-at-m/itm-java-codeformat) project to apply code formatting conventions.
To add those conventions to your favorite IDE, please have a look at the [README of itm-java-codeformat](https://github.com/it-at-m/itm-java-codeformat#verwendung).

## License

Distributed under the MIT License. See LICENSE for more information.
Expand Down
101 changes: 101 additions & 0 deletions apigateway/checkstyle.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">

<module name = "Checker">
<property name="charset" value="UTF-8"/>

<property name="severity" value="error"/>

<property name="fileExtensions" value="java, properties, xml"/>
<module name="BeforeExecutionExclusionFileFilter">
<property name="fileNamePattern" value="module\-info\.java$"/>
</module>

<module name="TreeWalker">
<module name="OuterTypeFilename"/>
<module name="NoLineWrap">
<property name="tokens" value="PACKAGE_DEF, IMPORT, STATIC_IMPORT"/>
</module>
<module name="LeftCurly" />
<module name="RightCurly" />
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround">
<property name="allowEmptyConstructors" value="true"/>
<property name="allowEmptyLambdas" value="true"/>
<property name="allowEmptyMethods" value="true"/>
<property name="allowEmptyTypes" value="true"/>
<property name="allowEmptyLoops" value="true"/>
<property name="allowEmptyCatches" value="true"/>
<property name="ignoreEnhancedForColon" value="false"/>
<property name="tokens"
value="ASSIGN, BAND, BAND_ASSIGN, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR,
BXOR_ASSIGN, COLON, DIV, DIV_ASSIGN, DO_WHILE, EQUAL, GE, GT, LAMBDA, LAND,
LCURLY, LE, LITERAL_CATCH, LITERAL_DO, LITERAL_ELSE, LITERAL_FINALLY,
LITERAL_FOR, LITERAL_IF, LITERAL_RETURN, LITERAL_SWITCH, LITERAL_SYNCHRONIZED,
LITERAL_TRY, LITERAL_WHILE, LOR, LT, MINUS, MINUS_ASSIGN, MOD, MOD_ASSIGN,
NOT_EQUAL, PLUS, PLUS_ASSIGN, QUESTION, RCURLY, SL, SLIST, SL_ASSIGN, SR,
SR_ASSIGN, STAR, STAR_ASSIGN, LITERAL_ASSERT, TYPE_EXTENSION_AND"/>
<message key="ws.notFollowed"
value="WhitespaceAround: ''{0}'' is not followed by whitespace. Empty blocks may only be represented as '{}' when not part of a multi-block statement (4.1.3)"/>
<message key="ws.notPreceded"
value="WhitespaceAround: ''{0}'' is not preceded with whitespace."/>
</module>
<module name="GenericWhitespace">
<message key="ws.followed"
value="GenericWhitespace ''{0}'' is followed by whitespace."/>
<message key="ws.preceded"
value="GenericWhitespace ''{0}'' is preceded with whitespace."/>
<message key="ws.illegalFollow"
value="GenericWhitespace ''{0}'' should followed by whitespace."/>
<message key="ws.notPreceded"
value="GenericWhitespace ''{0}'' is not preceded with whitespace."/>
</module>
<module name="OneStatementPerLine"/>
<module name="ModifierOrder"/>
<module name="EmptyLineSeparator">
<property name="tokens"
value="IMPORT, STATIC_IMPORT, CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
STATIC_INIT, INSTANCE_INIT, CTOR_DEF, VARIABLE_DEF, RECORD_DEF,
COMPACT_CTOR_DEF"/>
<property name="allowNoEmptyLineBetweenFields" value="true"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapDot"/>
<property name="tokens" value="DOT"/>
<property name="option" value="nl"/>
</module>
<module name="SeparatorWrap">
<property name="id" value="SeparatorWrapComma"/>
<property name="tokens" value="COMMA"/>
<property name="option" value="EOL"/>
</module>

<module name="CustomImportOrder">
<property name="sortImportsInGroupAlphabetically" value="true"/>
<property name="separateLineBetweenGroups" value="true"/>
<property name="customImportOrderRules" value="STATIC###THIRD_PARTY_PACKAGE"/>
<property name="tokens" value="IMPORT, STATIC_IMPORT, PACKAGE_DEF"/>
</module>
<module name="MethodParamPad">
<property name="tokens"
value="CTOR_DEF, LITERAL_NEW, METHOD_CALL, METHOD_DEF,
SUPER_CTOR_CALL, ENUM_CONSTANT_DEF, RECORD_DEF"/>
</module>
<module name="NoWhitespaceBefore">
<property name="tokens"
value="COMMA, SEMI, POST_INC, POST_DEC, DOT,
LABELED_STAT, METHOD_REF"/>
<property name="allowLineBreaks" value="true"/>
</module>
<module name="ParenPad"/>
<module name="AnnotationLocation">
<property name="allowSamelineMultipleAnnotations" value="false"/>
<property name="allowSamelineSingleParameterlessAnnotation" value="false"/>
<property name="allowSamelineParameterizedAnnotation" value="false"/>
</module>
<module name="AbbreviationAsWordInName"/>
<module name="UnusedLocalVariable"/>
</module>
</module>
55 changes: 55 additions & 0 deletions apigateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<logstash.encoder.version>7.0.1</logstash.encoder.version>
<apache.commons.lang.version>3.12.0</apache.commons.lang.version>
<jvm.options>-Dorg.conscrypt.native.workdir=$(pwd)</jvm.options>
<itm-codeformat.version>1.0.3</itm-codeformat.version>
</properties>


Expand Down Expand Up @@ -180,6 +181,60 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.28.0</version>
<dependencies>
<dependency>
<groupId>de.muenchen.itm</groupId>
<artifactId>itm-java-codeformat</artifactId>
<version>${itm-codeformat.version}</version>
</dependency>
</dependencies>
<configuration>
<java>
<includes>
<include>src/main/java/**/*.java</include> <!-- Check application code -->
<include>src/test/java/**/*.java</include> <!-- Check application tests code -->
</includes>
<eclipse>
<file>itm-java-codeformat/java_codestyle_formatter.xml</file>
</eclipse>
<trimTrailingWhitespace/>
<endWithNewline/>
</java>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<configLocation>checkstyle.xml</configLocation>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>9.3</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,27 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;


/**
* To do some base configuration for the non blocking client-server framework
* named Netty via properties use the properties listed in the link down below:
*
* @see <a href="https://projectreactor.io/docs/netty/release/api/constant-values.html">https://projectreactor.io/docs/netty/release/api/constant-values.html</a>
*
* As listed below, this above mentioned properties should be set before the application startup:
*
* <ul>
* <li>As command line argument: e.g. -Dreactor.netty.pool.maxConnections=1000.
* <li>As environmental property in Openshift: e.g. with key REACTOR_NETTY_POOL_MAXCONNECTIONS and value 1000.
* <li>As programatically set property before call {@link SpringApplication#run} in {@link ApiGatewayApplication#main}: e.g. <code>System.setProperty("reactor.netty.pool.maxConnections", "1000");</code>.
* </ul>
*
* To get more information about Spring Cloud Gateway visit the following link:
*
* @see <a href="https://cloud.spring.io/spring-cloud-gateway/reference/html/">https://cloud.spring.io/spring-cloud-gateway/reference/html/</a>
* @see <a href=
* "https://projectreactor.io/docs/netty/release/api/constant-values.html">https://projectreactor.io/docs/netty/release/api/constant-values.html</a>
* As listed below, this above mentioned properties should be set before the application
* startup:
* <ul>
* <li>As command line argument: e.g. -Dreactor.netty.pool.maxConnections=1000.
* <li>As environmental property in Openshift: e.g. with key REACTOR_NETTY_POOL_MAXCONNECTIONS
* and value 1000.
* <li>As programatically set property before call {@link SpringApplication#run} in
* {@link ApiGatewayApplication#main}: e.g.
* <code>System.setProperty("reactor.netty.pool.maxConnections", "1000");</code>.
* </ul>
* To get more information about Spring Cloud Gateway visit the following link:
* @see <a href=
* "https://cloud.spring.io/spring-cloud-gateway/reference/html/">https://cloud.spring.io/spring-cloud-gateway/reference/html/</a>
*/
@SpringBootApplication(
scanBasePackages = {"de.muenchen.dave"}
)
@SpringBootApplication(scanBasePackages = { "de.muenchen.dave" })
public class ApiGatewayApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
*/
package de.muenchen.dave.configuration;

import static org.springframework.web.reactive.function.server.RequestPredicates.GET;
import static org.springframework.web.reactive.function.server.RouterFunctions.route;
import static org.springframework.web.reactive.function.server.ServerResponse.ok;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
Expand All @@ -13,14 +17,8 @@
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.ServerResponse;

import static org.springframework.web.reactive.function.server.RequestPredicates.GET;
import static org.springframework.web.reactive.function.server.RouterFunctions.route;
import static org.springframework.web.reactive.function.server.ServerResponse.ok;


/**
* This class supplies the endpoint which provides the gui.
*
* The default path to the gui entry point is "classpath:/static/index.html".
*/
@Configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.springframework.security.config.web.server.ServerHttpSecurity;
import org.springframework.security.web.server.SecurityWebFilterChain;


@Configuration
@Profile("no-security")
public class NoSecurityConfiguration {
Expand Down
Loading

0 comments on commit 4af4fd1

Please sign in to comment.