Skip to content

Commit 862b928

Browse files
Merge pull request #332 from ua-parser/remove-scalafix
Drop scalafix
2 parents 3f190a4 + db33453 commit 862b928

File tree

8 files changed

+24
-31
lines changed

8 files changed

+24
-31
lines changed

.github/workflows/scala.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ jobs:
2424
- name: Setup sbt
2525
uses: sbt/setup-sbt@v1
2626
- name: Check formatting
27-
run: sbt -v "scalafixAll --check; scalafmtCheck"
27+
run: sbt -v "scalafmtCheck"
2828
- name: Run tests
2929
run: sbt -v "++${{ matrix.scala-version }} clean; test;"

.scalafix.conf

Lines changed: 0 additions & 19 deletions
This file was deleted.

.scalafmt.conf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
11
version = 3.10.2
22

33
runner.dialect = scala3
4+
45
maxColumn = 120
6+
57
newlines.topLevelStatementBlankLines = [
68
{ blanks: { after: 0 } }
79
]
10+
811
fileOverride {
912
"glob:**/*.sbt" {
1013
runner.dialect = sbt1
1114
align.preset = most
1215
}
1316
}
17+
18+
rewrite {
19+
rules = [AvoidInfix, Imports, RedundantBraces, RedundantParens, RemoveSemicolons]
20+
redundantBraces.maxBreaks = 0
21+
scala3.convertToNewSyntax = true
22+
scala3.newSyntax.control = false
23+
24+
imports {
25+
# 1) javax?/java, 2) scala, 3) everything else _not_ adstax, 4) adstax
26+
groups = [["javax?\\..*"], ["scala\\..*"], [".*"], ["org\\.uaparser\\..*"]]
27+
sort = ascii
28+
selectors = fold
29+
}
30+
}

build.sbt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ lazy val commonSettings = Seq(
2929
case _ =>
3030
commonScalacOptions
3131
}
32-
},
33-
// Enable scalafix
34-
semanticdbEnabled := true,
35-
semanticdbVersion := scalafixSemanticdb.revision
32+
}
3633
)
3734

3835
lazy val lib = project
@@ -63,7 +60,7 @@ lazy val lib = project
6360
publishMavenStyle := true,
6461
publishTo := {
6562
val centralSnapshots = "https://central.sonatype.com/repository/maven-snapshots/"
66-
if (isSnapshot.value) Some("central-snapshots" at centralSnapshots)
63+
if (isSnapshot.value) Some("central-snapshots".at(centralSnapshots))
6764
else localStaging.value
6865
}
6966
)

modules/lib/src/main/scala/org/uaparser/scala/DevicePattern.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ private[scala] case class DevicePattern(
2323

2424
private def replace(replacement: String, matcher: Matcher): String = {
2525
(if (replacement.contains("$") && matcher.groupCount() >= 1) {
26-
(1 to matcher.groupCount()).foldLeft(replacement)((rep, i) => {
26+
(1 to matcher.groupCount()).foldLeft(replacement) { (rep, i) =>
2727
val toInsert = if (matcher.group(i) ne null) matcher.group(i) else ""
2828
rep.replaceFirst("\\$" + i, Matcher.quoteReplacement(toInsert))
29-
})
29+
}
3030
} else replacement).trim
3131
}
3232
}

modules/lib/src/main/scala/org/uaparser/scala/OSPattern.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ private object OSPattern {
3939
private[this] def getBackreferenceGroup(replacement: String): Option[Int] =
4040
for {
4141
ref <- Option(replacement).filter(_.contains("$"))
42-
groupOpt = allCatch opt ref.substring(1).toInt
42+
groupOpt = allCatch.opt(ref.substring(1).toInt)
4343
group <- groupOpt
4444
} yield group
4545

modules/lib/src/main/scala/org/uaparser/scala/YamlUtil.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ private[scala] object YamlUtil {
1616
}.toMap
1717
}
1818

19-
def loadYamlAsMap(yamlStream: InputStream): Map[String, List[Map[String, String]]] = {
19+
def loadYamlAsMap(yamlStream: InputStream): Map[String, List[Map[String, String]]] =
2020
loadYamlAsMap(yamlStream, new Yaml(new SafeConstructor(new LoaderOptions)))
21-
}
2221
}

project/plugins.sbt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.14.4")
21
addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.3.1")
32
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.4.0")
43
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.4")

0 commit comments

Comments
 (0)