This commit is contained in:
Mark Canlas 2020-08-15 02:04:21 -04:00
parent 851b4ee99c
commit e112877f8d
9 changed files with 48 additions and 9 deletions

13
.scalafix.conf Normal file
View File

@ -0,0 +1,13 @@
rules = [
OrganizeImports
]
OrganizeImports {
expandRelative = true
groups = [
"java",
"scala",
"*",
"com.htmlism"
]
}

View File

@ -8,3 +8,4 @@ lazy val root =
.withCats
.withTesting
.withTestingBeta
.withOrganizeImports

View File

@ -0,0 +1,25 @@
import sbt.Keys._
import sbt._
object LintingPlugin extends AutoPlugin {
override def trigger = allRequirements
override lazy val globalSettings =
addCommandAlias("fmt", List("all", "scalafmtSbt", "compile:scalafmt", "test:scalafmt").mkString(" ")) ++
addCommandAlias("fix", "scalafixAll")
object autoImport {
// this class name should be unique to evade implicit collision with other ops classes
implicit class LintingOps(p: Project) {
def withOrganizeImports: Project = {
import scalafix.sbt.ScalafixPlugin.autoImport._
p.settings(
ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.4.0",
semanticdbEnabled := true,
semanticdbVersion := scalafixSemanticdb.revision
)
}
}
}
}

View File

@ -8,9 +8,6 @@ object ProjectPlugin extends AutoPlugin {
scalaVersion := "2.13.3"
)
override lazy val globalSettings =
addCommandAlias("fmt", List("", "scalafmtSbt", "compile:scalafmt", "test:scalafmt").mkString(";"))
object autoImport {
implicit class ProjectOps(p: Project) {
def withCats: Project =

View File

@ -1,3 +1,4 @@
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.3.4")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.13")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.1")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.19")

View File

@ -1,8 +1,9 @@
package com.htmlism
import cats.implicits._
import java.io.PrintWriter
import cats.implicits._
import com.htmlism.mos6502.model._
object MatchOpcodes {

View File

@ -1,7 +1,9 @@
package com.htmlism.mos6502.dsl
import scala.collection.mutable.ListBuffer
import cats.implicits._
import com.htmlism.mos6502.model._
object DslDemo extends App {
@ -141,6 +143,5 @@ class AssemblyContext {
}
def triplets: List[(String, Option[String], Option[String])] =
xs.map(_.toTriplet)
.toList
xs.map(_.toTriplet).toList
}

View File

@ -1,6 +1,7 @@
package com.htmlism.mos6502.dsl
import cats.implicits._
import com.htmlism.mos6502.model.Instruction
sealed trait Statement {

View File

@ -1,9 +1,8 @@
package com.htmlism.mos6502.dsl
import cats.implicits._
import org.scalatest._
import flatspec._
import matchers._
import org.scalatest.flatspec._
import org.scalatest.matchers._
class Easy6502Spec extends AnyFlatSpec with should.Matchers {