https://kotlinlang.org logo
#detekt
Title
# detekt
p

PJ Walstrom

05/13/2022, 3:51 PM
Is it possible to configure detekt to allow characters outside of the
a-z
range in e.g. function names? I see that `parameterPattern: '[a-z][A-Za-z0-9]*'`is used, but I would like to use the Norwegian characters
æ
,
ø
and
å
in function names, too. Any help would be highly appreciated!
Copy code
fun vilkårsØnske() {}
1
g

gammax

05/13/2022, 7:08 PM
Can't you extend the regex to include those chars? Also using non ASCII chars in the source code sounds like a bad idea to be 😅
☝️ 1
p

PJ Walstrom

05/13/2022, 8:42 PM
yes, you are right, thank you. The solution is
Copy code
parameterPattern: '[a-zæøå][A-ZÆØÅa-zæøå0-9]*'
👍 2
Regarding using non-ASCII characters in the source code: our domain is heavily related to formal writings of several legal texts. It just makes sense to keep the definitions also in the source code to avoid confusion. Norwegian characters are part of the extended ASCII Codes and Java/Kotlin supports the entire Unicode character set for just this reason (ref Java Language Specification section 3.8)
👍 1
2 Views