Hello :slightly_smiling_face: How can I allow the ...
# ktlint
s
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
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
Thanks for your clear & detailed explanation @Paul Dingemans 🙂 Now I can handle it using the annotation you mentioned!