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

Erroneous fix for NSIntersectionRect #3703

Closed
2 tasks done
J-rg opened this issue Aug 28, 2021 · 0 comments · Fixed by #4213
Closed
2 tasks done

Erroneous fix for NSIntersectionRect #3703

J-rg opened this issue Aug 28, 2021 · 0 comments · Fixed by #4213
Labels
bug Unexpected and reproducible misbehavior.

Comments

@J-rg
Copy link

J-rg commented Aug 28, 2021

New Issue Checklist

Describe the bug

When using the legacy_nsgeometry_functions rule, SwiftLint replaces NSIntersectionRect(rect1, rect2) with rect1.intersect(rect2). CGRect does not have an intersect(_:) method, the correct method name would be intersection(_:), however, if two rectangles don’t intersect, the intersection(_:) method produces CGRect.null, while NSIntersectionRect(_:_:) produces CGRect.zero, so replacing it might silently break the code.

Environment

  • SwiftLint version? 0.43.1
  • Installation method used? Homebrew
  • Which Xcode version are you using? Xcode 12.5.1 (12E507)
  • Do you have a sample that shows the issue? echo "NSIntersectionRect(rect1, rect2)" | swiftlint lint --no-cache --use-stdin --enable-all-rules
@jpsim jpsim added the bug Unexpected and reproducible misbehavior. label Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected and reproducible misbehavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants