Closed fbartho closed 7 years ago
This is a bit tricky, because allowed_symbols
was added to add exceptions for validating that identifiers only have alphanumeric characters.
I wonder what's the most predictable thing to do here. Just checking if the first character is in allowed_symbols
might surprise someone too.
On a first look, I guess we should change the rule to validate that the first character is not an uppercase one (instead of enforcing it to be a lowercase).
In fact, that's what the other rules that use NameConfiguration
do, so I guess this is a bug.
Turns out this is a duplicate of #1762.
Note that this issue exists for type_name
as well.
Description
I created a method prefixed with double underscores. I had
identifier_name
rule enabled, and had the option ofallowed_symbols: "_"
enabledExpectation: method would pass the identifier name check. Reality: method triggered a rule violation.
A casual reading of IdentifierNameRule shows that there is an if-block that handles name rules for functions, and this if-block does not reference the allowed_symbols list.
Reference: Line 77
New Issue Checklist
Bug Report
Complete output when running SwiftLint, including the stack trace and command used
Environment
swiftlint version
to be sure)?xcode-select -p
)?