Skip to content

Commit 2bfd744

Browse files
committed
Cleanup ScalaStyle things
1 parent cb67f35 commit 2bfd744

File tree

19 files changed

+11
-50
lines changed

19 files changed

+11
-50
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ To build Cats you should have
105105
* `console`: launch a REPL
106106
* `test`: run the tests
107107
* `unidoc`: generate the documentation
108-
* `scalastyle`: run the style-checker on the code
108+
* `fmt`: run formatting of the code
109109
* `validate`: run tests, style-checker, and doc generation
110110

111111
#### Scala and Scala.js

core/src/main/scala/cats/Eval.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ final class Later[A](f: () => A) extends Eval.Leaf[A] {
146146
// expensive to store, consider using `Always`.)
147147
lazy val value: A = {
148148
val result = thunk()
149-
thunk = null // scalastyle:off
149+
thunk = null
150150
result
151151
}
152152

core/src/main/scala/cats/data/Chain.scala

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ sealed abstract class Chain[+A] {
2222
this match {
2323
case non: Chain.NonEmpty[A] =>
2424
var c: NonEmpty[A] = non
25-
// scalastyle:off null
2625
var rights: Chain.NonEmpty[A] = null
2726
var result: (A, Chain[A]) = null
2827
while (result eq null) {
@@ -50,7 +49,6 @@ sealed abstract class Chain[+A] {
5049
result = (seq.head, next)
5150
}
5251
}
53-
// scalastyle:on null
5452
Some(result)
5553
case _ => None
5654
}
@@ -62,7 +60,6 @@ sealed abstract class Chain[+A] {
6260
this match {
6361
case non: Chain.NonEmpty[A] =>
6462
var c: NonEmpty[A] = non
65-
// scalastyle:off null
6663
var lefts: NonEmpty[A] = null
6764
var result: (Chain[A], A) = null
6865
while (result eq null) {
@@ -90,7 +87,6 @@ sealed abstract class Chain[+A] {
9087
result = (pre, seq.last)
9188
}
9289
}
93-
// scalastyle:on null
9490
Some(result)
9591
case _ => None
9692
}
@@ -491,7 +487,6 @@ sealed abstract class Chain[+A] {
491487
/**
492488
* Applies the supplied function to each element, left to right, but stops when true is returned
493489
*/
494-
// scalastyle:off null return cyclomatic.complexity
495490
final private def foreachUntil(f: A => Boolean): Unit =
496491
this match {
497492
case non: Chain.NonEmpty[A] =>
@@ -531,7 +526,6 @@ sealed abstract class Chain[+A] {
531526
}
532527
case _ => ()
533528
}
534-
// scalastyle:on null return cyclomatic.complexity
535529

536530
final def iterator: Iterator[A] =
537531
this match {
@@ -599,9 +593,7 @@ sealed abstract class Chain[+A] {
599593
val iterX = iterator
600594
val iterY = that.iterator
601595
while (iterX.hasNext && iterY.hasNext) {
602-
// scalastyle:off return
603596
if (!A.eqv(iterX.next(), iterY.next())) return false
604-
// scalastyle:on return
605597
}
606598

607599
iterX.hasNext == iterY.hasNext
@@ -877,7 +869,6 @@ object Chain extends ChainInstances {
877869
loop(0, as.size).value
878870
}
879871

880-
// scalastyle:off null
881872
private class ChainIterator[A](self: NonEmpty[A]) extends Iterator[A] {
882873
def this(chain: Chain[A]) =
883874
this(chain match {
@@ -930,9 +921,7 @@ object Chain extends ChainInstances {
930921
go
931922
}
932923
}
933-
// scalastyle:on null
934924

935-
// scalastyle:off null
936925
private class ChainReverseIterator[A](self: NonEmpty[A]) extends Iterator[A] {
937926
def this(chain: Chain[A]) =
938927
this(chain match {
@@ -985,7 +974,6 @@ object Chain extends ChainInstances {
985974
go
986975
}
987976
}
988-
// scalastyle:on null
989977
}
990978

991979
sealed abstract private[data] class ChainInstances extends ChainInstances1 {
@@ -1109,9 +1097,7 @@ sealed abstract private[data] class ChainInstances extends ChainInstances1 {
11091097
val iterY = y.iterator
11101098
while (iterX.hasNext && iterY.hasNext) {
11111099
val n = A0.compare(iterX.next(), iterY.next())
1112-
// scalastyle:off return
11131100
if (n != 0) return n
1114-
// scalastyle:on return
11151101
}
11161102

11171103
if (iterX.hasNext) 1
@@ -1184,9 +1170,7 @@ private[data] trait ChainPartialOrder[A] extends PartialOrder[Chain[A]] {
11841170
val iterY = y.iterator
11851171
while (iterX.hasNext && iterY.hasNext) {
11861172
val n = A.partialCompare(iterX.next(), iterY.next())
1187-
// scalastyle:off return
11881173
if (n != 0.0) return n
1189-
// scalastyle:on return
11901174
}
11911175

11921176
if (iterX.hasNext) 1.0

core/src/main/scala/cats/data/Ior.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,6 @@ sealed abstract class Ior[+A, +B] extends Product with Serializable {
730730
* res3: Ior[String, Int] = Both(abc,579)
731731
* }}}
732732
*/
733-
// scalastyle:off cyclomatic.complexity
734733
final def combine[AA >: A, BB >: B](that: AA Ior BB)(implicit AA: Semigroup[AA], BB: Semigroup[BB]): AA Ior BB =
735734
this match {
736735
case Ior.Left(a1) =>
@@ -752,7 +751,6 @@ sealed abstract class Ior[+A, +B] extends Product with Serializable {
752751
case Ior.Both(a2, b2) => Ior.Both(AA.combine(a1, a2), BB.combine(b1, b2))
753752
}
754753
}
755-
// scalastyle:on cyclomatic.complexity
756754

757755
final def ===[AA >: A, BB >: B](that: AA Ior BB)(implicit AA: Eq[AA], BB: Eq[BB]): Boolean =
758756
fold(
@@ -883,7 +881,6 @@ sealed abstract private[data] class IorInstances extends IorInstances0 {
883881
override def bimap[A, B, C, D](fab: A Ior B)(f: A => C, g: B => D): C Ior D = fab.bimap(f, g)
884882
}
885883

886-
// scalastyle:off cyclomatic.complexity
887884
implicit def catsDataParallelForIor[E](implicit E: Semigroup[E]): Parallel.Aux[Ior[E, *], Ior[E, *]] =
888885
new Parallel[Ior[E, *]] {
889886
type F[x] = Ior[E, x]
@@ -920,7 +917,6 @@ sealed abstract private[data] class IorInstances extends IorInstances0 {
920917

921918
lazy val monad: Monad[Ior[E, *]] = Monad[Ior[E, *]]
922919
}
923-
// scalastyle:on cyclomatic.complexity
924920

925921
}
926922

core/src/main/scala/cats/data/Validated.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,6 @@ sealed abstract private[data] class ValidatedInstances2 {
970970
def eqv(x: Validated[A, B], y: Validated[A, B]): Boolean = x === y
971971
}
972972

973-
// scalastyle:off method.length
974973
implicit def catsDataTraverseFunctorForValidated[E]: Traverse[Validated[E, *]] =
975974
new Traverse[Validated[E, *]] {
976975

@@ -1032,7 +1031,6 @@ sealed abstract private[data] class ValidatedInstances2 {
10321031

10331032
override def isEmpty[A](fa: Validated[E, A]): Boolean = fa.isInvalid
10341033
}
1035-
// scalastyle:off method.length
10361034
}
10371035

10381036
private[data] class ValidatedApplicative[E: Semigroup] extends CommutativeApplicative[Validated[E, *]] {

core/src/main/scala/cats/instances/either.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ trait EitherInstances extends cats.kernel.instances.EitherInstances {
3535
}
3636
}
3737

38-
// scalastyle:off method.length
3938
implicit def catsStdInstancesForEither[A]
4039
: MonadError[Either[A, *], A] with Traverse[Either[A, *]] with Align[Either[A, *]] =
4140
new MonadError[Either[A, *], A] with Traverse[Either[A, *]] with Align[Either[A, *]] {
@@ -177,7 +176,6 @@ trait EitherInstances extends cats.kernel.instances.EitherInstances {
177176
}
178177

179178
}
180-
// scalastyle:on method.length
181179

182180
implicit def catsStdSemigroupKForEither[L]: SemigroupK[Either[L, *]] =
183181
new SemigroupK[Either[L, *]] {

core/src/main/scala/cats/instances/map.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ trait MapInstances extends cats.kernel.instances.MapInstances {
1818
.mkString("Map(", ", ", ")")
1919
}
2020

21-
// scalastyle:off method.length
2221
implicit def catsStdInstancesForMap[K]: UnorderedTraverse[Map[K, *]] with FlatMap[Map[K, *]] with Align[Map[K, *]] =
2322
new UnorderedTraverse[Map[K, *]] with FlatMap[Map[K, *]] with Align[Map[K, *]] {
2423

@@ -110,7 +109,6 @@ trait MapInstances extends cats.kernel.instances.MapInstances {
110109
.result()
111110
}
112111
}
113-
// scalastyle:on method.length
114112

115113
}
116114

core/src/main/scala/cats/instances/sortedMap.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ trait SortedMapInstances extends SortedMapInstances2 {
2727
implicit def catsStdShowForSortedMap[A, B](orderA: Order[A], showA: Show[A], showB: Show[B]): Show[SortedMap[A, B]] =
2828
catsStdShowForSortedMap(showA, showB)
2929

30-
// scalastyle:off method.length
3130
implicit def catsStdInstancesForSortedMap[K]
3231
: Traverse[SortedMap[K, *]] with FlatMap[SortedMap[K, *]] with Align[SortedMap[K, *]] =
3332
new Traverse[SortedMap[K, *]] with FlatMap[SortedMap[K, *]] with Align[SortedMap[K, *]] {

core/src/main/scala/cats/instances/try.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import scala.annotation.tailrec
99

1010
trait TryInstances extends TryInstances1 {
1111

12-
// scalastyle:off method.length
1312
implicit def catsStdInstancesForTry: MonadThrow[Try] with CoflatMap[Try] with Traverse[Try] with Monad[Try] =
1413
new TryCoflatMap with MonadThrow[Try] with Traverse[Try] with Monad[Try] {
1514
def pure[A](x: A): Try[A] = Success(x)
@@ -143,7 +142,6 @@ trait TryInstances extends TryInstances1 {
143142

144143
override def catchNonFatalEval[A](a: Eval[A])(implicit ev: Throwable <:< Throwable): Try[A] = Try(a.value)
145144
}
146-
// scalastyle:on method.length
147145

148146
implicit def catsStdShowForTry[A](implicit A: Show[A]): Show[Try[A]] =
149147
new Show[Try[A]] {

core/src/main/scala/cats/syntax/either.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ trait EitherSyntax {
1111
implicit final def catsSyntaxEither[A, B](eab: Either[A, B]): EitherOps[A, B] = new EitherOps(eab)
1212

1313
implicit final def catsSyntaxEitherObject(either: Either.type): EitherObjectOps =
14-
new EitherObjectOps(either) // scalastyle:off ensure.single.space.after.token
14+
new EitherObjectOps(either)
1515

1616
implicit final def catsSyntaxLeft[A, B](left: Left[A, B]): LeftOps[A, B] = new LeftOps(left)
1717

@@ -334,7 +334,7 @@ final class EitherOps[A, B](private val eab: Either[A, B]) extends AnyVal {
334334
def liftTo[F[_]](implicit F: ApplicativeError[F, _ >: A]): F[B] = F.fromEither(eab)
335335
}
336336

337-
final class EitherObjectOps(private val either: Either.type) extends AnyVal { // scalastyle:off ensure.single.space.after.token
337+
final class EitherObjectOps(private val either: Either.type) extends AnyVal {
338338
def left[A, B](a: A): Either[A, B] = Left(a)
339339

340340
def right[A, B](b: B): Either[A, B] = Right(b)

free/src/main/scala/cats/free/FreeApplicative.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ sealed abstract class FreeApplicative[F[_], A] extends Product with Serializable
4444
* Interprets/Runs the sequence of operations using the semantics of `Applicative` G[_].
4545
* Tail recursive.
4646
*/
47-
// scalastyle:off method.length
4847
final def foldMap[G[_]](f: F ~> G)(implicit G: Applicative[G]): G[A] = {
4948
import FreeApplicative._
5049
// the remaining arguments to G[A => B]'s
@@ -127,7 +126,6 @@ sealed abstract class FreeApplicative[F[_], A] extends Product with Serializable
127126

128127
loop().asInstanceOf[G[A]]
129128
}
130-
// scalastyle:on method.length
131129

132130
/**
133131
* Interpret/run the operations using the semantics of `Applicative[F]`.

kernel-laws/shared/src/main/scala/cats/kernel/laws/SerializableLaws.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ object SerializableLaws {
3030

3131
val baos = new ByteArrayOutputStream()
3232
val oos = new ObjectOutputStream(baos)
33-
var ois: ObjectInputStream = null // scalastyle:ignore null
33+
var ois: ObjectInputStream = null
3434
try {
3535
oos.writeObject(a)
3636
oos.close()
@@ -44,7 +44,7 @@ object SerializableLaws {
4444
Result(status = Exception(t))
4545
} finally {
4646
oos.close()
47-
if (ois != null) ois.close() // scalastyle:ignore null
47+
if (ois != null) ois.close()
4848
}
4949
}
5050
} else Prop(_ => Result(status = Proof))

kernel/src/main/scala-2.13+/cats/kernel/compat/HashCompat.scala

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,9 @@ private[kernel] class HashCompat {
6565

6666
val it = xs.iterator
6767
var h = seqSeed
68-
// scalastyle:off
6968
if (!it.hasNext) return finalizeHash(h, 0)
70-
// scalastyle:on
7169
val x0 = it.next()
72-
// scalastyle:off
7370
if (!it.hasNext) return finalizeHash(mix(h, A.hash(x0)), 1)
74-
// scalastyle:on
7571
val x1 = it.next()
7672

7773
val initial = A.hash(x0)
@@ -90,9 +86,7 @@ private[kernel] class HashCompat {
9086
h = mix(h, A.hash(it.next()))
9187
i += 1
9288
}
93-
// scalastyle:off
9489
return finalizeHash(h, i)
95-
// scalastyle:on
9690
}
9791
prev = hash
9892
i += 1
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
package cats.kernel
22
package instances
33

4-
package object arraySeq extends ArraySeqInstances // scalastyle:ignore package.object.name
4+
package object arraySeq extends ArraySeqInstances

kernel/src/main/scala/cats/kernel/Comparison.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ object Comparison {
1818
def fromInt(int: Int): Comparison =
1919
if (int > 0) Comparison.GreaterThan
2020
else if (int == 0) Comparison.EqualTo
21-
else Comparison.LessThan // scalastyle:ignore ensure.single.space.after.token
21+
else Comparison.LessThan
2222

2323
def fromDouble(double: Double): Option[Comparison] =
2424
if (double.isNaN) None

kernel/src/main/scala/cats/kernel/instances/StaticMethods.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ object StaticMethods extends cats.kernel.compat.HashCompat {
3535
override def iterator: Iterator[A] = m.iterator
3636
}
3737

38-
// scalastyle:off return
3938
def iteratorCompare[A](xs: Iterator[A], ys: Iterator[A])(implicit ev: Order[A]): Int = {
4039
while (true) {
4140
if (xs.hasNext) {
@@ -86,7 +85,6 @@ object StaticMethods extends cats.kernel.compat.HashCompat {
8685
}
8786
true
8887
}
89-
// scalastyle:on return
9088

9189
def combineNIterable[A, R](b: mutable.Builder[A, R], x: Iterable[A], n: Int): R = {
9290
var i = n
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
package cats.kernel
22
package instances
33

4-
package object bigDecimal extends BigDecimalInstances // scalastyle:ignore package.object.name
4+
package object bigDecimal extends BigDecimalInstances
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
package cats.kernel
22
package instances
33

4-
package object bigInt extends BigIntInstances // scalastyle:ignore package.object.name
4+
package object bigInt extends BigIntInstances
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
package cats.kernel
22
package instances
33

4-
package object bitSet extends BitSetInstances // scalastyle:ignore package.object.name
4+
package object bitSet extends BitSetInstances

0 commit comments

Comments
 (0)