diff --git a/.scalafmt.conf b/.scalafmt.conf new file mode 100644 index 0000000..7a6afd9 --- /dev/null +++ b/.scalafmt.conf @@ -0,0 +1,64 @@ +project { + includeFilters = [ + ".*.\\.scala$" + ".*\\..sbt$" + ] +} + +maxColumn = 120 + +align = more +align { + openParenCallSite = false + openParenDefnSite = false + tokens = ["%", ":=", "~="] +} + +assumeStandardLibraryStripMargin = true + +includeCurlyBraceInSelectChains = false + +continuationIndent { + callSite = 2 + defnSite = 2 + extendSite = 4 +} + +danglingParentheses = true + +newlines { + alwaysBeforeTopLevelStatements = true + sometimesBeforeColonInMethodReturnType = true + penalizeSingleSelectMultiArgList = false + alwaysBeforeElseAfterCurlyIf = false + neverInResultType = false +} + +spaces { + afterKeywordBeforeParen = true +} + +binPack { + parentConstructors = true + literalArgumentLists = true +} + +optIn { + breaksInsideChains = false + breakChainOnFirstMethodDot = true + configStyleArguments = true +} + +runner { + optimizer { + forceConfigStyleOnOffset = 150 + forceConfigStyleMinArgCount = 2 + } +} + +rewrite { + rules = [ + SortImports + ] +} + diff --git a/build.sbt b/build.sbt index 96cb821..cf96653 100644 --- a/build.sbt +++ b/build.sbt @@ -13,14 +13,14 @@ val sharedSettings = Seq( "-feature" ), libraryDependencies ++= Seq( - "com.lihaoyi" %% "requests" % "0.1.4", - "org.typelevel" %% "jawn-ast" % "0.14.0", + "com.lihaoyi" %% "requests" % "0.1.4", + "org.typelevel" %% "jawn-ast" % "0.14.0", "org.typelevel" %% "jawn-parser" % "0.14.0" ) ) lazy val yarnmd = - crossProject(/* JSPlatform, */ JVMPlatform /* , NativePlatform */) + crossProject( /* JSPlatform, */ JVMPlatform /* , NativePlatform */ ) .crossType(CrossType.Pure) .settings(sharedSettings) // .jsSettings(crossScalaVersions := Seq("2.11.12", "2.12.7")) diff --git a/yarnmd/src/main/scala/com/gitdab/conduit/yarnmd/Downloader.scala b/yarnmd/src/main/scala/com/gitdab/conduit/yarnmd/Downloader.scala index 0b11c58..59d3be2 100644 --- a/yarnmd/src/main/scala/com/gitdab/conduit/yarnmd/Downloader.scala +++ b/yarnmd/src/main/scala/com/gitdab/conduit/yarnmd/Downloader.scala @@ -16,22 +16,26 @@ object Downloader { def versions: Try[List[MappingVersion]] = { val uri = new URI(apiURL).resolve("branches") val r = requests.get(uri.toString, headers = Map("User-Agent" -> userAgent)) - Parser.parseFromString[JValue](r.text()).map(j => { - val JArray(vs) = j - val childList = vs.toList.map { c => - val name = c.get("name").asString - MappingVersion(name) - } - childList - }) + Parser + .parseFromString[JValue](r.text()) + .map(j => { + val JArray(vs) = j + val childList = vs.toList.map { c => + val name = c.get("name").asString + MappingVersion(name) + } + childList + }) } def latestVersion: Try[MappingVersion] = { val repoInfo = new URI(apiURL) val r = requests.get(repoInfo.toString, headers = Map("User-Agent" -> userAgent)) - Parser.parseFromString[JValue](r.text()).map(j => { - MappingVersion(j.get("default_branch").asString) - }) + Parser + .parseFromString[JValue](r.text()) + .map(j => { + MappingVersion(j.get("default_branch").asString) + }) } def zipURI(mv: MappingVersion): URI = new URI(ghZipURL).resolve(mv.tag)