Swiftlint: Non ascii operators are rejected by `identifier_name` for not starting with a lowercase letter.

Created on 10 Aug 2017  Â·  11Comments  Â·  Source: realm/SwiftLint

While ["/", "=", "-", "+", "!", "*", "|", "^", "~", "?", ".", "%", "<", ">", "&"] are specifically allowed as the first character of operators, anything else is rejected.

e.g. using • as the compose operator or § as function application is relatively common and useful. Including them in allowed_symbols doesn't circumvent this behaviour. Should it? The isOperator function seems otherwise very narrow in its permissiveness.

I don't really want to disable the entire feature just to allow these functions.

bug wontfix

Most helpful comment

We are running in the same issue.

All 11 comments

Including them in allowed_symbols doesn't circumvent this behaviour. Should it?

I think so.


Also, I think there's another bug in the implementation currently:

let containsAllowedSymbol = configuration.allowedSymbols.contains(where: name.contains)
                if !containsAllowedSymbol &&
                    !CharacterSet.alphanumerics.isSuperset(ofCharactersIn: name) 

This doesn't seem to guarantee that all non-alphanumeric characters in name are in configuration.allowedSymbols.

OK. Cheers. I'll work on something for this in the next couple of days.

Was there any progress on this? I'm trying to permit variables/functions that begin with underscores.

@dcutting, this comment in the related pull request describes the current state of things.

In #2134 @marcelofabri wrote:

SwiftLint started validating local variables with Xcode 9.3.

This has quite an impact on this issue, because now all local variables that start with an underscore are flagged as errors and since allowed_symbols does not work, there's no option to prevent this.

Also looks like a regression of #628, unless the default behaviour has been changed on purpose.

We are running in the same issue.

I don't think I ended up pushing anything. I got sidetracked onto work. :

We are running in the same issue.

allowed_symbols not works for enum cases

has anyone been able to give this attention?

This issue has been automatically marked as stale because it has not had any recent activity. Please comment to prevent this issue from being closed. Thank you for your contributions!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BalestraPatrick picture BalestraPatrick  Â·  3Comments

ArthurMaroulier picture ArthurMaroulier  Â·  3Comments

msanders picture msanders  Â·  4Comments

Den-Ree picture Den-Ree  Â·  3Comments

jcarroll-mediafly picture jcarroll-mediafly  Â·  3Comments