-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Fix false positive on shorthand_operator rule #1157
Conversation
Generated by 🚫 danger |
Current coverage is 82.23% (diff: 100%)@@ master #1157 diff @@
==========================================
Files 165 165
Lines 8151 8151
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
Hits 6703 6703
Misses 1448 1448
Partials 0 0
|
|
||
private static let pattern: String = { | ||
let escapedOperators = allOperators.map { "\\\($0)" }.joined() | ||
let operators = "[\(escapedOperators)]" | ||
let escaped = { (operators: [String]) -> String in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You use this pattern to escape characters in OperatorFunctionWhitespaceRule and OperatorUsageWhitespaceRule (and possibly others). Might be worth refactoring this into a helper?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's complex enough to justify the additional complexity
Fixes #1156