Enable AlsoCouldBeApply rule

This commit is contained in:
Wolf-Martell Montwé 2023-10-10 10:56:20 +02:00
parent 6393a4ece7
commit b970e2f90f
No known key found for this signature in database
GPG key ID: 6D45B21512ACBF72
4 changed files with 7 additions and 7 deletions

View file

@ -6,5 +6,5 @@ import java.util.UUID
@Suppress("NULLABILITY_MISMATCH_BASED_ON_JAVA_ANNOTATIONS")
fun createRandomTempDirectory(): File {
val tempDirectory = File(System.getProperty("java.io.tmpdir", "."))
return File(tempDirectory, UUID.randomUUID().toString()).also { it.mkdir() }
return File(tempDirectory, UUID.randomUUID().toString()).apply { mkdir() }
}

View file

@ -506,7 +506,7 @@ potential-bugs:
style:
active: true
AlsoCouldBeApply:
active: false
active: true
BracesOnIfStatements:
active: false
singleLine: 'never'

View file

@ -85,8 +85,8 @@ class AuthorizationRepositoryTest {
val testSubject = AuthorizationRepository(
service = service,
)
val intent = Intent().also {
it.putExtra(AuthorizationResponse.EXTRA_RESPONSE, authorizationResponse.jsonSerializeString())
val intent = Intent().apply {
putExtra(AuthorizationResponse.EXTRA_RESPONSE, authorizationResponse.jsonSerializeString())
}
// When
@ -137,8 +137,8 @@ class AuthorizationRepositoryTest {
Uri.parse("https://example.com/errorUri"),
null,
)
val intent = Intent().also {
it.putExtra(AuthorizationException.EXTRA_EXCEPTION, authorizationException.toJsonString())
val intent = Intent().apply {
putExtra(AuthorizationException.EXTRA_EXCEPTION, authorizationException.toJsonString())
}
// When

View file

@ -395,7 +395,7 @@ class Pop3ConnectionTest {
}
private fun startServer(block: MockPop3Server.() -> Unit): MockPop3Server {
return MockPop3Server().apply(block).also { it.start() }
return MockPop3Server().apply(block).apply { start() }
}
companion object {