Skip to content

Commit

Permalink
Implement a linter
Browse files Browse the repository at this point in the history
  • Loading branch information
StanislavDevIOS committed Jul 31, 2022
1 parent a99eacf commit 5b89c93
Show file tree
Hide file tree
Showing 158 changed files with 401 additions and 747 deletions.
22 changes: 22 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
disabled_rules:
- colon
- comma
- control_statement
- identifier_name
- line_length
- force_try
- type_name
- cyclomatic_complexity
- force_cast
- type_body_length
- trailing_whitespace
- function_body_length
- comment_spacing
- file_length
- large_tuple
- function_parameter_count
- shorthand_operator
- operator_whitespace
- no_fallthrough_only
- computed_accessors_order
- xctfail_message
38 changes: 28 additions & 10 deletions Adamant.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
3AE89DDB2837F5D30051D3A9 /* ChatRoomsChats.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AE89DDA2837F5D30051D3A9 /* ChatRoomsChats.swift */; };
3C06931576393125C61FB8F6 /* Pods_Adamant.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33975C0D891698AA7E74EBCC /* Pods_Adamant.framework */; };
41935848287841E20083363B /* MacOSDeterminer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41935847287841E20083363B /* MacOSDeterminer.swift */; };
41E857A42847ADA200BC0783 /* AdamantSecret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41E857A32847ADA200BC0783 /* AdamantSecret.swift */; };
41E857A52847ADA200BC0783 /* AdamantSecret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41E857A32847ADA200BC0783 /* AdamantSecret.swift */; };
41E857A62847ADA200BC0783 /* AdamantSecret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41E857A32847ADA200BC0783 /* AdamantSecret.swift */; };
41E857A72847ADA200BC0783 /* AdamantSecret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41E857A32847ADA200BC0783 /* AdamantSecret.swift */; };
41E14154288545B2002142A6 /* AdamantSecret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41E14153288545B2002142A6 /* AdamantSecret.swift */; };
41E14155288545B2002142A6 /* AdamantSecret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41E14153288545B2002142A6 /* AdamantSecret.swift */; };
41E14156288545B2002142A6 /* AdamantSecret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41E14153288545B2002142A6 /* AdamantSecret.swift */; };
41E14157288545B2002142A6 /* AdamantSecret.swift in Sources */ = {isa = PBXBuildFile; fileRef = 41E14153288545B2002142A6 /* AdamantSecret.swift */; };
553B1284281C6EE100FFF24C /* GCDUtilites.swift in Sources */ = {isa = PBXBuildFile; fileRef = 553B1283281C6EE100FFF24C /* GCDUtilites.swift */; };
6403F5DB2272389800D58779 /* (null) in Sources */ = {isa = PBXBuildFile; };
6403F5DE22723C6800D58779 /* DashMainnet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6403F5DD22723C6800D58779 /* DashMainnet.swift */; };
Expand Down Expand Up @@ -619,7 +619,7 @@
3AE89DD82837F5BF0051D3A9 /* ChatRooms.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatRooms.swift; sourceTree = "<group>"; };
3AE89DDA2837F5D30051D3A9 /* ChatRoomsChats.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatRoomsChats.swift; sourceTree = "<group>"; };
41935847287841E20083363B /* MacOSDeterminer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MacOSDeterminer.swift; sourceTree = "<group>"; };
41E857A32847ADA200BC0783 /* AdamantSecret.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AdamantSecret.swift; sourceTree = "<group>"; };
41E14153288545B2002142A6 /* AdamantSecret.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdamantSecret.swift; sourceTree = "<group>"; };
4A4D67BD3DC89C07D1351248 /* Pods-AdmCore.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AdmCore.release.xcconfig"; path = "Target Support Files/Pods-AdmCore/Pods-AdmCore.release.xcconfig"; sourceTree = "<group>"; };
553B1283281C6EE100FFF24C /* GCDUtilites.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GCDUtilites.swift; sourceTree = "<group>"; };
6403F5DD22723C6800D58779 /* DashMainnet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashMainnet.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1725,7 +1725,7 @@
E9D664C222A0037600733F8A /* View */,
E957E123229B0C330019732A /* AdamantNotificationKeys.swift */,
E9771D802299602D0099AAC7 /* AdamantResources.swift */,
41E857A32847ADA200BC0783 /* AdamantSecret.swift */,
41E14153288545B2002142A6 /* AdamantSecret.swift */,
E957E170229C56EE0019732A /* Shared.xcassets */,
);
path = AdamantShared;
Expand Down Expand Up @@ -1993,6 +1993,7 @@
629616F00016639A2AFC5FC7 /* [CP] Embed Pods Frameworks */,
E96D64E62295CD4700CA5587 /* Embed App Extensions */,
A5AC8E01262E0B030053A7E2 /* Embed Frameworks */,
41E1415828854739002142A6 /* ShellScript */,
);
buildRules = (
);
Expand Down Expand Up @@ -2305,6 +2306,23 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
41E1415828854739002142A6 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"error: SwiftLint does not exist, download it from https://github.com/realm/SwiftLint\"\n exit 1\nfi\n";
};
47866E9AB7D201F2CED0064C /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -2371,7 +2389,7 @@
E9079A92229DF1B80022CA0D /* UIColor+hex.swift in Sources */,
E9079A8D229DF19A0022CA0D /* KeychainStore.swift in Sources */,
E9079AA4229DF6850022CA0D /* AdamantUtilities.swift in Sources */,
41E857A72847ADA200BC0783 /* AdamantSecret.swift in Sources */,
41E14157288545B2002142A6 /* AdamantSecret.swift in Sources */,
E951466C22A691EF007564D7 /* String+utilites.swift in Sources */,
E9079A8F229DF1A40022CA0D /* Crypto.swift in Sources */,
E9079A90229DF1A40022CA0D /* Mnemonic.swift in Sources */,
Expand Down Expand Up @@ -2411,7 +2429,7 @@
E9256F5F2034C21100DE86E9 /* String+localized.swift in Sources */,
6414C18E217DF43100373FA6 /* String+adamant.swift in Sources */,
E908472A2196FEA80095825D /* RichMessageTransaction+CoreDataClass.swift in Sources */,
41E857A42847ADA200BC0783 /* AdamantSecret.swift in Sources */,
41E14154288545B2002142A6 /* AdamantSecret.swift in Sources */,
64A223D620F760BB005157CB /* Localization.swift in Sources */,
64E1C82F222E95F6006C4DA7 /* DogeWallet.swift in Sources */,
E9484B7D2285BAD9008E10F0 /* PrivateKeyGenerator.swift in Sources */,
Expand Down Expand Up @@ -2754,7 +2772,7 @@
64AE84622300012400F38FBD /* DashProvider.swift in Sources */,
E957E16C229C53980019732A /* LskProvider.swift in Sources */,
E9D664D022A009AB00733F8A /* AdamantLocalized.swift in Sources */,
41E857A62847ADA200BC0783 /* AdamantSecret.swift in Sources */,
41E14156288545B2002142A6 /* AdamantSecret.swift in Sources */,
E957E14D229C3E530019732A /* Node.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -2797,7 +2815,7 @@
E957E0ED229982FF0019732A /* Keypair.swift in Sources */,
6423038324B26CAF004CF3FE /* ERC20Token.swift in Sources */,
E957E0FB229AB9310019732A /* AdamantProvider.swift in Sources */,
41E857A52847ADA200BC0783 /* AdamantSecret.swift in Sources */,
41E14155288545B2002142A6 /* AdamantSecret.swift in Sources */,
E957E157229C3F840019732A /* ExtensionsApi.swift in Sources */,
E957E0F722999BD50019732A /* TransferBaseProvider.swift in Sources */,
E9771D9622996FEB0099AAC7 /* StateType.swift in Sources */,
Expand Down
6 changes: 1 addition & 5 deletions Adamant/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ extension StoreKey {
}
}


// MARK: - Application
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
Expand Down Expand Up @@ -217,7 +216,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
dialogService.showError(withMessage: "Failed to register CurrencyInfoService autoupdate. Please, report a bug", error: nil)
}


// MARK: 6. Logout reset
NotificationCenter.default.addObserver(forName: Notification.Name.AdamantAccountService.userLoggedOut, object: nil, queue: OperationQueue.main) { [weak self] _ in
// On logout, pop all navigators to root.
Expand Down Expand Up @@ -343,7 +341,7 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
}
}

//MARK: Open Chat From Notification
// MARK: Open Chat From Notification
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
guard let transactionID = userInfo[AdamantNotificationUserInfoKeys.transactionId] as? String,
let transactionRaw = userInfo[AdamantNotificationUserInfoKeys.transaction] as? String,
Expand Down Expand Up @@ -410,7 +408,6 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
}
}


// MARK: - Background Fetch
extension AppDelegate {
func application(_ application: UIApplication, performFetchWithCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
Expand Down Expand Up @@ -470,7 +467,6 @@ extension AppDelegate {
}
}


// MARK: - Welcome messages
extension AppDelegate {
private func handleWelcomeMessages(notification: Notification) {
Expand Down
1 change: 0 additions & 1 deletion Adamant/CoreData/BaseAccount+CoreDataProperties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import Foundation
import CoreData


extension BaseAccount {

@nonobjc public class func fetchRequest() -> NSFetchRequest<BaseAccount> {
Expand Down
1 change: 0 additions & 1 deletion Adamant/CoreData/BaseTransaction+CoreDataProperties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import Foundation
import CoreData


extension BaseTransaction {

@nonobjc public class func fetchRequest() -> NSFetchRequest<BaseTransaction> {
Expand Down
1 change: 0 additions & 1 deletion Adamant/CoreData/ChatTransaction+CoreDataProperties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import Foundation
import CoreData


extension ChatTransaction {

@nonobjc public class func fetchRequest() -> NSFetchRequest<ChatTransaction> {
Expand Down
1 change: 0 additions & 1 deletion Adamant/CoreData/Chatroom+CoreDataProperties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import Foundation
import CoreData


extension Chatroom {

@nonobjc public class func fetchRequest() -> NSFetchRequest<Chatroom> {
Expand Down
1 change: 0 additions & 1 deletion Adamant/CoreData/CoreDataAccount+CoreDataProperties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import Foundation
import CoreData


extension CoreDataAccount {

@nonobjc public class func fetchRequest() -> NSFetchRequest<CoreDataAccount> {
Expand Down
2 changes: 0 additions & 2 deletions Adamant/CoreData/DummyAccount+CoreDataProperties.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@
import Foundation
import CoreData


extension DummyAccount {

@nonobjc public class func fetchRequest() -> NSFetchRequest<DummyAccount> {
return NSFetchRequest<DummyAccount>(entityName: "DummyAccount")
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import Foundation
import CoreData


extension MessageTransaction {

@nonobjc public class func fetchRequest() -> NSFetchRequest<MessageTransaction> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import Foundation
import CoreData


extension RichMessageTransaction {

@nonobjc public class func fetchRequest() -> NSFetchRequest<RichMessageTransaction> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import Foundation
import CoreData


extension TransferTransaction {

@nonobjc public class func fetchRequest() -> NSFetchRequest<TransferTransaction> {
Expand Down
6 changes: 3 additions & 3 deletions Adamant/Helpers/String+adamant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ extension String {

func getLegacyAdamantAddress() -> AdamantAddress? {
let address: String?
var name: String? = nil
var message: String? = nil
var name: String?
var message: String?

if let uri = AdamantUriTools.decode(uri: self) {
switch uri {
Expand All @@ -54,7 +54,7 @@ extension String {
}
}

case .passphrase(_):
case .passphrase:
address = nil
}
} else {
Expand Down
2 changes: 0 additions & 2 deletions Adamant/Models/AdamantMessage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ enum AdamantMessage {
case richMessage(payload: RichMessage)
}


// MARK: - Fee
extension AdamantMessage {
static private let textFee = Decimal(sign: .plus, exponent: -3, significand: 1)
Expand All @@ -38,7 +37,6 @@ extension AdamantMessage {
}
}


// MARK: - ChatType
extension AdamantMessage {
var chatType: ChatType {
Expand Down
7 changes: 3 additions & 4 deletions Adamant/Models/BTCRawTransaction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ struct BTCRawTransaction {
}
}

let senders = Set(inputs.map { $0.sender } )
let recipients = Set(outputs.compactMap { $0.addresses.first } )
let senders = Set(inputs.map { $0.sender })
let recipients = Set(outputs.compactMap { $0.addresses.first })

let sender: String
let recipient: String
Expand Down Expand Up @@ -98,7 +98,6 @@ struct BTCRawTransaction {
}
}


// MARK: Inputs
if myInputs.count > 0 {
let inputTransaction = T(txId: txId,
Expand Down Expand Up @@ -277,7 +276,7 @@ struct BTCOutput: Decodable {
self.value = value
} else if let raw = try? container.decode(Decimal.self, forKey: .value) {
self.value = raw
} else {
} else {
self.value = 0
}

Expand Down
4 changes: 0 additions & 4 deletions Adamant/Models/EthTransaction.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ extension EthResponse: Decodable {
}
}


// MARK: - Eth Transaction

struct EthTransaction {
Expand All @@ -57,7 +56,6 @@ struct EthTransaction {
var isOutgoing: Bool = false
}


// MARK: Decodable
extension EthTransaction: Decodable {
enum CodingKeys: String, CodingKey {
Expand Down Expand Up @@ -131,7 +129,6 @@ extension EthTransaction: Decodable {
}
}


// MARK: - TransactionDetails
extension EthTransaction: TransactionDetails {
static var defaultCurrencySymbol: String? { return EthWalletService.currencySymbol }
Expand Down Expand Up @@ -202,7 +199,6 @@ extension EthereumTransaction {
}
}


// MARK: Sample JSON
/*
{
Expand Down
Loading

0 comments on commit 5b89c93

Please sign in to comment.