Skip to content

Commit 3fd62f4

Browse files
authored
refactor: re-enable lint rules (#30)
* refactor: re-enable lint rules * more linting * add back lint rule * nit swiftlint * use SPM for 5.4 test * update ci * update ci
1 parent 35a7fe9 commit 3fd62f4

File tree

111 files changed

+724
-666
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+724
-666
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Use multiple cores
2424
run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
2525
- name: Build-Test
26-
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace Parse.xcworkspace -scheme ParseSwift\ \(iOS\) -destination platform\=iOS\ Simulator,name\=iPhone\ 12\ Pro\ Max -derivedDataPath DerivedData -test-iterations 10 -retry-tests-on-failure clean test | xcpretty
26+
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace Parse.xcworkspace -scheme ParseSwift\ \(iOS\) -destination platform\=iOS\ Simulator,name\=iPhone\ 12\ Pro\ Max -derivedDataPath DerivedData clean test | xcpretty
2727
env:
2828
DEVELOPER_DIR: ${{ env.CI_XCODE_LATEST }}
2929
- name: Prepare codecov
@@ -57,7 +57,7 @@ jobs:
5757
- name: Use multiple cores
5858
run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
5959
- name: Build-Test
60-
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace Parse.xcworkspace -scheme ParseSwift\ \(macOS\) -destination platform\=macOS -derivedDataPath DerivedData -test-iterations 10 -retry-tests-on-failure clean test | xcpretty
60+
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace Parse.xcworkspace -scheme ParseSwift\ \(macOS\) -destination platform\=macOS -derivedDataPath DerivedData clean test | xcpretty
6161
env:
6262
DEVELOPER_DIR: ${{ env.CI_XCODE_LATEST }}
6363
- name: Prepare codecov
@@ -84,8 +84,8 @@ jobs:
8484
- uses: actions/checkout@v3
8585
- name: Use multiple cores
8686
run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
87-
- name: Build
88-
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace Parse.xcworkspace -scheme ParseSwift\ \(tvOS\) -destination platform\=tvOS\ Simulator,name\=Apple\ TV -derivedDataPath DerivedData -test-iterations 10 -retry-tests-on-failure clean test | xcpretty
87+
- name: Build-Test
88+
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace Parse.xcworkspace -scheme ParseSwift\ \(tvOS\) -destination platform\=tvOS\ Simulator,name\=Apple\ TV -derivedDataPath DerivedData clean test | xcpretty
8989
env:
9090
DEVELOPER_DIR: ${{ env.CI_XCODE_LATEST }}
9191
- name: Prepare codecov
@@ -136,7 +136,7 @@ jobs:
136136
security set-keychain-settings -lut 7200 temporary
137137
- name: Use multiple cores
138138
run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
139-
- name: Build and Test
139+
- name: Build-Test
140140
run: swift test --enable-code-coverage -v
141141
env:
142142
DEVELOPER_DIR: ${{ env.CI_XCODE_LATEST }}
@@ -157,14 +157,14 @@ jobs:
157157
env:
158158
DEVELOPER_DIR: ${{ env.CI_XCODE_LATEST }}
159159

160-
xcode-test-ios-5_4:
160+
xcode-test-tvos-5_4:
161161
timeout-minutes: 15
162162
needs: xcode-build-watchos
163163
runs-on: macos-11
164164
steps:
165165
- uses: actions/checkout@v3
166166
- name: Build-Test
167-
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace Parse.xcworkspace -scheme ParseSwift\ \(iOS\) -destination platform\=iOS\ Simulator,name\=iPhone\ 11 -derivedDataPath DerivedData clean test | xcpretty
167+
run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace Parse.xcworkspace -scheme ParseSwift\ \(tvOS\) -destination platform\=tvOS\ Simulator,name\=Apple\ TV -derivedDataPath DerivedData clean test | xcpretty
168168
env:
169169
DEVELOPER_DIR: ${{ env.CI_XCODE_OLDEST }}
170170
- name: Prepare codecov

.swiftlint.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
disabled_rules:
2-
- large_tuple
3-
- unused_optional_binding
4-
- type_name
52
- file_length
6-
- cyclomatic_complexity
7-
- function_body_length
8-
- type_body_length
9-
- inclusive_language
10-
- comment_spacing
113
- identifier_name
124
excluded: # paths to ignore during linting. Takes precedence over `included`.
135
- Tests/ParseSwiftTests/ParseEncoderTests

ParseSwift.playground/Pages/11 - LiveQuery.xcplaygroundpage/Contents.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ subscription2.handleUnsubscribe { query in
191191
ParseLiveQuery.client?.close()
192192

193193
//: To close all LiveQuery connections use:
194-
//ParseLiveQuery.client?.closeAll()
194+
// ParseLiveQuery.client?.closeAll()
195195

196196
//: Ping the LiveQuery server. This should produce an error
197197
//: because LiveQuery is disconnected.

ParseSwift.playground/Pages/7 - GeoPoint.xcplaygroundpage/Contents.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@ query2.find { result in
322322
/*: Explain the previous query. Read the documentation note on `explain`
323323
queries and use a type-erased wrapper such as AnyCodable.
324324
*/
325-
//let explain: AnyDecodable = try query8.firstExplain()
326-
//print(explain)
325+
// let explain: AnyDecodable = try query8.firstExplain()
326+
// print(explain)
327327

328328
PlaygroundPage.current.finishExecution()
329329
//: [Next](@next)

ParseSwift.xcodeproj/project.pbxproj

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2442,7 +2442,6 @@
24422442
912C9BD424D3011F009947C3 /* Sources */,
24432443
912C9BD524D3011F009947C3 /* Frameworks */,
24442444
912C9BD624D3011F009947C3 /* Resources */,
2445-
918CED61268A23A700CFDC83 /* SwiftLint */,
24462445
);
24472446
buildRules = (
24482447
);
@@ -2637,25 +2636,6 @@
26372636
shellPath = /bin/sh;
26382637
shellScript = "if test -d \"/opt/homebrew/bin/\"; then\n PATH=\"/opt/homebrew/bin/:${PATH}\"\nfi\n\nexport PATH\n\nif which swiftlint >/dev/null; then\n swiftlint --fix && swiftlint --strict\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
26392638
};
2640-
918CED61268A23A700CFDC83 /* SwiftLint */ = {
2641-
isa = PBXShellScriptBuildPhase;
2642-
alwaysOutOfDate = 1;
2643-
buildActionMask = 2147483647;
2644-
files = (
2645-
);
2646-
inputFileListPaths = (
2647-
);
2648-
inputPaths = (
2649-
);
2650-
name = SwiftLint;
2651-
outputFileListPaths = (
2652-
);
2653-
outputPaths = (
2654-
);
2655-
runOnlyForDeploymentPostprocessing = 0;
2656-
shellPath = /bin/sh;
2657-
shellScript = "if which swiftlint >/dev/null; then\n swiftlint --strict\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
2658-
};
26592639
918CED62268A23E600CFDC83 /* SwiftLint */ = {
26602640
isa = PBXShellScriptBuildPhase;
26612641
alwaysOutOfDate = 1;

Sources/ParseSwift/API/API+Command.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import FoundationNetworking
1313

1414
internal extension API {
1515
// MARK: API.Command
16+
// swiftlint:disable:next type_body_length
1617
struct Command<T, U>: Encodable where T: ParseEncodable {
1718
typealias ReturnType = U // swiftlint:disable:this nesting
1819
let method: API.Method
@@ -249,7 +250,7 @@ internal extension API {
249250
}
250251
}
251252
} else if let otherURL = self.otherURL {
252-
//Non-parse servers do not receive any parse dedicated request info
253+
// Non-parse servers do not receive any parse dedicated request info
253254
var request = URLRequest(url: otherURL)
254255
request.cachePolicy = requestCachePolicy(options: options)
255256
URLSession.parse.downloadTask(with: request, mapper: mapper) { result in

Sources/ParseSwift/API/API+NonParseBodyCommand.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ internal extension API.NonParseBodyCommand {
151151

152152
internal extension API.NonParseBodyCommand {
153153
// MARK: Batch - Child Objects
154+
// swiftlint:disable:next function_body_length
154155
static func batch(objects: [ParseEncodable],
155156
transaction: Bool,
156157
objectsSavedBeforeThisOne: [String: PointerType]?,

Sources/ParseSwift/Coding/AnyDecodable.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ struct AnyDecodable: Decodable {
3535
}
3636
}
3737

38-
protocol _AnyDecodable {
38+
protocol _AnyDecodable { // swiftlint:disable:this type_name
3939
var value: Any { get }
4040
init<T>(_ value: T?)
4141
}
@@ -74,6 +74,7 @@ extension _AnyDecodable {
7474
}
7575

7676
extension AnyDecodable: Equatable {
77+
// swiftlint:disable:next cyclomatic_complexity
7778
static func == (lhs: AnyDecodable, rhs: AnyDecodable) -> Bool {
7879
switch (lhs.value, rhs.value) {
7980
#if canImport(Foundation)

Sources/ParseSwift/Coding/AnyEncodable.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ struct AnyEncodable: Encodable {
3838
}
3939

4040
@usableFromInline
41-
protocol _AnyEncodable {
41+
protocol _AnyEncodable { // swiftlint:disable:this type_name
4242

4343
var value: Any { get }
4444
init<T>(_ value: T?)
@@ -110,6 +110,7 @@ extension _AnyEncodable {
110110
}
111111

112112
#if canImport(Foundation)
113+
// swiftlint:disable:next cyclomatic_complexity
113114
private func encode(nsnumber: NSNumber, into container: inout SingleValueEncodingContainer) throws {
114115
switch Character(Unicode.Scalar(UInt8(nsnumber.objCType.pointee))) {
115116
case "c", "C":

Sources/ParseSwift/Coding/ParseEncoder.swift

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// Copyright © 2020 Parse. All rights reserved.
77
//
88

9-
//===----------------------------------------------------------------------===//
9+
// ===----------------------------------------------------------------------===//
1010
//
1111
// This source file is part of the Swift.org open source project
1212
//
@@ -16,10 +16,12 @@
1616
// See https://swift.org/LICENSE.txt for license information
1717
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
1818
//
19-
//===----------------------------------------------------------------------===//
19+
// ===----------------------------------------------------------------------===//
2020

2121
import Foundation
2222

23+
// swiftlint:disable type_name
24+
2325
/// A marker protocol used to determine whether a value is a `String`-keyed `Dictionary`
2426
/// containing `Encodable` values (in which case it should be exempt from key conversion strategies).
2527
///
@@ -1117,9 +1119,9 @@ internal struct _ParseEncodingStorage {
11171119
}
11181120
}
11191121

1120-
//===----------------------------------------------------------------------===//
1122+
// ===----------------------------------------------------------------------===//
11211123
// Error Utilities
1122-
//===----------------------------------------------------------------------===//
1124+
// ===----------------------------------------------------------------------===//
11231125

11241126
extension EncodingError {
11251127
/// Returns a `.invalidValue` error describing the given invalid floating-point value.
@@ -1143,9 +1145,9 @@ extension EncodingError {
11431145
}
11441146
}
11451147

1146-
//===----------------------------------------------------------------------===//
1148+
// ===----------------------------------------------------------------------===//
11471149
// Shared Key Types
1148-
//===----------------------------------------------------------------------===//
1150+
// ===----------------------------------------------------------------------===//
11491151

11501152
private struct _JSONKey : CodingKey {
11511153
public var stringValue: String
@@ -1174,9 +1176,9 @@ private struct _JSONKey : CodingKey {
11741176
static let `super` = _JSONKey(stringValue: "super")!
11751177
}
11761178

1177-
//===----------------------------------------------------------------------===//
1179+
// ===----------------------------------------------------------------------===//
11781180
// Shared ISO8601 Date Formatter
1179-
//===----------------------------------------------------------------------===//
1181+
// ===----------------------------------------------------------------------===//
11801182
// swiftlint:disable:next line_length
11811183
// NOTE: This value is implicitly lazy and _must_ be lazy. We're compiled against the latest SDK (w/ ISO8601DateFormatter), but linked against whichever Foundation the user has. ISO8601DateFormatter might not exist, so we better not hit this code path on an older OS.
11821184
@available(macOS 10.12, iOS 10.0, watchOS 3.0, tvOS 10.0, *)

0 commit comments

Comments
 (0)