Skip to content

Commit

Permalink
Adding SwiftLint and resolve warnings/errors (#277)
Browse files Browse the repository at this point in the history
* Update project.pbxproj

* Update project.pbxproj

* resolving build warnings (wip)

* added rules

* Revert "resolving build warnings (wip)"

This reverts commit 1e4c8e7.

* Update .swiftlint.yml

* auto corrections

* more rules and corrections

* update rules and more corrections

* reverted some automated changes

* resolve merge conflicts

* updates to formatting

* Update .swiftlint.yml

* formatting
  • Loading branch information
astewart43-gtri authored Jun 19, 2020
1 parent 8f9a4f8 commit 8bc2184
Show file tree
Hide file tree
Showing 100 changed files with 1,423 additions and 1,152 deletions.
39 changes: 39 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
disabled_rules:
- nesting
opt_in_rules:
- empty_count
- empty_string
excluded:
- Carthage
- Pods
- SwiftLint/Common/3rdPartyLib
cyclomatic_complexity:
warning: 20
error: 25
variable_name:
max_length:
warning: 45
error: 60
min_length:
warning: 1
file_length:
warning: 1000
error: 1500
ignore_comment_only_lines: true
function_body_length:
warning: 300
error: 500
type_body_length:
warning: 1000
error: 1500
line_length:
warning: 100
error: 130
ignores_function_declarations: false
ignores_comments: true
ignores_urls: false
force_cast:
warning
force_try:
warning
reporter: "xcode"
41 changes: 25 additions & 16 deletions CoEpi.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,10 @@
62983D91243CE60600B0294C /* RealmDao.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A4B9B7242CC97600516F3B /* RealmDao.swift */; };
62A334A52476CE6600CF4B25 /* SymptomFlow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62A334A42476CE6600CF4B25 /* SymptomFlow.swift */; };
62A334A72476CE8500CF4B25 /* SymptomFlowManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62A334A62476CE8500CF4B25 /* SymptomFlowManager.swift */; };
62A334A92476CEAA00CF4B25 /* SymptomInput.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62A334A82476CEAA00CF4B25 /* SymptomInput.swift */; };
62A334AB2476CEC100CF4B25 /* SymptomInputManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62A334AA2476CEC100CF4B25 /* SymptomInputManager.swift */; };
62A334AD2476CED600CF4B25 /* SymptomRouter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62A334AC2476CED600CF4B25 /* SymptomRouter.swift */; };
62A334AF2476CEEA00CF4B25 /* SymptomStep.swift in Sources */ = {isa = PBXBuildFile; fileRef = 62A334AE2476CEEA00CF4B25 /* SymptomStep.swift */; };
62B9A01F2434036A00885519 /* DebugBleViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8486BDD5242BA28C00A63DD5 /* DebugBleViewModel.swift */; };
62CE509B249BB496003F2ECE /* .swiftlint.yml in Resources */ = {isa = PBXBuildFile; fileRef = 62CE509A249BB496003F2ECE /* .swiftlint.yml */; };
700BA90C2489685400BE8F30 /* ButtonStyles.swift in Sources */ = {isa = PBXBuildFile; fileRef = 700BA90B2489685400BE8F30 /* ButtonStyles.swift */; };
841D39A0244E3EE200A9CD64 /* StartPermissions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 841D399F244E3EE200A9CD64 /* StartPermissions.swift */; };
84201691244B21FF000EE281 /* UnixTime.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84201690244B21FF000EE281 /* UnixTime.swift */; };
Expand Down Expand Up @@ -295,10 +294,9 @@
6291BE7C246D17C100984583 /* OnboardingWireframe.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingWireframe.swift; sourceTree = "<group>"; };
62A334A42476CE6600CF4B25 /* SymptomFlow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SymptomFlow.swift; sourceTree = "<group>"; };
62A334A62476CE8500CF4B25 /* SymptomFlowManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SymptomFlowManager.swift; sourceTree = "<group>"; };
62A334A82476CEAA00CF4B25 /* SymptomInput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SymptomInput.swift; sourceTree = "<group>"; };
62A334AA2476CEC100CF4B25 /* SymptomInputManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SymptomInputManager.swift; sourceTree = "<group>"; };
62A334AC2476CED600CF4B25 /* SymptomRouter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SymptomRouter.swift; sourceTree = "<group>"; };
62A334AE2476CEEA00CF4B25 /* SymptomStep.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SymptomStep.swift; sourceTree = "<group>"; };
62CE509A249BB496003F2ECE /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text.yaml; path = .swiftlint.yml; sourceTree = "<group>"; };
700BA90B2489685400BE8F30 /* ButtonStyles.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonStyles.swift; sourceTree = "<group>"; };
840405D6246C50C7008048BF /* Rust-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Rust-Bridging-Header.h"; sourceTree = "<group>"; };
841D399F244E3EE200A9CD64 /* StartPermissions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StartPermissions.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -535,13 +533,6 @@
path = "launch screen";
sourceTree = "<group>";
};
44CF83504F0FD8582FEC242D /* Pods */ = {
isa = PBXGroup;
children = (
);
path = Pods;
sourceTree = "<group>";
};
622AC2BA245CB93B00A6EB90 /* thankYou */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -630,8 +621,6 @@
children = (
62A334A42476CE6600CF4B25 /* SymptomFlow.swift */,
62A334A62476CE8500CF4B25 /* SymptomFlowManager.swift */,
62A334A82476CEAA00CF4B25 /* SymptomInput.swift */,
62A334AA2476CEC100CF4B25 /* SymptomInputManager.swift */,
62A334AC2476CED600CF4B25 /* SymptomRouter.swift */,
62A334AE2476CEEA00CF4B25 /* SymptomStep.swift */,
);
Expand Down Expand Up @@ -801,13 +790,13 @@
849DFE592427D3750008ED65 = {
isa = PBXGroup;
children = (
62CE509A249BB496003F2ECE /* .swiftlint.yml */,
849DFE642427D3750008ED65 /* CoEpi */,
849DFE7E2427D37A0008ED65 /* CoEpiTests */,
849DFE892427D37A0008ED65 /* CoEpiUITests */,
30EF956B24363115007D61C7 /* CoEpiNetworkingTests */,
30C3D5AB2495412B00A77F76 /* FFIStandaloneTests */,
849DFE632427D3750008ED65 /* Products */,
44CF83504F0FD8582FEC242D /* Pods */,
84E76D6A2470445F009C1D97 /* Frameworks */,
);
sourceTree = "<group>";
Expand Down Expand Up @@ -1154,6 +1143,7 @@
849DFE5E2427D3750008ED65 /* Sources */,
849DFE5F2427D3750008ED65 /* Frameworks */,
849DFE602427D3750008ED65 /* Resources */,
6275D334249BA1A200600458 /* ShellScript */,
);
buildRules = (
);
Expand Down Expand Up @@ -1333,6 +1323,7 @@
30EF957A24379E01007D61C7 /* CoEpiLaunchScreen.storyboard in Resources */,
848434572438C046006A5839 /* ErrorView.xib in Resources */,
622AC2CC245FC5E000A6EB90 /* CoughTypeViewController.xib in Resources */,
62CE509B249BB496003F2ECE /* .swiftlint.yml in Resources */,
05E0E4C8244403FE00D27F9A /* Localizable.strings in Resources */,
849D7B3F248EA0BB00C9DDBD /* DebugViewController.xib in Resources */,
84DE6A28243F9AA800CCF4A6 /* AlertView.xib in Resources */,
Expand Down Expand Up @@ -1361,6 +1352,26 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
6275D334249BA1A200600458 /* 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 \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
30C3D5A62495412B00A77F76 /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down Expand Up @@ -1421,7 +1432,6 @@
849D7B43248EB0B100C9DDBD /* Clipboard.swift in Sources */,
622AC2EA245FD2F400A6EB90 /* FeverWhereViewController.swift in Sources */,
622AC2BE245CC2F900A6EB90 /* ThankYouViewController.swift in Sources */,
62A334AB2476CEC100CF4B25 /* SymptomInputManager.swift in Sources */,
84D069692455E7C10004E8B6 /* AlertViewData.swift in Sources */,
622AC2E0245FD23A00A6EB90 /* FeverTodayViewModel.swift in Sources */,
622AC2D6245FC66800A6EB90 /* CoughHowViewController.swift in Sources */,
Expand Down Expand Up @@ -1458,7 +1468,6 @@
849D1B0A2439F31D00804511 /* DaoError.swift in Sources */,
8491497B24366FF000975344 /* PeriodicAlertsFetcher.swift in Sources */,
622AC2C0245F65FB00A6EB90 /* ThankYouViewModel.swift in Sources */,
62A334A92476CEAA00CF4B25 /* SymptomInput.swift in Sources */,
84BF972E24281082001ADD6B /* uuids.swift in Sources */,
84BF973024281082001ADD6B /* DataRepresentable.swift in Sources */,
84F93BF92451C32100B5F54D /* NotificationShower.swift in Sources */,
Expand Down
28 changes: 20 additions & 8 deletions CoEpi/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let container: DependencyContainer = Dependencies().createContainer()

internal var window: UIWindow?

private var rootWireframe: RootWireFrame?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?)
-> Bool {
MSAppCenter.start("2581ac81-eb5b-423a-83e6-65cab9d64dd8", withServices: [MSDistribute.self])

let bgManager: BackgroundTasksManager = try! container.resolve()
Expand All @@ -28,8 +31,14 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
func application(
_ application: UIApplication,
configurationForConnecting connectingSceneSession: UISceneSession,
options: UIScene.ConnectionOptions)
-> UISceneConfiguration {
UISceneConfiguration(
name: "Default Configuration",
sessionRole: connectingSceneSession.role)
}

// MARK: - Core Data stack
Expand All @@ -46,7 +55,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
if let error = error as NSError? {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.

/*
Typical reasons for an error here include:
* The parent directory does not exist, cannot be created, or disallows writing.
Expand All @@ -69,8 +78,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
do {
try context.save()
} catch {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
// fatalError()
// Replace this implementation with code to handle the error appropriately.
// causes the application to generate a crash log and terminate.
// You should not use this function in a shipping application,
// although it may be useful during development.
let nserror = error as NSError
fatalError("Unresolved error \(nserror), \(nserror.userInfo)")
}
Expand Down
Loading

0 comments on commit 8bc2184

Please # to comment.