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"
 | 
			
		||||
  ),
 | 
			
		||||
  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"))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue