From 9eb2a86c6eaaf9c3572cb01fdcc743b8ff55d1c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Grzegorz=20Ol=C4=99dzki?= Date: Fri, 2 Oct 2020 09:35:31 +0200 Subject: [PATCH] Scalafmt --- .../com/sksamuel/scapegoat/Feedback.scala | 3 ++- .../scala/com/sksamuel/scapegoat/Level.scala | 3 ++- .../sksamuel/scapegoat/ScapegoatConfig.scala | 3 ++- .../scapegoat/inspections/AnyUse.scala | 3 ++- .../inspections/AvoidToMinusOne.scala | 3 ++- .../scapegoat/inspections/DoubleNegation.scala | 3 ++- .../scapegoat/inspections/EmptyCaseClass.scala | 7 ++++--- .../inspections/LonelySealedTrait.scala | 3 ++- .../scapegoat/inspections/MaxParameters.scala | 3 ++- .../scapegoat/inspections/NoOpOverride.scala | 3 ++- .../inspections/PublicFinalizer.scala | 3 ++- .../RedundantFinalModifierOnMethod.scala | 8 ++++---- .../RedundantFinalModifierOnVar.scala | 8 ++++---- .../scapegoat/inspections/TypeShadowing.scala | 3 ++- .../scapegoat/inspections/VarClosure.scala | 3 ++- .../inspections/collections/ArrayEquals.scala | 3 ++- .../collections/AvoidSizeEqualsZero.scala | 3 ++- .../collections/AvoidSizeNotEqualsZero.scala | 3 ++- .../CollectionIndexOnNonIndexedSeq.scala | 3 ++- .../CollectionNamingConfusion.scala | 3 ++- .../collections/CollectionNegativeIndex.scala | 3 ++- .../collections/ComparisonToEmptyList.scala | 3 ++- .../collections/ComparisonToEmptySet.scala | 3 ++- .../collections/DuplicateMapKey.scala | 3 ++- .../collections/DuplicateSetValue.scala | 3 ++- .../ExistsSimplifiableToContains.scala | 2 +- .../collections/FilterDotHead.scala | 3 ++- .../collections/FilterDotHeadOption.scala | 3 ++- .../collections/FilterDotIsEmpty.scala | 3 ++- .../collections/FilterOptionAndGet.scala | 3 ++- .../collections/FindDotIsDefined.scala | 3 ++- .../collections/JavaConversionsUse.scala | 3 ++- .../inspections/collections/ListAppend.scala | 3 ++- .../inspections/collections/ListSize.scala | 3 ++- .../collections/NegationIsEmpty.scala | 3 ++- .../collections/NegationNonEmpty.scala | 3 ++- .../collections/NegativeSeqPad.scala | 3 ++- .../collections/PredefIterableIsMutable.scala | 3 ++- .../collections/PredefSeqIsMutable.scala | 3 ++- .../PredefTraversableIsMutable.scala | 3 ++- .../collections/PreferSeqEmpty.scala | 3 ++- .../collections/PreferSetEmpty.scala | 3 ++- .../collections/ReverseTailReverse.scala | 4 ++-- .../collections/ReverseTakeReverse.scala | 4 ++-- .../collections/SwapSortFilter.scala | 3 ++- .../collections/UnsafeContains.scala | 3 ++- .../scapegoat/inspections/empty/EmptyFor.scala | 3 ++- .../inspections/empty/EmptyIfBlock.scala | 3 ++- .../inspections/empty/EmptyMethod.scala | 3 ++- .../empty/EmptySynchronizedBlock.scala | 3 ++- .../inspections/empty/EmptyTryBlock.scala | 3 ++- .../inspections/empty/EmptyWhileBlock.scala | 3 ++- .../equality/ComparingFloatingPointTypes.scala | 3 ++- .../equality/ComparingUnrelatedTypes.scala | 3 ++- .../equality/ComparisonWithSelf.scala | 3 ++- .../inspections/exception/CatchException.scala | 3 ++- .../inspections/exception/CatchFatal.scala | 3 ++- .../inspections/exception/CatchNpe.scala | 3 ++- .../inspections/exception/CatchThrowable.scala | 3 ++- .../exception/IncorrectlyNamedExceptions.scala | 4 ++-- .../exception/SwallowedException.scala | 3 ++- .../exception/UnreachableCatch.scala | 3 ++- .../inspections/imports/DuplicateImport.scala | 3 ++- .../inspections/imports/WildcardImport.scala | 3 ++- .../inference/BoundedByFinalType.scala | 3 ++- .../inference/MethodReturningAny.scala | 3 ++- .../inference/PointlessTypeBounds.scala | 8 +++++--- .../ProductWithSerializableInferred.scala | 3 ++- .../PartialFunctionInsteadOfMatch.scala | 3 ++- .../matching/RepeatedCaseBody.scala | 3 ++- .../SuspiciousMatchOnClassObject.scala | 9 +++++---- .../math/BigDecimalDoubleConstructor.scala | 3 ++- .../BigDecimalScaleWithoutRoundingMode.scala | 3 ++- .../inspections/math/DivideByOne.scala | 3 ++- .../inspections/math/NanComparison.scala | 3 ++- .../scapegoat/inspections/math/UseCbrt.scala | 7 ++++--- .../scapegoat/inspections/math/UseExpM1.scala | 3 ++- .../scapegoat/inspections/math/UseSqrt.scala | 4 ++-- .../inspections/math/ZeroNumerator.scala | 3 ++- .../inspections/naming/ClassNames.scala | 3 ++- .../inspections/naming/MethodNames.scala | 3 ++- .../inspections/naming/ObjectNames.scala | 3 ++- .../inspections/nulls/NullAssignment.scala | 3 ++- .../inspections/nulls/NullParameter.scala | 3 ++- .../inspections/option/EitherGet.scala | 3 ++- .../option/ImpossibleOptionSizeCondition.scala | 3 ++- .../inspections/option/OptionGet.scala | 3 ++- .../inspections/option/OptionSize.scala | 3 ++- .../inspections/string/ArraysInFormat.scala | 3 ++- .../inspections/string/ArraysToString.scala | 3 ++- .../string/EmptyInterpolatedString.scala | 3 ++- .../string/IllegalFormatString.scala | 3 ++- .../string/IncorrectNumberOfArgsToFormat.scala | 3 ++- .../inspections/string/InvalidRegex.scala | 3 ++- .../string/StripMarginOnRegex.scala | 3 ++- .../inspections/string/SubstringZero.scala | 3 ++- .../string/UnsafeStringContains.scala | 3 ++- .../style/ParameterlessMethodReturnsUnit.scala | 3 ++- .../style/SimplifyBooleanExpression.scala | 3 ++- .../unneccesary/UnnecessaryConversion.scala | 3 ++- .../unneccesary/UnnecessaryIf.scala | 3 ++- .../unneccesary/UnnecessaryReturnUse.scala | 3 ++- .../unneccesary/UnusedMethodParameter.scala | 13 +++++++------ .../unneccesary/VarCouldBeVal.scala | 3 ++- .../unsafe/FinalizerWithoutSuper.scala | 3 ++- .../inspections/unsafe/IsInstanceOf.scala | 6 ++++-- .../scapegoat/inspections/unsafe/TryGet.scala | 3 ++- .../scapegoat/io/HtmlReportWriter.scala | 3 ++- .../scapegoat/io/XmlReportWriter.scala | 3 ++- .../com/sksamuel/scapegoat/ReadmeTest.scala | 8 ++++---- .../equality/ComparingUnrelatedTypesTest.scala | 18 +++++++++--------- 111 files changed, 251 insertions(+), 147 deletions(-) diff --git a/src/main/scala/com/sksamuel/scapegoat/Feedback.scala b/src/main/scala/com/sksamuel/scapegoat/Feedback.scala index 9a154aea..80aa86c4 100644 --- a/src/main/scala/com/sksamuel/scapegoat/Feedback.scala +++ b/src/main/scala/com/sksamuel/scapegoat/Feedback.scala @@ -5,7 +5,8 @@ import scala.reflect.internal.util.Position import scala.tools.nsc.reporters.Reporter /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class Feedback( consoleOutput: Boolean, reporter: Reporter, diff --git a/src/main/scala/com/sksamuel/scapegoat/Level.scala b/src/main/scala/com/sksamuel/scapegoat/Level.scala index 755b8cbc..bcf47a5d 100644 --- a/src/main/scala/com/sksamuel/scapegoat/Level.scala +++ b/src/main/scala/com/sksamuel/scapegoat/Level.scala @@ -1,7 +1,8 @@ package com.sksamuel.scapegoat /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ sealed trait Level object Levels { diff --git a/src/main/scala/com/sksamuel/scapegoat/ScapegoatConfig.scala b/src/main/scala/com/sksamuel/scapegoat/ScapegoatConfig.scala index c553e0d9..a66ea8e0 100644 --- a/src/main/scala/com/sksamuel/scapegoat/ScapegoatConfig.scala +++ b/src/main/scala/com/sksamuel/scapegoat/ScapegoatConfig.scala @@ -19,7 +19,8 @@ import com.sksamuel.scapegoat.inspections.unneccesary._ import com.sksamuel.scapegoat.inspections.unsafe._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ object ScapegoatConfig extends App { def inspections: Seq[Inspection] = diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/AnyUse.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/AnyUse.scala index 058fe096..8b0f08e5 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/AnyUse.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/AnyUse.scala @@ -5,7 +5,8 @@ import scala.reflect.internal.Flags import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class AnyUse extends Inspection( text = "Use of Any", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/AvoidToMinusOne.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/AvoidToMinusOne.scala index fca6dca1..004cb9f3 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/AvoidToMinusOne.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/AvoidToMinusOne.scala @@ -5,7 +5,8 @@ import scala.runtime.{RichInt, RichLong} import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class AvoidToMinusOne extends Inspection( text = "Avoid (j to k - 1)", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/DoubleNegation.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/DoubleNegation.scala index 8e461c41..7a0a8926 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/DoubleNegation.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/DoubleNegation.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class DoubleNegation extends Inspection( text = "Double negation", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/EmptyCaseClass.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/EmptyCaseClass.scala index 0710a077..5a7e2700 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/EmptyCaseClass.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/EmptyCaseClass.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class EmptyCaseClass extends Inspection( text = "Empty case class", @@ -21,8 +22,8 @@ class EmptyCaseClass def accessors(trees: List[Tree]): List[ValDef] = { trees - .collect { - case v: ValDef => v + .collect { case v: ValDef => + v } .filter(_.mods.isCaseAccessor) } diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/LonelySealedTrait.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/LonelySealedTrait.scala index 8ebdee73..b5de82d9 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/LonelySealedTrait.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/LonelySealedTrait.scala @@ -5,7 +5,8 @@ import scala.collection.mutable import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class LonelySealedTrait extends Inspection( text = "Lonely sealed trait", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/MaxParameters.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/MaxParameters.scala index 86834fc8..3df1a2c5 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/MaxParameters.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/MaxParameters.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class MaxParameters extends Inspection( text = "Max parameters", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/NoOpOverride.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/NoOpOverride.scala index a73c590c..ae77bc06 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/NoOpOverride.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/NoOpOverride.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class NoOpOverride extends Inspection( text = "Noop override", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/PublicFinalizer.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/PublicFinalizer.scala index 4b1829e2..405c29d4 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/PublicFinalizer.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/PublicFinalizer.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class PublicFinalizer extends Inspection( text = "PublicFinalizer", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/RedundantFinalModifierOnMethod.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/RedundantFinalModifierOnMethod.scala index cca8d850..f3304cf1 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/RedundantFinalModifierOnMethod.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/RedundantFinalModifierOnMethod.scala @@ -31,10 +31,10 @@ class RedundantFinalModifierOnMethod case DefDef(_, nme.CONSTRUCTOR, _, _, _, _) => case DefDef(mods, _, _, _, _, _) if mods.isFinal && - (tree.symbol.enclClass.isFinal || - tree.symbol.enclClass.isCase || - tree.symbol.enclClass.isModuleOrModuleClass || - tree.symbol.enclClass.isPackageObjectOrClass) => + (tree.symbol.enclClass.isFinal || + tree.symbol.enclClass.isCase || + tree.symbol.enclClass.isModuleOrModuleClass || + tree.symbol.enclClass.isPackageObjectOrClass) => context.warn(tree.pos, self) case _ => continue(tree) } diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/RedundantFinalModifierOnVar.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/RedundantFinalModifierOnVar.scala index b034ba4d..7920c1ec 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/RedundantFinalModifierOnVar.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/RedundantFinalModifierOnVar.scala @@ -22,10 +22,10 @@ class RedundantFinalModifierOnVar tree match { case ValDef(mods, _, _, _) if mods.isFinal && mods.isMutable && - (tree.symbol.enclClass.isFinal || - tree.symbol.enclClass.isCase || - tree.symbol.enclClass.isModuleOrModuleClass || - tree.symbol.enclClass.isPackageObjectOrClass) => + (tree.symbol.enclClass.isFinal || + tree.symbol.enclClass.isCase || + tree.symbol.enclClass.isModuleOrModuleClass || + tree.symbol.enclClass.isPackageObjectOrClass) => context.warn(tree.pos, self) case _ => continue(tree) } diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/TypeShadowing.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/TypeShadowing.scala index 485efec6..84559b93 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/TypeShadowing.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/TypeShadowing.scala @@ -5,7 +5,8 @@ import scala.collection.mutable import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class TypeShadowing extends Inspection( text = "Type shadowing", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/VarClosure.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/VarClosure.scala index ff128755..71412f8e 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/VarClosure.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/VarClosure.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class VarClosure extends Inspection( text = "Var in closure", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ArrayEquals.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ArrayEquals.scala index cee4be1b..dc84ea40 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ArrayEquals.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ArrayEquals.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class ArrayEquals extends Inspection( text = "Array equals", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/AvoidSizeEqualsZero.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/AvoidSizeEqualsZero.scala index e5630811..87dc9fc8 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/AvoidSizeEqualsZero.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/AvoidSizeEqualsZero.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class AvoidSizeEqualsZero extends Inspection( text = "Avoid Traversable.size == 0", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/AvoidSizeNotEqualsZero.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/AvoidSizeNotEqualsZero.scala index fbb59cc7..8676e2c2 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/AvoidSizeNotEqualsZero.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/AvoidSizeNotEqualsZero.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class AvoidSizeNotEqualsZero extends Inspection( text = "Avoid Traversable.size != 0", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/CollectionIndexOnNonIndexedSeq.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/CollectionIndexOnNonIndexedSeq.scala index 16aabfaf..ab723496 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/CollectionIndexOnNonIndexedSeq.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/CollectionIndexOnNonIndexedSeq.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat._ /** - * @author Josh Rosen */ + * @author Josh Rosen + */ class CollectionIndexOnNonIndexedSeq extends Inspection( text = "Use of apply method on a non-indexed Seq", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/CollectionNamingConfusion.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/CollectionNamingConfusion.scala index 21503034..e618c130 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/CollectionNamingConfusion.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/CollectionNamingConfusion.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class CollectionNamingConfusion extends Inspection( text = "Collection naming confusion", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/CollectionNegativeIndex.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/CollectionNegativeIndex.scala index 8c6fd299..90db590a 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/CollectionNegativeIndex.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/CollectionNegativeIndex.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class CollectionNegativeIndex extends Inspection( text = "Collection index out of bounds", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ComparisonToEmptyList.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ComparisonToEmptyList.scala index 937ae551..1468a3fc 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ComparisonToEmptyList.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ComparisonToEmptyList.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class ComparisonToEmptyList extends Inspection( text = "Comparison to empty list", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ComparisonToEmptySet.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ComparisonToEmptySet.scala index dc82ae5e..76801387 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ComparisonToEmptySet.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ComparisonToEmptySet.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class ComparisonToEmptySet extends Inspection( text = "Comparison to empty set", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/DuplicateMapKey.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/DuplicateMapKey.scala index 937524f8..92560d14 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/DuplicateMapKey.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/DuplicateMapKey.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class DuplicateMapKey extends Inspection( text = "Duplicated map key", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/DuplicateSetValue.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/DuplicateSetValue.scala index 07b24230..be37cbfe 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/DuplicateSetValue.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/DuplicateSetValue.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class DuplicateSetValue extends Inspection( text = "Duplicated set value", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ExistsSimplifiableToContains.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ExistsSimplifiableToContains.scala index 637be6ac..4acbef65 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ExistsSimplifiableToContains.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ExistsSimplifiableToContains.scala @@ -56,7 +56,7 @@ class ExistsSimplifiableToContains ) ) if isContainsTraversable(lhs) && doesElementTypeMatch(lhs, x) - && countUsagesOfAVariable(List(subtree), iterationVariable) == 1 => + && countUsagesOfAVariable(List(subtree), iterationVariable) == 1 => context.warn(tree.pos, self, tree.toString.take(500)) case _ => continue(tree) } diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/FilterDotHead.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/FilterDotHead.scala index 44b3f0ef..be7fa5b1 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/FilterDotHead.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/FilterDotHead.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class FilterDotHead extends Inspection( text = "filter().head can throw an exception", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/FilterDotHeadOption.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/FilterDotHeadOption.scala index 9a1fc853..188ce8ce 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/FilterDotHeadOption.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/FilterDotHeadOption.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class FilterDotHeadOption extends Inspection( text = "filter().headOption instead of find()", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/FilterDotIsEmpty.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/FilterDotIsEmpty.scala index d2690f9b..9e4306ca 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/FilterDotIsEmpty.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/FilterDotIsEmpty.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class FilterDotIsEmpty extends Inspection( text = "filter().isEmpty instead of !exists()", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/FilterOptionAndGet.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/FilterOptionAndGet.scala index 4e14a7f8..04f6a0f4 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/FilterOptionAndGet.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/FilterOptionAndGet.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class FilterOptionAndGet extends Inspection( text = "filter(_.isDefined).map(_.get) instead of flatten", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/FindDotIsDefined.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/FindDotIsDefined.scala index 4c34c373..fa112c4b 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/FindDotIsDefined.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/FindDotIsDefined.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class FindDotIsDefined extends Inspection( text = "find().isDefined() instead of exists()", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/JavaConversionsUse.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/JavaConversionsUse.scala index fe675445..300fe264 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/JavaConversionsUse.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/JavaConversionsUse.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class JavaConversionsUse extends Inspection( text = "Java conversions", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ListAppend.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ListAppend.scala index 86442dd6..eedb1a25 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ListAppend.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ListAppend.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class ListAppend extends Inspection( text = "List append is slow", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ListSize.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ListSize.scala index b7e16d66..d46d9c6c 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ListSize.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ListSize.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class ListSize extends Inspection( text = "List.size is O(n)", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/NegationIsEmpty.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/NegationIsEmpty.scala index b19814f7..2700a5aa 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/NegationIsEmpty.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/NegationIsEmpty.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class NegationIsEmpty extends Inspection( text = "!isEmpty can be replaced with nonEmpty", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/NegationNonEmpty.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/NegationNonEmpty.scala index bc0598bb..cf8f888d 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/NegationNonEmpty.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/NegationNonEmpty.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class NegationNonEmpty extends Inspection( text = "!nonEmpty can be replaced with isEmpty", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/NegativeSeqPad.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/NegativeSeqPad.scala index ed3e9514..b1b7651a 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/NegativeSeqPad.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/NegativeSeqPad.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class NegativeSeqPad extends Inspection( text = "Negative seq padTo", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/PredefIterableIsMutable.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/PredefIterableIsMutable.scala index 2cfa80ed..c6442618 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/PredefIterableIsMutable.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/PredefIterableIsMutable.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class PredefIterableIsMutable extends Inspection( text = "Default Iterable is mutable", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/PredefSeqIsMutable.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/PredefSeqIsMutable.scala index 1e6b73fc..f52fac89 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/PredefSeqIsMutable.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/PredefSeqIsMutable.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class PredefSeqIsMutable extends Inspection( text = "Predef.Seq is mutable", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/PredefTraversableIsMutable.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/PredefTraversableIsMutable.scala index f08c2765..9c55bba3 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/PredefTraversableIsMutable.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/PredefTraversableIsMutable.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class PredefTraversableIsMutable extends Inspection( text = "Traversable is mutable", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/PreferSeqEmpty.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/PreferSeqEmpty.scala index a180f202..24c31e3e 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/PreferSeqEmpty.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/PreferSeqEmpty.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class PreferSeqEmpty extends Inspection( text = "Prefer Seq.empty", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/PreferSetEmpty.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/PreferSetEmpty.scala index 28c4c94c..f38346e4 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/PreferSetEmpty.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/PreferSetEmpty.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class PreferSetEmpty extends Inspection( text = "Prefer Set.empty", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ReverseTailReverse.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ReverseTailReverse.scala index b4eed533..fce57feb 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ReverseTailReverse.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ReverseTailReverse.scala @@ -35,8 +35,8 @@ class ReverseTailReverse TermName("reverse") ) if arrayOps0.toString.contains("ArrayOps") - && arrayOps1.toString.contains("ArrayOps") - && arrayOps2.toString.contains("ArrayOps") => + && arrayOps1.toString.contains("ArrayOps") + && arrayOps2.toString.contains("ArrayOps") => context.warn(tree.pos, self, tree.toString.take(500)) case _ => continue(tree) } diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ReverseTakeReverse.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ReverseTakeReverse.scala index 16089886..af6c5568 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ReverseTakeReverse.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/ReverseTakeReverse.scala @@ -40,8 +40,8 @@ class ReverseTakeReverse TermName("reverse") ) if arrayOps0.toString.contains("ArrayOps") - && arrayOps1.toString.contains("ArrayOps") - && arrayOps2.toString.contains("ArrayOps") => + && arrayOps1.toString.contains("ArrayOps") + && arrayOps2.toString.contains("ArrayOps") => context.warn(tree.pos, self, tree.toString.take(500)) case _ => continue(tree) } diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/SwapSortFilter.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/SwapSortFilter.scala index 1fc121fb..8546f4de 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/SwapSortFilter.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/SwapSortFilter.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class SwapSortFilter extends Inspection( text = "Swap sort filter", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/UnsafeContains.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/UnsafeContains.scala index 1f5fbc5a..c61a465c 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/collections/UnsafeContains.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/collections/UnsafeContains.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.collections import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class UnsafeContains extends Inspection( text = "Unsafe contains", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptyFor.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptyFor.scala index b10618ef..363276e4 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptyFor.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptyFor.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.empty import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class EmptyFor extends Inspection( text = "Empty for loop", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptyIfBlock.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptyIfBlock.scala index c67b4313..92b61c9d 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptyIfBlock.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptyIfBlock.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.empty import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class EmptyIfBlock extends Inspection( text = "Empty if expression", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptyMethod.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptyMethod.scala index e056c6b1..a824e145 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptyMethod.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptyMethod.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.empty import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class EmptyMethod extends Inspection( text = "Empty method", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptySynchronizedBlock.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptySynchronizedBlock.scala index 20ba0116..8671e394 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptySynchronizedBlock.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptySynchronizedBlock.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.empty import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class EmptySynchronizedBlock extends Inspection( text = "Empty synchronized block", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptyTryBlock.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptyTryBlock.scala index 9d46b244..a46a8432 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptyTryBlock.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptyTryBlock.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.empty import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class EmptyTryBlock extends Inspection( text = "Empty try block", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptyWhileBlock.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptyWhileBlock.scala index 1542b960..317c96a7 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptyWhileBlock.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/empty/EmptyWhileBlock.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.empty import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class EmptyWhileBlock extends Inspection( text = "Empty while block", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/equality/ComparingFloatingPointTypes.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/equality/ComparingFloatingPointTypes.scala index 1c6028d7..ea929cc6 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/equality/ComparingFloatingPointTypes.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/equality/ComparingFloatingPointTypes.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.equality import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class ComparingFloatingPointTypes extends Inspection( text = "Floating type comparison", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/equality/ComparingUnrelatedTypes.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/equality/ComparingUnrelatedTypes.scala index 0a4f2446..301d4f12 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/equality/ComparingUnrelatedTypes.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/equality/ComparingUnrelatedTypes.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.equality import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class ComparingUnrelatedTypes extends Inspection( text = "Comparing unrelated types", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/equality/ComparisonWithSelf.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/equality/ComparisonWithSelf.scala index febe32e6..15f04ffc 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/equality/ComparisonWithSelf.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/equality/ComparisonWithSelf.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.equality import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class ComparisonWithSelf extends Inspection( text = "Comparision with self", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/exception/CatchException.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/exception/CatchException.scala index 9122c995..ca9d1830 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/exception/CatchException.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/exception/CatchException.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.exception import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Marconi Lanna */ + * @author Marconi Lanna + */ @SuppressWarnings(Array("IncorrectlyNamedExceptions")) class CatchException extends Inspection( diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/exception/CatchFatal.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/exception/CatchFatal.scala index 0fd52a43..f691f917 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/exception/CatchFatal.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/exception/CatchFatal.scala @@ -5,7 +5,8 @@ import scala.util.control.ControlThrowable import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Marconi Lanna */ + * @author Marconi Lanna + */ class CatchFatal extends Inspection( text = "Catch fatal exception", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/exception/CatchNpe.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/exception/CatchNpe.scala index 603dbe19..e7df3a4f 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/exception/CatchNpe.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/exception/CatchNpe.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.exception import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class CatchNpe extends Inspection( text = "Catching NPE", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/exception/CatchThrowable.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/exception/CatchThrowable.scala index cc408cc1..203151f5 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/exception/CatchThrowable.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/exception/CatchThrowable.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.exception import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class CatchThrowable extends Inspection( text = "Catch throwable", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/exception/IncorrectlyNamedExceptions.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/exception/IncorrectlyNamedExceptions.scala index 6069075d..285bb7ef 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/exception/IncorrectlyNamedExceptions.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/exception/IncorrectlyNamedExceptions.scala @@ -28,8 +28,8 @@ class IncorrectlyNamedExceptions case cdef @ ClassDef(_, name, _, impl) => val isNamedException = name.toString.endsWith("Exception") val isAnon = scala.util.Try { - cdef.symbol.isAnonymousClass - } getOrElse false + cdef.symbol.isAnonymousClass + } getOrElse false val extendsException = impl.tpe <:< typeOf[Exception] val selfTypeIsException = impl match { diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/exception/SwallowedException.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/exception/SwallowedException.scala index 1c21be50..6f72c304 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/exception/SwallowedException.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/exception/SwallowedException.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.exception import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ @SuppressWarnings(Array("IncorrectlyNamedExceptions")) class SwallowedException extends Inspection( diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/exception/UnreachableCatch.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/exception/UnreachableCatch.scala index 8beb80dd..2ba29f4c 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/exception/UnreachableCatch.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/exception/UnreachableCatch.scala @@ -5,7 +5,8 @@ import scala.collection.mutable import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class UnreachableCatch extends Inspection( text = "Unreachable catch", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/imports/DuplicateImport.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/imports/DuplicateImport.scala index 281a6bc7..22278289 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/imports/DuplicateImport.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/imports/DuplicateImport.scala @@ -5,7 +5,8 @@ import scala.collection.mutable import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class DuplicateImport extends Inspection( text = "Duplicate import", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/imports/WildcardImport.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/imports/WildcardImport.scala index 876a18fb..9bfbd1b1 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/imports/WildcardImport.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/imports/WildcardImport.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.imports import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class WildcardImport extends Inspection( text = "Wildcard imports", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/inference/BoundedByFinalType.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/inference/BoundedByFinalType.scala index c1aabaaa..4300ea57 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/inference/BoundedByFinalType.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/inference/BoundedByFinalType.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.inference import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class BoundedByFinalType extends Inspection( text = "Bounded by a final type", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/inference/MethodReturningAny.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/inference/MethodReturningAny.scala index 0b4addd0..d10dc94d 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/inference/MethodReturningAny.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/inference/MethodReturningAny.scala @@ -5,7 +5,8 @@ import scala.reflect.internal.Flags import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class MethodReturningAny extends Inspection( text = "Method returning Any", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/inference/PointlessTypeBounds.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/inference/PointlessTypeBounds.scala index 8a0b002a..2bca445c 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/inference/PointlessTypeBounds.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/inference/PointlessTypeBounds.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.inference import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class PointlessTypeBounds extends Inspection( text = "Pointless type bounds", @@ -23,8 +24,9 @@ class PointlessTypeBounds tree match { case TypeDef(_, _, _, rhs) if rhs.tpe.bounds.isEmptyBounds - && rhs.pos != null - && (rhs.pos.lineContent.contains("<: Any") || rhs.pos.lineContent.contains(">: Nothing")) => + && rhs.pos != null + && (rhs.pos.lineContent + .contains("<: Any") || rhs.pos.lineContent.contains(">: Nothing")) => context.warn(tree.pos, self, tree.toString.take(300)) case _ => continue(tree) } diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/inference/ProductWithSerializableInferred.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/inference/ProductWithSerializableInferred.scala index 64618449..5d12b4cc 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/inference/ProductWithSerializableInferred.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/inference/ProductWithSerializableInferred.scala @@ -5,7 +5,8 @@ import scala.reflect.internal.Flags import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class ProductWithSerializableInferred extends Inspection( text = "Product with Serializable inferred", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/matching/PartialFunctionInsteadOfMatch.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/matching/PartialFunctionInsteadOfMatch.scala index 09b8a92b..9332bfe3 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/matching/PartialFunctionInsteadOfMatch.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/matching/PartialFunctionInsteadOfMatch.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.matching import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class PartialFunctionInsteadOfMatch extends Inspection( text = "Match instead of a partial function", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/matching/RepeatedCaseBody.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/matching/RepeatedCaseBody.scala index 796239b6..48568628 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/matching/RepeatedCaseBody.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/matching/RepeatedCaseBody.scala @@ -5,7 +5,8 @@ import scala.collection.mutable import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class RepeatedCaseBody extends Inspection( text = "Repeated case body", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/matching/SuspiciousMatchOnClassObject.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/matching/SuspiciousMatchOnClassObject.scala index 3cded7c4..dc18cd55 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/matching/SuspiciousMatchOnClassObject.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/matching/SuspiciousMatchOnClassObject.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.matching import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class SuspiciousMatchOnClassObject extends Inspection( text = "Suspicious match on class object", @@ -36,9 +37,9 @@ class SuspiciousMatchOnClassObject _ ) // if we have a case object and a companion class, then we are matching on an object instead of a class if pat.symbol != null && - pat.symbol.isModuleOrModuleClass && - pat.tpe.typeSymbol.companionClass.isClass && - !pat.tpe.typeSymbol.companionClass.isAbstractClass => + pat.symbol.isModuleOrModuleClass && + pat.tpe.typeSymbol.companionClass.isClass && + !pat.tpe.typeSymbol.companionClass.isAbstractClass => context.warn(c.pos, self, c.toString.take(500)) true case _ => false diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/math/BigDecimalDoubleConstructor.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/math/BigDecimalDoubleConstructor.scala index 0c9ec92c..751bb46f 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/math/BigDecimalDoubleConstructor.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/math/BigDecimalDoubleConstructor.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.math import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class BigDecimalDoubleConstructor extends Inspection( text = "Big decimal double constructor", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/math/BigDecimalScaleWithoutRoundingMode.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/math/BigDecimalScaleWithoutRoundingMode.scala index 65c8d34a..314a1ec2 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/math/BigDecimalScaleWithoutRoundingMode.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/math/BigDecimalScaleWithoutRoundingMode.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.math import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class BigDecimalScaleWithoutRoundingMode extends Inspection( text = "BigDecimal `setScale()` without rounding mode", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/math/DivideByOne.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/math/DivideByOne.scala index 95a7a8e2..4245edb0 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/math/DivideByOne.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/math/DivideByOne.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.math import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class DivideByOne extends Inspection( text = "Divide by one", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/math/NanComparison.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/math/NanComparison.scala index 1eacef1d..e54e02ea 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/math/NanComparison.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/math/NanComparison.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.math import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class NanComparison extends Inspection( text = "Nan comparison", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/math/UseCbrt.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/math/UseCbrt.scala index 5007d994..0f3d75c2 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/math/UseCbrt.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/math/UseCbrt.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.math import com.sksamuel.scapegoat._ /** - * @author Matic Potočnik */ + * @author Matic Potočnik + */ class UseCbrt extends Inspection( text = "Use cbrt", @@ -25,8 +26,8 @@ class UseCbrt if (pack.symbol.fullNameString == "scala.math.package" || pack.symbol.fullNameString == "java.lang.Math" || pack.symbol.fullNameString == "java.lang.StrictMath") - && third >= 0.3333332 - && third <= 0.3333334 => + && third >= 0.3333332 + && third <= 0.3333334 => context.warn(tree.pos, self) case _ => continue(tree) } diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/math/UseExpM1.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/math/UseExpM1.scala index cb60c208..abff478c 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/math/UseExpM1.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/math/UseExpM1.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.math import com.sksamuel.scapegoat._ /** - * @author Matic Potočnik */ + * @author Matic Potočnik + */ class UseExpM1 extends Inspection( text = "Use expm1", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/math/UseSqrt.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/math/UseSqrt.scala index 8cafc8e4..bc798406 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/math/UseSqrt.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/math/UseSqrt.scala @@ -22,8 +22,8 @@ class UseSqrt tree match { case Apply(Select(pack, TermName("pow")), List(_, Literal(Constant(0.5d)))) if pack.symbol.fullNameString == "scala.math.package" || - pack.symbol.fullNameString == "java.lang.StrictMath" || - pack.symbol.fullNameString == "java.lang.Math" => + pack.symbol.fullNameString == "java.lang.StrictMath" || + pack.symbol.fullNameString == "java.lang.Math" => context.warn(tree.pos, self) case _ => continue(tree) diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/math/ZeroNumerator.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/math/ZeroNumerator.scala index ac17c53d..c9b02ed0 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/math/ZeroNumerator.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/math/ZeroNumerator.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.math import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class ZeroNumerator extends Inspection( text = "Zero numerator", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/naming/ClassNames.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/naming/ClassNames.scala index 48cd83e8..307d776a 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/naming/ClassNames.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/naming/ClassNames.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.naming import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class ClassNames extends Inspection( text = "Class name not recommended", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/naming/MethodNames.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/naming/MethodNames.scala index 158e571a..3d98fc20 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/naming/MethodNames.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/naming/MethodNames.scala @@ -5,7 +5,8 @@ import scala.reflect.internal.Flags import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class MethodNames extends Inspection( text = "Method name not recommended", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/naming/ObjectNames.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/naming/ObjectNames.scala index 691c3a28..ea84126a 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/naming/ObjectNames.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/naming/ObjectNames.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.naming import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class ObjectNames extends Inspection( text = "Object name not recommended", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/nulls/NullAssignment.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/nulls/NullAssignment.scala index 10d350b9..349b7344 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/nulls/NullAssignment.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/nulls/NullAssignment.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.nulls import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class NullAssignment extends Inspection( text = "Null assignment", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/nulls/NullParameter.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/nulls/NullParameter.scala index b957a285..91eb9065 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/nulls/NullParameter.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/nulls/NullParameter.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.nulls import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class NullParameter extends Inspection( text = "Null parameter", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/option/EitherGet.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/option/EitherGet.scala index 5475f4be..03bb1068 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/option/EitherGet.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/option/EitherGet.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.option import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class EitherGet extends Inspection( text = "Use of Either.right or Either.left projection followed by a get", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/option/ImpossibleOptionSizeCondition.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/option/ImpossibleOptionSizeCondition.scala index 6e07721a..19331292 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/option/ImpossibleOptionSizeCondition.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/option/ImpossibleOptionSizeCondition.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.option import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class ImpossibleOptionSizeCondition extends Inspection( text = "Impossible Option.size condition", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/option/OptionGet.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/option/OptionGet.scala index 197f7ede..88551756 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/option/OptionGet.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/option/OptionGet.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.option import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class OptionGet extends Inspection( text = "Use of Option.get", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/option/OptionSize.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/option/OptionSize.scala index f9c17ade..db23ff20 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/option/OptionSize.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/option/OptionSize.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.option import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class OptionSize extends Inspection( text = "Prefer Option.isDefined instead of Option.size", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/string/ArraysInFormat.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/string/ArraysInFormat.scala index 5f59c49f..33b77c44 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/string/ArraysInFormat.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/string/ArraysInFormat.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.string import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class ArraysInFormat extends Inspection( text = "Array passed to String.format", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/string/ArraysToString.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/string/ArraysToString.scala index 655f944d..48ee3edd 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/string/ArraysToString.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/string/ArraysToString.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.string import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class ArraysToString extends Inspection( text = "Use of Array.toString", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/string/EmptyInterpolatedString.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/string/EmptyInterpolatedString.scala index 383b1815..d0ca8347 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/string/EmptyInterpolatedString.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/string/EmptyInterpolatedString.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.string import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class EmptyInterpolatedString extends Inspection( text = "Empty interpolated string", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/string/IllegalFormatString.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/string/IllegalFormatString.scala index 91f1fc46..299bece0 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/string/IllegalFormatString.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/string/IllegalFormatString.scala @@ -5,7 +5,8 @@ import java.util.IllegalFormatException import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class IllegalFormatString extends Inspection( text = "Illegal format string", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/string/IncorrectNumberOfArgsToFormat.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/string/IncorrectNumberOfArgsToFormat.scala index e7dcb772..9fe6f91c 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/string/IncorrectNumberOfArgsToFormat.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/string/IncorrectNumberOfArgsToFormat.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.string import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class IncorrectNumberOfArgsToFormat extends Inspection( text = "Incorrect number of args for format", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/string/InvalidRegex.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/string/InvalidRegex.scala index a845e30c..d3991e17 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/string/InvalidRegex.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/string/InvalidRegex.scala @@ -5,7 +5,8 @@ import java.util.regex.PatternSyntaxException import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class InvalidRegex extends Inspection( text = "Invalid regex", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/string/StripMarginOnRegex.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/string/StripMarginOnRegex.scala index ff79e7ae..2addfa06 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/string/StripMarginOnRegex.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/string/StripMarginOnRegex.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.string import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class StripMarginOnRegex extends Inspection( text = "Strip margin on regex", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/string/SubstringZero.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/string/SubstringZero.scala index f406b8b5..b5367c58 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/string/SubstringZero.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/string/SubstringZero.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.string import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class SubstringZero extends Inspection( text = "String.substring(0)", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/string/UnsafeStringContains.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/string/UnsafeStringContains.scala index 08ba3954..1aca7ca2 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/string/UnsafeStringContains.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/string/UnsafeStringContains.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.string import com.sksamuel.scapegoat._ /** - * @author Zack Grannan */ + * @author Zack Grannan + */ class UnsafeStringContains extends Inspection( text = "Unsafe string contains", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/style/ParameterlessMethodReturnsUnit.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/style/ParameterlessMethodReturnsUnit.scala index daa2814a..1adfb321 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/style/ParameterlessMethodReturnsUnit.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/style/ParameterlessMethodReturnsUnit.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.style import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class ParameterlessMethodReturnsUnit extends Inspection( text = "Parameterless methods returns unit", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/style/SimplifyBooleanExpression.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/style/SimplifyBooleanExpression.scala index d852cef1..8bb31877 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/style/SimplifyBooleanExpression.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/style/SimplifyBooleanExpression.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.style import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class SimplifyBooleanExpression extends Inspection( text = "Simplify boolean expressions", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/unneccesary/UnnecessaryConversion.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/unneccesary/UnnecessaryConversion.scala index bf8362e4..577ea1da 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/unneccesary/UnnecessaryConversion.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/unneccesary/UnnecessaryConversion.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.unneccesary import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class UnnecessaryConversion extends Inspection( text = "Unnecessary conversion", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/unneccesary/UnnecessaryIf.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/unneccesary/UnnecessaryIf.scala index 9c12bbf8..8731309f 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/unneccesary/UnnecessaryIf.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/unneccesary/UnnecessaryIf.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.unneccesary import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class UnnecessaryIf extends Inspection( text = "Unnecessary if condition.", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/unneccesary/UnnecessaryReturnUse.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/unneccesary/UnnecessaryReturnUse.scala index a91edd03..ea960259 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/unneccesary/UnnecessaryReturnUse.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/unneccesary/UnnecessaryReturnUse.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.unneccesary import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class UnnecessaryReturnUse extends Inspection( text = "Unnecessary return", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/unneccesary/UnusedMethodParameter.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/unneccesary/UnusedMethodParameter.scala index b9695e9a..12f8d366 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/unneccesary/UnusedMethodParameter.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/unneccesary/UnusedMethodParameter.scala @@ -5,7 +5,8 @@ import scala.reflect.internal.Flags import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class UnusedMethodParameter extends Inspection( text = "Unused parameter", @@ -96,14 +97,14 @@ class UnusedMethodParameter // ignore overridden methods, the parameter might be used by other classes case DefDef(mods, _, _, _, _, _) if mods.isOverride || - mods.hasFlag(Flags.OVERRIDE) || - (tree.symbol != null && (tree.symbol.isAnyOverride || tree.symbol.isOverridingSymbol)) => + mods.hasFlag(Flags.OVERRIDE) || + (tree.symbol != null && (tree.symbol.isAnyOverride || tree.symbol.isOverridingSymbol)) => // ignore main method case DefDef(_, name, _, List(List(param)), tpt, _) if name.toString == "main" && - param.name.toString == "args" && - tpt.tpe =:= UnitTpe && - param.tpt.tpe =:= typeOf[Array[String]] => + param.name.toString == "args" && + tpt.tpe =:= UnitTpe && + param.tpt.tpe =:= typeOf[Array[String]] => case DefDef(_, _, _, vparamss, _, rhs) => for { vparams <- vparamss diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/unneccesary/VarCouldBeVal.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/unneccesary/VarCouldBeVal.scala index 671e72cc..1a1e5eda 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/unneccesary/VarCouldBeVal.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/unneccesary/VarCouldBeVal.scala @@ -5,7 +5,8 @@ import scala.collection.mutable import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class VarCouldBeVal extends Inspection( text = "Var could be val", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/unsafe/FinalizerWithoutSuper.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/unsafe/FinalizerWithoutSuper.scala index d758ea0c..342d8dc0 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/unsafe/FinalizerWithoutSuper.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/unsafe/FinalizerWithoutSuper.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.unsafe import com.sksamuel.scapegoat.{Inspection, InspectionContext, Inspector, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class FinalizerWithoutSuper extends Inspection( text = "Finalizer without super", diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/unsafe/IsInstanceOf.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/unsafe/IsInstanceOf.scala index 1968956f..35398dcd 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/unsafe/IsInstanceOf.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/unsafe/IsInstanceOf.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.unsafe import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class IsInstanceOf extends Inspection( text = "Use of isInstanceOf", @@ -24,7 +25,8 @@ class IsInstanceOf tree match { case TypeApply(Select(_, TermName("isInstanceOf")), _) => context.warn(tree.pos, self, tree.toString.take(500)) - case DefDef(modifiers, _, _, _, _, _) if modifiers.hasFlag(Flag.SYNTHETIC) => // avoid partial function stuff + case DefDef(modifiers, _, _, _, _, _) + if modifiers.hasFlag(Flag.SYNTHETIC) => // avoid partial function stuff case Match(_, cases) => // ignore selector and process cases cases.foreach(traverse) case _ => continue(tree) diff --git a/src/main/scala/com/sksamuel/scapegoat/inspections/unsafe/TryGet.scala b/src/main/scala/com/sksamuel/scapegoat/inspections/unsafe/TryGet.scala index 1688e52d..d8d793d5 100644 --- a/src/main/scala/com/sksamuel/scapegoat/inspections/unsafe/TryGet.scala +++ b/src/main/scala/com/sksamuel/scapegoat/inspections/unsafe/TryGet.scala @@ -3,7 +3,8 @@ package com.sksamuel.scapegoat.inspections.unsafe import com.sksamuel.scapegoat._ /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ class TryGet extends Inspection( text = "Use of Try.get", diff --git a/src/main/scala/com/sksamuel/scapegoat/io/HtmlReportWriter.scala b/src/main/scala/com/sksamuel/scapegoat/io/HtmlReportWriter.scala index 27958fb0..6ec87b4a 100644 --- a/src/main/scala/com/sksamuel/scapegoat/io/HtmlReportWriter.scala +++ b/src/main/scala/com/sksamuel/scapegoat/io/HtmlReportWriter.scala @@ -5,7 +5,8 @@ import scala.xml.Unparsed import com.sksamuel.scapegoat.{Feedback, Levels} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ object HtmlReportWriter extends ReportWriter { override protected def fileName: String = "scapegoat.html" diff --git a/src/main/scala/com/sksamuel/scapegoat/io/XmlReportWriter.scala b/src/main/scala/com/sksamuel/scapegoat/io/XmlReportWriter.scala index a1fcec2e..4168fa3d 100644 --- a/src/main/scala/com/sksamuel/scapegoat/io/XmlReportWriter.scala +++ b/src/main/scala/com/sksamuel/scapegoat/io/XmlReportWriter.scala @@ -5,7 +5,8 @@ import scala.xml.Node import com.sksamuel.scapegoat.{Feedback, Warning} /** - * @author Stephen Samuel */ + * @author Stephen Samuel + */ object XmlReportWriter extends ReportWriter { override protected val fileName = "scapegoat.xml" diff --git a/src/test/scala/com/sksamuel/scapegoat/ReadmeTest.scala b/src/test/scala/com/sksamuel/scapegoat/ReadmeTest.scala index 8ee5001c..5168423e 100644 --- a/src/test/scala/com/sksamuel/scapegoat/ReadmeTest.scala +++ b/src/test/scala/com/sksamuel/scapegoat/ReadmeTest.scala @@ -19,8 +19,8 @@ class ReadmeTest extends AnyFreeSpec with Matchers { .drop(1) .takeWhile(l => l.trim.nonEmpty) .map(_.split("\\|")) - .collect { - case Array(_, className, _, level) => className.trim -> level.trim + .collect { case Array(_, className, _, level) => + className.trim -> level.trim } val inspectionNamesAndLevels = @@ -45,8 +45,8 @@ class ReadmeTest extends AnyFreeSpec with Matchers { "should have correct number of inspections" in { val Pattern = raw"There are currently (\d+?) inspections.*".r - readme.collect { - case Pattern(n) => n.toInt shouldBe inspectionNamesAndLevels.size + readme.collect { case Pattern(n) => + n.toInt shouldBe inspectionNamesAndLevels.size } } } diff --git a/src/test/scala/com/sksamuel/scapegoat/inspections/equality/ComparingUnrelatedTypesTest.scala b/src/test/scala/com/sksamuel/scapegoat/inspections/equality/ComparingUnrelatedTypesTest.scala index 6d4e9b73..ee027ec4 100644 --- a/src/test/scala/com/sksamuel/scapegoat/inspections/equality/ComparingUnrelatedTypesTest.scala +++ b/src/test/scala/com/sksamuel/scapegoat/inspections/equality/ComparingUnrelatedTypesTest.scala @@ -46,13 +46,13 @@ class ComparingUnrelatedTypesTest extends InspectionTest { } "should not report warning" - { "for zero" - { - "compared to long" in { verifyNoWarnings("""object A { val l = 100l; val b = 0 == l }""") } - "compared to double" in { verifyNoWarnings("""object A { val d = 100d; val b = 0 == d }""") } - "compared to float" in { verifyNoWarnings("""object A { val f = 100f; val b = 0 == f }""") } + "compared to long" in verifyNoWarnings("""object A { val l = 100l; val b = 0 == l }""") + "compared to double" in verifyNoWarnings("""object A { val d = 100d; val b = 0 == d }""") + "compared to float" in verifyNoWarnings("""object A { val f = 100f; val b = 0 == f }""") } "for long" - { - "compared to zero" in { verifyNoWarnings("""object A { val l = 100l; val b = l == 0 }""") } - "compared to int literal" in { verifyNoWarnings("""object A { val l = 100l; val b = l == 100 }""") } + "compared to zero" in verifyNoWarnings("""object A { val l = 100l; val b = l == 0 }""") + "compared to int literal" in verifyNoWarnings("""object A { val l = 100l; val b = l == 100 }""") } "for char" - { "compared to char-sized long literal" in { @@ -68,10 +68,10 @@ class ComparingUnrelatedTypesTest extends InspectionTest { } } "for double" - { - "compared to zero" in { verifyNoWarnings("""object A { val d = 100d; val b = d == 0 }""") } + "compared to zero" in verifyNoWarnings("""object A { val d = 100d; val b = d == 0 }""") } "for float" - { - "compared to zero" in { verifyNoWarnings("""object A { val f = 100f; val b = f == 0 }""") } + "compared to zero" in verifyNoWarnings("""object A { val f = 100f; val b = f == 0 }""") } "for same enum values" in { val code = """object Main { @@ -88,8 +88,8 @@ class ComparingUnrelatedTypesTest extends InspectionTest { compiler.scapegoat.feedback.warnings.size shouldBe 0 } "for isSize comparison" - { - "equality check" in { verifyNoWarnings("""object A { val b = Seq("a", "b").sizeIs == 2 }""") } - "inequality check" in { verifyNoWarnings("""object A { val b = Seq("a", "b").sizeIs != 2 }""") } + "equality check" in verifyNoWarnings("""object A { val b = Seq("a", "b").sizeIs == 2 }""") + "inequality check" in verifyNoWarnings("""object A { val b = Seq("a", "b").sizeIs != 2 }""") } "singleton types" - { "sealed trait hierarchy match if guard" in {