From ab6ab41b3ab5938ad320f772052e17ea53f978ad Mon Sep 17 00:00:00 2001 From: I-Al-Istannen Date: Fri, 22 Oct 2021 10:58:06 +0200 Subject: [PATCH] Enable stricter qodana rules (#11) --- .github/workflows/analysis.yml | 8 ++++++++ build.gradle.kts | 4 +--- qodana.yml | 5 +++++ .../java/com/github/firmwehr/gentle/GentleCompiler.java | 1 + .../com/github/firmwehr/gentle/BuildGentle.java | 1 + 5 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 qodana.yml diff --git a/.github/workflows/analysis.yml b/.github/workflows/analysis.yml index 7da7ab85..4bb8ea44 100644 --- a/.github/workflows/analysis.yml +++ b/.github/workflows/analysis.yml @@ -10,6 +10,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: 17 - uses: actions/cache@v2 with: path: ~/work/_temp/_github_home/qodana-cache @@ -17,10 +21,14 @@ jobs: restore-keys: | ${{ runner.os }}-qodana-${{ github.ref }} ${{ runner.os }}-qodana- + - run: ./gradlew build - uses: JetBrains/qodana-action@v3.1.1 with: linter: qodana-jvm-community fail-threshold: 1 + - uses: actions/upload-artifact@v2 + with: + path: ${{ github.workspace }}/qodana - name: Print problems run: cat qodana/report/results/result-allProblems.json | jq - name: Fail on problems diff --git a/build.gradle.kts b/build.gradle.kts index 682df4cc..33087f70 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,7 +18,7 @@ repositories { application { mainClass.set("com.github.firmwehr.gentle.GentleCompiler") - applicationDefaultJvmArgs = listOf("--enable-preview"); + applicationDefaultJvmArgs = listOf("--enable-preview") } buildDir = File("_build") @@ -55,8 +55,6 @@ val integrationTest = task("integrationTest") { shouldRunAfter("test") } -tasks.check { dependsOn(integrationTest) } - dependencies { // logging diff --git a/qodana.yml b/qodana.yml new file mode 100644 index 00000000..cd9a9573 --- /dev/null +++ b/qodana.yml @@ -0,0 +1,5 @@ +version: 1.0 +profile: + name: qodana.recommended +exclude: + - name: JavaAnnotator # Counter - Hours wasted: 4 diff --git a/src/main/java/com/github/firmwehr/gentle/GentleCompiler.java b/src/main/java/com/github/firmwehr/gentle/GentleCompiler.java index 8fe4c619..e2816532 100644 --- a/src/main/java/com/github/firmwehr/gentle/GentleCompiler.java +++ b/src/main/java/com/github/firmwehr/gentle/GentleCompiler.java @@ -32,6 +32,7 @@ public static void main(String[] args) { private static void echoCommand(Path path) { try (Stream stream = Files.lines(path)) { + //noinspection UseOfSystemOutOrSystemErr stream.forEach(System.out::println); } catch (IOException e) { LOGGER.error("Could not echo file '{}': {}", path, e.getMessage()); diff --git a/src/test/integrationTest/com/github/firmwehr/gentle/BuildGentle.java b/src/test/integrationTest/com/github/firmwehr/gentle/BuildGentle.java index 8d92de0f..1364b9d2 100644 --- a/src/test/integrationTest/com/github/firmwehr/gentle/BuildGentle.java +++ b/src/test/integrationTest/com/github/firmwehr/gentle/BuildGentle.java @@ -15,6 +15,7 @@ public class BuildGentle implements BeforeAllCallback, ExtensionContext.Store.Cl @Override public void beforeAll(ExtensionContext context) throws IOException, InterruptedException { if (!started) { + //noinspection AssignmentToStaticFieldFromInstanceMethod started = true; context.getRoot().getStore(GLOBAL).put(getClass().getSimpleName(), this); int exitCode = new ProcessBuilder("sh", "-c", "./build").inheritIO().start().waitFor();