From f00a0d6dcd62fb4ad0b10c62a2499534874dcb96 Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 15 Jul 2023 00:58:25 +0000 Subject: [PATCH 1/3] Update scalafmt-core to 3.7.9 --- .scalafmt.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index e26dcdb..8b22a29 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,3 +1,3 @@ runner.dialect = scala212source3 -version = "3.7.5" +version = "3.7.9" maxColumn = 80 From 13ec28ec9e96c5649717916965db38aa925c315f Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 15 Jul 2023 00:58:34 +0000 Subject: [PATCH 2/3] Reformat with scalafmt 3.7.9 Executed command: scalafmt --non-interactive --- .../detectLicense/ApacheLicense.scala | 6 ++- .../detectLicense/LicenseFile.scala | 5 +- .../detectLicense/MitLicense.scala | 3 +- .../sbtBestPractice/git/Git.scala | 11 +++-- .../githubActions/GithubActionsDocTitle.scala | 3 +- .../GithubActionsEnvironmentVariables.scala | 4 +- .../githubActions/GithubActionsScalaJs.scala | 4 +- .../GithubActionsScalaVersions.scala | 48 ++++++++++++------- .../GithubActionsScaladocSourceUrl.scala | 19 ++++++-- .../mima/MimaPreviousVersion.scala | 7 ++- .../publishUnidoc/PackageUnidoc.scala | 5 +- .../publishUnidoc/UnidocProject.scala | 4 +- .../scalacOptions/ClasspathCache.scala | 5 +- .../scalacOptions/Optimization.scala | 3 +- .../SkipDuplicateJavaPublish.scala | 4 +- .../DetectScalaVersionsFromTravisYml.scala | 16 +++++-- .../travis/ScaladocSourceUrl.scala | 13 +++-- .../sbtBestPractice/travis/Travis.scala | 3 +- .../sbtBestPractice/travis/TravisGithub.scala | 30 +++++++++--- .../versionScheme/DefaultVersionScheme.scala | 4 +- 20 files changed, 142 insertions(+), 55 deletions(-) diff --git a/detect-license/src/main/scala/com/thoughtworks/sbtBestPractice/detectLicense/ApacheLicense.scala b/detect-license/src/main/scala/com/thoughtworks/sbtBestPractice/detectLicense/ApacheLicense.scala index fc63fd1..474bec2 100644 --- a/detect-license/src/main/scala/com/thoughtworks/sbtBestPractice/detectLicense/ApacheLicense.scala +++ b/detect-license/src/main/scala/com/thoughtworks/sbtBestPractice/detectLicense/ApacheLicense.scala @@ -7,7 +7,8 @@ import sbt._ */ object ApacheLicense extends AutoPlugin { - private val ApacheLicenseRegex = """^\s*Apache License\s*Version 2\.0, January 2004""".r + private val ApacheLicenseRegex = + """^\s*Apache License\s*Version 2\.0, January 2004""".r override def trigger = allRequirements @@ -16,7 +17,8 @@ object ApacheLicense extends AutoPlugin { override def projectSettings = Seq( licenses ++= { LicenseFile.licenseFileContent.value match { - case Some(content) if ApacheLicenseRegex.findFirstMatchIn(content).isDefined => + case Some(content) + if ApacheLicenseRegex.findFirstMatchIn(content).isDefined => Seq("Apache" -> url("http://www.apache.org/licenses/")) case _ => Seq.empty diff --git a/detect-license/src/main/scala/com/thoughtworks/sbtBestPractice/detectLicense/LicenseFile.scala b/detect-license/src/main/scala/com/thoughtworks/sbtBestPractice/detectLicense/LicenseFile.scala index 4757311..df734df 100644 --- a/detect-license/src/main/scala/com/thoughtworks/sbtBestPractice/detectLicense/LicenseFile.scala +++ b/detect-license/src/main/scala/com/thoughtworks/sbtBestPractice/detectLicense/LicenseFile.scala @@ -5,7 +5,10 @@ import sbt._ object LicenseFile extends AutoPlugin { - val licenseFileContent = SettingKey[Option[String]]("license-file-content", "The content of LICENSE file") + val licenseFileContent = SettingKey[Option[String]]( + "license-file-content", + "The content of LICENSE file" + ) override def trigger = allRequirements diff --git a/detect-license/src/main/scala/com/thoughtworks/sbtBestPractice/detectLicense/MitLicense.scala b/detect-license/src/main/scala/com/thoughtworks/sbtBestPractice/detectLicense/MitLicense.scala index 9e0a4ca..469a7c0 100644 --- a/detect-license/src/main/scala/com/thoughtworks/sbtBestPractice/detectLicense/MitLicense.scala +++ b/detect-license/src/main/scala/com/thoughtworks/sbtBestPractice/detectLicense/MitLicense.scala @@ -17,7 +17,8 @@ object MitLicense extends AutoPlugin { override def projectSettings = Seq( licenses ++= { LicenseFile.licenseFileContent.value match { - case Some(content) if MitLicenseRegex.findFirstMatchIn(content).isDefined => + case Some(content) + if MitLicenseRegex.findFirstMatchIn(content).isDefined => Seq("MIT" -> url("http://opensource.org/licenses/MIT")) case _ => Seq.empty diff --git a/git/src/main/scala/com/thoughtworks/sbtBestPractice/git/Git.scala b/git/src/main/scala/com/thoughtworks/sbtBestPractice/git/Git.scala index 1cf8d10..863322b 100644 --- a/git/src/main/scala/com/thoughtworks/sbtBestPractice/git/Git.scala +++ b/git/src/main/scala/com/thoughtworks/sbtBestPractice/git/Git.scala @@ -15,11 +15,16 @@ object Git extends AutoPlugin { override def trigger = allRequirements - val gitDir = SettingKey[Option[File]]("git-dir", ".git directory for current project") + val gitDir = + SettingKey[Option[File]]("git-dir", ".git directory for current project") - val gitWorkTree = SettingKey[Option[File]]("git-work-tree", "Root work tree of current project") + val gitWorkTree = SettingKey[Option[File]]( + "git-work-tree", + "Root work tree of current project" + ) - val gitRepositoryBuilder = SettingKey[RepositoryBuilder]("git-repository-builder", "") + val gitRepositoryBuilder = + SettingKey[RepositoryBuilder]("git-repository-builder", "") private def settings = Seq( gitRepositoryBuilder := { diff --git a/github-actions/src/main/scala/com/thoughtworks/sbtBestPractice/githubActions/GithubActionsDocTitle.scala b/github-actions/src/main/scala/com/thoughtworks/sbtBestPractice/githubActions/GithubActionsDocTitle.scala index 32bfebe..f1af756 100644 --- a/github-actions/src/main/scala/com/thoughtworks/sbtBestPractice/githubActions/GithubActionsDocTitle.scala +++ b/github-actions/src/main/scala/com/thoughtworks/sbtBestPractice/githubActions/GithubActionsDocTitle.scala @@ -8,7 +8,8 @@ import Keys._ * 杨博 (Yang Bo) <pop.atry@gmail.com> */ object GithubActionsDocTitle extends AutoPlugin { - override def requires: Plugins = GithubActionsEnvironmentVariables && JvmPlugin + override def requires: Plugins = + GithubActionsEnvironmentVariables && JvmPlugin override def trigger: PluginTrigger = allRequirements diff --git a/github-actions/src/main/scala/com/thoughtworks/sbtBestPractice/githubActions/GithubActionsEnvironmentVariables.scala b/github-actions/src/main/scala/com/thoughtworks/sbtBestPractice/githubActions/GithubActionsEnvironmentVariables.scala index b79c3c2..83b7b06 100644 --- a/github-actions/src/main/scala/com/thoughtworks/sbtBestPractice/githubActions/GithubActionsEnvironmentVariables.scala +++ b/github-actions/src/main/scala/com/thoughtworks/sbtBestPractice/githubActions/GithubActionsEnvironmentVariables.scala @@ -16,7 +16,9 @@ object GithubActionsEnvironmentVariables extends AutoPlugin { val githubRef = settingKey[String]( "The branch or tag ref that triggered the workflow. For example, refs/heads/feature-branch-1. If neither a branch or tag is available for the event type, the variable will not exist." ) - val githubRepository = settingKey[String]("The owner and repository name. For example, octocat/Hello-World.") + val githubRepository = settingKey[String]( + "The owner and repository name. For example, octocat/Hello-World." + ) val githubSha = settingKey[String]( "The commit SHA that triggered the workflow. For example, ffac537e6cbbf934b08745a378932722df287a53." ) diff --git a/github-actions/src/main/scala/com/thoughtworks/sbtBestPractice/githubActions/GithubActionsScalaJs.scala b/github-actions/src/main/scala/com/thoughtworks/sbtBestPractice/githubActions/GithubActionsScalaJs.scala index 0235f1a..fe43353 100644 --- a/github-actions/src/main/scala/com/thoughtworks/sbtBestPractice/githubActions/GithubActionsScalaJs.scala +++ b/github-actions/src/main/scala/com/thoughtworks/sbtBestPractice/githubActions/GithubActionsScalaJs.scala @@ -14,7 +14,9 @@ object GithubActionsScalaJs extends AutoPlugin { } ](key: SettingKey[StandardConfig]): Def.Setting[StandardConfig] = { key := { - key.value.withBatchMode(GithubActionsEnvironmentVariables.githubRepository.?.value.isDefined) + key.value.withBatchMode( + GithubActionsEnvironmentVariables.githubRepository.?.value.isDefined + ) } } diff --git a/github-actions/src/main/scala/com/thoughtworks/sbtBestPractice/githubActions/GithubActionsScalaVersions.scala b/github-actions/src/main/scala/com/thoughtworks/sbtBestPractice/githubActions/GithubActionsScalaVersions.scala index fa6c39d..822680e 100644 --- a/github-actions/src/main/scala/com/thoughtworks/sbtBestPractice/githubActions/GithubActionsScalaVersions.scala +++ b/github-actions/src/main/scala/com/thoughtworks/sbtBestPractice/githubActions/GithubActionsScalaVersions.scala @@ -26,16 +26,19 @@ object GithubActionsScalaVersions extends AutoPlugin { "The Scala versions extracted from the build matrices of Github Actions" ) - private implicit final class YamlPathOps(private val nodes: Seq[Node]) extends AnyVal { - private def keyValue: PartialFunction[NodeTuple, (Node, Node)] = { case tuple => - (tuple.getKeyNode(), tuple.getValueNode()) + private implicit final class YamlPathOps(private val nodes: Seq[Node]) + extends AnyVal { + private def keyValue: PartialFunction[NodeTuple, (Node, Node)] = { + case tuple => + (tuple.getKeyNode(), tuple.getValueNode()) } def childNodes(key: String): Seq[Node] = { nodes.flatMap { case mappingNode: MappingNode => mappingNode.getValue().asScala.collect { - case keyValue.extract(keyNode: ScalarNode, value) if keyNode.getValue() == key => + case keyValue.extract(keyNode: ScalarNode, value) + if keyNode.getValue() == key => value } case _ => @@ -46,8 +49,9 @@ object GithubActionsScalaVersions extends AutoPlugin { def childNodes: Seq[Node] = { nodes.flatMap { case mappingNode: MappingNode => - mappingNode.getValue().asScala.collect { case keyValue.extract(_, value) => - value + mappingNode.getValue().asScala.collect { + case keyValue.extract(_, value) => + value } case sequence: SequenceNode => sequence.getValue().asScala @@ -58,9 +62,13 @@ object GithubActionsScalaVersions extends AutoPlugin { } - private implicit def yamlPathOps(node: Node): YamlPathOps = new YamlPathOps(Seq(node)) + private implicit def yamlPathOps(node: Node): YamlPathOps = new YamlPathOps( + Seq(node) + ) - override def projectSettings = Seq(crossScalaVersions := githubActionsMatrixScalaVersions.value) + override def projectSettings = Seq( + crossScalaVersions := githubActionsMatrixScalaVersions.value + ) override def buildSettings = Seq( githubActionsMatrixScalaVersions ++= { @@ -68,9 +76,13 @@ object GithubActionsScalaVersions extends AutoPlugin { case None => Seq.empty case Some(gitWorkTree) => - FileTreeView.default.list(gitWorkTree.toGlob / ".github/workflows/*.{yml,yaml}").flatMap { - case (workflowYmlPath, _) => - val reader = Files.newBufferedReader(workflowYmlPath, scala.io.Codec.UTF8.charSet) + FileTreeView.default + .list(gitWorkTree.toGlob / ".github/workflows/*.{yml,yaml}") + .flatMap { case (workflowYmlPath, _) => + val reader = Files.newBufferedReader( + workflowYmlPath, + scala.io.Codec.UTF8.charSet + ) try { val matrix = new Yaml() .compose(reader) @@ -85,18 +97,22 @@ object GithubActionsScalaVersions extends AutoPlugin { .childNodes("include") .childNodes .childNodes("scala") - (scalaNodes ++ includeScalaNodes).collect { case scalarNode: ScalarNode => - scalarNode.getValue() + (scalaNodes ++ includeScalaNodes).collect { + case scalarNode: ScalarNode => + scalarNode.getValue() }.distinct } finally { reader.close() } - } + } } }, - scalaVersion := githubActionsMatrixScalaVersions.value.headOption.getOrElse(scalaVersion.value), + scalaVersion := githubActionsMatrixScalaVersions.value.headOption + .getOrElse(scalaVersion.value), crossScalaVersions := githubActionsMatrixScalaVersions.value ) - override def globalSettings = Seq(githubActionsMatrixScalaVersions := Seq.empty) + override def globalSettings = Seq( + githubActionsMatrixScalaVersions := Seq.empty + ) } diff --git a/github-actions/src/main/scala/com/thoughtworks/sbtBestPractice/githubActions/GithubActionsScaladocSourceUrl.scala b/github-actions/src/main/scala/com/thoughtworks/sbtBestPractice/githubActions/GithubActionsScaladocSourceUrl.scala index 288a1f4..5271fdf 100644 --- a/github-actions/src/main/scala/com/thoughtworks/sbtBestPractice/githubActions/GithubActionsScaladocSourceUrl.scala +++ b/github-actions/src/main/scala/com/thoughtworks/sbtBestPractice/githubActions/GithubActionsScaladocSourceUrl.scala @@ -10,7 +10,8 @@ import Ordering.Implicits._ * 杨博 (Yang Bo) <pop.atry@gmail.com> */ object GithubActionsScaladocSourceUrl extends AutoPlugin { - override def requires: Plugins = GithubActionsEnvironmentVariables && GitPlugin + override def requires: Plugins = + GithubActionsEnvironmentVariables && GitPlugin override def trigger: PluginTrigger = allRequirements @@ -22,7 +23,10 @@ object GithubActionsScaladocSourceUrl extends AutoPlugin { case Some(rootDirectory) => originalScalacOptions.indexOf("-sourcepath") match { case -1 => - originalScalacOptions ++ Seq("-sourcepath", rootDirectory.toString) + originalScalacOptions ++ Seq( + "-sourcepath", + rootDirectory.toString + ) case i => originalScalacOptions.updated(i + 1, rootDirectory.toString) } @@ -35,13 +39,17 @@ object GithubActionsScaladocSourceUrl extends AutoPlugin { }, scalacOptions in Compile in doc := { val originalScalacOptions = (scalacOptions in Compile in doc).value - (GitPlugin.gitRepositoryBuilder.?.value, GithubActionsEnvironmentVariables.githubRepository.?.value) match { + ( + GitPlugin.gitRepositoryBuilder.?.value, + GithubActionsEnvironmentVariables.githubRepository.?.value + ) match { case (Some(repositoryBuilder), Some(slug)) => val repository = repositoryBuilder.build() try { val hash = repository.resolve(Constants.HEAD).name if (VersionNumber(scalaVersion.value).numbers < Seq(3L)) { - val sourceUrl = raw"https://github.com/$slug/blob/${hash}€{FILE_PATH}.scala" + val sourceUrl = + raw"https://github.com/$slug/blob/${hash}€{FILE_PATH}.scala" originalScalacOptions.indexOf("-doc-source-url") match { case -1 => originalScalacOptions ++ Seq("-doc-source-url", sourceUrl) @@ -49,7 +57,8 @@ object GithubActionsScaladocSourceUrl extends AutoPlugin { originalScalacOptions.updated(i + 1, sourceUrl) } } else { - val pathPrefix = GitPlugin.gitWorkTree.value.fold("")(_.toString()) + val pathPrefix = + GitPlugin.gitWorkTree.value.fold("")(_.toString()) originalScalacOptions :+ raw"-source-links:$pathPrefix=github://$slug/$hash" } } finally { diff --git a/mima/src/main/scala/com/thoughtworks/sbtBestPractice/mima/MimaPreviousVersion.scala b/mima/src/main/scala/com/thoughtworks/sbtBestPractice/mima/MimaPreviousVersion.scala index 85f0ec0..14f32f6 100644 --- a/mima/src/main/scala/com/thoughtworks/sbtBestPractice/mima/MimaPreviousVersion.scala +++ b/mima/src/main/scala/com/thoughtworks/sbtBestPractice/mima/MimaPreviousVersion.scala @@ -20,8 +20,11 @@ object MimaPreviousVersion extends AutoPlugin { override def projectSettings: Seq[Def.Setting[_]] = Seq( mimaPreviousArtifacts ++= { - val currentModuleID = projectID.value.withExplicitArtifacts(Vector.empty) - previousStableVersion.value.map(currentModuleID.withRevision).toSet: Set[ModuleID] + val currentModuleID = + projectID.value.withExplicitArtifacts(Vector.empty) + previousStableVersion.value + .map(currentModuleID.withRevision) + .toSet: Set[ModuleID] } ) diff --git a/publish-unidoc/src/main/scala/com/thoughtworks/sbtBestPractice/publishUnidoc/PackageUnidoc.scala b/publish-unidoc/src/main/scala/com/thoughtworks/sbtBestPractice/publishUnidoc/PackageUnidoc.scala index 22851f0..6b80189 100644 --- a/publish-unidoc/src/main/scala/com/thoughtworks/sbtBestPractice/publishUnidoc/PackageUnidoc.scala +++ b/publish-unidoc/src/main/scala/com/thoughtworks/sbtBestPractice/publishUnidoc/PackageUnidoc.scala @@ -32,8 +32,9 @@ object PackageUnidoc extends AutoPlugin with UnidocKeys { packageDoc, Def.taskDyn { unidocProject.value match { - case None => packageDocMappings - case Some(p) => (unidoc in Compile in p).map(_.flatMap(Path.allSubpaths)) + case None => packageDocMappings + case Some(p) => + (unidoc in Compile in p).map(_.flatMap(Path.allSubpaths)) } } ) diff --git a/publish-unidoc/src/main/scala/com/thoughtworks/sbtBestPractice/publishUnidoc/UnidocProject.scala b/publish-unidoc/src/main/scala/com/thoughtworks/sbtBestPractice/publishUnidoc/UnidocProject.scala index 066b519..64522a0 100644 --- a/publish-unidoc/src/main/scala/com/thoughtworks/sbtBestPractice/publishUnidoc/UnidocProject.scala +++ b/publish-unidoc/src/main/scala/com/thoughtworks/sbtBestPractice/publishUnidoc/UnidocProject.scala @@ -11,7 +11,9 @@ object UnidocProject extends AutoPlugin { override def requires: Plugins = BaseUnidocPlugin override def projectSettings = Seq( - PackageUnidoc.autoImport.unidocProject in ThisBuild := Some(thisProjectRef.value) + PackageUnidoc.autoImport.unidocProject in ThisBuild := Some( + thisProjectRef.value + ) ) } diff --git a/scalac-options/src/main/scala/com/thoughtworks/sbtBestPractice/scalacOptions/ClasspathCache.scala b/scalac-options/src/main/scala/com/thoughtworks/sbtBestPractice/scalacOptions/ClasspathCache.scala index e5f4b88..ca08b68 100644 --- a/scalac-options/src/main/scala/com/thoughtworks/sbtBestPractice/scalacOptions/ClasspathCache.scala +++ b/scalac-options/src/main/scala/com/thoughtworks/sbtBestPractice/scalacOptions/ClasspathCache.scala @@ -17,7 +17,10 @@ object ClasspathCache extends AutoPlugin { val versionNumbers = VersionNumber(scalaVersion.value).numbers import scala.Ordering.Implicits._ if (versionNumbers >= Seq(2L, 12L, 5L) && versionNumbers < Seq(3L)) { - Seq("-Ycache-plugin-class-loader:last-modified", "-Ycache-macro-class-loader:last-modified") + Seq( + "-Ycache-plugin-class-loader:last-modified", + "-Ycache-macro-class-loader:last-modified" + ) } else { Nil } diff --git a/scalac-options/src/main/scala/com/thoughtworks/sbtBestPractice/scalacOptions/Optimization.scala b/scalac-options/src/main/scala/com/thoughtworks/sbtBestPractice/scalacOptions/Optimization.scala index ca5750b..60f5e5b 100644 --- a/scalac-options/src/main/scala/com/thoughtworks/sbtBestPractice/scalacOptions/Optimization.scala +++ b/scalac-options/src/main/scala/com/thoughtworks/sbtBestPractice/scalacOptions/Optimization.scala @@ -15,7 +15,8 @@ object Optimization extends AutoPlugin { override def trigger: PluginTrigger = allRequirements object autoImport { - val optimization = settingKey[Boolean]("Whether to enable scalac flags for optimization") + val optimization = + settingKey[Boolean]("Whether to enable scalac flags for optimization") } import autoImport._ diff --git a/skip-duplicate-java-publish/src/main/scala/com/thoughtworks/sbtBestPractice/skipDuplicateJavaPublish/SkipDuplicateJavaPublish.scala b/skip-duplicate-java-publish/src/main/scala/com/thoughtworks/sbtBestPractice/skipDuplicateJavaPublish/SkipDuplicateJavaPublish.scala index 7d1788b..a548072 100644 --- a/skip-duplicate-java-publish/src/main/scala/com/thoughtworks/sbtBestPractice/skipDuplicateJavaPublish/SkipDuplicateJavaPublish.scala +++ b/skip-duplicate-java-publish/src/main/scala/com/thoughtworks/sbtBestPractice/skipDuplicateJavaPublish/SkipDuplicateJavaPublish.scala @@ -5,8 +5,8 @@ import sbt.{AutoPlugin, Def} /** Skip duplicate publish. * - * If cross paths are disabled, then publish will be skipped, unless current scala version is the same as the first - * cross scala version. + * If cross paths are disabled, then publish will be skipped, unless current + * scala version is the same as the first cross scala version. * * @author * 杨博 (Yang Bo) diff --git a/travis/src/main/scala/com/thoughtworks/sbtBestPractice/travis/DetectScalaVersionsFromTravisYml.scala b/travis/src/main/scala/com/thoughtworks/sbtBestPractice/travis/DetectScalaVersionsFromTravisYml.scala index 41e3532..8862c83 100644 --- a/travis/src/main/scala/com/thoughtworks/sbtBestPractice/travis/DetectScalaVersionsFromTravisYml.scala +++ b/travis/src/main/scala/com/thoughtworks/sbtBestPractice/travis/DetectScalaVersionsFromTravisYml.scala @@ -36,7 +36,8 @@ object DetectScalaVersionsFromTravisYml extends AutoPlugin { case elementNode: MappingNode => val pair = !Each(elementNode.getValue.asScala) pair.getKeyNode match { - case keyNode: ScalarNode if keyNode.getValue == "scala" => + case keyNode: ScalarNode + if keyNode.getValue == "scala" => pair.getValueNode match { case valueNode: ScalarNode => !Return(valueNode.getValue) @@ -95,7 +96,10 @@ object DetectScalaVersionsFromTravisYml extends AutoPlugin { val travisYmlPath = (gitWorkTree / ".travis.yml").toPath if (Files.exists(travisYmlPath)) { val versions = extractScalaVersions { - val reader = Files.newBufferedReader(travisYmlPath, scala.io.Codec.UTF8.charSet) + val reader = Files.newBufferedReader( + travisYmlPath, + scala.io.Codec.UTF8.charSet + ) try { new Yaml().compose(reader) } finally { @@ -120,7 +124,10 @@ object DetectScalaVersionsFromTravisYml extends AutoPlugin { if (Files.exists(travisYmlPath)) { extractScalaVersions { - val reader = Files.newBufferedReader(travisYmlPath, scala.io.Codec.UTF8.charSet) + val reader = Files.newBufferedReader( + travisYmlPath, + scala.io.Codec.UTF8.charSet + ) try { new Yaml().compose(reader) } finally { @@ -136,5 +143,6 @@ object DetectScalaVersionsFromTravisYml extends AutoPlugin { override def projectSettings = crossScalaVersionsSetting - override def buildSettings = Seq(crossScalaVersionsSetting, scalaVersionSetting) + override def buildSettings = + Seq(crossScalaVersionsSetting, scalaVersionSetting) } diff --git a/travis/src/main/scala/com/thoughtworks/sbtBestPractice/travis/ScaladocSourceUrl.scala b/travis/src/main/scala/com/thoughtworks/sbtBestPractice/travis/ScaladocSourceUrl.scala index 19fe1d5..b24803d 100644 --- a/travis/src/main/scala/com/thoughtworks/sbtBestPractice/travis/ScaladocSourceUrl.scala +++ b/travis/src/main/scala/com/thoughtworks/sbtBestPractice/travis/ScaladocSourceUrl.scala @@ -20,7 +20,10 @@ object ScaladocSourceUrl extends AutoPlugin { case Some(rootDirectory) => originalScalacOptions.indexOf("-sourcepath") match { case -1 => - originalScalacOptions ++ Seq("-sourcepath", rootDirectory.toString) + originalScalacOptions ++ Seq( + "-sourcepath", + rootDirectory.toString + ) case i => originalScalacOptions.updated(i + 1, rootDirectory.toString) } @@ -30,12 +33,16 @@ object ScaladocSourceUrl extends AutoPlugin { }, scalacOptions in Compile in doc := { val originalScalacOptions = (scalacOptions in Compile in doc).value - (GitPlugin.gitRepositoryBuilder.?.value, Travis.travisRepoSlug.?.value) match { + ( + GitPlugin.gitRepositoryBuilder.?.value, + Travis.travisRepoSlug.?.value + ) match { case (Some(repositoryBuilder), Some(slug)) => val repository = repositoryBuilder.build() try { val hash = repository.resolve(Constants.HEAD).name - val sourceUrl = raw"https://github.com/$slug/blob/${hash}€{FILE_PATH}.scala" + val sourceUrl = + raw"https://github.com/$slug/blob/${hash}€{FILE_PATH}.scala" originalScalacOptions.indexOf("-doc-source-url") match { case -1 => originalScalacOptions ++ Seq("-doc-source-url", sourceUrl) diff --git a/travis/src/main/scala/com/thoughtworks/sbtBestPractice/travis/Travis.scala b/travis/src/main/scala/com/thoughtworks/sbtBestPractice/travis/Travis.scala index 67fea10..740065e 100644 --- a/travis/src/main/scala/com/thoughtworks/sbtBestPractice/travis/Travis.scala +++ b/travis/src/main/scala/com/thoughtworks/sbtBestPractice/travis/Travis.scala @@ -18,7 +18,8 @@ object Travis extends AutoPlugin { val travisRepoSlug = settingKey[String]( "The slug (in form: owner_name/repo_name) of the repository currently being built. (for example, “travis-ci/travis-build”)." ) - val travisCommit = settingKey[String]("The commit that the current build is testing.") + val travisCommit = + settingKey[String]("The commit that the current build is testing.") private val Variables = Seq( "TRAVIS_BRANCH" -> travisBranch, diff --git a/travis/src/main/scala/com/thoughtworks/sbtBestPractice/travis/TravisGithub.scala b/travis/src/main/scala/com/thoughtworks/sbtBestPractice/travis/TravisGithub.scala index 5000230..71db295 100644 --- a/travis/src/main/scala/com/thoughtworks/sbtBestPractice/travis/TravisGithub.scala +++ b/travis/src/main/scala/com/thoughtworks/sbtBestPractice/travis/TravisGithub.scala @@ -22,9 +22,13 @@ object TravisGithub extends AutoPlugin { final case class SshKey(privateKeyFile: File) extends GitCredential - val githubCredential = SettingKey[GitCredential]("github-credential", "Credential for git push") + val githubCredential = + SettingKey[GitCredential]("github-credential", "Credential for git push") - val travisGitConfig = TaskKey[Unit]("travis-git-config", "Configure git from Travis environment variables") + val travisGitConfig = TaskKey[Unit]( + "travis-git-config", + "Configure git from Travis environment variables" + ) } @@ -51,7 +55,9 @@ object TravisGithub extends AutoPlugin { command.setPush(true) credential match { case Some(PersonalAccessToken(key)) => - command.setUri(new URIish(s"https://$key@github.com/$slug.git")) + command.setUri( + new URIish(s"https://$key@github.com/$slug.git") + ) case Some(SshKey(privateKeyFile)) => command.setUri(new URIish(s"ssh://git@github.com:$slug.git")) case _ => @@ -64,15 +70,27 @@ object TravisGithub extends AutoPlugin { { val config = git.getRepository.getConfig - config.setString(CONFIG_BRANCH_SECTION, branch, CONFIG_KEY_REMOTE, RemoteName) - config.setString(CONFIG_BRANCH_SECTION, branch, CONFIG_KEY_MERGE, raw"""$R_HEADS$branch""") + config.setString( + CONFIG_BRANCH_SECTION, + branch, + CONFIG_KEY_REMOTE, + RemoteName + ) + config.setString( + CONFIG_BRANCH_SECTION, + branch, + CONFIG_KEY_MERGE, + raw"""$R_HEADS$branch""" + ) config.save() } git.checkout().setName(branch).call() } case _ => - throw new MessageOnlyException("travisBranch or travisRepoSlug is not set") + throw new MessageOnlyException( + "travisBranch or travisRepoSlug is not set" + ) } } ) diff --git a/version-scheme/src/main/scala/com/thoughtworks/sbtBestPractice/versionScheme/DefaultVersionScheme.scala b/version-scheme/src/main/scala/com/thoughtworks/sbtBestPractice/versionScheme/DefaultVersionScheme.scala index f6e6a19..4c26077 100644 --- a/version-scheme/src/main/scala/com/thoughtworks/sbtBestPractice/versionScheme/DefaultVersionScheme.scala +++ b/version-scheme/src/main/scala/com/thoughtworks/sbtBestPractice/versionScheme/DefaultVersionScheme.scala @@ -5,5 +5,7 @@ import sbt._, Keys._ object DefaultVersionScheme extends AutoPlugin { override def trigger = allRequirements - override def buildSettings = Seq(ThisBuild / versionScheme := Some(VersionScheme.SemVerSpec)) + override def buildSettings = Seq( + ThisBuild / versionScheme := Some(VersionScheme.SemVerSpec) + ) } From 9b2daf921822e12b8995ed8bba0de9b8920b5fbb Mon Sep 17 00:00:00 2001 From: Scala Steward Date: Sat, 15 Jul 2023 00:58:35 +0000 Subject: [PATCH 3/3] Add 'Reformat with scalafmt 3.7.9' to .git-blame-ignore-revs --- .git-blame-ignore-revs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs index a94ba1f..63d467f 100644 --- a/.git-blame-ignore-revs +++ b/.git-blame-ignore-revs @@ -1,2 +1,5 @@ # Scala Steward: Reformat with scalafmt 3.1.2 fb6cfb8aea15a1b339e3ed69e1e96acd7df4cae6 + +# Scala Steward: Reformat with scalafmt 3.7.9 +13ec28ec9e96c5649717916965db38aa925c315f