Skip to content

Commit 9b32d97

Browse files
authored
Re-enable sonarqube for quality assessment (#3488)
2 parents ff9c793 + 89d5911 commit 9b32d97

File tree

9 files changed

+65
-262
lines changed

9 files changed

+65
-262
lines changed

.github/old_workflows/sonarqube.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/artiweb.yml

Lines changed: 0 additions & 88 deletions
This file was deleted.

.github/workflows/code_quality.yml

Lines changed: 2 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,6 @@ jobs:
2424
- name: Build with Gradle
2525
run: ./gradlew -DENABLE_NULLNESS=true compileTest
2626

27-
28-
qodana:
29-
runs-on: ubuntu-latest
30-
steps:
31-
- uses: actions/checkout@v4
32-
with:
33-
fetch-depth: 0
34-
- name: 'Qodana Scan'
35-
uses: JetBrains/qodana-action@v2024.2.6
36-
37-
- uses: github/codeql-action/upload-sarif@v3
38-
if: success() || failure()
39-
with:
40-
sarif_file: ${{ runner.temp }}/qodana/results/qodana.sarif.json
41-
4227
formatting:
4328
runs-on: ubuntu-latest
4429
steps:
@@ -48,78 +33,5 @@ jobs:
4833
distribution: 'corretto'
4934
java-version: '21'
5035
cache: 'gradle'
51-
- name: Setup Gradle
52-
uses: gradle/actions/setup-gradle@v4.1.0
53-
- name: SpotlessCheck
54-
run: ./gradlew --continue spotlessCheck
55-
56-
# checkstyle:
57-
# runs-on: ubuntu-latest
58-
# steps:
59-
# - uses: actions/checkout@v4
60-
# with:
61-
# fetch-depth: 0
62-
# - run: scripts/tools/checkstyle/runIncrementalCheckstyle.sh --xml | tee report.xml
63-
# - run: |
64-
# npx violations-command-line -sarif sarif-report.json \
65-
# -v "CHECKSTYLE" "." ".*/report.xml$" "Checkstyle" \
66-
# -diff-to $(git merge-base HEAD origin/main) -pv false
67-
68-
# - uses: github/codeql-action/upload-sarif@v3
69-
# if: success() || failure()
70-
# with:
71-
# sarif_file: sarif-report.json
72-
73-
74-
checkstyle_new:
75-
runs-on: ubuntu-latest
76-
steps:
77-
- uses: actions/checkout@v4
78-
- uses: actions/setup-java@v4
79-
with:
80-
distribution: 'corretto'
81-
java-version: '21'
82-
cache: 'gradle'
83-
- name: Setup Gradle
84-
uses: gradle/actions/setup-gradle@v4.1.0
85-
- name: Checkstyle
86-
run: ./gradlew --continue checkstyleMainChanged
87-
- run: |
88-
npx violations-command-line -sarif sarif-report.json \
89-
-v "CHECKSTYLE" "." ".*/build/reports/checkstyle/main_diff.xml$" "Checkstyle"
90-
91-
#-diff-from $(git merge-base HEAD origin/main)
92-
# - run: python3 ./.github/printcs.py */build/reports/checkstyle/main_diff.xml
93-
94-
# $(git merge-base HEAD origin/main)
95-
96-
- uses: github/codeql-action/upload-sarif@v3
97-
if: success() || failure()
98-
with:
99-
sarif_file: sarif-report.json
100-
101-
pmd:
102-
runs-on: ubuntu-latest
103-
steps:
104-
- uses: actions/checkout@v4
105-
- uses: actions/setup-java@v4
106-
with:
107-
distribution: 'corretto'
108-
java-version: '21'
109-
cache: 'gradle'
110-
- name: Setup Gradle
111-
uses: gradle/actions/setup-gradle@v4.1.0
112-
- name: PMD checks
113-
run: ./gradlew --continue pmdMainChanged
114-
115-
# - run: python3 ./.github/printAnnotations.py */build/reports/pmd/main.xml
116-
117-
- run: |
118-
npx violations-command-line -sarif pmd-report.json \
119-
-v "PMD" "." ".*/build/reports/pmd/main_diff.xml$" "PMD"
120-
121-
# -diff-from $(git merge-base HEAD origin/main)
122-
- name: Upload SARIF file
123-
uses: github/codeql-action/upload-sarif@v3
124-
with:
125-
sarif_file: pmd-report.json
36+
- name: Build with Gradle
37+
run: ./gradlew --parallel --continue spotlessCheck

.github/workflows/codeql.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

.github/workflows/sonarqube.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
## Copied from SonarCloud
2+
3+
name: SonarCloud
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
types: [opened, synchronize, reopened]
10+
11+
jobs:
12+
build:
13+
name: Build and analyze
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
19+
- name: Set up JDK 21
20+
uses: actions/setup-java@v3
21+
with:
22+
java-version: 21
23+
distribution: 'zulu'
24+
- name: Cache SonarCloud packages
25+
uses: actions/cache@v3
26+
with:
27+
path: ~/.sonar/cache
28+
key: ${{ runner.os }}-sonar
29+
restore-keys: ${{ runner.os }}-sonar
30+
- name: Cache Gradle packages
31+
uses: actions/cache@v3
32+
with:
33+
path: ~/.gradle/caches
34+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
35+
restore-keys: ${{ runner.os }}-gradle
36+
37+
- name: Generate and submit dependency graph
38+
uses: gradle/actions/dependency-submission@v3
39+
with:
40+
build-scan-publish: true
41+
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
42+
build-scan-terms-of-use-agree: "yes"
43+
44+
- name: Build and analyze
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
47+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
48+
GRADLE_OPTS: "-Xmx6g -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8"
49+
run: ./gradlew --parallel --continue -DjacocoEnabled=true -x :key.core.symbolic_execution:test -x :key.core.proof_references:test classes testClasses :key.util:test jacocoTestReport sonar

build.gradle

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,19 @@ plugins {
2525

2626
// EISOP Checker Framework
2727
id "org.checkerframework" version "0.6.45"
28+
29+
id("org.sonarqube") version "5.0.0.4638"
30+
}
31+
32+
sonar {
33+
properties {
34+
property "sonar.projectKey", "KeYProject_key"
35+
property "sonar.organization", "keyproject"
36+
property "sonar.host.url", "https://sonarcloud.io"
37+
}
2838
}
2939

40+
3041
// Configure this project for use inside IntelliJ:
3142
idea {
3243
module {

gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8

recoder/src/main/java/recoder/abstraction/IntersectionType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import recoder.service.ProgramModelInfo;
1212

1313
/**
14-
* Represents an intersection type, which was introduced in java 5. See JLS, 3rd edition, 4.9 for
14+
* Represents an intersection type, which was introduced in java 5. See JLS, 3rd edition, §4.9 for
1515
* details.
1616
*
1717
* @author Tobias Gutzmann

recoder/src/main/java/recoder/kit/transformation/java5to4/EnhancedFor2For.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import recoder.list.generic.ASTList;
2626

2727
/**
28-
* converts an enhanced for loop to an "old style" for loop. This follows JLS 3rd edition, 14.14.2.
28+
* converts an enhanced for loop to an "old style" for loop. This follows JLS 3rd edition, §14.14.2.
2929
* <p>
3030
* Currently, if given enhanced for iterates over an array, this will replace the enhanced for with
3131
* a statement block and not inline it into a possibly given statement block, yielding possibly not

0 commit comments

Comments
 (0)