nicklockwood / SwiftFormat

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

Add `noExplicitOwnersip` rule #1516

Closed calda closed 11 months ago

calda commented 12 months ago

This PR adds a new disabled-by-default noExplicitOwnership rule, which removes borrowing and consuming ownership modifiers.

Ownership modifiers do not affect the correctness of code, and adding / removing them does not affect behavior. Some teams may prefer to avoid using these modifiers (except in truly performance-critical code) since they would add mental overhead for little gain in most cases.

- borrowing func foo(_ bar: consuming Bar) { ... }
+ func foo(_ bar: Bar) { ... }
codecov[bot] commented 12 months ago

Codecov Report

Merging #1516 (5ae64a9) into develop (28c7e4f) will increase coverage by 0.31%. Report is 1 commits behind head on develop. The diff coverage is 97.10%.

@@             Coverage Diff             @@
##           develop    #1516      +/-   ##
===========================================
+ Coverage    95.06%   95.37%   +0.31%     
===========================================
  Files           20       20              
  Lines        21373    21534     +161     
===========================================
+ Hits         20318    20538     +220     
+ Misses        1055      996      -59     
Files Changed Coverage Δ
Sources/ParsingHelpers.swift 96.74% <90.90%> (-0.08%) :arrow_down:
Sources/Examples.swift 99.93% <100.00%> (+<0.01%) :arrow_up:
Sources/Rules.swift 99.35% <100.00%> (+0.73%) :arrow_up:

... and 3 files with indirect coverage changes