-
Notifications
You must be signed in to change notification settings - Fork 659
Open
Labels
Description
@calda I was testing out the new noGuardInTests
rule in one of my projects. It works great for cases like this:
guard let intersection = plane1.intersection(with: plane2) else {
XCTFail()
return
}
XCTAssertEqual(intersection, Line(origin: [-1, 0, 1], direction: -.unitY))
However I had to disable it because it was also removing the guard in cases like this:
guard polygons.count > 1 else {
return
}
let a = Set(polygons[0].vertices.map(\.position))
I wonder if there's a way to make it configurable to only apply in the former and not the latter cases?
It's probably too complex to try to examine the condition itself for bounds checks, but perhaps we could have an option to only remove guard let
constructs and not other types of guard?