dmiluski / bitrise-step-swiftformat

Runs SwiftFormat linting to validate formatted code
MIT License
0 stars 0 forks source link

Clean locally, dirty on bitrise #6

Closed brandtdaniels closed 3 years ago

brandtdaniels commented 3 years ago

Bitrise

 * [OK] swiftformat installed
INFO[03:15:12]  * [OK] Step dependency (swiftformat) installed, available. 
+ '[' -z CRM ']'
+ FLAGS=
+ '[' -s '' ']'
+ cd CRM
+ swiftformat . --lint
Running SwiftFormat...
(lint mode - no files will be changed.)
Reading config file at /Users/vagrant/git/CRM/.swiftformat
/Users/vagrant/git/CRM/CRM/Application/AppSettings.swift:3:1: warning: (enumNamespaces) Converts types used for hosting only static members into enums.
/Users/vagrant/git/CRM/CRM/Application/AppConfiguration.swift:15:1: warning: (enumNamespaces) Converts types used for hosting only static members into enums.
/Users/vagrant/git/CRM/CRM/Application/AppCoordinator.swift:74:1: warning: (indent) Indent code in accordance with the scope level.
/Users/vagrant/git/CRM/CRM/Application/AppCoordinator.swift:115:1: warning: (indent) Indent code in accordance with the scope level.
/Users/vagrant/git/CRM/CRM/Application/AppCoordinator.swift:116:1: warning: (indent) Indent code in accordance with the scope level.
...

Local

± bd |release/0.15.0 ✓| → swiftformat . --lint
Running SwiftFormat...
(lint mode - no files will be changed.)
Reading config file at /Users/bdaniels/Developer/git/mobile.crm.ios/CRM/.swiftformat
SwiftFormat completed in 0.82s.
0/1324 files require formatting, 3 files skipped.
dmiluski commented 3 years ago

I ran into this issue upgrading between Xcode 12.0 and 12.1

Double check:

  1. What brew version is on your local machine? Latest?
  2. What swiftformat is installed on your computer? Latest?
  3. What Xcode is installed on your computer? Vs the Xcode selected for bitrise stack?

As of Xcode 12.1, indentation for things like guard statements have changed. And the latest swiftformat plays friendly with those changes.

brandtdaniels commented 3 years ago

Oh yes, you did mention this...Thank you

brandtdaniels commented 3 years ago

It would be good to be able to specify the version of swiftformat that is used

dmiluski commented 3 years ago

Yeah, that's a pain point I've struggled with. It's been less of an issue shipping with .swfitformat file enabling specific items rather than just defaults as they're updated often. But, things still crop up. Which is not ideal, especially at large companies.

With Carthage, I can pin specific items. I'm not yet sure how to pin specific versions with Brewfile/Bitrise.

dmiluski commented 3 years ago

TBH, Its for this reason I've been toying with the idea of shifting to an in project step (rather than from bitrise) which pulls in swiftformat as a SwiftPM package (which can be specifically bonded with a version). I haven't made the jump just yet though due to other priorities.

https://github.com/nicklockwood/SwiftFormat#2-add-a-build-phases-to-your-app-target

brandtdaniels commented 3 years ago

I've been using a Brewfile, which allows you to specify versions I think...although my team has not specified a version yet...

On Fri, Oct 30, 2020 at 10:07 AM Dane Miluski notifications@github.com wrote:

TBH, Its for this reason I've been toying with the idea of shifting to an in project step (rather than from bitrise) which pulls in swiftformat as a SwiftPM package (which can be specifically bonded with a version). I haven't made the jump just yet though due to other priorities.

https://github.com/nicklockwood/SwiftFormat#2-add-a-build-phases-to-your-app-target

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dmiluski/bitrise-step-swiftformat/issues/6#issuecomment-719678156, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHXPLHRAGBE2HMJOSZFNGDSNLXDLANCNFSM4TEPZMRQ .

brandtdaniels commented 3 years ago

The issue here was that the step, while constantly downloading the latest version of swiftformat, was ahead of my local swiftformat version.