From 533ffabc8b43edb3691b8aea1b7d146b65612b2d Mon Sep 17 00:00:00 2001 From: Joan Goyeau Date: Mon, 9 Oct 2023 02:27:24 -0400 Subject: [PATCH] Upgrade mill-scalafix --- build.sc | 2 +- .../com/goyeau/kubernetes/client/api/PodsApi.scala | 14 +++++++------- .../kubernetes/client/util/SslContexts.scala | 5 +++-- .../com/goyeau/kubernetes/client/util/Uris.scala | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/build.sc b/build.sc index df058c16..2ec4e96f 100644 --- a/build.sc +++ b/build.sc @@ -1,5 +1,5 @@ import $ivy.`com.goyeau::mill-git::0.2.5` -import $ivy.`com.goyeau::mill-scalafix::0.2.11` +import $ivy.`com.goyeau::mill-scalafix::0.3.1` import $ivy.`org.typelevel::scalac-options:0.1.4` import $file.project.Dependencies diff --git a/kubernetes-client/src/com/goyeau/kubernetes/client/api/PodsApi.scala b/kubernetes-client/src/com/goyeau/kubernetes/client/api/PodsApi.scala index 0e3fcc04..567450fd 100644 --- a/kubernetes-client/src/com/goyeau/kubernetes/client/api/PodsApi.scala +++ b/kubernetes-client/src/com/goyeau/kubernetes/client/api/PodsApi.scala @@ -105,13 +105,13 @@ private[client] class NamespacedPodsApi[F[_]]( stderr: Boolean = true, tty: Boolean = false ): F[WSRequest] = { - val uri = (webSocketAddress.resolve(resourceUri) / podName / "exec") - .+?("stdin" -> stdin.toString) - .+?("stdout" -> stdout.toString) - .+?("stderr" -> stderr.toString) - .+?("tty" -> tty.toString) - .+??("container" -> container) - .++?("command" -> commands) + val uri = (webSocketAddress.resolve(resourceUri) / podName / "exec") +? + ("stdin" -> stdin.toString) +? + ("stdout" -> stdout.toString) +? + ("stderr" -> stderr.toString) +? + ("tty" -> tty.toString) +?? + ("container" -> container) ++? + ("command" -> commands) WSRequest(uri, method = Method.POST) .withOptionalAuthorization(authorization) diff --git a/kubernetes-client/src/com/goyeau/kubernetes/client/util/SslContexts.scala b/kubernetes-client/src/com/goyeau/kubernetes/client/util/SslContexts.scala index 5690375e..2dec6f40 100644 --- a/kubernetes-client/src/com/goyeau/kubernetes/client/util/SslContexts.scala +++ b/kubernetes-client/src/com/goyeau/kubernetes/client/util/SslContexts.scala @@ -23,6 +23,7 @@ object SslContexts { sslContext } + @SuppressWarnings(Array("scalafix:DisableSyntax.asInstanceOf")) private def keyManagers[F[_]](config: KubeConfig[F]) = { // Client certificate val certDataStream = config.clientCertData.map(data => new ByteArrayInputStream(Base64.getDecoder.decode(data))) @@ -38,11 +39,11 @@ object SslContexts { } yield { Security.addProvider(new BouncyCastleProvider()) val pemKeyPair = - new PEMParser(new InputStreamReader(keyStream)).readObject().asInstanceOf[PEMKeyPair] // scalafix:ok + new PEMParser(new InputStreamReader(keyStream)).readObject().asInstanceOf[PEMKeyPair] val privateKey = new JcaPEMKeyConverter().setProvider("BC").getPrivateKey(pemKeyPair.getPrivateKeyInfo) val certificateFactory = CertificateFactory.getInstance("X509") - val certificate = certificateFactory.generateCertificate(certStream).asInstanceOf[X509Certificate] // scalafix:ok + val certificate = certificateFactory.generateCertificate(certStream).asInstanceOf[X509Certificate] defaultKeyStore.setKeyEntry( certificate.getSubjectX500Principal.getName, diff --git a/kubernetes-client/src/com/goyeau/kubernetes/client/util/Uris.scala b/kubernetes-client/src/com/goyeau/kubernetes/client/util/Uris.scala index 96a40c15..8fc94ecf 100644 --- a/kubernetes-client/src/com/goyeau/kubernetes/client/util/Uris.scala +++ b/kubernetes-client/src/com/goyeau/kubernetes/client/util/Uris.scala @@ -4,6 +4,6 @@ import org.http4s.Uri object Uris { def addLabels(labels: Map[String, String], uri: Uri): Uri = - if (labels.nonEmpty) uri.+?("labelSelector" -> labels.map { case (k, v) => s"$k=$v" }.mkString(",")) + if (labels.nonEmpty) uri +? ("labelSelector" -> labels.map { case (k, v) => s"$k=$v" }.mkString(",")) else uri }