Skip to content

Commit

Permalink
Add scalafix
Browse files Browse the repository at this point in the history
  • Loading branch information
2m committed Feb 25, 2020
1 parent 63eb5ce commit 517b438
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 15 deletions.
8 changes: 8 additions & 0 deletions .scalafix.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
rule = SortImports
SortImports.blocks = [
"java.",
"scala.",
"akka.",
"*",
"lt.dvim.authors.",
]
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ jobs:
name: "Code style check (fixed with `sbt Test/compile`)"
- script: sbt scalafmtSbtCheck || { echo "[error] Unformatted sbt code found. Please run 'scalafmtSbt' and commit the reformatted code."; false; }
name: "Build code style check (fixed with `sbt scalafmtSbt`)"
- script: sbt "scalafix --check" || { echo "[error] Unformatted code found. Please run 'scalafix' and commit the reformatted code."; false; }
name: "Code style check (fixed with `sbt scalafix`)"

- stage: test
script: sbt test
Expand Down
7 changes: 5 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ lazy val cli = project
name := "authors-cli",
scalaVersion := ScalaVersion,
libraryDependencies ++= Seq(
"org.rogach" %% "scallop" % "3.3.2"
)
"org.rogach" %% "scallop" % "3.3.2"
)
)

inThisBuild(
Expand All @@ -76,6 +76,9 @@ inThisBuild(
),
bintrayOrganization := Some("2m"),
scalafmtOnCompile := true,
scalafixDependencies ++= Seq(
"com.nequissimus" %% "sort-imports" % "0.3.1"
),
// show full stack traces and test case durations
testOptions in Test += Tests.Argument("-oDF")
)
Expand Down
6 changes: 3 additions & 3 deletions cli/src/main/scala/AuthorsCli.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

package lt.dvim.authors

import org.rogach.scallop._

import scala.concurrent.duration._
import scala.concurrent.Await
import scala.concurrent.duration._

import org.rogach.scallop._

object AuthorsCli {
import ScallopOpts._
Expand Down
12 changes: 7 additions & 5 deletions core/src/main/scala/Authors.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ package lt.dvim.authors

import java.io.File

import scala.collection.JavaConverters._
import scala.concurrent.{ExecutionContext, Future}

import akka.NotUsed
import akka.actor.ActorSystem
import akka.event.{Logging, LoggingAdapter}
Expand All @@ -27,16 +30,15 @@ import akka.http.scaladsl.marshalling.PredefinedToRequestMarshallers._
import akka.http.scaladsl.model.{HttpRequest, Uri}
import akka.stream.scaladsl.{Flow, Source}
import akka.util.ByteString

import com.madgag.git._
import com.tradeshift.reaktive.marshal.stream.{ActsonReader, ProtocolReader}
import org.eclipse.jgit.diff.DiffFormatter
import org.eclipse.jgit.internal.storage.file.FileRepository
import org.eclipse.jgit.util.io.DisabledOutputStream
import com.madgag.git._
import lt.dvim.authors.GithubProtocol.{AuthorStats, Commit, Stats}
import org.eclipse.jgit.storage.file.FileRepositoryBuilder
import org.eclipse.jgit.util.io.DisabledOutputStream

import scala.collection.JavaConverters._
import scala.concurrent.{ExecutionContext, Future}
import lt.dvim.authors.GithubProtocol.{AuthorStats, Commit, Stats}

object Authors {
final val MaxAuthors = 1024
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/GithubProtocol.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ package lt.dvim.authors

import com.tradeshift.reaktive.json.JSONProtocol._
import com.tradeshift.reaktive.marshal.Protocol._
import lt.dvim.scala.compat.vavr.OptionConverters._
import io.vavr.control.{Option => VavrOption}
import lt.dvim.scala.compat.vavr.OptionConverters._

object GithubProtocol {
final case class GithubAuthor(login: String, url: String, avatar: String)
Expand Down
8 changes: 4 additions & 4 deletions plugin/src/main/scala/AuthorsPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@

package lt.dvim.authors

import sbt._
import scala.concurrent.duration._
import scala.concurrent.{Await, Future}

import sbt.Keys._
import sbt._
import sbt.complete.DefaultParsers._

import scala.concurrent.{Await, Future}
import scala.concurrent.duration._

object AuthorsPlugin extends AutoPlugin {
object autoImport extends AuthorsKeys
import autoImport._
Expand Down
1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.3.1")
addSbtPlugin("org.foundweekends" % "sbt-bintray" % "0.5.6")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.11")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.4.0")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.11")

0 comments on commit 517b438

Please sign in to comment.