From ebfd1f4b9493480c0fd2a169a60d138f948b8a1e Mon Sep 17 00:00:00 2001 From: Peter Trifanov Date: Tue, 17 Dec 2024 10:43:05 +0100 Subject: [PATCH 1/2] Change the way how additional spotless configuration is applied --- .github/workflows/PullRequestCreated.yml | 1 + .gitmodules | 1 + README.md | 8 +------- build-logic | 2 +- build.gradle | 4 ++-- its/plugin/build.gradle.kts | 16 ++++++++++++++++ its/ruling/build.gradle.kts | 16 ++++++++++++++++ settings.gradle.kts | 16 ++++++++++++++++ sonar-go-plugin/build.gradle.kts | 16 ++++++++++++++++ sonar-go-to-slang/build.gradle.kts | 16 ++++++++++++++++ 10 files changed, 86 insertions(+), 10 deletions(-) diff --git a/.github/workflows/PullRequestCreated.yml b/.github/workflows/PullRequestCreated.yml index a849154c..d2646c24 100644 --- a/.github/workflows/PullRequestCreated.yml +++ b/.github/workflows/PullRequestCreated.yml @@ -13,6 +13,7 @@ jobs: # For external PR, ticket should be created manually if: | github.event.pull_request.head.repo.full_name == github.repository + && github.event.sender.type != 'Bot' steps: - id: secrets uses: SonarSource/vault-action-wrapper@v3 diff --git a/.gitmodules b/.gitmodules index 73aed1c5..44de577c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,4 @@ [submodule "build-logic"] path = build-logic url = https://github.com/SonarSource/cloud-native-gradle-modules + branch = petertrr/fix-spotless-config diff --git a/README.md b/README.md index d062dee1..584517bd 100644 --- a/README.md +++ b/README.md @@ -49,13 +49,7 @@ You can also build and run only Ruling Tests: ## License headers -License headers are automatically updated by the spotless plugin but only for Java files. -Furthermore, there are files such as `package-info.java` and `module-info.java` that spotless ignores. -Also the Go source files are not handled. For those files use a manual script like below to update the license: - -```shell -`find . -type f -name "*.go" -exec sed -i '' 's/2018-2023/2018-2024/' "{}" \;` -``` +License headers are automatically updated by the spotless plugin. ## License diff --git a/build-logic b/build-logic index f06117a4..0e9d0782 160000 --- a/build-logic +++ b/build-logic @@ -1 +1 @@ -Subproject commit f06117a4b95ed46c71f9219b0a2fe6f4fef54c8a +Subproject commit 0e9d0782a0d10732828fdb7ed59de4c455008111 diff --git a/build.gradle b/build.gradle index 34e142db..d81fca90 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,7 @@ import java.util.jar.JarInputStream plugins { + id("org.sonarsource.cloud-native.code-style-conventions") id 'com.jfrog.artifactory' version '4.28.2' id 'org.sonarqube' version '6.0.1.5171' id 'de.thetaphi.forbiddenapis' version '3.0' apply false @@ -21,7 +22,7 @@ allprojects { } repositories { - mavenLocal() + mavenCentral() def artifactoryBearerToken = System.getenv("ARTIFACTORY_PRIVATE_PASSWORD") ?: project.findProperty("artifactoryPassword") if (artifactoryBearerToken) { maven { @@ -35,7 +36,6 @@ allprojects { } } } - mavenCentral() } } diff --git a/its/plugin/build.gradle.kts b/its/plugin/build.gradle.kts index 09cb8870..e07b810d 100644 --- a/its/plugin/build.gradle.kts +++ b/its/plugin/build.gradle.kts @@ -1,3 +1,19 @@ +/* + * SonarSource Go + * Copyright (C) 2018-2024 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Sonar Source-Available License for more details. + * + * You should have received a copy of the Sonar Source-Available License + * along with this program; if not, see https://sonarsource.com/license/ssal/ + */ plugins { id("org.sonarsource.cloud-native.java-conventions") id("org.sonarsource.cloud-native.code-style-conventions") diff --git a/its/ruling/build.gradle.kts b/its/ruling/build.gradle.kts index 956e807b..44d39569 100644 --- a/its/ruling/build.gradle.kts +++ b/its/ruling/build.gradle.kts @@ -1,3 +1,19 @@ +/* + * SonarSource Go + * Copyright (C) 2018-2024 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Sonar Source-Available License for more details. + * + * You should have received a copy of the Sonar Source-Available License + * along with this program; if not, see https://sonarsource.com/license/ssal/ + */ plugins { id("org.sonarsource.cloud-native.java-conventions") id("org.sonarsource.cloud-native.code-style-conventions") diff --git a/settings.gradle.kts b/settings.gradle.kts index 852c7e5d..aa573ec7 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,3 +1,19 @@ +/* + * SonarSource Go + * Copyright (C) 2018-2024 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Sonar Source-Available License for more details. + * + * You should have received a copy of the Sonar Source-Available License + * along with this program; if not, see https://sonarsource.com/license/ssal/ + */ pluginManagement { includeBuild("build-logic") } diff --git a/sonar-go-plugin/build.gradle.kts b/sonar-go-plugin/build.gradle.kts index 0cabf12a..1b00ad0a 100644 --- a/sonar-go-plugin/build.gradle.kts +++ b/sonar-go-plugin/build.gradle.kts @@ -1,3 +1,19 @@ +/* + * SonarSource Go + * Copyright (C) 2018-2024 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Sonar Source-Available License for more details. + * + * You should have received a copy of the Sonar Source-Available License + * along with this program; if not, see https://sonarsource.com/license/ssal/ + */ import java.text.SimpleDateFormat import java.util.Date import java.util.HashSet diff --git a/sonar-go-to-slang/build.gradle.kts b/sonar-go-to-slang/build.gradle.kts index f02c4a45..503354bf 100644 --- a/sonar-go-to-slang/build.gradle.kts +++ b/sonar-go-to-slang/build.gradle.kts @@ -1,3 +1,19 @@ +/* + * SonarSource Go + * Copyright (C) 2018-2024 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Sonar Source-Available License for more details. + * + * You should have received a copy of the Sonar Source-Available License + * along with this program; if not, see https://sonarsource.com/license/ssal/ + */ plugins { id("org.sonarsource.cloud-native.code-style-conventions") } From ac0516eaee7882ee45602867043261eecdf8c947 Mon Sep 17 00:00:00 2001 From: Peter Trifanov Date: Tue, 17 Dec 2024 11:05:46 +0100 Subject: [PATCH 2/2] Update common scripts --- .gitmodules | 1 - build-logic | 2 +- build.gradle | 16 ++++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.gitmodules b/.gitmodules index 44de577c..73aed1c5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,4 +13,3 @@ [submodule "build-logic"] path = build-logic url = https://github.com/SonarSource/cloud-native-gradle-modules - branch = petertrr/fix-spotless-config diff --git a/build-logic b/build-logic index 0e9d0782..3a87c251 160000 --- a/build-logic +++ b/build-logic @@ -1 +1 @@ -Subproject commit 0e9d0782a0d10732828fdb7ed59de4c455008111 +Subproject commit 3a87c2511f6809b708685b09c5170a2fc25a5349 diff --git a/build.gradle b/build.gradle index d81fca90..f29ea2e8 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,19 @@ +/* + * SonarSource Go + * Copyright (C) 2018-2024 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the Sonar Source-Available License Version 1, as published by SonarSource SA. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the Sonar Source-Available License for more details. + * + * You should have received a copy of the Sonar Source-Available License + * along with this program; if not, see https://sonarsource.com/license/ssal/ + */ import java.util.jar.JarInputStream plugins {