Add code formatting
This commit is contained in:
parent
669304f33e
commit
b7e784a3e9
3 changed files with 82 additions and 14 deletions
64
.scalafmt.conf
Normal file
64
.scalafmt.conf
Normal file
|
@ -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
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
|
@ -13,14 +13,14 @@ val sharedSettings = Seq(
|
||||||
"-feature"
|
"-feature"
|
||||||
),
|
),
|
||||||
libraryDependencies ++= Seq(
|
libraryDependencies ++= Seq(
|
||||||
"com.lihaoyi" %% "requests" % "0.1.4",
|
"com.lihaoyi" %% "requests" % "0.1.4",
|
||||||
"org.typelevel" %% "jawn-ast" % "0.14.0",
|
"org.typelevel" %% "jawn-ast" % "0.14.0",
|
||||||
"org.typelevel" %% "jawn-parser" % "0.14.0"
|
"org.typelevel" %% "jawn-parser" % "0.14.0"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
lazy val yarnmd =
|
lazy val yarnmd =
|
||||||
crossProject(/* JSPlatform, */ JVMPlatform /* , NativePlatform */)
|
crossProject( /* JSPlatform, */ JVMPlatform /* , NativePlatform */ )
|
||||||
.crossType(CrossType.Pure)
|
.crossType(CrossType.Pure)
|
||||||
.settings(sharedSettings)
|
.settings(sharedSettings)
|
||||||
// .jsSettings(crossScalaVersions := Seq("2.11.12", "2.12.7"))
|
// .jsSettings(crossScalaVersions := Seq("2.11.12", "2.12.7"))
|
||||||
|
|
|
@ -16,22 +16,26 @@ object Downloader {
|
||||||
def versions: Try[List[MappingVersion]] = {
|
def versions: Try[List[MappingVersion]] = {
|
||||||
val uri = new URI(apiURL).resolve("branches")
|
val uri = new URI(apiURL).resolve("branches")
|
||||||
val r = requests.get(uri.toString, headers = Map("User-Agent" -> userAgent))
|
val r = requests.get(uri.toString, headers = Map("User-Agent" -> userAgent))
|
||||||
Parser.parseFromString[JValue](r.text()).map(j => {
|
Parser
|
||||||
val JArray(vs) = j
|
.parseFromString[JValue](r.text())
|
||||||
val childList = vs.toList.map { c =>
|
.map(j => {
|
||||||
val name = c.get("name").asString
|
val JArray(vs) = j
|
||||||
MappingVersion(name)
|
val childList = vs.toList.map { c =>
|
||||||
}
|
val name = c.get("name").asString
|
||||||
childList
|
MappingVersion(name)
|
||||||
})
|
}
|
||||||
|
childList
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
def latestVersion: Try[MappingVersion] = {
|
def latestVersion: Try[MappingVersion] = {
|
||||||
val repoInfo = new URI(apiURL)
|
val repoInfo = new URI(apiURL)
|
||||||
val r = requests.get(repoInfo.toString, headers = Map("User-Agent" -> userAgent))
|
val r = requests.get(repoInfo.toString, headers = Map("User-Agent" -> userAgent))
|
||||||
Parser.parseFromString[JValue](r.text()).map(j => {
|
Parser
|
||||||
MappingVersion(j.get("default_branch").asString)
|
.parseFromString[JValue](r.text())
|
||||||
})
|
.map(j => {
|
||||||
|
MappingVersion(j.get("default_branch").asString)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
def zipURI(mv: MappingVersion): URI = new URI(ghZipURL).resolve(mv.tag)
|
def zipURI(mv: MappingVersion): URI = new URI(ghZipURL).resolve(mv.tag)
|
||||||
|
|
Loading…
Reference in a new issue