Czerwinskimarek88
10/08/2024, 9:28 AM@Test
fun `Invalid function name`() {
}
@Test
fun `valid function name`() {
}
Any guidance on this would be appreciated!Яўген Сліж
10/09/2024, 8:33 AMFunctionNaming
just change functionPattern to ``?([a-z][a-zA-Z0-9 ]*)`?`
You need to do this in detkt.yml
file, documentation
FunctionNaming:
active: true
excludes: ['**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/androidUnitTest/**', '**/androidInstrumentedTest/**', '**/jsTest/**', '**/iosTest/**']
functionPattern: '`?([a-z][a-zA-Z0-9 ]*)`?'
excludeClassPattern: '$^'
I did this for this test class
class TestClass {
fun test() {
println()
}
fun Test() {
println()
}
fun `Test function with capital`() {
println()
}
fun `test function with lowercase letter`() {
println()
}
}
Rule found two issue
/Users/yauheni/Projects/Home/CustomeDetectRule/app/src/test/java/com/github/kiolk/customedetectrule/TestClass.kt:9:9: Function names should match the pattern: `?([a-z][a-zA-Z0-9 ]*)`? [FunctionNaming]
/Users/yauheni/Projects/Home/CustomeDetectRule/app/src/test/java/com/github/kiolk/customedetectrule/TestClass.kt:13:9: Function names should match the pattern: `?([a-z][a-zA-Z0-9 ]*)`? [FunctionNaming]
Czerwinskimarek88
10/09/2024, 9:16 AM