Skip to content

Commit

Permalink
Merge pull request #159 from http4s/feature/scalafix
Browse files Browse the repository at this point in the history
Add scalafix integration
  • Loading branch information
armanbilge committed Jun 4, 2022
2 parents 600a144 + 97fbba1 commit 9d3bcb3
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 8 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ jobs:
- name: Test
run: sbt '++${{ matrix.scala }}' test

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

- name: Check binary compatibility
if: matrix.java == 'temurin@8'
run: sbt '++${{ matrix.scala }}' mimaReportBinaryIssues
Expand Down
3 changes: 3 additions & 0 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
rules = [
OrganizeImports
]
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ lazy val docs = project
tlSiteRelatedProjects += "sbt-typelevel" -> url("https://typelevel.org/sbt-typelevel/")
)

ThisBuild / tlBaseVersion := "0.13"
ThisBuild / tlBaseVersion := "0.14"
ThisBuild / crossScalaVersions := Seq("2.12.15")
ThisBuild / developers := List(
Developer(
Expand Down
1 change: 1 addition & 0 deletions core/build.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
val sbtTypelevelVersion = "0.4.10"
addSbtPlugin("org.typelevel" % "sbt-typelevel" % sbtTypelevelVersion)
addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % sbtTypelevelVersion)
addSbtPlugin("org.typelevel" % "sbt-typelevel-scalafix" % sbtTypelevelVersion)
addSbtPlugin("com.github.cb372" % "sbt-explicit-dependencies" % "0.2.16")
27 changes: 20 additions & 7 deletions core/src/main/scala/org/http4s/sbt/Http4sOrgPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,28 @@

package org.http4s.sbt

import sbt._
import explicitdeps.ExplicitDepsPlugin
import org.typelevel.sbt._
import org.typelevel.sbt.gha._
import sbt.Keys._
import sbt._
import scalafix.sbt.ScalafixPlugin.autoImport._

import explicitdeps.ExplicitDepsPlugin, ExplicitDepsPlugin.autoImport._
import org.typelevel.sbt.gha._, GenerativeKeys._
import org.typelevel.sbt._
import TypelevelKernelPlugin._, autoImport._
import ExplicitDepsPlugin.autoImport._
import GenerativeKeys._
import TypelevelKernelPlugin._
import autoImport._
import TypelevelSonatypePlugin.autoImport._

object Http4sOrgPlugin extends AutoPlugin {
object autoImport

override def trigger = allRequirements

override def requires = TypelevelPlugin && ExplicitDepsPlugin
override def requires = TypelevelPlugin && TypelevelScalafixPlugin && ExplicitDepsPlugin

override def buildSettings = publishSettings ++ organizationSettings ++ githubActionsSettings
override def buildSettings =
publishSettings ++ organizationSettings ++ githubActionsSettings ++ scalafixSettings

override def projectSettings = explicitDepsSettings

Expand Down Expand Up @@ -71,6 +76,14 @@ object Http4sOrgPlugin extends AutoPlugin {
skipIfIrrelevant(unusedCompileDependenciesTest)
)

lazy val scalafixSettings: Seq[Setting[_]] =
Seq(
scalafixDependencies ++= Seq(
"org.http4s" %% "http4s-scalafix-internal" % "0.23.12",
"com.github.liancheng" %% "organize-imports" % "0.6.0"
)
)

private val primaryJavaCond = Def.setting {
val java = githubWorkflowJavaVersions.value.head
s"matrix.java == '${java.render}'"
Expand Down

0 comments on commit 9d3bcb3

Please sign in to comment.