Add code formatting

This commit is contained in:
Aly 2018-12-20 14:49:38 -08:00
parent 669304f33e
commit b7e784a3e9
No known key found for this signature in database
GPG Key ID: 555B7346639DDAC3
3 changed files with 82 additions and 14 deletions

64
.scalafmt.conf Normal file
View 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
]
}

View File

@ -16,7 +16,9 @@ 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 => {
Parser
.parseFromString[JValue](r.text())
.map(j => {
val JArray(vs) = j
val childList = vs.toList.map { c =>
val name = c.get("name").asString
@ -29,7 +31,9 @@ object Downloader {
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 => {
Parser
.parseFromString[JValue](r.text())
.map(j => {
MappingVersion(j.get("default_branch").asString)
})
}