-
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
Identical operands rule using syntaxmap #2918
Identical operands rule using syntaxmap #2918
Conversation
That's weird. Will fix in evening 😊 |
Generated by 🚫 Danger |
Well, at least it's faster |
|
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.
👍 nice work! Removing regex use is probably one of the more impactful ways to speed up SwiftLint 😄
Please add a changelog entry, consider addressing the nitpicks I highlighted, and merge when ready.
Source/SwiftLintFramework/Rules/Lint/IdenticalOperandsRule.swift
Outdated
Show resolved
Hide resolved
Source/SwiftLintFramework/Rules/Lint/IdenticalOperandsRule.swift
Outdated
Show resolved
Hide resolved
Source/SwiftLintFramework/Rules/Lint/IdenticalOperandsRule.swift
Outdated
Show resolved
Hide resolved
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.
Oops, looks like this introduces some new false positives according to OSSCheck's comment.
@jpsim yeah. also, it seems that this solution also can handle bit complex examples like
|
9ec712d
to
1db3eb7
Compare
Let's call it a day. |
Let's fix the remaining false positives first please. They're missing from the latest OSSCheck comment, but here's one that I copied from before: https://github.com/mozilla-mobile/firefox-ios/blob/48798608a791bbaea7ba3e22d58694318a40da0b/Shared/Extensions/URLExtensions.swift#L363:108 |
it's done in the latest commits. |
@PaulTaykalo you should now have push access, feel free to merge when you're ready. |
Rewrite identical operands rule which using syntax map and tokens access instead of full Regex solution.
This solutions search for the operator first and then tries to find operands to the right and to the left of the operator. This is done by searching tokens which has dots between them.
Operands are matching if the next is true: