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.
Including them in
allowed_symbolsdoesn'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!
Most helpful comment
We are running in the same issue.