Fix code analytics

Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
alperozturk 2024-07-02 15:37:23 +02:00 committed by Alper Öztürk
parent f547e50e4e
commit d48b043e02
2 changed files with 5 additions and 2 deletions

View file

@ -16,7 +16,7 @@ import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Test
class FileNameValidatorTests: AbstractIT() {
class FileNameValidatorTests : AbstractIT() {
@Test
fun testInvalidCharacter() {

View file

@ -22,8 +22,11 @@ object FileNameValidator {
"LPT¹", "LPT²", "LPT³"
)
@Suppress("ReturnCount")
fun isValid(name: String, context: Context, fileNames: MutableSet<String>? = null): String? {
val invalidCharacter = name.find { it.toString().matches(reservedWindowsChars) || it.toString().matches(reservedUnixChars) }
val invalidCharacter = name.find {
it.toString().matches(reservedWindowsChars) || it.toString().matches(reservedUnixChars)
}
if (invalidCharacter != null) {
return context.getString(R.string.file_name_validator_error_invalid_character, invalidCharacter)
}