From 9d8a69d24e03a03727de262e8a1f6db857b20e24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Lars=C3=A9n?= Date: Thu, 6 May 2021 14:37:47 +0200 Subject: [PATCH 1/7] Add job for sorald-buildbreaker --- .github/workflows/tests.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 630bcdf4d7d..b927ad753f3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -132,3 +132,17 @@ jobs: run: mv chore/logback.xml src/test/resources/ - name: Run extra checks run: ./chore/ci-extra.sh + + sorald-buildbreaker: + runs-on: ubuntu-latest + name: Run Sorald Buildbreaker + steps: + - name: Checkout + uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 + with: + fetch-depth: 0 + - name: Run Sorald Buildbreaker + uses: SpoonLabs/sorald-buildbreaker@f3ce916e2a3f83cfbee20bf6fa743c565c2e3696 # dev version + with: + source: 'src/main/java' + ratchet-from: 'origin/master' From ccc440a17d7cf735e4d66d42ed48a9a56ea37065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Lars=C3=A9n?= Date: Fri, 7 May 2021 09:15:57 +0200 Subject: [PATCH 2/7] Use fixed version of sorald-buildbreaker --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b927ad753f3..7b1aac8e544 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -142,7 +142,7 @@ jobs: with: fetch-depth: 0 - name: Run Sorald Buildbreaker - uses: SpoonLabs/sorald-buildbreaker@f3ce916e2a3f83cfbee20bf6fa743c565c2e3696 # dev version + uses: SpoonLabs/sorald-buildbreaker@70d81bc6aa8edfe64e2945ce64d485254e17aeec # dev version with: source: 'src/main/java' ratchet-from: 'origin/master' From 3ad89a4d164ff74f1ed10d6506f0c12dc5a18b3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Lars=C3=A9n?= Date: Fri, 7 May 2021 09:45:48 +0200 Subject: [PATCH 3/7] Introduce violation of rule 1854 to verify ratcheting works --- src/main/java/spoon/FluentLauncher.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/spoon/FluentLauncher.java b/src/main/java/spoon/FluentLauncher.java index f6b05faa2cb..1d8c1786cb7 100644 --- a/src/main/java/spoon/FluentLauncher.java +++ b/src/main/java/spoon/FluentLauncher.java @@ -33,6 +33,7 @@ public class FluentLauncher { * */ public FluentLauncher() { + int a = 2; this.launcher = new Launcher(); } From fe19b6d620c12879daf2728492941c2611823703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Lars=C3=A9n?= Date: Fri, 7 May 2021 09:49:14 +0200 Subject: [PATCH 4/7] Move violation to method Curiously, dead stores are not detected in constructors. Bug in Sonar? --- src/main/java/spoon/FluentLauncher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/spoon/FluentLauncher.java b/src/main/java/spoon/FluentLauncher.java index 1d8c1786cb7..06080560e0c 100644 --- a/src/main/java/spoon/FluentLauncher.java +++ b/src/main/java/spoon/FluentLauncher.java @@ -33,7 +33,6 @@ public class FluentLauncher { * */ public FluentLauncher() { - int a = 2; this.launcher = new Launcher(); } @@ -61,6 +60,7 @@ public FluentLauncher inputResource(String path) { * Adds an input resource to be processed by Spoon (either a file or a folder). */ public FluentLauncher inputResource(Iterable paths) { + int a = 2; for (String path : paths) { launcher.addInputResource(path); } From 02dc0c66f2d6afc9c86f3eaed2ad830048d72391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Lars=C3=A9n?= Date: Mon, 10 May 2021 08:57:57 +0200 Subject: [PATCH 5/7] Use latest version of buildbreaker --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7b1aac8e544..35cf3700a6b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -142,7 +142,7 @@ jobs: with: fetch-depth: 0 - name: Run Sorald Buildbreaker - uses: SpoonLabs/sorald-buildbreaker@70d81bc6aa8edfe64e2945ce64d485254e17aeec # dev version + uses: SpoonLabs/sorald-buildbreaker@35c1a784848bd3182cfcc8a584cff90560fa6371 # dev version with: source: 'src/main/java' ratchet-from: 'origin/master' From e5609f4ab5c5226f54c7a140677dd3da94c3b756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Lars=C3=A9n?= Date: Mon, 10 May 2021 08:58:28 +0200 Subject: [PATCH 6/7] Fix indentation of rule violation --- src/main/java/spoon/FluentLauncher.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/spoon/FluentLauncher.java b/src/main/java/spoon/FluentLauncher.java index 06080560e0c..cdf1be41b80 100644 --- a/src/main/java/spoon/FluentLauncher.java +++ b/src/main/java/spoon/FluentLauncher.java @@ -60,7 +60,7 @@ public FluentLauncher inputResource(String path) { * Adds an input resource to be processed by Spoon (either a file or a folder). */ public FluentLauncher inputResource(Iterable paths) { - int a = 2; + int a = 2; for (String path : paths) { launcher.addInputResource(path); } From 27dc1f1720ff44ffb5f247d7cae38baaaba955de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Lars=C3=A9n?= Date: Mon, 10 May 2021 09:08:48 +0200 Subject: [PATCH 7/7] Remove artificial rule violation --- src/main/java/spoon/FluentLauncher.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/spoon/FluentLauncher.java b/src/main/java/spoon/FluentLauncher.java index cdf1be41b80..f6b05faa2cb 100644 --- a/src/main/java/spoon/FluentLauncher.java +++ b/src/main/java/spoon/FluentLauncher.java @@ -60,7 +60,6 @@ public FluentLauncher inputResource(String path) { * Adds an input resource to be processed by Spoon (either a file or a folder). */ public FluentLauncher inputResource(Iterable paths) { - int a = 2; for (String path : paths) { launcher.addInputResource(path); }