Merge pull request #164 from scala-steward/update/scalafmt-core-3.5.1

Update scalafmt-core to 3.5.1
This commit is contained in:
hrj 2022-04-17 00:20:09 +05:30 committed by GitHub
commit 353ecaa1eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View File

@ -1,3 +1,3 @@
version="3.5.0" version="3.5.1"
maxColumn = 120 maxColumn = 120
runner.dialect = scala3 runner.dialect = scala3

View File

@ -46,7 +46,7 @@ class BackgroundTask(config: Config, captchaManager: CaptchaManager) {
(captcha.allowedLevels).flatMap { level => (captcha.allowedLevels).flatMap { level =>
(captcha.allowedMedia).flatMap { media => (captcha.allowedMedia).flatMap { media =>
(captcha.allowedInputType).flatMap { inputType => (captcha.allowedInputType).flatMap { inputType =>
(captcha.allowedSizes).map {size => (captcha.allowedSizes).map { size =>
Parameters(level, media, inputType, size) Parameters(level, media, inputType, size)
} }
} }

View File

@ -43,16 +43,16 @@ class FilterChallenge extends ChallengeProvider {
val height = size2D(1) val height = size2D(1)
val canvas = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB) val canvas = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB)
val g = canvas.createGraphics() val g = canvas.createGraphics()
val fontHeight = (height*0.6).toInt val fontHeight = (height * 0.6).toInt
g.setColor(Color.WHITE) g.setColor(Color.WHITE)
g.fillRect(0, 0, canvas.getWidth, canvas.getHeight) g.fillRect(0, 0, canvas.getWidth, canvas.getHeight)
g.setColor(Color.BLACK) g.setColor(Color.BLACK)
val font = new Font("Serif", Font.BOLD, fontHeight) val font = new Font("Serif", Font.BOLD, fontHeight)
g.setFont(font) g.setFont(font)
val stringWidth = g.getFontMetrics().stringWidth(secret) val stringWidth = g.getFontMetrics().stringWidth(secret)
val scaleX = if (stringWidth > width) width/(stringWidth.toDouble) else 1d val scaleX = if (stringWidth > width) width / (stringWidth.toDouble) else 1d
val margin = if (stringWidth > width) 0 else (width - stringWidth) val margin = if (stringWidth > width) 0 else (width - stringWidth)
val xOffset = (margin*r.nextDouble).toInt val xOffset = (margin * r.nextDouble).toInt
g.scale(scaleX, 1d) g.scale(scaleX, 1d)
g.drawString(secret, xOffset, fontHeight) g.drawString(secret, xOffset, fontHeight)
g.dispose() g.dispose()

View File

@ -128,13 +128,13 @@ class RainDropsCP extends ChallengeProvider {
val textX = if (textWidth > width) 0 else ((width - textWidth) / 2) val textX = if (textWidth > width) 0 else ((width - textWidth) / 2)
// this will be overlapped by the following text to show the top outline because of the offset // this will be overlapped by the following text to show the top outline because of the offset
val yOffset = (fontHeight*0.01).ceil.toInt val yOffset = (fontHeight * 0.01).ceil.toInt
g.setColor(textHighlightColor) g.setColor(textHighlightColor)
g.drawString(secret, textX, (fontHeight*1.1).toInt - yOffset) g.drawString(secret, textX, (fontHeight * 1.1).toInt - yOffset)
// paint the text // paint the text
g.setColor(textColor) g.setColor(textColor)
g.drawString(secret, textX, (fontHeight*1.1).toInt) g.drawString(secret, textX, (fontHeight * 1.1).toInt)
g.dispose() g.dispose()
writer.writeToSequence(canvas) writer.writeToSequence(canvas)