-
Notifications
You must be signed in to change notification settings - Fork 510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
0.46.1 does not allow nordic chars åäöåæø in enum values #1530
Comments
I guess this applies generally for regex-checks, and the question is, should Also applies to // Filename Foo.kt
data class Foo(val bar: String)
data class Åæø(val bar: String)
// Output: valid
// Filename Åæø.kt
data class Åæø(val bar: String)
data class Foo(val bar: String)
// Output: invalid - File name 'Åæø.kt' should conform PascalCase (cannot be auto-corrected) (filename)
// Filename Åæø.kt
data class Åæø(val bar: String)
// Output: valid |
Sorry, reference above is incorrect. |
This is not a regression problem. The enum value rules was an experimental rule which was moved to the standard ruleset in the 0.46.x release. The problem was not reported by users of the experimental ruleset. PR #1535 resolves the problem. So far only the enum values rule and the filename rule use a regexp that checks for ranges like "a-zA-Z" which disallow diacritics. Note: The rule (set) naming policy is kept unchanged and still does not allow diacritics as they should be in plain English. |
Thanks for having a look at it and creating a PR. |
I was afraid of that. There are a few characters (see unit test) for which the Unicode trick which removes the diacritics does not work. I would need to add a translation table for missing characters. That would be a cumbersome and potential hard to maintain solution if there are more special characters that I am not aware of. |
Hehe yep. An alternative would be checkout upper-/lowercase with |
Thnx for that hint. The characters will now be accepted as well (55ce3e2#diff-3879682bb7a6b6d015c4f82d9645952e98ca9698e76fc61c1e4bf862438dc56d). |
* Allow usage of letters with diacritics or strokes in enum values and filenames. Closes #1530
When we upgrade from 0.45.2 to 0.46.1 ktlint complains on enums and files containing åæø
Edit: I see this is because of https://github.com/pinterest/ktlint/releases/tag/0.46.0
Where some rules goes for experimental to standard.
Expected Behavior
Should be ok
Observed Behavior
Steps to Reproduce
And run
mvn antrun:run@ktlint
Your Environment
The text was updated successfully, but these errors were encountered: