nicklockwood / SwiftFormat

A command-line tool and Xcode Extension for formatting Swift code
MIT License
7.63k stars 623 forks source link

Fix issue where declaration body wouldn't be sorted if organizeDeclarations was enabled but excluded declaration type #1628

Closed calda closed 4 months ago

calda commented 4 months ago

This PR fixes an issue where declaration bodies wouldn't be sorted if the organizeDeclarations rule was enabled, but configured with a organizeTypes value that excluded that declaration type.

For example, organizeTypes excludes extensions by default. So when organizeDeclarations was enabled, the neither the sortDeclarations rule nor the organizeDeclarations rule would apply the // swiftformat:sort directive.

This PR should fix https://github.com/nicklockwood/SwiftFormat/issues/1622.

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (cc6ca5a) 95.12% compared to head (9dd8aea) 95.12%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #1628 +/- ## ======================================== Coverage 95.12% 95.12% ======================================== Files 20 20 Lines 22328 22337 +9 ======================================== + Hits 21239 21248 +9 Misses 1089 1089 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.