rspec/rules/S4232/swift/rule.adoc
Fred Tingaud 16f6c0aecf
Inline adoc when include has no additional value (#1940)
Inline adoc files when they are included exactly once.

Also fix language tags because this inlining gives us better information
on what language the code is written in.
2023-05-25 14:18:12 +02:00

69 lines
1.6 KiB
Plaintext

== Why is this an issue?
Some legacy geometry functions can be replaced with struct extension properties or methods.
This rule raises an issue when any of the following substitutions can be made:
||Legacy Function||Preferred Replacement||
|``++CGRectGetWidth(rect)++``|``++rect.width++``|
|``++CGRectGetHeight(rect)++``|``++rect.height++``|
|``++CGRectGetMinX(rect)++``|``++rect.minX++``|
|``++CGRectGetMidX(rect)++``|``++rect.midX++``|
|``++CGRectGetMaxX(rect)++``|``++rect.maxX++``|
|``++CGRectGetMinY(rect)++``|``++rect.minY++``|
|``++CGRectGetMidY(rect)++``|``++rect.midY++``|
|``++CGRectGetMaxY(rect)++``|``++rect.maxY++``|
|``++CGRectIsNull(rect)++``|``++rect.isNull++``|
|``++CGRectIsEmpty(rect)++``|``++rect.isEmpty++``|
|``++CGRectIsInfinite(rect)++``|``++rect.isInfinite++``|
|``++CGRectStandardize++``|``++rect.standardized++``|
|``++CGRectIntegral(rect)++``|``++rect.integral++``|
|``++CGRectInset(rect, x, y)++``|``++rect.insetBy(dx: x, dy: y)++``|
|``++CGRectOffset(rect, x, y++``|``++rect.offsetBy(dx: x, dy: y++``|
|``++CGRectUnion(rect1, rect2)++``|``++rect1.union(rect2)++``|
|``++CGRectIntersection( rect1 ,rect2)++``|``++rect1.intersect(rect2)++``|
|``++CGRectContainsRect(rect1, rect2)++``|``++rect1.contains(rect2)++``|
|``++CGRectContainsPoint(rect, point)++``|``++rect.contains(point)++``|
|``++CGRectIntersectsRect(rect1, rect2)++``|``++rect1.intersects(rect2)++``|
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Replace 'xxxx' with 'yyyy'
=== Highlighting
The function call
endif::env-github,rspecator-view[]