https://kotlinlang.org logo
#ktlint
Title
# ktlint
s

Seokjae Lee

03/14/2024, 1:30 AM
Hello 🙂 How can I allow the underscore(
_
) in function name? For example, There's a query method feature in Spring Data project and for using this feature, I use underscore in function name.
Copy code
fun findByUserDetail_UserId (userId)
But the ktlint said(Actually I use ktlint-gradle) the message below...
Copy code
Function name should start with a lowercase letter (except factory methods) and use camel case (cannot be auto-corrected)
How can I allow it? 🤔
p

Paul Dingemans

03/14/2024, 8:23 AM
You can not configure this unless those functions are always annotated. See https://pinterest.github.io/ktlint/latest/rules/standard/#function-naming how to suppress the rule in case the function is annotated. But you can always suppress individual occurrences (or maybe once per class classes that contains those functions). https://pinterest.github.io/ktlint/latest/faq/#how-do-i-suppress-errors-for-a-lineblockfile
thank you color 1
s

Seokjae Lee

03/18/2024, 1:00 AM
Thanks for your clear & detailed explanation @Paul Dingemans 🙂 Now I can handle it using the annotation you mentioned!
5 Views