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

False positive with toggle_bool #2471

Closed
rounak opened this Issue Nov 19, 2018 · 1 comment

Comments

Projects
None yet
3 participants
@rounak
Copy link
Contributor

rounak commented Nov 19, 2018

New Issue Checklist

Describe the bug

object.property = !property This triggers a toggle_bool warning even though property is a local variable, and calling .toggle() on object.property might produce incorrect results.

Environment

  • SwiftLint version (run swiftlint version to be sure)? 0.28.1
  • Installation method used (Homebrew, CocoaPods, building from source, etc)? cocoapods
  • Which Xcode version are you using (check xcode-select -p)? 10.1
  • Do you have a sample that shows the issue? Run echo "object.property = !property" | swiftlint lint --no-cache --use-stdin --enable-all-rules
    to quickly test if your example is really demonstrating the issue.
// This triggers a violation:
object.property = !property

@marcelofabri marcelofabri added the bug label Nov 19, 2018

biboran added a commit to biboran/SwiftLint that referenced this issue Nov 23, 2018

biboran added a commit to biboran/SwiftLint that referenced this issue Nov 23, 2018

jpsim added a commit that referenced this issue Nov 24, 2018

#2471 - Fix false positive toggle_bool (#2479)
* #2471 - Fix false positive toggle_bool by using negative lookbehind on dot and word character

* #2471 - Update changelog
@jpsim

This comment has been minimized.

Copy link
Collaborator

jpsim commented Nov 24, 2018

Fixed in #2479

@jpsim jpsim closed this Nov 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment