Skip to content

Commit 9050c6c

Browse files
authored
add scalafmt (#1601)
* add scalafmt * add flint ci workflow Signed-off-by: Peng Huo <[email protected]>
1 parent f9ae159 commit 9050c6c

File tree

6 files changed

+31
-5
lines changed

6 files changed

+31
-5
lines changed

.scalafmt.conf

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version = 3.7.3
2+
3+
runner.dialect = scala212

DEVELOPER_GUIDE.md

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Developer Guide
2+
3+
## Scala Formatting Guidelines
4+
5+
For Scala code, We use [scalafmt](https://scalameta.org/scalafmt/) to format the code and check the code style.
6+
7+
To use the plugin, user could check the style
8+
```
9+
sbt scalafmtCheck
10+
```
11+
The code can be formatted with
12+
```
13+
sbt scalafmtAll
14+
```
15+
For more sbt tasks, read more in [scalafmt sbt](https://scalameta.org/scalafmt/docs/installation.html#sbt)
16+
17+
For Intellij user, read more in [scalafmt IntelliJ](https://scalameta.org/scalafmt/docs/installation.html#intellij)

build.sbt

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ lazy val flintSparkIntegration = (project in file("flint-spark-integration"))
2727
.settings(
2828
name := "flint-spark-integration",
2929
scalaVersion := scala212,
30+
Compile / compile := (Compile / compile)
31+
.dependsOn(Compile / scalafmtCheck)
32+
.value,
3033
libraryDependencies ++= Seq(
3134
"org.apache.spark" %% "spark-core" % sparkVersion,
3235
"org.apache.spark" %% "spark-sql" % sparkVersion

flint-core/src/main/scala/org/opensearch/flint/core/FlintIndex.scala

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,4 @@
55

66
package org.opensearch.flint.core
77

8-
class FlintIndex {
9-
10-
}
8+
class FlintIndex {}

flint-spark-integration/src/main/scala/org/opensearch/flint/spark/FlintSparkExtensions.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ import org.apache.spark.sql.SparkSessionExtensions
99

1010
class FlintSparkExtensions extends (SparkSessionExtensions => Unit) {
1111

12-
override def apply(v1: SparkSessionExtensions): Unit = {
13-
}
12+
override def apply(v1: SparkSessionExtensions): Unit = {}
1413
}

project/plugins.sbt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/*
2+
* Copyright OpenSearch Contributors
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")

0 commit comments

Comments
 (0)