You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by md...@apache.org on 2023/07/31 12:42:14 UTC
[incubator-pekko-connectors] branch main updated: Add commands to apply and check codestyle
This is an automated email from the ASF dual-hosted git repository.
mdedetrich pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-pekko-connectors.git
The following commit(s) were added to refs/heads/main by this push:
new b9fad2d78 Add commands to apply and check codestyle
b9fad2d78 is described below
commit b9fad2d7834600b18d3e7b9597a6e9f0b05e67c0
Author: Matthew de Detrich <ma...@aiven.io>
AuthorDate: Mon Jul 31 09:59:39 2023 +0200
Add commands to apply and check codestyle
---
.github/workflows/check-build-test.yml | 4 ++--
CONTRIBUTING.md | 6 ++++++
build.sbt | 13 +++++++------
3 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/.github/workflows/check-build-test.yml b/.github/workflows/check-build-test.yml
index 14d238292..52c5fd767 100644
--- a/.github/workflows/check-build-test.yml
+++ b/.github/workflows/check-build-test.yml
@@ -41,8 +41,8 @@ jobs:
uses: coursier/cache-action@v6.4.0
# temporarily remove mima checks
- - name: "Code style, compile tests, MiMa. Run locally with: sbt +~2.13 \"verifyCodeFmt; Test/compile; mimaReportBinaryIssues\""
- run: sbt "verifyCodeFmt; +Test/compile"
+ - name: "Code style, compile tests, MiMa. Run locally with: sbt +~2.13 \"javafmtCheckAll; Test/compile; mimaReportBinaryIssues\""
+ run: sbt "javafmtCheckAll; +Test/compile"
documentation:
name: ScalaDoc, Documentation with Paradox
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 7c0476df4..bdbdd52d6 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -81,6 +81,12 @@ Example:
* Details 2
* Details 3
+## Applying code style to the project
+
+The project uses [scalafmt](https://scalameta.org/scalafmt/) to ensure code quality which is automatically checked on
+every PR. If you would like to check for any potential code style problems locally you can run `sbt checkCodeStyle`
+and if you want to apply the code style then you can run `sbt applyCodeStyle`.
+
### Ignoring formatting commits in git blame
Throughout the history of the codebase various formatting commits have been applied as the scalafmt style has evolved over time, if desired
diff --git a/build.sbt b/build.sbt
index a9969e7a7..47176e169 100644
--- a/build.sbt
+++ b/build.sbt
@@ -98,6 +98,11 @@ lazy val `pekko-connectors` = project
|
| mimaReportBinaryIssues - checks whether this current API
| is binary compatible with the released version
+ |
+ | checkCodeStyle - checks that the codebase follows code
+ | style
+ |
+ | applyCodeStyle - applies code style to the codebase
""".stripMargin,
// unidoc combines sources and jars from all connectors and that
// might include some incompatible ones. Depending on the
@@ -124,12 +129,8 @@ lazy val `pekko-connectors` = project
crossScalaVersions := List() // workaround for https://github.com/sbt/sbt/issues/3465
)
-TaskKey[Unit]("verifyCodeFmt") := {
- javafmtCheckAll.all(ScopeFilter(inAnyProject)).result.value.toEither.left.foreach { _ =>
- throw new MessageOnlyException(
- "Unformatted Java code found. Please run 'javafmtAll' and commit the reformatted code")
- }
-}
+addCommandAlias("applyCodeStyle", ";scalafmtAll; scalafmtSbt; javafmtAll")
+addCommandAlias("checkCodeStyle", ";scalafmtCheckAll; scalafmtSbtCheck; javafmtCheckAll")
lazy val amqp = pekkoConnectorProject("amqp", "amqp", Dependencies.Amqp)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org