Closed calda closed 3 months ago
Attention: Patch coverage is 96.18209%
with 52 lines
in your changes are missing coverage. Please review.
Project coverage is 95.19%. Comparing base (
088875d
) to head (fe2ae2d
). Report is 37 commits behind head on develop.:exclamation: Current head fe2ae2d differs from pull request most recent head 89e0129. Consider uploading reports for the commit 89e0129 to get more accurate results
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Oh, I love this one! 😍
Worth noting: I'd like to enable this rule by default, but people do sometimes deliberately assign the result of a complex expression to a variable before returning so that they can use a breakpoint to inspect its value. I wonder if there's a heuristic to detect cases like that.
Hmmmm, that's a reasonable use case but I can't think of a reliable heuristic for it. We could use some sort of token count or character count threshold that is enabled by default, if you think that's valuable.
Updated to resolve merge conflicts with https://github.com/nicklockwood/SwiftFormat/pull/1655
btw, looks like there are test failures on develop
starting with https://github.com/nicklockwood/SwiftFormat/commit/7c7941ee7f237b0928c00d0f58dc1240a52ac0eb
This PR adds a new
redundantProperty
rule, which removes a property declaration if that property is just returned immediately. For example:Here's an example of a pattern I saw somewhat frequently in Airbnb's codebase:
The
conditionalAssignment
rule converts this tolet foo = switch { ... }; return foo
. Now with bothconditionalAssignment
andredundantProperty
enabled, it's instead converted to an even simpler form: