Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scalafmt #365

Merged
merged 1 commit into from
May 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/scala/com/sksamuel/scapegoat/Inspection.scala
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ case class InspectionContext(global: Global, feedback: Feedback) {
case tri @ Try(_, _, _) if isSuppressed(tri.symbol) =>
case ClassDef(_, _, _, Template(parents, _, _))
if parents.map(_.tpe.typeSymbol.fullName).contains("scala.reflect.api.TypeCreator") =>
case _ if analyzer.hasMacroExpansionAttachment(tree) => //skip macros as per http://bit.ly/2uS8BrU
case _ => inspect(tree)
case _ if analyzer.hasMacroExpansionAttachment(tree) => //skip macros as per http://bit.ly/2uS8BrU
case _ => inspect(tree)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ class LonelySealedTrait
private val implementedClasses = mutable.HashSet[String]()

override def postInspection(): Unit = {
for ((name, cdef) <- sealedClasses) {
for ((name, cdef) <- sealedClasses)
if (!implementedClasses.contains(name))
context.warn(cdef.pos, self)
}
}

private def inspectParents(parents: List[Tree]): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class RedundantFinalModifierOnMethod
tree match {
case DefDef(_, _, _, _, _, _)
if tree.symbol != null && tree.symbol.owner.tpe.baseClasses
.contains(PartialFunctionClass) =>
.contains(PartialFunctionClass) =>
case dd: DefDef if dd.symbol != null && dd.symbol.isSynthetic =>
case DefDef(mods, _, _, _, _, _) if mods.hasFlag(Flags.ACCESSOR) =>
case DefDef(_, nme.CONSTRUCTOR, _, _, _, _) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class BoundedByFinalType
tree match {
case dd @ DefDef(_, _, _, _, _, _)
if dd.symbol != null && dd.symbol.owner.tpe.baseClasses.contains(PartialFunctionClass) =>
case tdef: TypeDef if tdef.symbol.isAliasType =>
case tdef: TypeDef if tdef.symbol.isAliasType =>
case TypeDef(_, _, _, typeTree: TypeTree) =>
typeTree.original match {
case TypeBoundsTree(lo, hi) if lo.tpe.isFinalType && hi.tpe.isFinalType =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class AvoidOperatorOverload
tree match {
case DefDef(mods, _, _, _, _, _)
if mods.hasFlag(Flags.SetterFlags) | mods.hasFlag(Flags.GetterFlags) =>
case DefDef(_, nme.CONSTRUCTOR, _, _, _, _) =>
case DefDef(_, TermName("$init$"), _, _, _, _) =>
case DefDef(_, nme.CONSTRUCTOR, _, _, _, _) =>
case DefDef(_, TermName("$init$"), _, _, _, _) =>
case DefDef(_, name, _, _, _, _) if name.toChars.count(_ == '$') > 2 =>
context.warn(tree.pos, self)
case _ => continue(tree)
Expand Down