Skip to content

Commit

Permalink
Modified ArraysEqual and ComparingFloatingPointTypes names
Browse files Browse the repository at this point in the history
  • Loading branch information
t1b00 committed Sep 12, 2024
1 parent 3b5a8f8 commit 0e74b89
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 76 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/*
rule = ArraysEquals
rule = ArrayEquals
*/
package fix

object ArraysEquals {
object ArrayEquals {
def test(): Unit = {
val a = Array(1, 2, 3)
val b = Array(1, 2, 3)
println(a == b) // assert: ArraysEquals
println(a != b) // assert: ArraysEquals
println(a == b) // assert: ArrayEquals
println(a != b) // assert: ArrayEquals

println(Array(1, 2, 3) == Array(1, 2, 3)) // assert: ArraysEquals
println(Array(1, 2, 3) != Array(1, 2, 3)) // assert: ArraysEquals
println(Array(1, 2, 3) == Array(1, 2, 3)) // assert: ArrayEquals
println(Array(1, 2, 3) != Array(1, 2, 3)) // assert: ArrayEquals

// Null comparison shouldn't lead to warnings
println(a != null) // scalafix: ok;
Expand Down
27 changes: 27 additions & 0 deletions input/src/main/scala/fix/ComparingFloatingPointTypes.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
rule = ComparingFloatingPointTypes
*/
package fix

object ComparingFloatingPointTypes {
def test(): Unit = {
val f1 = 1.46456f
val f2 = 1.46456f
if (f1 == f2) { // assert: ComparingFloatingPointTypes
print("Equal!")
} else {
print("Not equal")
}
val d1 = 1.546456
val d2 = 1.546456
if (d1 == d2) { // assert: ComparingFloatingPointTypes
print("Equal!")
} else {
print("Not equal!")
}
f1 == d1 // assert: ComparingFloatingPointTypes
f1.equals(f2) // assert: ComparingFloatingPointTypes
d1.equals(d2) // assert: ComparingFloatingPointTypes
}

}
27 changes: 0 additions & 27 deletions input/src/main/scala/fix/ComparingFloatingTypes.scala

This file was deleted.

78 changes: 39 additions & 39 deletions rules/src/main/resources/META-INF/services/scalafix.v1.Rule
Original file line number Diff line number Diff line change
@@ -1,70 +1,70 @@
fix.ArrayEquals
fix.ArraysInFormat
fix.CatchNpe
fix.ComparingFloatingTypes
fix.EmptyInterpolatedString
fix.ImpossibleOptionSizeCondition
fix.IllegalFormatString
fix.IncorrectNumberOfArgsToFormat
fix.IncorrectlyNamedExceptions
fix.LonelySealedTrait
fix.MapGetAndGetOrElse
fix.NanComparison
fix.OptionGet
fix.OptionSize
fix.StripMarginOnRegex
fix.TryGet
fix.UnsafeTraversableMethods
fix.UnsafeContains
fix.UnsafeStringContains
fix.ArraysToString
fix.AsInstanceOf
fix.AvoidSizeEqualsZero
fix.AvoidSizeNotEqualsZero
fix.AvoidToMinusOne
fix.BigDecimalDoubleConstructor
fix.BigDecimalScaleWithoutRoundingMode
fix.BooleanParameter
fix.BoundedByFinalType
fix.BrokenOddness
fix.CatchException
fix.CatchExceptionImmediatelyRethrown
fix.CatchFatal
fix.CatchNpe
fix.CatchThrowable
fix.ClassNames
fix.CollectionIndexOnNonIndexedSeq
fix.CollectionNamingConfusion
fix.CollectionNegativeIndex
fix.CollectionPromotionToAny
fix.ComparingFloatingPointTypes
fix.ComparisonToEmptyList
fix.ComparisonToEmptySet
fix.ComparisonWithSelf
fix.ConstantIf
fix.DivideByOne
fix.DoubleNegation
fix.DuplicateImport
fix.DuplicateMapKey
fix.DuplicateSetValue
fix.EitherGet
fix.EmptyCaseClass
fix.EmptyFor
fix.EmptyIfBlock
fix.EmptyInterpolatedString
fix.EmptyMethod
fix.EmptySynchronizedBlock
fix.EmptyTryBlock
fix.EmptyWhileBlock
fix.FinalizerWithoutSuper
fix.IllegalFormatString
fix.ImpossibleOptionSizeCondition
fix.IncorrectNumberOfArgsToFormat
fix.IncorrectlyNamedExceptions
fix.InterpolationToString
fix.LonelySealedTrait
fix.LooksLikeInterpolatedString
fix.MapGetAndGetOrElse
fix.MethodReturningAny
fix.NanComparison
fix.NullAssignment
fix.NullParameter
fix.OptionGet
fix.OptionSize
fix.RepeatedCaseBody
fix.RepeatedIfElseBody
fix.StripMarginOnRegex
fix.SwallowedException
fix.TryGet
fix.UnnecessaryConversion
fix.UnreachableCatch
fix.UnsafeContains
fix.UnsafeStringContains
fix.UnsafeTraversableMethods
fix.UnusedMethodParameter
fix.VarCouldBeVal
fix.VariableShadowing
fix.WhileTrue
fix.InterpolationToString
fix.EitherGet
fix.NullParameter
fix.ArraysEquals
fix.ArraysToString
fix.AsInstanceOf
fix.AvoidToMinusOne
fix.BigDecimalDoubleConstructor
fix.BigDecimalScaleWithoutRoundingMode
fix.BooleanParameter
fix.BoundedByFinalType
fix.BrokenOddness
fix.ClassNames
fix.CollectionNamingConfusion
fix.ComparisonToEmptyList
fix.ComparisonToEmptySet
fix.DivideByOne
fix.DoubleNegation
fix.DuplicateMapKey
fix.DuplicateSetValue
fix.EmptyCaseClass
fix.WhileTrue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
rule = ArraysEquals
rule = ArrayEquals
*/
package fix

Expand All @@ -8,7 +8,7 @@ import scalafix.v1._

import scala.meta._

class ArraysEquals extends SemanticRule("ArraysEquals") {
class ArrayEquals extends SemanticRule("ArrayEquals") {

private def diag(pos: Position) = Diagnostic(
"",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
rule = ComparingFloatingTypes
rule = ComparingFloatingPointTypes
*/
package fix

Expand All @@ -8,7 +8,7 @@ import scalafix.lint.LintSeverity
import scala.meta._
import scalafix.v1._

class ComparingFloatingTypes extends SemanticRule("ComparingFloatingTypes") {
class ComparingFloatingPointTypes extends SemanticRule("ComparingFloatingPointTypes") {

private def diag(pos: Position) = Diagnostic(
"",
Expand Down

0 comments on commit 0e74b89

Please sign in to comment.