Skip to content

Commit

Permalink
Upgrade scalafmt to 3.8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
joan38 committed Feb 2, 2025
1 parent 97fbd6a commit 6baa4fd
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 38 deletions.
3 changes: 2 additions & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
version = 3.7.14
version = 3.8.3
runner.dialect = scala213source3
fileOverride."glob:**.sc".runner.dialect = scala213
project.git = true
maxColumn = 120
align.preset = more
Expand Down
12 changes: 4 additions & 8 deletions build.sc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import $ivy.`com.goyeau::mill-git::0.2.5`
import $ivy.`com.goyeau::mill-scalafix::0.4.2`
import $ivy.`org.typelevel::scalac-options:0.1.7`

import $file.project.Dependencies
import Dependencies.Dependencies._
import $file.project.SwaggerModelGenerator
Expand All @@ -12,10 +11,10 @@ import mill.scalalib.TestModule.Munit
import mill.scalalib._
import mill.scalalib.api.ZincWorkerUtil.isScala3
import mill.scalalib.publish.{Developer, License, PomSettings, VersionControl}
import org.typelevel.scalacoptions.ScalacOptions.{advancedOption, fatalWarningOptions, release, source3}
import org.typelevel.scalacoptions.ScalacOptions.{fatalWarningOptions, maxInlines, release, source3}
import org.typelevel.scalacoptions.{ScalaVersion, ScalacOptions}

object `kubernetes-client` extends Cross[KubernetesClientModule]("3.3.4", "2.13.15", "2.12.17")
object `kubernetes-client` extends Cross[KubernetesClientModule]("3.3.4", "2.13.15", "2.12.20")
trait KubernetesClientModule
extends CrossScalaModule
with StyleModule
Expand All @@ -24,11 +23,8 @@ trait KubernetesClientModule
lazy val jvmVersion = "11"
override def javacOptions = super.javacOptions() ++ Seq("-source", jvmVersion, "-target", jvmVersion)
override def scalacOptions = super.scalacOptions() ++ ScalacOptions.tokensForVersion(
scalaVersion() match {
case s"$major.$minor.$patch" => ScalaVersion(major.toInt, minor.toInt, patch.toInt)
},
ScalacOptions.default + release(jvmVersion) + source3 +
advancedOption("max-inlines", List("50"), _.isAtLeast(ScalaVersion.V3_0_0)) // ++ fatalWarningOptions
ScalaVersion.unsafeFromString(scalaVersion()),
ScalacOptions.default + release(jvmVersion) + source3 + maxInlines(50) // ++ fatalWarningOptions
)

override def ivyDeps =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,11 @@ class KubernetesClient[F[_]: Async: Logger](
new PersistentVolumeClaimsApi(httpClient, config, authorization)
lazy val raw: RawApi[F] = new RawApi[F](httpClient, wsClient, config, authorization)

def customResources[A: Encoder: Decoder, B: Encoder: Decoder](context: CrdContext)(implicit
def customResources[A, B](context: CrdContext)(implicit
listDecoder: Decoder[CustomResourceList[A, B]],
encoder: Encoder[CustomResource[A, B]],
decoder: Decoder[CustomResource[A, B]]
) = new CustomResourcesApi[F, A, B](httpClient, config, authorization, context)

}

object KubernetesClient {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ private[client] trait Listable[F[_], Resource] {

def list(labels: Map[String, String] = Map.empty): F[Resource] = {
val uri = addLabels(labels, config.server.resolve(resourceUri))
httpClient.expectF[Resource](
Request[F](GET, uri).withOptionalAuthorization(authorization)
)
httpClient.expectF[Resource](Request[F](GET, uri).withOptionalAuthorization(authorization))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.goyeau.kubernetes.client.operation

import cats.effect.Async
import com.goyeau.kubernetes.client.KubeConfig
import com.goyeau.kubernetes.client.operation.*
import org.http4s.*
import org.http4s.client.Client
import org.http4s.EntityDecoder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ object SslContexts {
val keyDataStream = config.clientKeyData.map(data => new ByteArrayInputStream(Base64.getDecoder.decode(data)))
val keyFileStream = config.clientKeyFile.map(_.toNioPath.toFile).map(new FileInputStream(_))

for {
val _ = for {
keyStream <- keyDataStream.orElse(keyFileStream)
certStream <- certDataStream.orElse(certFileStream)
} yield {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
package com.goyeau.kubernetes.client.api

import cats.effect.IO
import cats.Applicative
import cats.effect.*
import cats.implicits.*
import com.goyeau.kubernetes.client.KubernetesClient
import com.goyeau.kubernetes.client.api.CustomResourceDefinitionsApiTest.*
import com.goyeau.kubernetes.client.operation.*
import io.k8s.api.coordination.v1.*
import io.k8s.api.core.v1.Node
import io.k8s.apiextensionsapiserver.pkg.apis.apiextensions.v1.*
import munit.Assertions.*
import munit.FunSuite
import org.typelevel.log4cats.Logger
import org.typelevel.log4cats.slf4j.Slf4jLogger
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
package com.goyeau.kubernetes.client.api

import cats.syntax.all.*
import cats.effect.unsafe.implicits.global
import cats.effect.{Async, IO}
import com.goyeau.kubernetes.client.KubernetesClient
import com.goyeau.kubernetes.client.Utils.retry
import com.goyeau.kubernetes.client.api.ExecStream.{StdErr, StdOut}
import com.goyeau.kubernetes.client.operation.*
import fs2.io.file.{Files, Path}
import fs2.{text, Stream}
import io.k8s.api.core.v1.*
import io.k8s.apimachinery.pkg.apis.meta.v1
import io.k8s.apimachinery.pkg.apis.meta.v1.{ListMeta, ObjectMeta}
import munit.FunSuite
import org.http4s.{Request, Status, Uri}
import org.http4s.{Request, Status}
import org.typelevel.log4cats.Logger
import org.typelevel.log4cats.slf4j.Slf4jLogger

import java.nio.file.Files as JFiles
import scala.util.Random
import org.http4s.implicits.*
import org.http4s.jdkhttpclient.WSConnectionHighLevel

class RawApiTest extends FunSuite with MinikubeClientProvider[IO] with ContextProvider {

Expand Down
9 changes: 5 additions & 4 deletions project/SwaggerModelGenerator.sc
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import $file.Model, Model.{Definition, Property}
import $file.Model
import Model.{Definition, Property}
import $ivy.`io.circe::circe-core:0.14.0`
import $ivy.`io.circe::circe-generic:0.14.0`
import $ivy.`io.circe::circe-parser:0.14.0`
import mill._
import mill.api.Logger
import mill.define.Sources
import mill.scalalib._
import io.circe._
import io.circe.generic.auto._
Expand All @@ -14,7 +14,7 @@ import os._
trait SwaggerModelGenerator extends JavaModule {
import SwaggerModelGenerator._

def swaggerSources: Sources = T.sources(resources().map(resource => PathRef(resource.path / "swagger")))
def swaggerSources: T[Seq[PathRef]] = T.sources(resources().map(resource => PathRef(resource.path / "swagger")))
def allSwaggerSourceFiles: T[Seq[PathRef]] = T {
def isHiddenFile(path: os.Path) = path.last.startsWith(".")
for {
Expand All @@ -28,7 +28,7 @@ trait SwaggerModelGenerator extends JavaModule {
override def generatedSources = T {
super.generatedSources() ++
allSwaggerSourceFiles()
.flatMap(swagger => processSwaggerFile(swagger.path, T.ctx.dest, T.ctx.log))
.flatMap(swagger => processSwaggerFile(swagger.path, T.dest, T.log))
.map(PathRef(_))
}
}
Expand Down Expand Up @@ -228,6 +228,7 @@ object SwaggerModelGenerator {
case (Some(t), None) =>
swaggerToScalaType(t, property.items.orElse(property.additionalProperties), property.format)
case (None, Some(ref)) => sanitizeClassPath(ref)
case _ => throw new IllegalArgumentException(s"Either the type or the ref should be set on property: $property")
}

def swaggerToScalaType(
Expand Down

0 comments on commit 6baa4fd

Please sign in to comment.