xcode 哪些文件在SwiftLint中失败?

xxslljrj  于 2023-01-14  发布在  Swift
关注(0)|答案(1)|浏览(137)

我对SwiftLint相当缺乏经验,但是由于下面文本中指出的一个linting错误,我的分支无法在CircleCI中构建。
我们使用Carthage以及Swift包管理器。从构建阶段-〉Swiftlint Lint部分可以看到,我们运行了一个Swiftlint shell脚本。
我的问题是到底是什么导致了这个问题?我所看到的只是一堆“警告”。输出并没有指出到底是什么导致了掉毛失败(除非所有的警告都必须修复)?
另外,如何在本地运行swift lint检查,而不必在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
nxowjjhe

nxowjjhe1#

输出中的所有文件都有问题,这就是为什么它们显示在上面的输出中。当警告超过配置的warning_threshold时,swiftlint命令返回失败代码(2)您可以使用brew install swiftlint在本地安装和运行swiftlint

相关问题