Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Remove default values from sbt-fix #80

Merged
merged 1 commit into from
Apr 12, 2020
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
3 changes: 3 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ ThisBuild / organization := "com.alejandrohdezma"
*/
ThisBuild / scalafixDependencies := ScalafixWithDefaultsPlugin.scalafixDefaultRules

ThisBuild / scalafixConfigLocation := "https://github.com/alejandrohdezma/sbt-fix-defaults/releases/download/v0.0.6/default.scalafix.conf"
ThisBuild / scalafmtConfigLocation := "https://github.com/alejandrohdezma/sbt-fix-defaults/releases/download/v0.0.6/default.scalafmt.conf"

Global / onChangedBuildSource := ReloadOnSourceChanges

addCommandAlias("ci-test", "fix --check; docs/mdoc")
Expand Down
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ All included plugins are automatically activated, so you don't have to do anythi

### Download scalafix/scalafmt configuration from the cloud

One of the main reasons of this plugin is to keep scalafix/scalafmt configurations synchronized across projects. To do so, both configurations are automatically downloaded from a remote location. By default both configurations are downloaded from [alejandrohdezma/sbt-fix-defaults](https://github.com/alejandrohdezma/sbt-fix-defaults).
One of the main reasons of this plugin is to keep scalafix/scalafmt configurations synchronized across projects. To do so, both configurations are automatically downloaded from a remote location.

#### Edit configuration location

To download configurations from a different location, edit `scalafixConfigLocation` and `scalafmtConfigLocation` to a valid url:
Edit `scalafixConfigLocation` and `scalafmtConfigLocation` to a valid url:

```sbt
scalafixConfigLocation := "your-url"
Expand Down
34 changes: 0 additions & 34 deletions sbt-fix/src/main/scala/com/alejandrohdezma/sbt/fix/Defaults.scala

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
package com.alejandrohdezma.sbt.fix

import sbt.Keys._
import sbt.{Command, Def, addCompilerPlugin, _}
import sbt._

import scalafix.sbt.ScalafixPlugin
import scalafix.sbt.ScalafixPlugin.autoImport._
Expand All @@ -36,7 +36,7 @@ object ScalafixWithDefaultsPlugin extends AutoPlugin {
object autoImport {

lazy val scalafixConfigLocation: SettingKey[String] = settingKey[String] {
s"Location of the remote scalafix config. Defaults to ${Defaults.scalafix}"
s"Location of the remote scalafix config"
}

lazy val scalafixExtraConfig: SettingKey[File] = settingKey[File] {
Expand All @@ -55,7 +55,6 @@ object ScalafixWithDefaultsPlugin extends AutoPlugin {
override def buildSettings: Seq[Setting[_]] = Seq(
scalafixExtraConfig := file(".scalafix-extra.conf"),
scalafixConfig := scalafixDownloadConfig.value,
scalafixConfigLocation := Defaults.scalafix,
scalacOptions += "-P:semanticdb:synthetics:on",
scalafixDependencies in ThisBuild ++= scalafixDefaultRules,
addCompilerPlugin(scalafixSemanticdb)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ object ScalafmtWithDefaultsPlugin extends AutoPlugin {
object autoImport {

lazy val scalafmtConfigLocation: SettingKey[String] = settingKey[String] {
s"Location of the remote scalafmt config. Defaults to ${Defaults.scalafmt}"
s"Location of the remote scalafmt config"
}

lazy val scalafmtExtraConfig: SettingKey[File] = settingKey[File] {
Expand All @@ -49,9 +49,8 @@ object ScalafmtWithDefaultsPlugin extends AutoPlugin {

override def buildSettings: Seq[Setting[_]] =
Seq(
scalafmtConfigLocation := Defaults.scalafmt,
scalafmtExtraConfig := file(".scalafmt-extra.conf"),
scalafmtConfig := scalafmtDownloadConfig.value
scalafmtExtraConfig := file(".scalafmt-extra.conf"),
scalafmtConfig := scalafmtDownloadConfig.value
)

private lazy val scalafmtDownloadConfig: Def.Initialize[Task[File]] = Def.task {
Expand Down