Skip to content

Commit

Permalink
Merge pull request #10 from bitreserve/enhancement/add-linter
Browse files Browse the repository at this point in the history
Add swift linter
  • Loading branch information
SandroMachado committed Oct 14, 2015
2 parents b529009 + 793c858 commit 08950a1
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 14 deletions.
9 changes: 9 additions & 0 deletions .swiftlint.yml
@@ -0,0 +1,9 @@
disabled_rules:
- control_statement
- line_length
- variable_name

included:
- Example
- Source
- Tests
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -6,6 +6,8 @@ before_script:
- brew update
- brew install carthage
- carthage update --use-submodules --no-build --no-use-binaries
- brew install swiftlint

script:
- swiftlint lint
- xctool -project BitreserveSdk.xcodeproj -scheme BitreserveSdk test sdk iphonesimulator CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
17 changes: 17 additions & 0 deletions BitreserveSdk.xcodeproj/project.pbxproj
Expand Up @@ -343,6 +343,7 @@
BC2381281BB462170060CC80 /* Frameworks */,
BC2381291BB462170060CC80 /* Headers */,
BC23812A1BB462170060CC80 /* Resources */,
BC62F2AE1BCE4EFA007E6FDB /* ShellScript */,
);
buildRules = (
);
Expand Down Expand Up @@ -485,6 +486,22 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
BC62F2AE1BCE4EFA007E6FDB /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = /usr/local/bin/swiftlint;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
BC2381271BB462170060CC80 /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down
4 changes: 2 additions & 2 deletions Example/AppDelegate.swift
Expand Up @@ -2,7 +2,7 @@ import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

}
2 changes: 1 addition & 1 deletion Source/Client/BitreserveClient.swift
Expand Up @@ -3,7 +3,7 @@ import SwiftClient

public class BitreserveClient: Client {

public override init(){
public override init() {
super.init()

self.baseUrl("https://api.bitreserve.org")
Expand Down
2 changes: 1 addition & 1 deletion Source/Model/Transaction/Destination.swift
Expand Up @@ -36,7 +36,7 @@ public class Destination: Mappable {

/**
Constructor.
- parameter cardId: The card id of the card from the destination of the transaction.
- parameter amount: The amount from the destination of the transaction.
- parameter base: The base from the destination of the transaction.
Expand Down
4 changes: 2 additions & 2 deletions Source/Model/Transaction/Origin.swift
Expand Up @@ -39,7 +39,7 @@ public class Origin: Mappable {

/**
Constructor.
- parameter cardId: The card id of the card from the origin of the transaction.
- parameter amount: The amount from the origin of the transaction.
- parameter base: The base from the origin of the transaction.
Expand All @@ -65,7 +65,7 @@ public class Origin: Mappable {
self.type = type
self.username = username
}

// MARK: Required by the ObjectMapper.

/**
Expand Down
2 changes: 1 addition & 1 deletion Source/Model/User.swift
Expand Up @@ -48,7 +48,7 @@ public class User: Mappable {
- parameter status: The user status.
- parameter username: The user username.
*/
public init(country : String, currencies : [String], email : String, firstName : String, lastName : String, name : String, settings : UserSettings, state : String, status : String, username : String) {
public init(country: String, currencies: [String], email: String, firstName: String, lastName: String, name: String, settings: UserSettings, state: String, status: String, username: String) {
self.country = country
self.currencies = currencies
self.email = email
Expand Down
2 changes: 1 addition & 1 deletion Source/Model/User/InternationalizationUserSetting.swift
Expand Up @@ -23,7 +23,7 @@ public class InternationalizationUserSetting: Mappable {
*/
required public init?(_ map: Map) {
}

/// Maps the JSON to the Object.
public func mapping(map: Map) {
locale <- map["locale"]
Expand Down
2 changes: 1 addition & 1 deletion Source/Model/User/InternationalizationUserSettings.swift
Expand Up @@ -15,7 +15,7 @@ public class InternationalizationUserSettings: Mappable {

/**
Constructor.
- parameter language: The internationalization language user settings.
- parameter dateTimeFormat: The internationalization date time format user settings.
- parameter numberFormat: The internationalization number format user settings.
Expand Down
2 changes: 1 addition & 1 deletion Source/Model/User/UserSettings.swift
Expand Up @@ -28,7 +28,7 @@ public class UserSettings: Mappable {
- parameter intl: The user internationalization settings.
- parameter theme: The user theme.
*/
public init(currency: String, hasNewsSubscription : Bool, hasOtpEnabled : Bool, intl : InternationalizationUserSettings, theme : String) {
public init(currency: String, hasNewsSubscription: Bool, hasOtpEnabled: Bool, intl: InternationalizationUserSettings, theme: String) {
self.currency = currency
self.hasNewsSubscription = hasNewsSubscription
self.hasOtpEnabled = hasOtpEnabled
Expand Down
2 changes: 1 addition & 1 deletion Tests/Integration/Service/ReserveServiceTest.swift
Expand Up @@ -7,7 +7,7 @@ class ReserveServiceTest: XCTestCase {

func testGetLedgerShouldReturnTheRequest() {
let request = ReserveService.getLedger("foo")

XCTAssertEqual(request.url, "https://api.bitreserve.org/v0/reserve/ledger", "Failed: Wrong URL.")
XCTAssertEqual(request.method, "GET", "Failed: Wrong method.")
XCTAssertNotNil(request.headers["Range"], "Failed: Range header doesn't exist.")
Expand Down
6 changes: 3 additions & 3 deletions Tests/Integration/Service/TickerServiceTest.swift
Expand Up @@ -11,12 +11,12 @@ class TickerServiceTest: XCTestCase {
XCTAssertEqual(request.url, "https://api.bitreserve.org/v0/ticker", "Failed: Wrong URL")
XCTAssertEqual(request.method, "GET", "Failed: Wrong method.")
}

func testGetAllTickersByCurrencyShouldReturnTheRequest() {
let request = TickerService.getAllTickersByCurrency("foo")

XCTAssertEqual(request.url, "https://api.bitreserve.org/v0/ticker/foo", "Failed: Wrong URL")
XCTAssertEqual(request.method, "GET", "Failed: Wrong method.")
}

}

0 comments on commit 08950a1

Please sign in to comment.