Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update scalafmt-core to 3.7.11 #414

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# Scala Steward: Reformat with scalafmt 3.6.0
49896fb5557f065fbd41afbd74085f49177aa3d4

# Scala Steward: Reformat with scalafmt 3.7.11
5151b3f6bc489ebf8720e8d71a1c65beefd7fff2
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.6.1"
version = "3.7.11"
runner.dialect = scala213
maxColumn = 140
align.preset = some
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import cats.implicits._
import scala.concurrent.ExecutionContext
import cats.data.OptionT

final class MonixFutureCache[K, V](timeProvider: TimeProvider)(implicit ec: ExecutionContext) extends ExpiringCache[Future, K, V] {
final class MonixFutureCache[K, V](
timeProvider: TimeProvider
)(
implicit ec: ExecutionContext
) extends ExpiringCache[Future, K, V] {
private val ref: AtomicAny[Map[K, Entry[V]]] = AtomicAny(Map.empty[K, Entry[V]])

override def get(key: K): Future[Option[V]] =
Expand Down Expand Up @@ -41,6 +45,11 @@ final class MonixFutureCache[K, V](timeProvider: TimeProvider)(implicit ec: Exec
object MonixFutureCache {
final case class Entry[V](value: V, expirationTime: Instant)

def apply[K, V](timeProvider: TimeProvider = TimeProvider.default)(implicit ec: ExecutionContext): MonixFutureCache[K, V] =
def apply[K, V](
timeProvider: TimeProvider = TimeProvider.default
)(
implicit ec: ExecutionContext
): MonixFutureCache[K, V] =
new MonixFutureCache[K, V](timeProvider)

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ import scala.concurrent.duration.FiniteDuration

trait CirceJsonDecoders {

implicit def jsonDecoder[A](implicit decoder: Decoder[A]): JsonDecoder[A] =
implicit def jsonDecoder[A](
implicit decoder: Decoder[A]
): JsonDecoder[A] =
(data: String) => io.circe.parser.decode[A](data).leftMap(error => JsonDecoder.Error(error.getMessage, cause = Some(error)))

implicit val userInfoDecoder: Decoder[UserInfo] = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ import scala.util.control.NonFatal

trait JsoniterJsonDecoders {

implicit def jsonDecoder[A](implicit jsonCodec: JsonValueCodec[A]): JsonDecoder[A] =
implicit def jsonDecoder[A](
implicit jsonCodec: JsonValueCodec[A]
): JsonDecoder[A] =
(data: String) =>
Try(readFromString[A](data)) match {
case Success(value) =>
Expand Down Expand Up @@ -114,10 +116,18 @@ trait JsoniterJsonDecoders {
implicit val refreshTokenResponseDecoder: JsonValueCodec[RefreshTokenResponse] =
JsonCodecMaker.make(CodecMakerConfig.withFieldNameMapper(JsonCodecMaker.enforce_snake_case))

private def customDecoderFromUnsafe[A](read: JsonReader => A)(implicit toNull: Null <:< A): JsonValueCodec[A] =
private def customDecoderFromUnsafe[A](
read: JsonReader => A
)(
implicit toNull: Null <:< A
): JsonValueCodec[A] =
customDecoderTry[A](reader => Try(read(reader)))

private def customDecoderTry[A](read: JsonReader => Try[A])(implicit toNull: Null <:< A): JsonValueCodec[A] =
private def customDecoderTry[A](
read: JsonReader => Try[A]
)(
implicit toNull: Null <:< A
): JsonValueCodec[A] =
customDecoderWithDefault[A](read)(toNull(null))

private def customDecoderWithDefault[A](read: JsonReader => Try[A])(default: A) = new JsonValueCodec[A] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ object AccessTokenProvider {
clientSecret: Secret[String]
)(
backend: SttpBackend[F, Any]
)(implicit decoder: JsonDecoder[ClientCredentialsToken.AccessTokenResponse], oAuth2ErrorDecoder: JsonDecoder[OAuth2Error]): AccessTokenProvider[F] =
)(
implicit decoder: JsonDecoder[ClientCredentialsToken.AccessTokenResponse],
oAuth2ErrorDecoder: JsonDecoder[OAuth2Error]
): AccessTokenProvider[F] =
new AccessTokenProvider[F] {
implicit val F: MonadError[F] = backend.responseMonad

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ trait AuthorizationCodeProvider[UriType, F[_]] {

object AuthorizationCodeProvider {

def apply[U, F[_]](implicit ev: AuthorizationCodeProvider[U, F]): AuthorizationCodeProvider[U, F] = ev
def apply[U, F[_]](
implicit ev: AuthorizationCodeProvider[U, F]
): AuthorizationCodeProvider[U, F] = ev

/*
Structure describing endpoints configuration for selected oauth2 provider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ object ClientCredentials {
scope: Option[Scope]
)(
backend: SttpBackend[F, Any]
)(implicit decoder: JsonDecoder[ClientCredentialsToken.AccessTokenResponse], oAuth2ErrorDecoder: JsonDecoder[OAuth2Error]): F[ClientCredentialsToken.Response] = {
)(
implicit decoder: JsonDecoder[ClientCredentialsToken.AccessTokenResponse],
oAuth2ErrorDecoder: JsonDecoder[OAuth2Error]
): F[ClientCredentialsToken.Response] = {
implicit val F: MonadError[F] = backend.responseMonad
backend
.send {
Expand Down Expand Up @@ -56,7 +59,10 @@ object ClientCredentials {
token: Secret[String]
)(
backend: SttpBackend[F, Any]
)(implicit decoder: JsonDecoder[TokenIntrospectionResponse], oAuth2ErrorDecoder: JsonDecoder[OAuth2Error]): F[Introspection.Response] = {
)(
implicit decoder: JsonDecoder[TokenIntrospectionResponse],
oAuth2ErrorDecoder: JsonDecoder[OAuth2Error]
): F[Introspection.Response] = {
implicit val F: MonadError[F] = backend.responseMonad
backend
.send {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ trait PasswordGrantProvider[F[_]] {

object PasswordGrantProvider {

def apply[F[_]](implicit ev: PasswordGrantProvider[F]): PasswordGrantProvider[F] = ev
def apply[F[_]](
implicit ev: PasswordGrantProvider[F]
): PasswordGrantProvider[F] = ev

def apply[F[_]](
tokenUrl: Uri,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ private[oauth2] final case class RefreshTokenResponse(
)

}

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ trait UserInfoProvider[F[_]] {
}

object UserInfoProvider {
def apply[F[_]](implicit ev: UserInfoProvider[F]): UserInfoProvider[F] = ev

def apply[F[_]](
implicit ev: UserInfoProvider[F]
): UserInfoProvider[F] = ev

private def requestUserInfo[F[_]](
baseUrl: Uri,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ trait JsonDecoder[A] {
}

object JsonDecoder {
def apply[A](implicit ev: JsonDecoder[A]): JsonDecoder[A] = ev

def apply[A](
implicit ev: JsonDecoder[A]
): JsonDecoder[A] = ev

final case class Error(message: String, cause: Option[Throwable] = None) extends Exception(message, cause.orNull)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,29 +161,28 @@ class AuthorizationCodeSpec extends AnyWordSpec with Matchers {
.whenRequestMatches(_ => true)
.thenRespond(jsonResponse)

implicit val decoder: JsonDecoder[ExtendedOAuth2TokenResponse] = JsonDecoderMock.partialFunction {
case `jsonResponse` =>
ExtendedOAuth2TokenResponse(
Secret("secret"),
"refreshToken",
30.seconds,
"userName",
"domain",
TokenUserDetails(
"username",
"name",
"forename",
"surname",
"mail",
"cn",
"sn"
),
roles = Set(),
"scope",
securityLevel = 2L,
"userId",
"tokenType"
)
implicit val decoder: JsonDecoder[ExtendedOAuth2TokenResponse] = JsonDecoderMock.partialFunction { case `jsonResponse` =>
ExtendedOAuth2TokenResponse(
Secret("secret"),
"refreshToken",
30.seconds,
"userName",
"domain",
TokenUserDetails(
"username",
"name",
"forename",
"surname",
"mail",
"cn",
"sn"
),
roles = Set(),
"scope",
securityLevel = 2L,
"userId",
"tokenType"
)
}

val response = AuthorizationCode.authCodeToToken[Try, ExtendedOAuth2TokenResponse](
Expand Down
Loading