Skip to content
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

Merged
merged 1 commit into from
Jan 11, 2017
Merged

Fix false positive on shorthand_operator rule #1157

merged 1 commit into from
Jan 11, 2017

Conversation

marcelofabri
Copy link
Collaborator

Fixes #1156

@SwiftLintBot
Copy link

7 Messages
📖 Linting realm-cocoa with this PR took 3.36s vs 3.44s on master (2% faster)
📖 Linting Alamofire with this PR took 2.91s vs 3.09s on master (5% faster)
📖 Linting swift with this PR took 10.42s vs 10.94s on master (4% faster)
📖 This PR fixed a violation in swift: /stdlib/private/StdlibUnittest/LifetimeTracked.swift#L33:5: error: Shorthand Operator Violation: Prefer shorhand operators (+=, -=, *=, /=) over doing the operation and assigning. (shorthand_operator)
📖 Linting SourceKitten with this PR took 1.6s vs 1.66s on master (3% faster)
📖 Linting Moya with this PR took 0.43s vs 0.44s on master (2% faster)
📖 Linting Aerial with this PR took 0.41s vs 0.41s on master (0% slower)

Generated by 🚫 danger

@codecov-io
Copy link

codecov-io commented Jan 11, 2017

Current coverage is 82.23% (diff: 100%)

Merging #1157 into master will not change coverage

@@             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          

Powered by Codecov. Last update a9f13af...cbe149f


private static let pattern: String = {
let escapedOperators = allOperators.map { "\\\($0)" }.joined()
let operators = "[\(escapedOperators)]"
let escaped = { (operators: [String]) -> String in
Copy link

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?

Copy link
Collaborator Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants