Permalink
Browse files

Add Swiftlint basic YAML

  • Loading branch information...
freak4pc authored and kzaher committed Jan 5, 2019
1 parent bc30215 commit 2e645681e140120bc6723f43599430e027f1ad80
Showing with 138 additions and 111 deletions.
  1. +7 −0 .swiftlint.yml
  2. +21 −0 Rx.xcodeproj/project.pbxproj
  3. +1 −1 RxBlocking/RunLoopLock.swift
  4. +2 −2 RxCocoa/Common/Binder.swift
  5. +2 −2 RxCocoa/Common/DelegateProxy.swift
  6. +1 −1 RxCocoa/Deprecated.swift
  7. +3 −3 RxCocoa/Foundation/NSObject+Rx.swift
  8. +2 −2 RxCocoa/Traits/SharedSequence/SchedulerType+SharedSequence.swift
  9. +1 −1 RxCocoa/Traits/SharedSequence/SharedSequence+Operators.swift
  10. +0 −1 RxCocoa/Traits/Signal/ObservableConvertibleType+Signal.swift
  11. +1 −1 RxCocoa/iOS/Protocols/RxCollectionViewDataSourceType.swift
  12. +4 −4 RxCocoa/iOS/UIButton+Rx.swift
  13. +2 −2 RxCocoa/iOS/UIControl+Rx.swift
  14. +3 −3 RxCocoa/iOS/UISegmentedControl+Rx.swift
  15. +1 −1 RxCocoa/macOS/NSControl+Rx.swift
  16. +1 −1 RxExample/RxDataSources/Differentiator/Diff.swift
  17. +1 −1 RxExample/RxDataSources/Differentiator/Utilities.swift
  18. +1 −1 RxExample/RxDataSources/RxDataSources/DataSources.swift
  19. +4 −4 RxExample/RxExample-iOSTests/Mocks/MockWireframe.swift
  20. +1 −1 RxExample/RxExample/Examples/ImagePicker/UIImagePickerController+RxCreate.swift
  21. +2 −2 RxExample/RxExample/Lenses.swift
  22. +1 −1 RxExample/RxExample/Services/ActivityIndicator.swift
  23. +2 −2 RxExample/RxExample/Services/Reachability.swift
  24. +2 −2 RxExample/RxExample/Version.swift
  25. +1 −1 RxSwift/AnyObserver.swift
  26. +1 −1 RxSwift/Disposables/AnonymousDisposable.swift
  27. +1 −1 RxSwift/Extensions/Bag+Rx.swift
  28. +1 −1 RxSwift/ImmediateSchedulerType.swift
  29. +1 −1 RxSwift/ObservableType+Extensions.swift
  30. +5 −5 RxSwift/Observables/Do.swift
  31. +1 −1 RxSwift/Observables/ObserveOn.swift
  32. +2 −2 RxSwift/Observables/Scan.swift
  33. +1 −1 RxSwift/Observables/Zip.swift
  34. +1 −1 RxSwift/SchedulerType.swift
  35. +1 −1 RxSwift/Schedulers/SchedulerServices+Emulation.swift
  36. +4 −4 RxSwift/Traits/Completable.swift
  37. +4 −4 RxSwift/Traits/Maybe.swift
  38. +8 −8 RxSwift/Traits/Single.swift
  39. +1 −1 RxTest/HotObservable.swift
  40. +3 −3 Tests/Microoptimizations/PerformanceTools.swift
  41. +1 −1 Tests/RxCocoaTests/DelegateProxyTest.swift
  42. +5 −5 Tests/RxCocoaTests/SentMessageTest.swift
  43. +1 −1 Tests/RxCocoaTests/SharedSequence+Test.swift
  44. +12 −12 Tests/RxSwiftTests/BagTest.swift
  45. +3 −3 Tests/RxSwiftTests/CompletableTest.swift
  46. +4 −4 Tests/RxSwiftTests/MaybeTest.swift
  47. +1 −1 Tests/RxSwiftTests/RecursiveLockTest.swift
  48. +3 −3 Tests/RxSwiftTests/SingleTest.swift
  49. +2 −2 Tests/XCTest+AllTests.swift
  50. +4 −4 scripts/package-spm.swift
@@ -0,0 +1,7 @@
included:
- Sources
disabled_rules:
- line_length
- trailing_whitespace
- type_name

@@ -2632,6 +2632,7 @@
C8A56AD21AD7424700B4673B /* Sources */,
C8A56AD51AD7424700B4673B /* Resources */,
C8A56AD31AD7424700B4673B /* Frameworks */,
A21F589121E109AD0051AEA2 /* ShellScript */,
);
buildRules = (
);
@@ -2810,6 +2811,26 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
A21F589121E109AD0051AEA2 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which swiftlint >/dev/null; then\nswiftlint\nelse\necho \"warning: SwiftLint is installed\"\nfi\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
C80938F61B8A71760088E94D /* Sources */ = {
isa = PBXSourcesBuildPhase;
@@ -31,7 +31,7 @@ final class RunLoopLock {
_currentRunLoop = CFRunLoopGetCurrent()
}

func dispatch(_ action: @escaping () -> ()) {
func dispatch(_ action: @escaping () -> Void) {
CFRunLoopPerformBlock(_currentRunLoop, runLoopModeRaw) {
if CurrentThreadScheduler.isScheduleRequired {
_ = CurrentThreadScheduler.instance.schedule(()) { _ in
@@ -20,14 +20,14 @@ import RxSwift
public struct Binder<Value>: ObserverType {
public typealias E = Value

private let _binding: (Event<Value>) -> ()
private let _binding: (Event<Value>) -> Void

/// Initializes `Binder`
///
/// - parameter target: Target object.
/// - parameter scheduler: Scheduler used to bind the events.
/// - parameter binding: Binding logic.
public init<Target: AnyObject>(_ target: Target, scheduler: ImmediateSchedulerType = MainScheduler(), binding: @escaping (Target, Value) -> ()) {
public init<Target: AnyObject>(_ target: Target, scheduler: ImmediateSchedulerType = MainScheduler(), binding: @escaping (Target, Value) -> Void) {
weak var weakTarget = target

_binding = { event in
@@ -27,7 +27,7 @@
private weak var _parentObject: ParentObject?

fileprivate let _currentDelegateFor: (ParentObject) -> AnyObject?
fileprivate let _setCurrentDelegateTo: (AnyObject?, ParentObject) -> ()
fileprivate let _setCurrentDelegateTo: (AnyObject?, ParentObject) -> Void

/// Initializes new instance.
///
@@ -277,7 +277,7 @@
.subscribeOn(mainScheduler)
}

var on: (Event<[Any]>) -> () {
var on: (Event<[Any]>) -> Void {
return self.dispatcher.on
}

@@ -245,7 +245,7 @@ extension ObservableType {
**This shouldn't be used in normal release builds.**
*/
@available(*, deprecated, renamed: "SharingScheduler.mock(scheduler:action:)")
public func driveOnScheduler(_ scheduler: SchedulerType, action: () -> ()) {
public func driveOnScheduler(_ scheduler: SchedulerType, action: () -> Void) {
SharingScheduler.mock(scheduler: scheduler, action: action)
}

@@ -267,7 +267,7 @@ extension Reactive where Base: AnyObject {
init() {
}

@objc func deallocating() -> Void {
@objc func deallocating() {
messageSent.on(.next(()))
}

@@ -293,11 +293,11 @@ extension Reactive where Base: AnyObject {
init() {
}

@objc func messageSent(withArguments arguments: [Any]) -> Void {
@objc func messageSent(withArguments arguments: [Any]) {
messageSent.on(.next(arguments))
}

@objc func methodInvoked(withArguments arguments: [Any]) -> Void {
@objc func methodInvoked(withArguments arguments: [Any]) {
methodInvoked.on(.next(arguments))
}

@@ -18,7 +18,7 @@ public enum SharingScheduler {
**This shouldn't be used in normal release builds.**
*/
static public func mock(scheduler: SchedulerType, action: () -> ()) {
static public func mock(scheduler: SchedulerType, action: () -> Void) {
return mock(makeScheduler: { scheduler }, action: action)
}

@@ -28,7 +28,7 @@ public enum SharingScheduler {
**This shouldn't be used in normal release builds.**
*/
static public func mock(makeScheduler: @escaping () -> SchedulerType, action: () -> ()) {
static public func mock(makeScheduler: @escaping () -> SchedulerType, action: () -> Void) {
let originalMake = make
make = makeScheduler

@@ -114,7 +114,7 @@ extension SharedSequenceConvertibleType {
- parameter onDispose: Action to invoke after subscription to source observable has been disposed for any reason. It can be either because sequence terminates for some reason or observer subscription being disposed.
- returns: The source sequence with the side-effecting behavior applied.
*/
public func `do`(onNext: ((E) -> Void)? = nil, onCompleted: (() -> Void)? = nil, onSubscribe: (() -> ())? = nil, onSubscribed: (() -> ())? = nil, onDispose: (() -> ())? = nil)
public func `do`(onNext: ((E) -> Void)? = nil, onCompleted: (() -> Void)? = nil, onSubscribe: (() -> Void)? = nil, onSubscribed: (() -> Void)? = nil, onDispose: (() -> Void)? = nil)
-> SharedSequence<SharingStrategy, E> {
let source = self.asObservable()
.do(onNext: onNext, onCompleted: onCompleted, onSubscribe: onSubscribe, onSubscribed: onSubscribed, onDispose: onDispose)
@@ -55,4 +55,3 @@ extension ObservableConvertibleType {
return Signal(source)
}
}

@@ -21,7 +21,7 @@ public protocol RxCollectionViewDataSourceType /*: UICollectionViewDataSource*/
///
/// - parameter collectionView: Bound collection view.
/// - parameter observedEvent: Event
func collectionView(_ collectionView: UICollectionView, observedEvent: Event<Element>) -> Void
func collectionView(_ collectionView: UICollectionView, observedEvent: Event<Element>)
}

#endif
@@ -50,21 +50,21 @@ extension Reactive where Base: UIButton {

/// Reactive wrapper for `setTitle(_:for:)`
public func title(for controlState: UIControlState = []) -> Binder<String?> {
return Binder(self.base) { (button, title) -> () in
return Binder(self.base) { (button, title) -> Void in
button.setTitle(title, for: controlState)
}
}

/// Reactive wrapper for `setImage(_:for:)`
public func image(for controlState: UIControlState = []) -> Binder<UIImage?> {
return Binder(self.base) { (button, image) -> () in
return Binder(self.base) { (button, image) -> Void in
button.setImage(image, for: controlState)
}
}

/// Reactive wrapper for `setBackgroundImage(_:for:)`
public func backgroundImage(for controlState: UIControlState = []) -> Binder<UIImage?> {
return Binder(self.base) { (button, image) -> () in
return Binder(self.base) { (button, image) -> Void in
button.setBackgroundImage(image, for: controlState)
}
}
@@ -81,7 +81,7 @@ extension Reactive where Base: UIButton {

/// Reactive wrapper for `setAttributedTitle(_:controlState:)`
public func attributedTitle(for controlState: UIControlState = []) -> Binder<NSAttributedString?> {
return Binder(self.base) { (button, attributedTitle) -> () in
return Binder(self.base) { (button, attributedTitle) -> Void in
button.setAttributedTitle(attributedTitle, for: controlState)
}
}
@@ -63,7 +63,7 @@ extension Reactive where Base: UIControl {
public func controlProperty<T>(
editingEvents: UIControlEvents,
getter: @escaping (Base) -> T,
setter: @escaping (Base, T) -> ()
setter: @escaping (Base, T) -> Void
) -> ControlProperty<T> {
let source: Observable<T> = Observable.create { [weak weakControl = base] observer in
guard let control = weakControl else {
@@ -93,7 +93,7 @@ extension Reactive where Base: UIControl {
internal func controlPropertyWithDefaultEvents<T>(
editingEvents: UIControlEvents = [.allEditingEvents, .valueChanged],
getter: @escaping (Base) -> T,
setter: @escaping (Base, T) -> ()
setter: @escaping (Base, T) -> Void
) -> ControlProperty<T> {
return controlProperty(
editingEvents: editingEvents,
@@ -30,21 +30,21 @@ extension Reactive where Base: UISegmentedControl {

/// Reactive wrapper for `setEnabled(_:forSegmentAt:)`
public func enabledForSegment(at index: Int) -> Binder<Bool> {
return Binder(self.base) { (segmentedControl, segmentEnabled) -> () in
return Binder(self.base) { (segmentedControl, segmentEnabled) -> Void in
segmentedControl.setEnabled(segmentEnabled, forSegmentAt: index)
}
}

/// Reactive wrapper for `setTitle(_:forSegmentAt:)`
public func titleForSegment(at index: Int) -> Binder<String?> {
return Binder(self.base) { (segmentedControl, title) -> () in
return Binder(self.base) { (segmentedControl, title) -> Void in
segmentedControl.setTitle(title, forSegmentAt: index)
}
}

/// Reactive wrapper for `setImage(_:forSegmentAt:)`
public func imageForSegment(at index: Int) -> Binder<UIImage?> {
return Binder(self.base) { (segmentedControl, image) -> () in
return Binder(self.base) { (segmentedControl, image) -> Void in
segmentedControl.setImage(image, forSegmentAt: index)
}
}
@@ -48,7 +48,7 @@ extension Reactive where Base: NSControl {
/// - parameter setter: Property value setter.
public func controlProperty<T>(
getter: @escaping (Base) -> T,
setter: @escaping (Base, T) -> ()
setter: @escaping (Base, T) -> Void
) -> ControlProperty<T> {
MainScheduler.ensureExecutingOnScheduler()

@@ -181,7 +181,7 @@ public enum Diff {
return ContiguousArray<ItemAssociatedData>(repeating: ItemAssociatedData.initial, count: items.count)
})

try initialIdentities.withUnsafeBufferPointer { (identitiesBuffer: UnsafeBufferPointer<Identity>) -> () in
try initialIdentities.withUnsafeBufferPointer { (identitiesBuffer: UnsafeBufferPointer<Identity>) -> Void in
var dictionary: [OptimizedIdentity<Identity>: Int] = Dictionary(minimumCapacity: totalInitialItems * 2)

for i in 0 ..< initialIdentities.count {
@@ -13,7 +13,7 @@ enum DifferentiatorError : Error {
case preconditionFailed(message: String)
}

func precondition(_ condition: Bool, _ message: @autoclosure() -> String) throws -> () {
func precondition(_ condition: Bool, _ message: @autoclosure() -> String) throws -> Void {
if condition {
return
}
@@ -12,7 +12,7 @@ enum RxDataSourceError : Error {
case preconditionFailed(message: String)
}

func rxPrecondition(_ condition: Bool, _ message: @autoclosure() -> String) throws -> () {
func rxPrecondition(_ condition: Bool, _ message: @autoclosure() -> String) throws -> Void {
if condition {
return
}
@@ -9,12 +9,12 @@
import RxSwift
import struct Foundation.URL

class MockWireframe : Wireframe {
let _openURL: (URL) -> ()
class MockWireframe: Wireframe {
let _openURL: (URL) -> Void
let _promptFor: (String, Any, [Any]) -> Observable<Any>

init(openURL: @escaping (URL) -> () = notImplementedSync(),
promptFor: @escaping (String, Any, [Any]) -> Observable<Any> = notImplemented()) {
init(openURL: @escaping (URL) -> Void = notImplementedSync(),
promptFor: @escaping (String, Any, [Any]) -> Observable<Any> = notImplemented()) {
_openURL = openURL
_promptFor = promptFor
}
@@ -25,7 +25,7 @@ func dismissViewController(_ viewController: UIViewController, animated: Bool) {
}

extension Reactive where Base: UIImagePickerController {
static func createWithParent(_ parent: UIViewController?, animated: Bool = true, configureImagePicker: @escaping (UIImagePickerController) throws -> () = { x in }) -> Observable<UIImagePickerController> {
static func createWithParent(_ parent: UIViewController?, animated: Bool = true, configureImagePicker: @escaping (UIImagePickerController) throws -> Void = { x in }) -> Observable<UIImagePickerController> {
return Observable.create { [weak parent] observer in
let imagePicker = UIImagePickerController()
let dismissDisposable = imagePicker.rx
@@ -17,13 +17,13 @@ extension Mutable {
return newSelf
}

func mutate(transform: (inout Self) -> ()) -> Self {
func mutate(transform: (inout Self) -> Void) -> Self {
var newSelf = self
transform(&newSelf)
return newSelf
}

func mutate(transform: (inout Self) throws -> ()) rethrows -> Self {
func mutate(transform: (inout Self) throws -> Void) rethrows -> Self {
var newSelf = self
try transform(&newSelf)
return newSelf
@@ -13,7 +13,7 @@ private struct ActivityToken<E> : ObservableConvertibleType, Disposable {
private let _source: Observable<E>
private let _dispose: Cancelable

init(source: Observable<E>, disposeAction: @escaping () -> ()) {
init(source: Observable<E>, disposeAction: @escaping () -> Void) {
_source = source
_dispose = Disposables.create(with: disposeAction)
}
@@ -51,8 +51,8 @@ func callback(reachability:SCNetworkReachability, flags: SCNetworkReachabilityFl

public class Reachability {

public typealias NetworkReachable = (Reachability) -> ()
public typealias NetworkUnreachable = (Reachability) -> ()
public typealias NetworkReachable = (Reachability) -> Void
public typealias NetworkUnreachable = (Reachability) -> Void

public enum NetworkStatus: CustomStringConvertible {

@@ -31,13 +31,13 @@ struct Version<Value>: Hashable {
}

extension Version {
func mutate(transform: (inout Value) -> ()) -> Version<Value> {
func mutate(transform: (inout Value) -> Void) -> Version<Value> {
var newSelf = self.value
transform(&newSelf)
return Version(newSelf)
}

func mutate(transform: (inout Value) throws -> ()) rethrows -> Version<Value> {
func mutate(transform: (inout Value) throws -> Void) rethrows -> Version<Value> {
var newSelf = self.value
try transform(&newSelf)
return Version(newSelf)
@@ -49,7 +49,7 @@ public struct AnyObserver<Element> : ObserverType {

extension AnyObserver {
/// Collection of `AnyObserver`s
typealias s = Bag<(Event<Element>) -> ()>
typealias s = Bag<(Event<Element>) -> Void>
}

extension ObserverType {
@@ -54,7 +54,7 @@ extension Disposables {
/// Constructs a new disposable with the given action used for disposal.
///
/// - parameter dispose: Disposal action which will be run upon calling `dispose`.
public static func create(with dispose: @escaping () -> ()) -> Cancelable {
public static func create(with dispose: @escaping () -> Void) -> Cancelable {
return AnonymousDisposable(disposeAction: dispose)
}

@@ -10,7 +10,7 @@
// MARK: forEach
@inline(__always)
func dispatch<E>(_ bag: Bag<(Event<E>) -> ()>, _ event: Event<E>) {
func dispatch<E>(_ bag: Bag<(Event<E>) -> Void>, _ event: Event<E>) {
bag._value0?(event)

if bag._onlyFastPath {
@@ -26,7 +26,7 @@ extension ImmediateSchedulerType {
- parameter action: Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.
- returns: The disposable object used to cancel the scheduled action (best effort).
*/
public func scheduleRecursive<State>(_ state: State, action: @escaping (_ state: State, _ recurse: (State) -> ()) -> ()) -> Disposable {
public func scheduleRecursive<State>(_ state: State, action: @escaping (_ state: State, _ recurse: (State) -> Void) -> Void) -> Disposable {
let recursiveScheduler = RecursiveImmediateScheduler(action: action, scheduler: self)

recursiveScheduler.schedule(state)
@@ -86,7 +86,7 @@ extension ObservableType {
import class Foundation.NSRecursiveLock

extension Hooks {
public typealias DefaultErrorHandler = (_ subscriptionCallStack: [String], _ error: Error) -> ()
public typealias DefaultErrorHandler = (_ subscriptionCallStack: [String], _ error: Error) -> Void
public typealias CustomCaptureSubscriptionCallstack = () -> [String]

fileprivate static let _lock = RecursiveLock()
Oops, something went wrong.

0 comments on commit 2e64568

Please sign in to comment.