Commit b9446537 authored by Alexander Weigl's avatar Alexander Weigl Committed by Mattias Ulbrich
Browse files

More Awareness for SonarQube Results

parent a3cd916f
......@@ -74,6 +74,7 @@ sonarqube:
script:
- cd key
- gradle --build-cache --continue -Dsonar.qualitygate.wait=true -DjacocoEnabled=true testFast sonarqube
- ./scripts/tools/sonarqube_hint.py
only:
- merge_requests
- master
......@@ -97,10 +98,9 @@ checkstyle:
- key/scripts/tools/checkstyle/translateAudit.py report.txt > report.json
artifacts:
name: "checkstyle-report-$CI_JOB_ID"
paths:
paths:
- report.txt
when: always
reports:
codequality: report.json
expire_in: 1 year
# KeY -- Deductive Java Program Verifier
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=key-main&metric=bugs)](https://sonarcloud.io/dashboard?id=key-main) [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=key-main&metric=code_smells)](https://sonarcloud.io/dashboard?id=key-main) [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=key-main&metric=coverage)](https://sonarcloud.io/dashboard?id=key-main) [![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=key-main&metric=duplicated_lines_density)](https://sonarcloud.io/dashboard?id=key-main) [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=key-main&metric=ncloc)](https://sonarcloud.io/dashboard?id=key-main) [![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=key-main&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=key-main) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=key-main&metric=alert_status)](https://sonarcloud.io/dashboard?id=key-main) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=key-main&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=key-main) [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=key-main&metric=security_rating)](https://sonarcloud.io/dashboard?id=key-main) [![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=key-main&metric=sqale_index)](https://sonarcloud.io/dashboard?id=key-main) [![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=key-main&metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=key-main)
This folder contains the interactive theorem prover KeY for the verification of Java programs.
You can find more information on KeY on our [website](https://key-project.org) or in use the
You can find more information on KeY on our [website](https://key-project.org) or in use the
documentation in the companion repository [key-docs](https://git.key-project.org/key/key-docs).
The current version is 2.8.0, licensed under GPL v2.
The current version is 2.8.0, licensed under GPL v2.
## Requirements:
## Requirements:
* Hardware: >=2 GB RAM
* Operating System: Linux/Unix, MacOSX, Windows
* Java SE 8 or newer
* Optionally, KeY can make use of the following binaries:
* SMT Solvers:
* [Z3](https://github.com/Z3Prover/z3)
* [CVC4](http://cvc4.cs.stanford.edu/web/)
* SMT Solvers:
* [Z3](https://github.com/Z3Prover/z3)
* [CVC4](http://cvc4.cs.stanford.edu/web/)
## Content of the KeY folder
This folder provides a [gradle](https://gradle.org)-managed project following
This folder provides a [gradle](https://gradle.org)-managed project following
[Maven's standard folder layout](https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html).
There are several modules in this folder. In general every `key.*/` contains a core component of KeY. Additional
and optional components are in `keyext.*/` folders. The file `build.gradle` is the root build script describing
There are several modules in this folder. In general every `key.*/` contains a core component of KeY. Additional
and optional components are in `keyext.*/` folders. The file `build.gradle` is the root build script describing
the dependencies and build tasks for all sub-modules.
`key.util`, `key.core` and `key.ui` are the base for the product "KeY Prover". Special care are needed
if you plan to make changes here.
`key.util`, `key.core` and `key.ui` are the base for the product "KeY Prover". Special care are needed
if you plan to make changes here.
## Compile and Run KeY
Assuming you are in directory `key/`, the directory of this README file,
Assuming you are in directory `key/`, the directory of this README file,
then you can create a runnable and deployable version with one of these commands:
1. With `./gradlew :key.ui:run` you can run the user interface of KeY directly from the repository.
2. Use `./gradlew classes` to compile KeY, includes running JavaCC and Antlr, additional use `./gradlew testClasses` if
you also want to compile the JUnit test classes.
2. Use `./gradlew classes` to compile KeY, includes running JavaCC and Antlr, additional use `./gradlew testClasses` if
you also want to compile the JUnit test classes.
3. Test your installation with `./gradlew test` or `./gradlew testFast`.
3. Test your installation with `./gradlew test` or `./gradlew testFast`.
The later command disables the slow running test cases.
You can select a specific test case with `--tests` argument. Wildcards are allowed.
You can select a specific test case with `--tests` argument. Wildcards are allowed.
```
./gradlew :key.<subproject>:test --tests "<class>.<method>"
```
You can debug KeY by adding the `--debug-jvm` option, then attaching a debugger at `localhost:5005`.
4. You can create a single jar-version, aka *fat jar*, of KeY with
4. You can create a single jar-version, aka *fat jar*, of KeY with
```
./gradlew :key.ui:shadowJar
./gradlew :key.ui:shadowJar
```
The file is generated in `key.ui/build/libs/key-*-exe.jar`.
5. A distributiion is build with
5. A distributiion is build with
```
./gradlew :key.ui:installDist :key.ui:distZip
```
The distribution can tested by calling `key.ui/install/key/bin/key.ui`
The distribution can tested by calling `key.ui/install/key/bin/key.ui`
and is zipped in `key.ui/build/distributions`.
The distribution gives you potential of using single jar files.
# Developing KeY
* Quality is automatically assessed using [SonarQube](https://sonarqube.org) on each merge requests.
The results of the assessments can be found on
[SonarCloud.io](https://sonarcloud.io/dashboard?id=key-main)
([Branches](https://sonarcloud.io/project/branches?id=key-main))
The rules and quality gate are maintained by Alexander Weigl
<weigl@kit.edu> currently.
* More guideline and documentation for the KeY development can be found under
[key-docs](https://key-project.org/docs/).
# Issues and Bug Reports
If you encounter problems, please send a message to
......@@ -72,17 +89,18 @@ If you encounter problems, please send a message to
<support@key-project.org>
# License Remark
```
This is the KeY project - Integrated Deductive Software Design
Copyright (C) 2001-2011 Universität Karlsruhe, Germany
Universität Koblenz-Landau, Germany
and Chalmers University of Technology, Sweden
Copyright (C) 2011-2020 Karlsruhe Institute of Technology, Germany
Technical University Darmstadt, Germany
Chalmers University of Technology, Sweden
Universität Koblenz-Landau, Germany
and Chalmers University of Technology, Sweden
Copyright (C) 2011-2021 Karlsruhe Institute of Technology, Germany
Technical University Darmstadt, Germany
Chalmers University of Technology, Sweden
The KeY system is protected by the GNU General Public License.
The KeY system is protected by the GNU General Public License.
See LICENSE.TXT for details.
```
#!/usr/bin/python3
import sys
import os
import re
import urllib
import json
import pprint
import requests
HOST = "https://git.key-project.org/api/v4"
URL = os.environ["CI_PROJECT_URL"]
PROJECT_ID = os.environ["CI_PROJECT_ID"]
MR_IID = os.environ["CI_MERGE_REQUEST_IID"]
TOKEN = os.environ["CI_COMMENT_TOKEN"]
note = "SonarQube analysis was triggered. The [:beetle: results will appear on SonarCloud](https://sonarcloud.io/dashboard?id=key-main&pullRequest=%s) soon." % MR_IID
def isSonarQubeComment(obj):
return obj['body'].startswith("SonarQube analysis was triggered.")
checkUrl = "%s/projects/%s/merge_requests/%s/notes" % (HOST, PROJECT_ID, MR_IID)
print("Check For Hint at: ", checkUrl)
resp = requests.get(checkUrl, headers={"Private-Token": TOKEN})
if resp.status_code != 200:
print(resp.content)
sys.exit(0)
notesOnMr = resp.json()
print("Founds %s comments" % len(notesOnMr))
print("Check for comment on SonarQube.")
if not any(map(isSonarQubeComment, notesOnMr)):
reportUrl = "%s/projects/%s/merge_requests/%s/notes"% (HOST, PROJECT_ID, MR_IID)
print("Send report to", reportUrl)
resp = requests.post(reportUrl, data={ b'private_token': TOKEN, b'body': note })
if resp.status_code >=400:
sys.exit(1)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment