Skip to content

Commit

Permalink
fix: swiftlint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
GMinucci committed Dec 10, 2024
1 parent 2c68863 commit 82bd008
Show file tree
Hide file tree
Showing 15 changed files with 88 additions and 36 deletions.
11 changes: 8 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ let package = Package(
name: "danger-swift",
url: "https://github.com/danger/swift.git",
from: "3.5.0"
)
),
.package(
url: "https://github.com/SimplyDanny/SwiftLintPlugins")
],
targets: [
.target(
Expand All @@ -46,7 +48,8 @@ let package = Package(
"Yams",
"XcodeProj",
.product(name: "ArgumentParser", package: "swift-argument-parser"),
"Stencil"
"Stencil",
"SwiftLintPlugins"
]
),
.target(
Expand All @@ -57,7 +60,9 @@ let package = Package(
),
.testTarget(
name: "VariantsTests",
dependencies: ["Variants"]
dependencies: [
"Variants"
]
)
]
)
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class AndroidProject: Project {
try gradleFactory.createScript(with: configuration, variant: defaultVariant)
}

// swiftlint:disable function_body_length
// swiftlint:disable:next function_body_length
private func setupFastlane(with configuration: AndroidConfiguration, skip: Bool) {
if skip {
Logger.shared.logInfo("Skipped Fastlane setup", item: "")
Expand Down Expand Up @@ -183,7 +183,6 @@ class AndroidProject: Project {
}
}
}
// swiftlint:enable function_body_length

private func storeFastlaneParams(for variant: AndroidVariant, configuration: AndroidConfiguration) throws {
var customProperties: [CustomProperty] = (variant.custom ?? []) + (configuration.custom ?? [])
Expand Down
7 changes: 3 additions & 4 deletions Sources/VariantsCore/Custom Types/Project/iOSProject.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
// Created by Balazs Toth
//

// swiftlint:disable type_name

import Foundation
import ArgumentParser
import PathKit

// swiftlint:disable type_name

class iOSProject: Project {
init(
specHelper: SpecHelper,
Expand Down Expand Up @@ -140,7 +140,7 @@ class iOSProject: Project {
}
}

// swiftlint:disable function_body_length
// swiftlint:disable:next function_body_length
private func setupFastlane(with configuration: iOSConfiguration, skip: Bool) {
if skip {
Logger.shared.logInfo("Skipped Fastlane setup", item: "")
Expand Down Expand Up @@ -225,7 +225,6 @@ class iOSProject: Project {
}
}
}
// swiftlint:enable function_body_length

private func storeFastlaneParams(_ properties: [CustomProperty]) throws {
let fastlaneProperties = properties.filter { $0.destination == .fastlane }
Expand Down
4 changes: 2 additions & 2 deletions Sources/VariantsCore/Helpers/SpecHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
// Created by Arthur Alves
//

// swiftlint:disable type_name

import Foundation
import PathKit

// swiftlint:disable type_name

enum iOSProjectKey: String, CaseIterable {
case project = "PROJECT"
case target = "TARGET"
Expand Down
4 changes: 2 additions & 2 deletions Sources/VariantsCore/Schemas/iOS/iOSConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
// Created by Arthur Alves
//

import Foundation

// swiftlint:disable type_name

import Foundation

internal extension CodingUserInfoKey {
static let bundleID = CodingUserInfoKey(rawValue: "bundle_id")!
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/VariantsCore/Schemas/iOS/iOSSigning.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
// Created by Arthur Alves
//

import Foundation

// swiftlint:disable type_name

import Foundation

struct iOSSigning: Codable {
let teamName: String?
let teamID: String?
Expand Down
4 changes: 2 additions & 2 deletions Sources/VariantsCore/Schemas/iOS/iOSTarget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
// Created by Arthur Alves
//

import Foundation

// swiftlint:disable type_name

import Foundation

public typealias NamedTarget = (key: String, value: iOSTarget)

public struct iOSTarget: Codable {
Expand Down
4 changes: 2 additions & 2 deletions Sources/VariantsCore/Schemas/iOS/iOSVariant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
// Created by Arthur Alves
//

import Foundation

// swiftlint:disable type_name

import Foundation

public struct iOSVariant: Variant {
let name: String
let versionName: String
Expand Down
3 changes: 2 additions & 1 deletion Tests/VariantsCoreTests/Mocks/MockXCcodeConfigFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
// Created by Arthur Alves
//

// swiftlint:disable colon

import Foundation
import PathKit
@testable import VariantsCore
// swiftlint:disable colon

class MockXCcodeConfigFactory: XCFactory {
var writeContentCache: [(content: String, file: Path, force: Bool)] = []
Expand Down
5 changes: 3 additions & 2 deletions Tests/VariantsCoreTests/YamlParserTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ class YamlParserTests: XCTestCase {
}
}
}
// swiftlint:disable function_body_length

// swiftlint:disable:next function_body_length
func testExtractConfiguration_valid_iOS() {
let parser = YamlParser()
do {
Expand Down Expand Up @@ -167,7 +168,7 @@ class YamlParserTests: XCTestCase {
XCTAssertTrue(((error as? DecodingError) == nil))
}
}
// swiftlint:enable function_body_length

func testExtractConfiguration_valid_android() {
let parser = YamlParser()
do {
Expand Down
3 changes: 2 additions & 1 deletion Tests/VariantsCoreTests/iOSProjectTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
// Created by Arthur Alves
//

// swiftlint:disable type_name

import XCTest
import PathKit
import ArgumentParser
@testable import VariantsCore
// swiftlint:disable type_name

class iOSProjectTests: XCTestCase {
let specHelperMock = SpecHelperMock(
Expand Down
4 changes: 2 additions & 2 deletions Tests/VariantsCoreTests/iOSSigningTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
// Created by Roman Huti
//

// swiftlint:disable type_name

import XCTest
@testable import VariantsCore

// swiftlint:disable type_name

final class iOSSigningTests: XCTestCase {

func testMergeValidSignings() throws {
Expand Down
9 changes: 5 additions & 4 deletions Tests/VariantsTests/InitCommandTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
// Created by Arthur Alves
//

// swiftlint:disable line_length

import XCTest
import class Foundation.Bundle

// swiftlint:disable line_length

final class InitCommandTests: XCTestCase {
func testUsage_help() throws {
let arguments = ["init", "--help"]
Expand All @@ -33,8 +33,9 @@ final class InitCommandTests: XCTestCase {
let output = try CLIExecutor.shared.run(with: arguments)
XCTAssertEqual(output, expectedOutput)
}

#warning("Test 'testUsage_noExtraArguments' will always fail when running from Xcode.")

/// Note:
/// Test testUsage_noExtraArguments' will always fail when running from Xcode.
func testUsage_noExtraArguments() throws {
let arguments = ["init"]

Expand Down
52 changes: 51 additions & 1 deletion Variants.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objectVersion = 54;
objects = {

/* Begin PBXAggregateTarget section */
Expand Down Expand Up @@ -601,6 +601,7 @@
buildPhases = (
8E1B9CC9254AC1E700DD0204 /* Headers */,
8E1B9CCA254AC1E700DD0204 /* Sources */,
2D70A7582D0854F000DF5272 /* ShellScript */,
8E1B9CCB254AC1E700DD0204 /* Frameworks */,
8E1B9CCC254AC1E700DD0204 /* Resources */,
);
Expand Down Expand Up @@ -643,6 +644,7 @@
buildConfigurationList = OBJ_379 /* Build configuration list for PBXNativeTarget "Variants" */;
buildPhases = (
OBJ_382 /* Sources */,
2D70A7562D08548E00DF5272 /* ShellScript */,
OBJ_421 /* Frameworks */,
8E1BA14E254C43A900DD0204 /* Embed Frameworks */,
);
Expand Down Expand Up @@ -710,6 +712,7 @@
8E1BA105254C3FD000DD0204 /* XCRemoteSwiftPackageReference "xcodeproj" */,
8E1BA10E254C3FFF00DD0204 /* XCRemoteSwiftPackageReference "swift-argument-parser" */,
8E8A483325514BE00056F79F /* XCRemoteSwiftPackageReference "Stencil" */,
2D70A7512D08525300DF5272 /* XCRemoteSwiftPackageReference "SwiftLintPlugins" */,
);
productRefGroup = OBJ_274 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -750,6 +753,45 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
2D70A7562D08548E00DF5272 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "SWIFT_PACKAGE_DIR=\"${BUILD_DIR%Build/*}SourcePackages/artifacts\"\nSWIFTLINT_CMD=$(ls \"$SWIFT_PACKAGE_DIR\"/swiftlintplugins/SwiftLintBinary/SwiftLintBinary.artifactbundle/swiftlint-*/bin/swiftlint | head -n 1)\n\nif test -f \"$SWIFTLINT_CMD\" 2>&1\nthen\n \"$SWIFTLINT_CMD\"\nelse\n echo \"warning: `swiftlint` command not found - See https://github.com/realm/SwiftLint#installation for installation instructions.\"\nfi\n";
};
2D70A7582D0854F000DF5272 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "SWIFT_PACKAGE_DIR=\"${BUILD_DIR%Build/*}SourcePackages/artifacts\"\nSWIFTLINT_CMD=$(ls \"$SWIFT_PACKAGE_DIR\"/swiftlintplugins/SwiftLintBinary/SwiftLintBinary.artifactbundle/swiftlint-*/bin/swiftlint | head -n 1)\n\nif test -f \"$SWIFTLINT_CMD\" 2>&1\nthen\n \"$SWIFTLINT_CMD\"\nelse\n echo \"warning: `swiftlint` command not found - See https://github.com/realm/SwiftLint#installation for installation instructions.\"\nfi\n";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
8E1B9CCA254AC1E700DD0204 /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down Expand Up @@ -1481,6 +1523,14 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
2D70A7512D08525300DF5272 /* XCRemoteSwiftPackageReference "SwiftLintPlugins" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/SimplyDanny/SwiftLintPlugins";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.57.1;
};
};
8E1BA0F3254C3F3E00DD0204 /* XCRemoteSwiftPackageReference "PathKit" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/kylef/PathKit.git";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,4 @@

import UIKit

class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
}
class ViewController: UIViewController { }

0 comments on commit 82bd008

Please sign in to comment.