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

Adding InspectionTest as a superclass for all inspection tests #332

Merged
merged 1 commit into from
Mar 30, 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
7 changes: 7 additions & 0 deletions src/test/scala/com/sksamuel/scapegoat/InspectionTest.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.sksamuel.scapegoat

import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers

abstract class InspectionTest extends AnyFreeSpec with Matchers with PluginRunner with OneInstancePerTest {}
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package com.sksamuel.scapegoat.inspections

import com.sksamuel.scapegoat.PluginRunner
import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers
import com.sksamuel.scapegoat.InspectionTest

/** @author Stephen Samuel */
class AnyUseTest extends AnyFreeSpec with Matchers with PluginRunner with OneInstancePerTest {
class AnyUseTest extends InspectionTest {

override val inspections = Seq(new AnyUse)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package com.sksamuel.scapegoat.inspections

import com.sksamuel.scapegoat.PluginRunner
import com.sksamuel.scapegoat.InspectionTest
import com.sksamuel.scapegoat.inspections.unsafe.AsInstanceOf
import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers

class AsInstanceOfTest extends AnyFreeSpec with Matchers with PluginRunner with OneInstancePerTest {
class AsInstanceOfTest extends InspectionTest {

override val inspections = Seq(new AsInstanceOf)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package com.sksamuel.scapegoat.inspections

import com.sksamuel.scapegoat.PluginRunner
import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers
import com.sksamuel.scapegoat.InspectionTest

/** @author Stephen Samuel */
class AvoidToMinusOneTest extends AnyFreeSpec with Matchers with PluginRunner with OneInstancePerTest {
class AvoidToMinusOneTest extends InspectionTest {

override val inspections = Seq(new AvoidToMinusOne)

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package com.sksamuel.scapegoat.inspections

import com.sksamuel.scapegoat.PluginRunner
import com.sksamuel.scapegoat.InspectionTest
import com.sksamuel.scapegoat.inspections.unneccesary.ConstantIf
import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers

/** @author Stephen Samuel */
class ConstantIfTest extends AnyFreeSpec with Matchers with PluginRunner with OneInstancePerTest {
class ConstantIfTest extends InspectionTest {

override val inspections = Seq(new ConstantIf)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package com.sksamuel.scapegoat.inspections

import com.sksamuel.scapegoat.PluginRunner
import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers
import com.sksamuel.scapegoat.InspectionTest

/** @author Stephen Samuel */
class DoubleNegationTest extends AnyFreeSpec with Matchers with PluginRunner with OneInstancePerTest {
class DoubleNegationTest extends InspectionTest {

override val inspections = Seq(new DoubleNegation)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.sksamuel.scapegoat.inspections

import com.sksamuel.scapegoat.PluginRunner
import com.sksamuel.scapegoat.InspectionTest
import com.sksamuel.scapegoat.inspections.option.EitherGet
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers

class EitherGetTest extends AnyFreeSpec with Matchers with PluginRunner {
class EitherGetTest extends InspectionTest {

override val inspections = Seq(new EitherGet)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
package com.sksamuel.scapegoat.inspections

import com.sksamuel.scapegoat.PluginRunner
import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers

class FinalModifierOnCaseClassTest
extends AnyFreeSpec
with Matchers
with PluginRunner
with OneInstancePerTest {
import com.sksamuel.scapegoat.InspectionTest
class FinalModifierOnCaseClassTest extends InspectionTest {

override val inspections = Seq(new FinalModifierOnCaseClass)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package com.sksamuel.scapegoat.inspections

import com.sksamuel.scapegoat.PluginRunner
import com.sksamuel.scapegoat.InspectionTest
import com.sksamuel.scapegoat.inspections.unsafe.FinalizerWithoutSuper
import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers

/** @author Stephen Samuel */
class FinalizerWithoutSuperTest extends AnyFreeSpec with Matchers with PluginRunner with OneInstancePerTest {
class FinalizerWithoutSuperTest extends InspectionTest {

override val inspections = Seq(new FinalizerWithoutSuper)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package com.sksamuel.scapegoat.inspections

import com.sksamuel.scapegoat.PluginRunner
import com.sksamuel.scapegoat.InspectionTest
import com.sksamuel.scapegoat.inspections.unsafe.IsInstanceOf
import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers

/** @author Stephen Samuel */
class IsInstanceOfTest extends AnyFreeSpec with Matchers with PluginRunner with OneInstancePerTest {
class IsInstanceOfTest extends InspectionTest {

override val inspections = Seq(new IsInstanceOf)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package com.sksamuel.scapegoat.inspections

import com.sksamuel.scapegoat.PluginRunner
import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers
import com.sksamuel.scapegoat.InspectionTest

/** @author Stephen Samuel */
class LonelySealedTraitTest extends AnyFreeSpec with Matchers with PluginRunner with OneInstancePerTest {
class LonelySealedTraitTest extends InspectionTest {

override val inspections = Seq(new LonelySealedTrait)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package com.sksamuel.scapegoat.inspections

import com.sksamuel.scapegoat.PluginRunner
import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers

class MaxParameterTest extends AnyFreeSpec with Matchers with PluginRunner with OneInstancePerTest {
import com.sksamuel.scapegoat.InspectionTest
class MaxParameterTest extends InspectionTest {

override val inspections = Seq(new MaxParameters)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package com.sksamuel.scapegoat.inspections

import com.sksamuel.scapegoat.PluginRunner
import com.sksamuel.scapegoat.InspectionTest
import com.sksamuel.scapegoat.inspections.inference.MethodReturningAny
import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers

/** @author Stephen Samuel */
class MethodReturningAnyTest extends AnyFreeSpec with Matchers with PluginRunner with OneInstancePerTest {
class MethodReturningAnyTest extends InspectionTest {

override val inspections = Seq(new MethodReturningAny)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package com.sksamuel.scapegoat.inspections

import com.sksamuel.scapegoat.PluginRunner
import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers
import com.sksamuel.scapegoat.InspectionTest

/** @author Stephen Samuel */
class PublicFinalizerTest extends AnyFreeSpec with Matchers with PluginRunner with OneInstancePerTest {
class PublicFinalizerTest extends InspectionTest {

override val inspections = Seq(new PublicFinalizer)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
package com.sksamuel.scapegoat.inspections

import com.sksamuel.scapegoat.PluginRunner
import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers
import com.sksamuel.scapegoat.InspectionTest

/** @author Stephen Samuel */
class RedundantFinalModifierOnMethodTest
extends AnyFreeSpec
with Matchers
with PluginRunner
with OneInstancePerTest {
class RedundantFinalModifierOnMethodTest extends InspectionTest {

override val inspections = Seq(new RedundantFinalModifierOnMethod)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
package com.sksamuel.scapegoat.inspections

import com.sksamuel.scapegoat.PluginRunner
import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers
import com.sksamuel.scapegoat.InspectionTest

/** @author Stephen Samuel */
class RedundantFinalModifierOnVarTest
extends AnyFreeSpec
with Matchers
with PluginRunner
with OneInstancePerTest {
class RedundantFinalModifierOnVarTest extends InspectionTest {

override val inspections = Seq(new RedundantFinalModifierOnVar)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
package com.sksamuel.scapegoat.inspections

import com.sksamuel.scapegoat.PluginRunner
import com.sksamuel.scapegoat.InspectionTest
import com.sksamuel.scapegoat.inspections.unsafe.TryGet
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers

/** @author Stephen Samuel */
class TryGetTest extends AnyFreeSpec with PluginRunner with Matchers {
class TryGetTest extends InspectionTest {

override val inspections = Seq(new TryGet)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package com.sksamuel.scapegoat.inspections

import com.sksamuel.scapegoat.PluginRunner
import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers
import com.sksamuel.scapegoat.InspectionTest

/** @author Stephen Samuel */
class TypeShadowingTest extends AnyFreeSpec with Matchers with PluginRunner with OneInstancePerTest {
class TypeShadowingTest extends InspectionTest {

override val inspections = Seq(new TypeShadowing)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package com.sksamuel.scapegoat.inspections

import com.sksamuel.scapegoat.PluginRunner
import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers
import com.sksamuel.scapegoat.InspectionTest

/** @author Stephen Samuel */
class VarClosureTest extends AnyFreeSpec with Matchers with PluginRunner with OneInstancePerTest {
class VarClosureTest extends InspectionTest {

override val inspections = Seq(new VarClosure)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package com.sksamuel.scapegoat.inspections

import com.sksamuel.scapegoat.PluginRunner
import com.sksamuel.scapegoat.InspectionTest
import com.sksamuel.scapegoat.inspections.unneccesary.VarCouldBeVal
import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers

class VarCouldBeValTest extends AnyFreeSpec with Matchers with PluginRunner with OneInstancePerTest {
class VarCouldBeValTest extends InspectionTest {

override val inspections = Seq(new VarCouldBeVal)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package com.sksamuel.scapegoat.inspections

import com.sksamuel.scapegoat.PluginRunner
import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers

class VarUseTest extends AnyFreeSpec with Matchers with PluginRunner with OneInstancePerTest {
import com.sksamuel.scapegoat.InspectionTest
class VarUseTest extends InspectionTest {

override val inspections = Seq(new VarUse)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package com.sksamuel.scapegoat.inspections

import com.sksamuel.scapegoat.PluginRunner
import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers
import com.sksamuel.scapegoat.InspectionTest

/** @author Stephen Samuel */
class VariableShadowingTest extends AnyFreeSpec with Matchers with PluginRunner with OneInstancePerTest {
class VariableShadowingTest extends InspectionTest {

override val inspections = Seq(new VariableShadowing)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package com.sksamuel.scapegoat.inspections

import com.sksamuel.scapegoat.PluginRunner
import com.sksamuel.scapegoat.InspectionTest
import com.sksamuel.scapegoat.inspections.controlflow.WhileTrue
import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers

/** @author Stephen Samuel */
class WhileTrueTest extends AnyFreeSpec with Matchers with PluginRunner with OneInstancePerTest {
class WhileTrueTest extends InspectionTest {

override val inspections = Seq(new WhileTrue)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package com.sksamuel.scapegoat.inspections.collections

import com.sksamuel.scapegoat.PluginRunner
import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers
import com.sksamuel.scapegoat.InspectionTest

/** @author Stephen Samuel */
class ArrayEqualsTest extends AnyFreeSpec with Matchers with PluginRunner with OneInstancePerTest {
class ArrayEqualsTest extends InspectionTest {

override val inspections = Seq(new ArrayEquals)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package com.sksamuel.scapegoat.inspections.collections

import com.sksamuel.scapegoat.PluginRunner
import org.scalatest.OneInstancePerTest
import org.scalatest.freespec.AnyFreeSpec
import org.scalatest.matchers.should.Matchers
import com.sksamuel.scapegoat.InspectionTest

/** @author Stephen Samuel */
class AvoidSizeEqualsZeroTest extends AnyFreeSpec with Matchers with PluginRunner with OneInstancePerTest {
class AvoidSizeEqualsZeroTest extends InspectionTest {

override val inspections = Seq(new AvoidSizeEqualsZero)

Expand Down
Loading