podfile.lock update and linter rules update

This commit is contained in:
Ivan Smolin 2017-03-07 16:32:01 +05:00
parent ccf33130b5
commit fb3dc417a4
35 changed files with 81 additions and 59 deletions

View File

@ -1,8 +1,21 @@
disabled_rules:
- force_cast
- trailing_whitespace
- variable_name
excluded:
- Carthage
- Pods
- RxAlamofire
line_length: 128
line_length: 128
type_body_length:
- 500 # warning
- 700 # error
file_length:
warning: 500
error: 1200
warning_threshold: 1
custom_rules:
uiwebview_disabled:
included: ".*.swift"
name: "UIWebView Usage Disabled"
regex: "(UIWebView)"
message: "Do not use UIWebView. Use WKWebView Instead. https://developer.apple.com/reference/uikit/uiwebview"
severity: error

View File

@ -70,5 +70,5 @@ public class FixedPageCursor<Cursor: CursorType>: CursorType where Cursor.LoadRe
.flatMap { _ in self.loadNextBatch() }
}
}
}

View File

@ -79,5 +79,5 @@ public class MapCursor<Cursor: CursorType, T>: CursorType where Cursor.LoadResul
return startIndex..<self.elements.count
}
}
}

View File

@ -57,5 +57,5 @@ public class StaticCursor<Element>: CursorType {
return Observable.just(0..<self.count)
}
}
}

View File

@ -22,7 +22,6 @@
import Foundation
import CocoaLumberjack
import CocoaLumberjack.DDDispatchQueueLogFormatter
class LogFormatter: DDDispatchQueueLogFormatter {
fileprivate let dateFormatter: DateFormatter

View File

@ -115,5 +115,5 @@ public extension Observable {
networkService.decreaseRequestCounter()
})
}
}

View File

@ -65,5 +65,5 @@ public extension CGContext {
space: colorSpace,
bitmapInfo: bitmapInfo.rawValue)
}
}

View File

@ -49,5 +49,5 @@ public extension CGImage {
return ctx?.makeImage()
}
}

View File

@ -71,7 +71,7 @@ public extension CGImage {
}
view.layer.render(in: ctx)
return ctx.makeImage()
}

View File

@ -45,5 +45,5 @@ public extension CGImage {
return cropping(to: cropRect)
}
}

View File

@ -49,5 +49,5 @@ public extension CGImage {
return ctx.makeImage()
}
}

View File

@ -94,7 +94,7 @@ public extension CGImage {
} else {
ctx.stroke(inset, width: border)
}
return ctx.makeImage()
}
@ -191,13 +191,13 @@ public extension CGImage {
y: padding,
width: CGFloat(width),
height: CGFloat(height))
ctx.addRect(imageLocation)
ctx.clip()
ctx.draw(self, in: imageLocation)
return ctx.makeImage()
}
}

View File

@ -31,7 +31,7 @@ public extension CursorType where LoadResultType == CountableRange<Int> {
var loadedElements: [Self.Element] {
return self[0..<count]
}
}
public extension CursorType where LoadResultType == CountableClosedRange<Int> {
@ -43,5 +43,5 @@ public extension CursorType where LoadResultType == CountableClosedRange<Int> {
var loadedElements: [Self.Element] {
return self[0...count - 1]
}
}

View File

@ -30,8 +30,8 @@ extension IndexPath {
if Mirror(reflecting: self).subjectType == IndexPath.self { // check for UIMutableIndexPath
return self
}
return IndexPath(item: item, section: section)
}
}

View File

@ -41,5 +41,5 @@ public extension Observable {
return Disposables.create()
}
}
}

View File

@ -61,5 +61,5 @@ public extension Sequence {
.toArray()
.map { $0.sorted { $0.0.idx < $0.1.idx }.flatMap { $0.results } }
}
}

View File

@ -43,5 +43,5 @@ ViewControllerIdentifier: RawRepresentable, ViewControllerIdentifier.RawValue ==
public static func instantiateViewController(_ viewController: ViewControllerIdentifier) -> UIViewController {
return uiStoryboard.instantiateViewController(withIdentifier: viewController.rawValue)
}
}

View File

@ -75,8 +75,8 @@ public extension String {
context: nil).size
let fontLineHeight = (attributes?[NSFontAttributeName] as? UIFont)?.lineHeight
return StringSizeCalculationResult(size: size, fontLineHeight: fontLineHeight)
}
}

View File

@ -53,7 +53,7 @@ public extension UICollectionView {
public func registerNib<T>(forCellClass cellClass: T.Type,
forUserInterfaceIdiom interfaceIdiom: UIUserInterfaceIdiom)
where T: ReuseIdentifierProtocol, T: UICollectionViewCell, T: NibNameProtocol {
let nib = UINib(nibName: T.nibName(forConfiguration: interfaceIdiom))
register(nib, forCellWithReuseIdentifier: T.reuseIdentifier)
}

View File

@ -28,5 +28,5 @@ public extension UIDevice {
public static var isSimulator: Bool {
return ProcessInfo.processInfo.environment["SIMULATOR_DEVICE_NAME"] != nil
}
}

View File

@ -29,9 +29,14 @@ extension UIStoryboard {
- returns: UIViewController subclass instance
*/
public func instantiateViewController<T>() -> T where T: UIViewController, T: StoryboardIdentifierProtocol {
return self.instantiateViewController(withIdentifier: T.storyboardIdentifier) as! T
guard let viewController = self.instantiateViewController(withIdentifier: T.storyboardIdentifier) as? T else {
fatalError("Can't instantiate view controller with type \(T.self)")
}
return viewController
}
}

View File

@ -32,5 +32,5 @@ extension UIView: StaticNibNameProtocol {
open class var nibName: String {
return className(of: self)
}
}

View File

@ -36,12 +36,12 @@ public extension UIView {
- returns: UIView subclass instance
*/
public static func loadFromNib<T>
(forUserInterfaceIdiom interfaceIdiom: UIUserInterfaceIdiom) -> T where T: NibNameProtocol, T: UIView {
return loadFromNib(named: T.nibName(forConfiguration: interfaceIdiom))
}
/**
method which return UIView subclass instance loaded from nib using nib name
provided by StaticNibNameProtocol implementation
@ -51,7 +51,7 @@ public extension UIView {
public static func loadFromNib<T>() -> T where T: StaticNibNameProtocol, T: UIView {
return loadFromNib(named: T.nibName)
}
/**
method which loads UIView (or subclass) instance from nib using given nib name parameter
@ -60,7 +60,12 @@ public extension UIView {
- returns: UIView subclass instance
*/
public static func loadFromNib<T>(named nibName: String) -> T {
return UINib(nibName: nibName).instantiate(withOwner: nil, options: nil).first as! T
guard let nibView = UINib(nibName: nibName).instantiate(withOwner: nil, options: nil).first as? T else {
fatalError("Can't nstantiate nib view with type \(T.self)")
}
return nibView
}
}

View File

@ -47,5 +47,5 @@ extension UIView {
public func stopZRotation() {
layer.removeAnimation(forKey: UIView.rotationKeyPath)
}
}

View File

@ -32,5 +32,5 @@ extension UIViewController: StoryboardIdentifierProtocol {
open class var storyboardIdentifier: String {
return className(of: self)
}
}

View File

@ -33,7 +33,7 @@ public enum UserDefaultsError: Error {
case noSuchValue(key: String)
case unableToMap(mappingError: Error)
}
fileprivate typealias JSONObject = [String: Any]

View File

@ -72,5 +72,5 @@ extension ConfigurableController where Self: UIViewController {
localize()
bindViews()
}
}

View File

@ -41,5 +41,5 @@ public protocol CursorType {
///
/// - Returns: Observable of LoadResultType
func loadNextBatch() -> Observable<LoadResultType>
}

View File

@ -27,7 +27,7 @@ import Foundation
*/
public protocol EstimatedViewHeightProtocol {
associatedtype ViewModelType
/**
method which returns estimated view height for specific view model

View File

@ -27,7 +27,7 @@ import Foundation
*/
public protocol AbstractReuseIdentifierProtocol {
associatedtype IdentifierType
/**
- returns: reuse identifier with protocol associated type
*/

View File

@ -48,7 +48,7 @@ public protocol StoryboardProtocol {
- returns: UIViewController instance
*/
static func instantiateViewController(_: ViewControllerIdentifier) -> UIViewController
}
public extension StoryboardProtocol {
@ -60,5 +60,5 @@ public extension StoryboardProtocol {
}
return controller
}
}

View File

@ -27,7 +27,7 @@ import Foundation
*/
public protocol ViewHeightProtocol {
associatedtype ViewModelType
/**
method which returns view height for specific view model

View File

@ -29,18 +29,18 @@ class MappableUserDefaultsTests: XCTestCase {
static let postsKey = "posts"
let disposeBag = DisposeBag()
override func setUp() {
super.setUp()
}
override func tearDown() {
userDefaults.set(nil, forKey: MappableUserDefaultsTests.postKey)
userDefaults.set(nil, forKey: MappableUserDefaultsTests.postsKey)
super.tearDown()
}
func testPostSave() {
userDefaults.set(model: post, forKey: MappableUserDefaultsTests.postKey)
@ -90,5 +90,5 @@ class MappableUserDefaultsTests: XCTestCase {
})
.addDisposableTo(disposeBag)
}
}

View File

@ -49,7 +49,7 @@ struct Post: ImmutableMappable {
title >>> map["title"]
body >>> map["body"]
}
}
extension Post: Equatable {
@ -60,5 +60,5 @@ extension Post: Equatable {
lhs.title == rhs.title &&
lhs.body == rhs.body
}
}

View File

@ -1,5 +1,5 @@
PODS:
- Alamofire (4.3.0)
- Alamofire (4.4.0)
- CocoaLumberjack/Core (3.0.0)
- CocoaLumberjack/Default (3.0.0):
- CocoaLumberjack/Core
@ -7,7 +7,7 @@ PODS:
- CocoaLumberjack/Default
- CocoaLumberjack/Swift (3.0.0):
- CocoaLumberjack/Extensions
- ObjectMapper (2.2.3)
- ObjectMapper (2.2.5)
- RxAlamofire (3.0.0):
- RxAlamofire/Core (= 3.0.0)
- RxAlamofire/Core (3.0.0):
@ -27,9 +27,9 @@ DEPENDENCIES:
- Toast-Swift (~> 2.0.0)
SPEC CHECKSUMS:
Alamofire: 856a113053a7bc9cbe5d6367a555d773fc5cfef7
Alamofire: dc44b1600b800eb63da6a19039a0083d62a6a62d
CocoaLumberjack: c823149bccc5519a9447aeb433be7b1212a7d6a5
ObjectMapper: d3b3de11267f5d971f390eb8d63dd509116a4329
ObjectMapper: fb30f71e08470d1e5a20b199fafe1246281db898
RxAlamofire: 0b1fa48f545fffe7f7a28af2086bcaa3b5946cc9
RxCocoa: ccdf43101a70407097a29082f648ba1676075b30
RxSwift: 46574f70d416b7923c237195939cc488a7fbf3a0