Skip to content

Commit

Permalink
Setup Scalafix
Browse files Browse the repository at this point in the history
  • Loading branch information
jultty committed Nov 27, 2023
1 parent 41b8a81 commit 1292230
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 2 deletions.
12 changes: 10 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ lazy val root = project
test / watchBeforeCommand := Watch.clearScreen,
Global / onChangedBuildSource := ReloadOnSourceChanges,
Global / cancelable := true,

libraryDependencies += "org.scalameta" %% "munit" % "0.7.29" % Test,
semanticdbEnabled := true,

scalacOptions ++= Seq(
"-encoding", "utf8",
Expand All @@ -24,6 +23,15 @@ lazy val root = project
"-Ysafe-init",
),

libraryDependencies += "org.scalameta" %% "munit" % "0.7.29" % Test,

scalafixConfig := Some(file("project/scalafix.conf")),
ThisBuild / scalafixDependencies ++= Seq(
"io.github.ghostbuster91.scalafix-unified" %% "unified" % "0.0.8",
"com.github.xuwei-k" %% "scalafix-rules" % "0.3.1",
"net.pixiv" %% "scalafix-pixiv-rule" % "4.5.3",
),

wartremoverErrors ++= Warts.unsafe.filterNot(Set(
Wart.Var, Wart.Any
).contains),
Expand Down
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
addSbtPlugin("org.wartremover" % "sbt-wartremover" % "3.1.5")
addSbtPlugin("org.wartremover" % "sbt-wartremover-contrib" % "2.1.0")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.1")
100 changes: 100 additions & 0 deletions project/scalafix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
rules = [
NoAutoTupling,
OrganizeImports,
DisableSyntax,
LeakingImplicitClassVal,
NoValInForComprehension,
RedundantSyntax,
# pixiv/scalafix-pixiv-rule
UnnecessarySemicolon,
ZeroIndexToHead,
CheckIsEmpty,
NonCaseException,
SingleConditionMatch,
NeedMessageExtendsRuntimeException,
NamingConventionPackage,
PackageJavaxToJakarta,
# ghostbuster91/scalafix-unified
EmptyCollectionsUnified,
# xuwei-k/scalafix-rules
AddExplicitImplicitTypes
AddLambdaParamParentheses
CirceCodec
CollectHeadOption
CollectHead
CompareSameValue
DirectoryAndPackageName
DuplicateWildcardImport
EitherFold
EitherGetOrElse
EitherMap
EtaExpand
ExplicitImplicitTypes
ExtendsProductWithSerializable
FileNameConsistent
FilterNot
FilterSize
FinalObjectWarn
FlatMapCollect
FlatTraverse
GroupMap
ImplicitValueClass
IncorrectScaladocParam
InterpolationToString
InterpolationToStringWarn
IsEmptyNonEmpty
JavaURLConstructorsWarn
KeySet
KindProjector
LambdaParamParentheses
LazyZip
MapDistinctSize
MapFlattenFlatMap
MapSequenceTraverse
MapToForeach
NamedParamOrder
ObjectSelfType
OptionContains
OptionFilter
OptionForallExists
OptionGetOrElse
OptionGetWarn
OptionMapFlatMap
OptionMatchToRight
OptionOrElse
OptionWhenUnless
PartialFunctionCondOpt
RedundantCaseClassVal
RemoveEmptyObject
RemoveIf
RemovePureEff
RemoveSamePackageImport
RemoveStringInterpolation
RemoveUselessParamComments
ReplaceFill
ReplacePlaceholder
ReplaceSymbolLiterals
ReuseInstances
SameParamOverloading
Scala3ImportRewrite
Scala3ImportWarn
Scala3Placeholder
ScalaApp
ScalazEitherInfix
SimplifyForYield
SizeToLength
SlickFilter
StringFormatToInterpolation
SyntacticOrganizeImports
ThrowableToNonFatal
UnnecessaryCase
UnnecessaryMatch
UnnecessarySortRewrite
UnnecessarySort
UnusedConstructorParams
UnusedTypeParams
UselessParamCommentsWarn
WithFilter
]

OrganizeImports.removeUnused = false,

0 comments on commit 1292230

Please sign in to comment.