Reformat with scalafmt 3.0.0

This commit is contained in:
Scala Steward
2021-08-19 08:50:30 +02:00
parent 5a2a0295ef
commit e4fecefaea
127 changed files with 558 additions and 658 deletions

View File

@ -19,10 +19,9 @@ sealed trait ConversionResult[F[_]] {
object ConversionResult {
/** The conversion is done by external tools that write files to the
* file system. These are temporary files and they will be deleted
* once the process finishes. This handler is used to do something
* relevant with the resulting files.
/** The conversion is done by external tools that write files to the file system. These
* are temporary files and they will be deleted once the process finishes. This handler
* is used to do something relevant with the resulting files.
*/
type Handler[F[_], A] = Kleisli[F, ConversionResult[F], A]

View File

@ -12,11 +12,10 @@ import scodec.bits.ByteVector
@FunctionalInterface
trait SanitizeHtml {
/** The given `bytes' are html which can be modified to strip out
* unwanted content.
/** The given `bytes' are html which can be modified to strip out unwanted content.
*
* The result should use the same character encoding as the given
* charset implies, or utf8 if not specified.
* The result should use the same character encoding as the given charset implies, or
* utf8 if not specified.
*/
def apply(bytes: ByteVector, charset: Option[Charset]): ByteVector

View File

@ -132,7 +132,7 @@ private[extern] object ExternConv {
): Pipe[F, Byte, Unit] =
in =>
Stream
.eval(logger.debug(s"Storing input to file ${inFile} for running $name"))
.eval(logger.debug(s"Storing input to file $inFile for running $name"))
.drain ++
Stream.eval(storeFile(in, inFile))

View File

@ -150,12 +150,12 @@ class ConversionTest extends FunSuite with FileChecks {
conversion
.use { conv =>
def check: Handler[IO, Unit] =
Kleisli({
Kleisli {
case ConversionResult.InputMalformed(_, _) =>
().pure[IO]
case cr =>
IO.raiseError(new Exception(s"Unexpected result: $cr"))
})
}
runConversion(bombs, _ => check, conv).compile.drain
}
@ -171,12 +171,12 @@ class ConversionTest extends FunSuite with FileChecks {
.emits(uris)
.covary[IO]
.zipWithIndex
.evalMap({ case (uri, index) =>
.evalMap { case (uri, index) =>
val load = uri.readURL[IO](8192)
val dataType = DataType.filename(uri.path.segments.last)
logger.info(s"Processing file ${uri.path.asString}") *>
conv.toPDF(dataType, Language.German, handler(index))(load)
})
}
def commandsExist: Boolean =
commandExists(convertConfig.unoconv.command.program) &&

View File

@ -48,7 +48,7 @@ trait FileChecks {
storePdfTxtHandler(file, file.resolveSibling("unexpected.txt")).map(_._1)
def storePdfTxtHandler(filePdf: Path, fileTxt: Path): Handler[IO, (Path, Path)] =
Kleisli({
Kleisli {
case ConversionResult.SuccessPdfTxt(pdf, txt) =>
for {
pout <- pdf.through(storeFile(filePdf)).compile.lastOrError
@ -64,7 +64,7 @@ trait FileChecks {
case cr =>
throw new Exception(s"Unexpected result: $cr")
})
}
def commandExists(cmd: String): Boolean =
Runtime.getRuntime.exec(Array("which", cmd)).waitFor() == 0