Skip to content

Commit 20aaf20

Browse files
committed
Introduce SwiftLint.
1 parent 8f24573 commit 20aaf20

35 files changed

+1002
-940
lines changed

.swiftlint.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#
2+
# NOTE:
3+
# To fix `trailing_whitespace` error,
4+
# go to Xcode Preferences -> Text Editing -> turn on both "Automatically trim trailing whitespace" and "Including whitespace-only lines".
5+
#
6+
7+
disabled_rules:
8+
- variable_name_min_length
9+
- line_length
10+
- function_body_length
11+
- type_body_length
12+
- file_length
13+
- cyclomatic_complexity
14+
15+
- opening_brace # prefer Allman-Style
16+
- statement_position # allow `if {}\nelse {}`
17+
- type_name # allow "_" prefix name
18+
- variable_name # allow "_" prefix name
19+
- todo
20+
- valid_docs
21+
22+
opt_in_rules:
23+
- empty_count
24+
25+
#included:
26+
# - Sources
27+
# - Tests
28+
29+
excluded:
30+
- Carthage
31+
- Packages
32+
- Benchmark/Packages
33+
34+
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle)

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ import PackageDescription
1010

1111
let package = Package(
1212
name: "SwiftState"
13-
)
13+
)

Sources/Disposable.swift

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
//
88

99
//
10-
// NOTE:
10+
// NOTE:
1111
// This file is a partial copy from ReactiveCocoa v4.0.0-alpha.4 (removing `Atomic` dependency),
12-
// which has not been taken out as microframework yet.
12+
// which has not been taken out as microframework.
1313
// https://github.com/ReactiveCocoa/ReactiveCocoa/issues/2579
1414
//
1515
// Note that `ActionDisposable` also works as `() -> ()` wrapper to help suppressing warning:
@@ -19,27 +19,27 @@
1919
/// Represents something that can be “disposed,” usually associated with freeing
2020
/// resources or canceling work.
2121
public protocol Disposable {
22-
/// Whether this disposable has been disposed already.
23-
var disposed: Bool { get }
22+
/// Whether this disposable has been disposed already.
23+
var disposed: Bool { get }
2424

25-
func dispose()
25+
func dispose()
2626
}
2727

2828
/// A disposable that will run an action upon disposal.
2929
public final class ActionDisposable: Disposable {
30-
private var action: (() -> ())?
30+
private var action: (() -> ())?
3131

32-
public var disposed: Bool {
33-
return action == nil
34-
}
32+
public var disposed: Bool {
33+
return action == nil
34+
}
3535

36-
/// Initializes the disposable to run the given action upon disposal.
37-
public init(action: () -> ()) {
38-
self.action = action
39-
}
36+
/// Initializes the disposable to run the given action upon disposal.
37+
public init(action: () -> ()) {
38+
self.action = action
39+
}
4040

41-
public func dispose() {
42-
self.action?()
41+
public func dispose() {
42+
self.action?()
4343
self.action = nil
44-
}
45-
}
44+
}
45+
}

Sources/EventType.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ extension Event: RawRepresentable
3939
self = .Any
4040
}
4141
}
42-
42+
4343
public var rawValue: E?
4444
{
4545
switch self {

0 commit comments

Comments
 (0)