From 2463cc13d89be592daa6fdc50192358894b3ccd3 Mon Sep 17 00:00:00 2001 From: Angelo Stavrow Date: Wed, 22 Jul 2020 10:17:11 -0400 Subject: [PATCH] Add SwiftLint and sort out boilerplate warnings and errors --- .swiftlint.yml | 2 ++ Tests iOS/Tests_iOS.swift | 3 ++- Tests macOS/Tests_macOS.swift | 3 ++- .../project.pbxproj | 20 ++++++++++++++++++- 4 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 .swiftlint.yml diff --git a/.swiftlint.yml b/.swiftlint.yml new file mode 100644 index 0000000..6931ea5 --- /dev/null +++ b/.swiftlint.yml @@ -0,0 +1,2 @@ +type_name: + allowed_symbols: ["_"] # Used in SwiftUI boilerplate naming diff --git a/Tests iOS/Tests_iOS.swift b/Tests iOS/Tests_iOS.swift index f9b403c..523998c 100644 --- a/Tests iOS/Tests_iOS.swift +++ b/Tests iOS/Tests_iOS.swift @@ -8,7 +8,8 @@ class Tests_iOS: XCTestCase { // In UI tests it is usually best to stop immediately when a failure occurs. continueAfterFailure = false - // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests + // before they run. The setUp method is a good place to do this. } override func tearDownWithError() throws { diff --git a/Tests macOS/Tests_macOS.swift b/Tests macOS/Tests_macOS.swift index 97c5ff2..a5c9d86 100644 --- a/Tests macOS/Tests_macOS.swift +++ b/Tests macOS/Tests_macOS.swift @@ -8,7 +8,8 @@ class Tests_macOS: XCTestCase { // In UI tests it is usually best to stop immediately when a failure occurs. continueAfterFailure = false - // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests + // before they run. The setUp method is a good place to do this. } override func tearDownWithError() throws { diff --git a/WriteFreely-MultiPlatform.xcodeproj/project.pbxproj b/WriteFreely-MultiPlatform.xcodeproj/project.pbxproj index ddba9be..9533816 100644 --- a/WriteFreely-MultiPlatform.xcodeproj/project.pbxproj +++ b/WriteFreely-MultiPlatform.xcodeproj/project.pbxproj @@ -194,6 +194,7 @@ 17DF328C24C87D3500BCE2E3 /* Sources */, 17DF328D24C87D3500BCE2E3 /* Frameworks */, 17DF328E24C87D3500BCE2E3 /* Resources */, + 17DF32C524C87FDB00BCE2E3 /* ShellScript */, ); buildRules = ( ); @@ -341,7 +342,24 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Type a script or drag a script file from your workspace to insert its path.\n"; + shellScript = "# Run SwiftLint on builds\nif which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; + }; + 17DF32C524C87FDB00BCE2E3 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + ); + outputFileListPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# Run SwiftLint on builds\nif 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 */