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

Enable Scalafix. #30

Merged
merged 2 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ jobs:
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck

- name: Check scalafix lints
if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' 'scalafixAll --check'

- name: scalaJSLink
if: matrix.project == 'rootJS'
run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' Test/scalaJSLinkerResult
Expand Down
8 changes: 8 additions & 0 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
rules = [
LeakingImplicitClassVal,
NoValInForComprehension,
OrganizeImports,
RedundantSyntax
]
OrganizeImports.removeUnused = false
OrganizeImports.groupedImports = AggressiveMerge
1 change: 0 additions & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ indent.extendSite = 4
indent.main = 2
maxColumn = 80
project.git = true
rewrite.imports.sort = original
rewrite.rules = [Imports, RedundantBraces, RedundantParens, SortModifiers]
rewrite.trailingCommas.style = always
rewrite.redundantBraces.maxBreaks = 1
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ package com.github.tarao.record4s

import scala.deriving.Mirror
import scala.language.dynamics

import typing.ArrayRecord.{Aux, Concat, Lookup}
import typing.Record.{Select, Unselect}
import util.SeqOps.deduped
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
package com.github.tarao.record4s

import scala.annotation.nowarn

import typing.ArrayRecord.{Concat, Lookup}
import util.SeqOps.deduped

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
package com.github.tarao.record4s

import scala.annotation.tailrec

import util.SeqOps.deduped

private[record4s] class InternalMacros(using
Expand Down Expand Up @@ -315,7 +316,7 @@ private[record4s] class InternalMacros(using
fieldTypeOf(labelExpr, valueExpr)

case expr =>
errorAndAbort(s"Invalid field", Some(expr))
errorAndAbort("Invalid field", Some(expr))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
package com.github.tarao.record4s

import scala.annotation.nowarn

import typing.Record.{Concat, Lookup, Select, Unselect}

@nowarn("msg=unused local")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ package com.github.tarao.record4s

import scala.compiletime.requireConst
import scala.language.dynamics

import typing.Record.Select

final class Selector[T <: Tuple](val labels: Seq[String] = Seq.empty)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@ object ArrayRecord {
}

transparent inline given [R, L <: String]: Lookup[R, L] =
${ ArrayRecordMacros.derivedTypingLookupImpl[R, L] }
${ ArrayRecordMacros.derivedTypingLookupImpl }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

package com.github.tarao.record4s

import scala.compiletime.testing.{typeCheckErrors, Error, ErrorKind}
import scala.compiletime.testing.{Error, ErrorKind, typeCheckErrors}

class TypeErrorSpec extends helper.UnitSpec {
describe("Typing %") {
Expand Down
3 changes: 2 additions & 1 deletion modules/core/src/test/scala/helper/StaticTypeMatcher.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,13 @@

package helper

import scala.compiletime.summonInline
import org.scalatest.matchers.dsl.{
ResultOfATypeInvocation,
ResultOfAnTypeInvocation,
}

import scala.compiletime.summonInline

trait StaticTypeMatcher {
extension [T1](anything: T1) {
inline def shouldStaticallyBe[T2](r: ResultOfATypeInvocation[T2]): Unit = {
Expand Down
5 changes: 1 addition & 4 deletions modules/core/src/test/scala/helper/UnitSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@

package helper

import org.scalatest.Inside
import org.scalatest.Inspectors
import org.scalatest.OptionValues
import org.scalatest.funspec.AnyFunSpec
import org.scalatest.matchers
import org.scalatest.{Inside, Inspectors, OptionValues, matchers}

abstract class UnitSpec
extends AnyFunSpec
Expand Down
9 changes: 5 additions & 4 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.6")
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.6.1")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.14.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.16")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.6")
addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.6.1")
addSbtPlugin("org.typelevel" % "sbt-typelevel-scalafix" % "0.6.1")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.14.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.16")