You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by nv...@apache.org on 2023/01/17 13:13:00 UTC

[incubator-pekko-management] branch main updated: Adds code style check (#9)

This is an automated email from the ASF dual-hosted git repository.

nvollmar pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-pekko-management.git


The following commit(s) were added to refs/heads/main by this push:
     new b878d9c  Adds code style check (#9)
b878d9c is described below

commit b878d9ca4670c0640a84902b0bdc4eb47c000786
Author: Nicolas Vollmar <nv...@gmail.com>
AuthorDate: Tue Jan 17 14:12:51 2023 +0100

    Adds code style check (#9)
---
 .github/workflows/checks.yml |  2 +-
 build.sbt                    | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml
index 19fb6c5..565b50f 100644
--- a/.github/workflows/checks.yml
+++ b/.github/workflows/checks.yml
@@ -34,7 +34,7 @@ jobs:
         uses: coursier/cache-action@v6.4.0
 
       - name: Compilation and binary-compatibility check
-        run: sbt "headerCheckAll;+IntegrationTest/compile;mimaReportBinaryIssues"
+        run: sbt "verifyCodeStyle;+IntegrationTest/compile;mimaReportBinaryIssues"
 
   check-docs:
     name: Check Docs
diff --git a/build.sbt b/build.sbt
index b479bbd..3113612 100644
--- a/build.sbt
+++ b/build.sbt
@@ -302,3 +302,16 @@ lazy val docs = project
       "scaladoc.akka.management.base_url" -> s"/${(Preprocess / siteSubdirName).value}/"),
     publishRsyncArtifacts += makeSite.value -> "www/",
     publishRsyncHost := "akkarepo@gustav.akka.io")
+
+TaskKey[Unit]("verifyCodeFmt") := {
+  scalafmtCheckAll.all(ScopeFilter(inAnyProject)).result.value.toEither.left.foreach { _ =>
+    throw new MessageOnlyException(
+      "Unformatted Scala code found. Please run 'scalafmtAll' and commit the reformatted code")
+  }
+  (Compile / scalafmtSbtCheck).result.value.toEither.left.foreach { _ =>
+    throw new MessageOnlyException(
+      "Unformatted sbt code found. Please run 'scalafmtSbt' and commit the reformatted code")
+  }
+}
+
+addCommandAlias("verifyCodeStyle", "headerCheckAll; verifyCodeFmt")


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org