@@ -21,8 +21,9 @@ import cats.syntax.all._
2121import io .chrisdavenport .log4cats .Logger
2222import org .http4s .Uri
2323import org .scalasteward .core .git .GitAlg
24- import org .scalasteward .core .scalafmt .ScalafmtAlg
24+ import org .scalasteward .core .scalafmt .{ scalafmtBinary , ScalafmtAlg }
2525import org .scalasteward .core .util .UrlChecker
26+ import org .scalasteward .core .util .logger .LoggerOps
2627
2728final class SelfCheckAlg [F [_]](implicit
2829 gitAlg : GitAlg [F ],
@@ -40,23 +41,18 @@ final class SelfCheckAlg[F[_]](implicit
4041 } yield ()
4142
4243 private def checkGitBinary : F [Unit ] =
43- gitAlg.version.attempt.flatMap {
44- case Right (output) => logger.info(s " Using $output" )
45- case Left (throwable) =>
46- logger.warn(throwable)(
47- " Failed to execute git -- make sure it is on the PATH; following the detailed exception:"
48- )
44+ logger.attemptLogWarn_(execFailedMessage(" git" )) {
45+ gitAlg.version.flatMap(output => logger.info(s " Using $output" ))
4946 }
5047
5148 private def checkScalafmtBinary : F [Unit ] =
52- scalafmtAlg.version.attempt.flatMap {
53- case Right (output) => logger.info(s " Using $output" )
54- case Left (throwable) =>
55- logger.warn(throwable)(
56- " Failed to execute scalafmt -- make sure it is on the PATH; following the detailed exception:"
57- )
49+ logger.attemptLogWarn_(execFailedMessage(scalafmtBinary)) {
50+ scalafmtAlg.version.flatMap(output => logger.info(s " Using $output" ))
5851 }
5952
53+ private def execFailedMessage (binary : String ): String =
54+ s " Failed to execute $binary -- make sure it is on the PATH; following the detailed exception: "
55+
6056 private def checkUrlChecker : F [Unit ] =
6157 for {
6258 url <- F .fromEither(Uri .fromString(" https://github.com" ))
0 commit comments