Skip to content

Commit c807aaa

Browse files
committed
Update scalafix/scalafmt. Reformat all
1 parent 1f1523d commit c807aaa

26 files changed

+564
-538
lines changed

.scalafix.conf

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,40 @@
11
rules = [
22
DisableSyntax,
3-
# RemoveUnused,
3+
RemoveUnused,
44
OrganizeImports,
55
NoValInForComprehension,
66
LeakingImplicitClassVal,
77
NoAutoTupling,
88
RedundantSyntax,
9+
# ExplicitResultTypes,
910
]
1011

11-
DisableSyntax.noFinalize = true
12-
DisableSyntax.noIsInstanceOf = true
13-
DisableSyntax.noReturns = true
12+
RemoveUnused.imports = false
13+
14+
DisableSyntax {
15+
noFinalize = true
16+
noIsInstanceOf = true
17+
noReturns = true
18+
# noVars = true
19+
}
1420

1521
triggered.rules = [
1622
DisableSyntax
1723
]
1824

1925
OrganizeImports {
20-
coalesceToWildcardImportThreshold = 6
26+
targetDialect = Scala3
27+
blankLines = Auto
2128
expandRelative = true
22-
groups = [
29+
groupedImports = AggressiveMerge
30+
coalesceToWildcardImportThreshold = 5
31+
removeUnused = true
32+
groups = [
2333
"re:javax?\\."
2434
"scala."
2535
"scala.meta."
36+
"zio."
37+
"io.quarkus."
2638
"*"
2739
]
28-
groupedImports = AggressiveMerge
29-
removeUnused = false # Disabled until available on Scalafix for Scala 3.3
30-
blankLines = Auto
3140
}
32-
OrganizeImports.targetDialect = Scala3

.scalafmt.conf

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
version = 3.8.2
1+
version = 3.8.3
22
runner.dialect = scala3
3-
project.git = true
43

54
fileOverride {
6-
"glob:**/build.sc" {
5+
"glob:**/build.{sc, mill}" {
76
runner.dialect = scala213
87
}
98
}
10-
9+
project.git = true
1110
maxColumn = 120
12-
indent.main = 4
13-
indent.callSite = 4
1411

1512
align.preset = more
13+
align.tokens."+" = [
14+
{
15+
code = ":"
16+
}
17+
]
1618
assumeStandardLibraryStripMargin = true
1719
docstrings.style = Asterisk
1820
docstrings.wrapMaxColumn = 80
@@ -21,33 +23,26 @@ danglingParentheses.preset = true
2123
danglingParentheses.exclude = [
2224
"`trait`"
2325
]
24-
align.tokens."+" = [
25-
{
26-
code = ":"
27-
}
28-
]
2926
newlines.source = keep
3027
newlines.beforeCurlyLambdaParams = false
3128
newlines.implicitParamListModifierForce = [before]
3229
rewrite.trailingCommas.style = "multiple"
3330
rewrite.trailingCommas.allowFolding = true
3431
rewrite.scala3.convertToNewSyntax = true
3532
rewrite.scala3.removeOptionalBraces = yes
36-
rewrite.scala3.insertEndMarkerMinLines = 20
37-
rewrite.scala3.removeEndMarkerMaxLines = 19
38-
33+
rewrite.scala3.insertEndMarkerMinLines = 15
34+
rewrite.scala3.removeEndMarkerMaxLines = 14
35+
rewrite.redundantBraces.generalExpressions = false
3936
rewrite.rules = [
4037
RedundantBraces,
4138
RedundantParens,
4239
PreferCurlyFors,
4340
]
44-
45-
verticalMultiline.atDefnSite = true
46-
verticalMultiline.arityThreshold = 3
47-
48-
rewrite.redundantBraces.generalExpressions = false
4941
rewriteTokens = {
5042
"⇒": "=>"
5143
"→": "->"
5244
"←": "<-"
5345
}
46+
47+
verticalMultiline.atDefnSite = true
48+
verticalMultiline.arityThreshold = 3

build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ dependencies {
3636
implementation "io.quarkus:quarkus-rest-qute"
3737
implementation "io.quarkus:quarkus-smallrye-metrics"
3838
implementation "io.quarkus:quarkus-smallrye-health"
39+
implementation "io.quarkus:quarkus-quartz"
3940
// Quarkus Test Libs
4041
testImplementation "io.quarkus:quarkus-junit5"
4142
testImplementation "io.quarkus:quarkus-jacoco"

pom.xml

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
<?xml version="1.0"?>
2-
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
3-
xmlns="http://maven.apache.org/POM/4.0.0"
4-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
54
<modelVersion>4.0.0</modelVersion>
65
<groupId>org.acme</groupId>
76
<artifactId>scala3-quarkus-quickstart</artifactId>
@@ -99,49 +98,53 @@
9998
<groupId>io.quarkus</groupId>
10099
<artifactId>quarkus-messaging-kafka</artifactId>
101100
</dependency>
101+
<dependency>
102+
<groupId>io.quarkus</groupId>
103+
<artifactId>quarkus-quartz</artifactId>
104+
</dependency>
105+
<!-- ######## Quarkus Health Check Endpoints ######## -->
102106
<dependency>
103107
<groupId>io.smallrye.reactive</groupId>
104108
<artifactId>smallrye-reactive-messaging-in-memory</artifactId>
105109
<scope>test</scope>
106110
</dependency>
107-
<!-- ######## Quarkus Health Check Endpoints ######## -->
111+
<!-- ######## Hibernate ORM specific dependencies ######## -->
108112
<dependency>
109113
<groupId>io.quarkus</groupId>
110114
<artifactId>quarkus-smallrye-health</artifactId>
111115
</dependency>
112-
<!-- ######## Hibernate ORM specific dependencies ######## -->
116+
<!-- JDBC driver dependencies -->
113117
<dependency>
114118
<groupId>io.quarkus</groupId>
115119
<artifactId>quarkus-hibernate-orm</artifactId>
116120
</dependency>
117-
<!-- JDBC driver dependencies -->
121+
<!-- Narayana JTA dependencies, added to be more explicit, it is otherwise included because of hibernate-orm extension -->
118122
<dependency>
119123
<groupId>io.quarkus</groupId>
120124
<artifactId>quarkus-jdbc-postgresql</artifactId>
121125
</dependency>
122-
<!-- Narayana JTA dependencies, added to be more explicit, it is otherwise included because of hibernate-orm extension -->
126+
<!-- Flyway DB migration specific dependencies -->
123127
<dependency>
124128
<groupId>io.quarkus</groupId>
125129
<artifactId>quarkus-narayana-jta</artifactId>
126130
</dependency>
127-
<!-- Flyway DB migration specific dependencies -->
131+
<!-- ######## Scala 3 Magnum DB Library ######## -->
128132
<dependency>
129133
<groupId>io.quarkus</groupId>
130134
<artifactId>quarkus-flyway</artifactId>
131135
</dependency>
132-
<!-- ######## Scala 3 Magnum DB Library ######## -->
136+
<!-- ######## Quarkus JUnit test dependencies ######## -->
133137
<dependency>
134138
<groupId>com.augustnagro</groupId>
135139
<artifactId>magnum_3</artifactId>
136140
<version>1.3.0</version>
137141
</dependency>
138-
<!-- ######## Quarkus JUnit test dependencies ######## -->
142+
<!-- Here we use the latest version of Rest Assured to use the Scala 3 extensions -->
139143
<dependency>
140144
<groupId>io.quarkus</groupId>
141145
<artifactId>quarkus-junit5</artifactId>
142146
<scope>test</scope>
143147
</dependency>
144-
<!-- Here we use the latest version of Rest Assured to use the Scala 3 extensions -->
145148
<dependency>
146149
<groupId>io.rest-assured</groupId>
147150
<artifactId>rest-assured</artifactId>
@@ -159,12 +162,12 @@
159162
<artifactId>quarkus-jacoco</artifactId>
160163
<scope>test</scope>
161164
</dependency>
165+
<!-- ######## Metrics dependencies ######## -->
162166
<dependency>
163167
<groupId>org.awaitility</groupId>
164168
<artifactId>awaitility</artifactId>
165169
<scope>test</scope>
166170
</dependency>
167-
<!-- ######## Metrics dependencies ######## -->
168171
<dependency>
169172
<groupId>io.quarkus</groupId>
170173
<artifactId>quarkus-smallrye-metrics</artifactId>
@@ -288,7 +291,7 @@
288291
<plugin>
289292
<groupId>io.github.evis</groupId>
290293
<artifactId>scalafix-maven-plugin_2.13</artifactId>
291-
<version>0.1.10_0.11.0</version>
294+
<version>0.1.9_0.12.1</version>
292295
</plugin>
293296
</plugins>
294297
</build>
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
package helper
22

3+
import io.quarkus.jackson.ObjectMapperCustomizer
4+
35
import com.fasterxml.jackson.databind.ObjectMapper
46
import com.fasterxml.jackson.module.scala.DefaultScalaModule
5-
import io.quarkus.jackson.ObjectMapperCustomizer
67
import jakarta.inject.Singleton
78

89
@Singleton
910
class Scala3ObjectMapperCustomizer extends ObjectMapperCustomizer:
10-
def customize(mapper: ObjectMapper) =
11-
// General Scala support
12-
// https://github.com/FasterXML/jackson-module-scala
13-
mapper.registerModule(DefaultScalaModule)
11+
def customize(mapper: ObjectMapper) =
12+
// General Scala support
13+
// https://github.com/FasterXML/jackson-module-scala
14+
mapper.registerModule(DefaultScalaModule)

src/main/scala/helper/ZioHelper.scala

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,29 @@ import zio.*
88

99
// Helper methods to run ZIO effects and return a CompletionStage
1010
object ZIOHelper:
11+
/**
12+
* Run a ZIO effect and return a Java CompletionStage
13+
*
14+
* @param zio
15+
* ZIO[Any, Throwable, A]
16+
* @tparam A
17+
* The type of the ZIO effect
18+
* @return
19+
* CompletionStage[A]
20+
*/
21+
def runZio[A](zio: ZIO[Any, Throwable, A]): CompletionStage[A] =
22+
val runtime = Runtime.default
23+
val run = Unsafe.unsafe { implicit unsafe =>
24+
runtime.unsafe.runToFuture(zio)
25+
}
26+
run.asJava
27+
28+
extension [A](zio: ZIO[Any, Throwable, A])
1129
/**
12-
* Run a ZIO effect and return a Java CompletionStage
30+
* Convert a ZIO effect to a Java CompletionStage
1331
*
14-
* @param zio
15-
* ZIO[Any, Throwable, A]
16-
* @tparam A
17-
* The type of the ZIO effect
1832
* @return
1933
* CompletionStage[A]
2034
*/
21-
def runZio[A](zio: ZIO[Any, Throwable, A]): CompletionStage[A] =
22-
val runtime = Runtime.default
23-
val run = Unsafe.unsafe { implicit unsafe =>
24-
runtime.unsafe.runToFuture(zio)
25-
}
26-
run.asJava
27-
28-
extension [A](zio: ZIO[Any, Throwable, A])
29-
/**
30-
* Convert a ZIO effect to a Java CompletionStage
31-
*
32-
* @return
33-
* CompletionStage[A]
34-
*/
35-
def fromZio: CompletionStage[A] = runZio(zio)
35+
def fromZio: CompletionStage[A] = runZio(zio)
3636
end ZIOHelper

src/main/scala/org/acme/GreetingResource.scala

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,29 @@ class GreetingResource(
1212
// Let's inject the configuration property "greeting.message" into a variable
1313
@ConfigProperty(name = "greeting.message") message: String
1414
):
15-
@GET
16-
@Path("/hello")
17-
@Counted(name = "helloCounter", description = "How many times the hello endpoint was invoked")
18-
@Produces(Array(TEXT_PLAIN))
19-
def hello() =
20-
// Or programatically access the configuration property greeting.suffix
21-
val messageSuffix = ConfigProvider.getConfig().getValue("greeting.suffix", classOf[String])
22-
s"Hello ${message} from RESTEasy Reactive in Scala 3${messageSuffix}"
15+
@GET
16+
@Path("/hello")
17+
@Counted(name = "helloCounter", description = "How many times the hello endpoint was invoked")
18+
@Produces(Array(TEXT_PLAIN))
19+
def hello() =
20+
// Or programatically access the configuration property greeting.suffix
21+
val messageSuffix = ConfigProvider.getConfig().getValue("greeting.suffix", classOf[String])
22+
s"Hello ${message} from RESTEasy Reactive in Scala 3${messageSuffix}"
2323

24-
// This is an endpoint which greets a name or names passed via a query parameter "name"
25-
@GET
26-
@Path("/greet")
27-
@Produces(Array(TEXT_PLAIN))
28-
def greeting(@RestQuery @DefaultValue("world") name: Array[String]) =
29-
val names = name.mkString(" and ")
30-
s"Hello ${names} from RESTEasy Reactive in Scala 3"
24+
// This is an endpoint which greets a name or names passed via a query parameter "name"
25+
@GET
26+
@Path("/greet")
27+
@Produces(Array(TEXT_PLAIN))
28+
def greeting(@RestQuery @DefaultValue("world") name: Array[String]) =
29+
val names = name.mkString(" and ")
30+
s"Hello ${names} from RESTEasy Reactive in Scala 3"
3131

32-
// Generates a greeting message in JSON format
33-
@GET
34-
@Path("/greet/json")
35-
@Produces(Array(APPLICATION_JSON))
36-
def greetingJson(@RestQuery @DefaultValue("world") name: Array[String]) =
37-
val names = name.mkString(" and ")
38-
s"""{"message": "Hello ${names} from RESTEasy Reactive in Scala 3"}"""
32+
// Generates a greeting message in JSON format
33+
@GET
34+
@Path("/greet/json")
35+
@Produces(Array(APPLICATION_JSON))
36+
def greetingJson(@RestQuery @DefaultValue("world") name: Array[String]) =
37+
val names = name.mkString(" and ")
38+
s"""{"message": "Hello ${names} from RESTEasy Reactive in Scala 3"}"""
3939

4040
end GreetingResource

src/main/scala/org/acme/Main.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ import io.quarkus.runtime.{Quarkus, QuarkusApplication}
77
@QuarkusMain
88
class Main
99
object Main:
10-
def main(args: Array[String]): Unit =
11-
Quarkus.run(classOf[MainApp], args*)
10+
def main(args: Array[String]): Unit =
11+
Quarkus.run(classOf[MainApp], args*)
1212

1313
class MainApp extends QuarkusApplication:
14-
def run(args: String*): Int =
15-
Log.debug("Running MainApp... processing startup logic")
16-
Log.debug(s"Startup args: ${if args.isEmpty then "none" else args.mkString(", ")}")
17-
Quarkus.waitForExit()
18-
Log.debug("Shutting down MainApp... processing shutdown logic")
19-
0
14+
def run(args: String*): Int =
15+
Log.debug("Running MainApp... processing startup logic")
16+
Log.debug(s"Startup args: ${if args.isEmpty then "none" else args.mkString(", ")}")
17+
Quarkus.waitForExit()
18+
Log.debug("Shutting down MainApp... processing shutdown logic")
19+
0

0 commit comments

Comments
 (0)