Skip to content

Commit 416d8ae

Browse files
Move strict linting to git push hook (#898)
1 parent adb8507 commit 416d8ae

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

.swiftformat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,6 @@
3131
--wraparguments before-first
3232
--wrapparameters before-first
3333
--wrapcollections before-first
34+
35+
# Exclude paths
36+
--exclude **/Generated,**/generated,**/protobuf,**/OpenApi

fastlane/Fastfile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -673,8 +673,8 @@ desc 'Run source code formatting/linting'
673673
lane :run_swift_format do |options|
674674
Dir.chdir('..') do
675675
strict = options[:strict] ? '--lint' : nil
676-
sources_matrix[:swiftformat_include].each do |path|
677-
sh("mint run swiftformat #{strict} --config .swiftformat --exclude #{sources_matrix[:swiftformat_exclude].join(',')} #{path}")
676+
sources_matrix[:swiftformat].each do |path|
677+
sh("mint run swiftformat #{strict} --config .swiftformat #{path}")
678678
next if path.include?('Tests')
679679

680680
sh("mint run swiftlint lint --config .swiftlint.yml --fix --progress --quiet --reporter json #{path}") unless strict
@@ -711,8 +711,7 @@ lane :sources_matrix do
711711
size: ['Sources', xcode_project],
712712
public_interface: ['Sources'],
713713
ruby: ['fastlane'],
714-
swiftformat_include: ['Sources', 'DemoApp', 'DemoAppUIKit', 'StreamVideoTests', 'StreamVideoSwiftUITests', 'StreamVideoUIKitTests'],
715-
swiftformat_exclude: ['**/Generated', '**/generated', '**/protobuf', '**/OpenApi']
714+
swiftformat: ['Sources', 'DemoApp', 'DemoAppUIKit', 'StreamVideoTests', 'StreamVideoSwiftUITests', 'StreamVideoUIKitTests']
716715
}
717716
end
718717

lefthook.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,38 @@
11
pre-commit:
22
parallel: false
33
jobs:
4-
- run: mint run swiftformat --config .swiftformat --exclude '**/Generated', '**/generated', '**/protobuf', '**/OpenApi' {staged_files}
4+
- run: mint run swiftformat --config .swiftformat {staged_files}
55
glob: "*.{swift}"
66
stage_fixed: true
7+
exclude:
8+
- "**/Generated/**"
9+
- "**/generated/**"
10+
- "**/protobuf/**"
11+
- "**/OpenApi/**"
712
skip:
813
- merge
914
- rebase
1015

1116
- run: mint run swiftlint lint --config .swiftlint.yml --fix --progress --quiet --reporter json {staged_files}
1217
glob: "*.{swift}"
1318
stage_fixed: true
19+
exclude:
20+
- "**/Generated/**"
21+
- "**/generated/**"
22+
- "**/protobuf/**"
23+
- "**/OpenApi/**"
1424
skip:
1525
- merge
1626
- rebase
1727

18-
- run: mint run swiftlint lint --config .swiftlint.yml --strict --progress --quiet --reporter json {staged_files}
28+
pre-push:
29+
jobs:
30+
- run: mint run swiftlint lint --config .swiftlint.yml --strict --progress --quiet --reporter json {push_files}
1931
glob: "*.{swift}"
20-
stage_fixed: true
32+
exclude:
33+
- "**/Generated/**"
34+
- "**/generated/**"
35+
- "**/protobuf/**"
36+
- "**/OpenApi/**"
2137
skip:
22-
- merge
23-
- rebase
38+
- merge-commit

0 commit comments

Comments
 (0)