diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 13e35aa1e9..bf0a5710c8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,10 +1,11 @@ name: Build on: push: - branches: - - master pull_request: - types: [opened, synchronize, reopened] + branches: + - main + - 'master' + - 'releases/**' jobs: build: name: Build @@ -31,6 +32,6 @@ jobs: restore-keys: ${{ runner.os }}-m2 - name: Build and analyze env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar + SONAR_HOST_URL: ${{ secrets.SONAR_SQ_URL }} + run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -X diff --git a/README.md b/README.md index 40efacc879..c291afb282 100644 --- a/README.md +++ b/README.md @@ -13,3 +13,5 @@ The `jenkins` directory contains an example of the `Jenkinsfile` (i.e. Pipeline) you'll be creating yourself during the tutorial and the `scripts` subdirectory contains a shell script with commands that are executed when Jenkins processes the "Deliver" stage of your Pipeline. + +test update diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml index 30703612c7..07e48bdc40 100644 --- a/azure-pipelines-1.yml +++ b/azure-pipelines-1.yml @@ -5,6 +5,10 @@ trigger: - master +- new* +pr: +- master +- releases/* pool: vmImage: ubuntu-latest diff --git a/my-app.iml b/my-app.iml new file mode 100644 index 0000000000..e802c7b850 --- /dev/null +++ b/my-app.iml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index c6369d0b2a..0e88105cff 100644 --- a/pom.xml +++ b/pom.xml @@ -43,7 +43,5 @@ 1.8 1.8 sylvain-combe-sonarsource_simple-java-maven-app - sylvain-combe-sonarsource - https://sonarcloud.io diff --git a/src/main/java/com/mycompany/app/App.java b/src/main/java/com/mycompany/app/App.java index b08275ffdd..05d9cc1a33 100644 --- a/src/main/java/com/mycompany/app/App.java +++ b/src/main/java/com/mycompany/app/App.java @@ -7,18 +7,43 @@ public class App { private final String message = "Hello World!"; + public String msg1; + public String msg2; - public App() {} + + public App() { + msg1 = "one"; + msg2="two"; + } public static void main(String[] args) { - System.out.println(new App().getMessage()); + App myApp = new App(); + try { + System.out.println(myApp.getMessage()); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + private final String getMessage(boolean isSync) throws InterruptedException { + synchronized (this.msg1) { + // threadB can't enter this block to request this.mon2 lock & release threadA + synchronized (this.msg2) { + this.msg2.wait(); // Noncompliant; threadA is stuck here holding lock on this.mon1 + } + } + return message; } - private final String getMessage() { + private final String getMessage() throws InterruptedException { return message; } - private class S2259FalsePositive { + private final String doNothing() throws InterruptedException { + return null; + } + + private static class S2259FalsePositive { private enum Valid { OK, NOT_OK; }