0

I'm fairly inexperienced with SwiftLint, but my branch is failing to build in CircleCI due to a linting error as indicated in the text below.

We use Carthage as well as Swift Package Manager. From what I can see from the Build Phases -> Swiftlint Lint section, we run a swiftlint shell script.

The question I have is what exactly is generating the issue? All I see is a bunch of "warnings". The output doesn't indicate what exactly is causing the linting to fail (unless all the warnings have to be fixed)?

Also, how can I run the swift lint check locally without having to run it on CircleCI?

swiftformat --config .swiftformat --lint .
Running SwiftFormat...
(lint mode - no files will be changed.)
Reading config file at /root/project/.swiftformat
Reading config file at /root/project/.swiftformat
/root/project/Shared/Classes/RestaurantDatabase.swift:253:1: warning: (trailingSpace) Remove trailing space at end of a line.
/root/project/Shared/Classes/RestaurantDatabase.swift:261:1: warning: (trailingSpace) Remove trailing space at end of a line.
/root/project/Shared/Classes/RestaurantDatabase.swift:266:1: warning: (trailingSpace) Remove trailing space at end of a line.
/root/project/Shared/Classes/RestaurantDatabase.swift:277:1: warning: (braces) Wrap braces in accordance with selected style (K&R or Allman).
/root/project/Shared/Classes/RestaurantDatabase.swift:277:1: warning: (wrapMultilineStatementBraces) Wrap the opening brace of multiline statements.
/root/project/Shared/Classes/RestaurantDatabase.swift:278:1: warning: (wrapMultilineStatementBraces) Wrap the opening brace of multiline statements.
/root/project/Shared/Services/Restaurant Creation/TrustedDeviceManager.swift:12:1: warning: (trailingSpace) Remove trailing space at end of a line.
/root/project/Shared/Services/Restaurant Creation/TrustedDeviceManager.swift:421:1: warning: (trailingSpace) Remove trailing space at end of a line.
/root/project/Shared/Services/Restaurant Creation/TrustedDeviceManager.swift:426:1: warning: (trailingSpace) Remove trailing space at end of a line.
/root/project/Shared/Services/Restaurant Creation/TrustedDeviceManager.swift:429:1: warning: (redundantLetError) Remove redundant let error from catch clause.
/root/project/Shared/Services/Restaurant Creation/TrustedDeviceManager.swift:433:1: warning: (trailingSpace) Remove trailing space at end of a line.
/root/project/Shared/Services/Restaurant Creation/TrustedDeviceManager.swift:436:1: warning: (redundantLetError) Remove redundant let error from catch clause.
/root/project/Shared/Services/Restaurant Creation/TrustedDeviceManager.swift:440:1: warning: (trailingSpace) Remove trailing space at end of a line.
/root/project/Shared/Services/Restaurant Creation/TrustedDeviceManager.swift:442:1: warning: (elseOnSameLine) Place else, catch or while keyword in accordance with current style (same or next line).
/root/project/Shared/Services/Restaurant Creation/TrustedDeviceManager.swift:442:1: warning: (wrapMultilineStatementBraces) Wrap the opening brace of multiline statements.
/root/project/Shared/Services/Restaurant Creation/TrustedDeviceManager.swift:443:1: warning: (elseOnSameLine) Place else, catch or while keyword in accordance with current style (same or next line).
/root/project/Shared/Services/Restaurant Creation/TrustedDeviceManager.swift:443:1: warning: (wrapMultilineStatementBraces) Wrap the opening brace of multiline statements.
/root/project/Shared/Services/Restaurant Creation/TrustedDeviceManager.swift:446:1: warning: (trailingSpace) Remove trailing space at end of a line.
/root/project/Shared/Services/Restaurant Creation/TrustedDeviceManager.swift:449:1: warning: (trailingSpace) Remove trailing space at end of a line.
/root/project/Shared/Services/Restaurant Creation/TrustedDeviceManager.swift:457:1: warning: (trailingSpace) Remove trailing space at end of a line.
/root/project/Shared/Services/Restaurant Creation/TrustedDeviceManager.swift:460:1: warning: (trailingSpace) Remove trailing space at end of a line.
/root/project/Shared/Services/Restaurant Creation/TrustedDeviceManager.swift:473:1: warning: (trailingCommas) Add or remove trailing comma from the last item in a collection literal.
/root/project/iOS/Sources/Domains/SupportMode/SupportModeViewModel.swift:314:1: warning: (trailingSpace) Remove trailing space at end of a line.
/root/project/iOS/Sources/Domains/Connectivity/Devices/Utils/DeviceTrust+Utilities.swift:30:1: warning: (trailingSpace) Remove trailing space at end of a line.
/root/project/iOS/Sources/Domains/Connectivity/Devices/Utils/DeviceTrust+Utilities.swift:113:1: warning: (braces) Wrap braces in accordance with selected style (K&R or Allman).
/root/project/iOS/Sources/Domains/Connectivity/Devices/Utils/DeviceTrust+Utilities.swift:113:1: warning: (wrapMultilineStatementBraces) Wrap the opening brace of multiline statements.
/root/project/iOS/Sources/Domains/Connectivity/Devices/Utils/DeviceTrust+Utilities.swift:114:1: warning: (wrapMultilineStatementBraces) Wrap the opening brace of multiline statements.
SwiftFormat completed in 11.35s.
Source input did not pass lint check.
4/2250 files require formatting, 6 files skipped.

Exited with code exit status 1
CircleCI received exit code 1
JFortYork
  • 137
  • 10

1 Answers1

0

All of the files in the output have problems which is why they're being shown in the output above. The swiftlint command returns a failure code (2) when warnings exceed the configured warning_threshold You can install and run swiftlint locally with brew install swiftlint

Martin
  • 770
  • 6
  • 22