PMT-3: Add Static Analysis
This commit is contained in:
parent
424d7ac95a
commit
6e4a925328
5 changed files with 40 additions and 18 deletions
|
@ -15,7 +15,11 @@ jobs:
|
|||
uses: "https://git.euph.dev/actions/checkout@v3"
|
||||
- name: "Prepare Gradle"
|
||||
run: gradle clean
|
||||
- name: "Checkstyle Linting Main"
|
||||
- name: "Linting Main"
|
||||
run: gradle checkstyleMain
|
||||
- name: "Checkstyle Linting Test"
|
||||
run: gradle checkstyleTest
|
||||
- name: "Linting Test"
|
||||
run: gradle checkstyleTest
|
||||
- name: "Static Analysis Main"
|
||||
run: gradle spotbugsMain
|
||||
- name: "Static Analysis Test"
|
||||
run: gradle spotbugsTest
|
|
@ -1,5 +1,5 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Validate Linting" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<configuration default="false" name="Main Static Analysis" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
|
@ -10,7 +10,7 @@
|
|||
</option>
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value="checkstyleMain" />
|
||||
<option value="spotbugsMain" />
|
||||
</list>
|
||||
</option>
|
||||
<option name="vmOptions" />
|
|
@ -1,5 +1,5 @@
|
|||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Validate OAS" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<configuration default="false" name="Test Static Analysis" type="GradleRunConfiguration" factoryName="Gradle">
|
||||
<ExternalSystemSettings>
|
||||
<option name="executionName" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
|
@ -9,9 +9,7 @@
|
|||
<list />
|
||||
</option>
|
||||
<option name="taskNames">
|
||||
<list>
|
||||
<option value="validateSwagger" />
|
||||
</list>
|
||||
<list />
|
||||
</option>
|
||||
<option name="vmOptions" />
|
||||
</ExternalSystemSettings>
|
|
@ -1,3 +1,6 @@
|
|||
import com.github.spotbugs.snom.Confidence
|
||||
import com.github.spotbugs.snom.Effort
|
||||
import com.github.spotbugs.snom.SpotBugsTask
|
||||
import org.hidetake.gradle.swagger.generator.GenerateSwaggerCode
|
||||
|
||||
repositories {
|
||||
|
@ -7,6 +10,7 @@ repositories {
|
|||
plugins {
|
||||
java
|
||||
checkstyle
|
||||
id("com.github.spotbugs") version "6.0.22"
|
||||
id("org.springframework.boot") version "3.3.3"
|
||||
id("io.spring.dependency-management") version "1.1.6"
|
||||
id("org.hidetake.swagger.generator") version "2.19.2"
|
||||
|
@ -17,6 +21,12 @@ checkstyle {
|
|||
configFile = file("src/main/resources/checkstyle.xml")
|
||||
}
|
||||
|
||||
spotbugs {
|
||||
toolVersion = "4.8.6"
|
||||
effort.set(Effort.MAX)
|
||||
reportLevel.set(Confidence.LOW)
|
||||
}
|
||||
|
||||
group = "de.hmmh"
|
||||
version = "0.0.1-SNAPSHOT"
|
||||
|
||||
|
@ -38,11 +48,11 @@ dependencies {
|
|||
implementation("org.springframework.boot:spring-boot-starter-validation")
|
||||
implementation("org.springframework.boot:spring-boot-starter-web")
|
||||
runtimeOnly("org.postgresql:postgresql")
|
||||
|
||||
|
||||
//Lombok
|
||||
compileOnly("org.projectlombok:lombok")
|
||||
annotationProcessor("org.projectlombok:lombok")
|
||||
|
||||
|
||||
//Test
|
||||
testImplementation("org.springframework.boot:spring-boot-starter-test")
|
||||
testImplementation("org.springframework.boot:spring-boot-testcontainers")
|
||||
|
@ -63,13 +73,24 @@ swaggerSources {
|
|||
code(delegateClosureOf<GenerateSwaggerCode> {
|
||||
language = "spring"
|
||||
components = listOf("models", "apis", "supportingFiles=ApiUtil.java")
|
||||
code.rawOptions = listOf("--ignore-file-override=" + file("${rootDir}/src/main/resources/.codegen-ignore").absolutePath)
|
||||
code.rawOptions =
|
||||
listOf("--ignore-file-override=" + file("${rootDir}/src/main/resources/.codegen-ignore").absolutePath)
|
||||
dependsOn(validationTask)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
tasks {
|
||||
|
||||
withType<Checkstyle> {
|
||||
reports {
|
||||
xml.required.set(true)
|
||||
html.required.set(false)
|
||||
}
|
||||
}
|
||||
withType<SpotBugsTask> {
|
||||
excludeFilter.set(file("${rootDir}/src/main/resources/spotbugs-exclude.xml"))
|
||||
}
|
||||
processResources {
|
||||
dependsOn(generateSwaggerCode)
|
||||
}
|
||||
|
@ -79,12 +100,6 @@ tasks {
|
|||
named("compileJava").configure {
|
||||
dependsOn(swaggerSources.getByName("pmt").code)
|
||||
}
|
||||
withType<Checkstyle> {
|
||||
reports {
|
||||
xml.required.set(true)
|
||||
html.required.set(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
|
|
5
src/main/resources/spotbugs-exclude.xml
Normal file
5
src/main/resources/spotbugs-exclude.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<FindBugsFilter>
|
||||
<Match>
|
||||
<Package name="de.hmmh.pmt.oas"/>
|
||||
</Match>
|
||||
</FindBugsFilter>
|
Loading…
Reference in a new issue