Closed soudai-s closed 5 months ago
this example is reported by ktlint as function-naming violation, is it correct?
The rule is based on https://kotlinlang.org/docs/coding-conventions.html#function-names. This guideline has been loosened so that underscores are allowed in names of test cases. Also diacritics and stokes on letters (for example è
or ŷ
) are allowed.
Characters like 条件
do not comply with this rule. In your case it might be best to disable this entire rule or to start using function names wrapped between backticks.
Could you change the behavior for multi-byte characters of function-naming in test similar to the snake case? I think the base rule https://kotlinlang.org/docs/coding-conventions.html#function-names does apply to the code except test, since ktlint permit the snake case in the test. The same rule above already apply to Android Studio as default (no matter what in the test with the function whose name has multi-byte characters).
The proposed behavior is also applied by default in Android Studio (there is no warning in the test even if the function name contains multibyte characters).
Could you change the behavior for multi-byte characters of function-naming in test similar to the snake case? I think the base rule https://kotlinlang.org/docs/coding-conventions.html#function-names does apply to the code except test, since ktlint permit the snake case in the test.
Based on references below, I do not agree with this.
https://kotlinlang.org/docs/coding-conventions.html#names-for-test-methods
In tests (and only in tests), you can use method names with spaces enclosed in backticks. Note that such method names are currently not supported by the Android runtime. Underscores in method names are also allowed in test code.
https://developer.android.com/kotlin/style-guide#naming_2
Identifiers use only ASCII letters and digits, and, in a small number of cases noted below, underscores. Thus each valid identifier name is matched by the regular expression \w+.
Special prefixes or suffixes, like those seen in the examples name_, mName, s_name, and kName, are not used except in the case of backing properties (see Backing properties).
Ok, Thank you for the consideration.
A function naming violation is reported in the test file, is this behavior correct? Apparently it didn't happen with v0.47.1.
Expected Behavior
Nothing.
Observed Behavior
Be Reported as function-naming.
Steps to Reproduce