Skip to content

Commit 1292230

Browse files
committed
Setup Scalafix
1 parent 41b8a81 commit 1292230

File tree

3 files changed

+111
-2
lines changed

3 files changed

+111
-2
lines changed

build.sbt

+10-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ lazy val root = project
1313
test / watchBeforeCommand := Watch.clearScreen,
1414
Global / onChangedBuildSource := ReloadOnSourceChanges,
1515
Global / cancelable := true,
16-
17-
libraryDependencies += "org.scalameta" %% "munit" % "0.7.29" % Test,
16+
semanticdbEnabled := true,
1817

1918
scalacOptions ++= Seq(
2019
"-encoding", "utf8",
@@ -24,6 +23,15 @@ lazy val root = project
2423
"-Ysafe-init",
2524
),
2625

26+
libraryDependencies += "org.scalameta" %% "munit" % "0.7.29" % Test,
27+
28+
scalafixConfig := Some(file("project/scalafix.conf")),
29+
ThisBuild / scalafixDependencies ++= Seq(
30+
"io.github.ghostbuster91.scalafix-unified" %% "unified" % "0.0.8",
31+
"com.github.xuwei-k" %% "scalafix-rules" % "0.3.1",
32+
"net.pixiv" %% "scalafix-pixiv-rule" % "4.5.3",
33+
),
34+
2735
wartremoverErrors ++= Warts.unsafe.filterNot(Set(
2836
Wart.Var, Wart.Any
2937
).contains),

project/plugins.sbt

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
addSbtPlugin("org.wartremover" % "sbt-wartremover" % "3.1.5")
22
addSbtPlugin("org.wartremover" % "sbt-wartremover-contrib" % "2.1.0")
3+
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.1")

project/scalafix.conf

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
rules = [
2+
NoAutoTupling,
3+
OrganizeImports,
4+
DisableSyntax,
5+
LeakingImplicitClassVal,
6+
NoValInForComprehension,
7+
RedundantSyntax,
8+
# pixiv/scalafix-pixiv-rule
9+
UnnecessarySemicolon,
10+
ZeroIndexToHead,
11+
CheckIsEmpty,
12+
NonCaseException,
13+
SingleConditionMatch,
14+
NeedMessageExtendsRuntimeException,
15+
NamingConventionPackage,
16+
PackageJavaxToJakarta,
17+
# ghostbuster91/scalafix-unified
18+
EmptyCollectionsUnified,
19+
# xuwei-k/scalafix-rules
20+
AddExplicitImplicitTypes
21+
AddLambdaParamParentheses
22+
CirceCodec
23+
CollectHeadOption
24+
CollectHead
25+
CompareSameValue
26+
DirectoryAndPackageName
27+
DuplicateWildcardImport
28+
EitherFold
29+
EitherGetOrElse
30+
EitherMap
31+
EtaExpand
32+
ExplicitImplicitTypes
33+
ExtendsProductWithSerializable
34+
FileNameConsistent
35+
FilterNot
36+
FilterSize
37+
FinalObjectWarn
38+
FlatMapCollect
39+
FlatTraverse
40+
GroupMap
41+
ImplicitValueClass
42+
IncorrectScaladocParam
43+
InterpolationToString
44+
InterpolationToStringWarn
45+
IsEmptyNonEmpty
46+
JavaURLConstructorsWarn
47+
KeySet
48+
KindProjector
49+
LambdaParamParentheses
50+
LazyZip
51+
MapDistinctSize
52+
MapFlattenFlatMap
53+
MapSequenceTraverse
54+
MapToForeach
55+
NamedParamOrder
56+
ObjectSelfType
57+
OptionContains
58+
OptionFilter
59+
OptionForallExists
60+
OptionGetOrElse
61+
OptionGetWarn
62+
OptionMapFlatMap
63+
OptionMatchToRight
64+
OptionOrElse
65+
OptionWhenUnless
66+
PartialFunctionCondOpt
67+
RedundantCaseClassVal
68+
RemoveEmptyObject
69+
RemoveIf
70+
RemovePureEff
71+
RemoveSamePackageImport
72+
RemoveStringInterpolation
73+
RemoveUselessParamComments
74+
ReplaceFill
75+
ReplacePlaceholder
76+
ReplaceSymbolLiterals
77+
ReuseInstances
78+
SameParamOverloading
79+
Scala3ImportRewrite
80+
Scala3ImportWarn
81+
Scala3Placeholder
82+
ScalaApp
83+
ScalazEitherInfix
84+
SimplifyForYield
85+
SizeToLength
86+
SlickFilter
87+
StringFormatToInterpolation
88+
SyntacticOrganizeImports
89+
ThrowableToNonFatal
90+
UnnecessaryCase
91+
UnnecessaryMatch
92+
UnnecessarySortRewrite
93+
UnnecessarySort
94+
UnusedConstructorParams
95+
UnusedTypeParams
96+
UselessParamCommentsWarn
97+
WithFilter
98+
]
99+
100+
OrganizeImports.removeUnused = false,

0 commit comments

Comments
 (0)