Add SwiftLint and fix lint warnings

This commit is contained in:
2025-01-19 21:56:37 -05:00
parent 4dc6a71a5c
commit 62fe96bd2f
6 changed files with 69 additions and 4 deletions

View File

@@ -106,6 +106,7 @@
buildRules = ( buildRules = (
); );
dependencies = ( dependencies = (
3AA480FA2D3DF10E0052A05C /* PBXTargetDependency */,
); );
fileSystemSynchronizedGroups = ( fileSystemSynchronizedGroups = (
3AA480BA2D3DECF10052A05C /* Yeti */, 3AA480BA2D3DECF10052A05C /* Yeti */,
@@ -128,6 +129,7 @@
buildRules = ( buildRules = (
); );
dependencies = ( dependencies = (
3AA481002D3DF2080052A05C /* PBXTargetDependency */,
3AA480CC2D3DECF20052A05C /* PBXTargetDependency */, 3AA480CC2D3DECF20052A05C /* PBXTargetDependency */,
); );
fileSystemSynchronizedGroups = ( fileSystemSynchronizedGroups = (
@@ -151,6 +153,7 @@
buildRules = ( buildRules = (
); );
dependencies = ( dependencies = (
3AA481022D3DF20D0052A05C /* PBXTargetDependency */,
3AA480D62D3DECF20052A05C /* PBXTargetDependency */, 3AA480D62D3DECF20052A05C /* PBXTargetDependency */,
); );
fileSystemSynchronizedGroups = ( fileSystemSynchronizedGroups = (
@@ -195,6 +198,9 @@
); );
mainGroup = 3AA480AF2D3DECF10052A05C; mainGroup = 3AA480AF2D3DECF10052A05C;
minimizedProjectReferenceProxies = 1; minimizedProjectReferenceProxies = 1;
packageReferences = (
3AA480F82D3DF0820052A05C /* XCRemoteSwiftPackageReference "SwiftLintPlugins" */,
);
preferredProjectObjectVersion = 77; preferredProjectObjectVersion = 77;
productRefGroup = 3AA480B92D3DECF10052A05C /* Products */; productRefGroup = 3AA480B92D3DECF10052A05C /* Products */;
projectDirPath = ""; projectDirPath = "";
@@ -266,6 +272,18 @@
target = 3AA480B72D3DECF10052A05C /* Yeti */; target = 3AA480B72D3DECF10052A05C /* Yeti */;
targetProxy = 3AA480D52D3DECF20052A05C /* PBXContainerItemProxy */; targetProxy = 3AA480D52D3DECF20052A05C /* PBXContainerItemProxy */;
}; };
3AA480FA2D3DF10E0052A05C /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = 3AA480F92D3DF10E0052A05C /* SwiftLintBuildToolPlugin */;
};
3AA481002D3DF2080052A05C /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = 3AA480FF2D3DF2080052A05C /* SwiftLintBuildToolPlugin */;
};
3AA481022D3DF20D0052A05C /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
productRef = 3AA481012D3DF20D0052A05C /* SwiftLintBuildToolPlugin */;
};
/* End PBXTargetDependency section */ /* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */ /* Begin XCBuildConfiguration section */
@@ -397,6 +415,7 @@
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"Yeti/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"Yeti/Preview Content\"";
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
@@ -425,6 +444,7 @@
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"Yeti/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"Yeti/Preview Content\"";
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
ENABLE_USER_SCRIPT_SANDBOXING = NO;
GENERATE_INFOPLIST_FILE = YES; GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
@@ -552,6 +572,35 @@
defaultConfigurationName = Release; defaultConfigurationName = Release;
}; };
/* End XCConfigurationList section */ /* End XCConfigurationList section */
/* Begin XCRemoteSwiftPackageReference section */
3AA480F82D3DF0820052A05C /* XCRemoteSwiftPackageReference "SwiftLintPlugins" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/SimplyDanny/SwiftLintPlugins";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 0.58.2;
};
};
/* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */
3AA480F92D3DF10E0052A05C /* SwiftLintBuildToolPlugin */ = {
isa = XCSwiftPackageProductDependency;
package = 3AA480F82D3DF0820052A05C /* XCRemoteSwiftPackageReference "SwiftLintPlugins" */;
productName = "plugin:SwiftLintBuildToolPlugin";
};
3AA480FF2D3DF2080052A05C /* SwiftLintBuildToolPlugin */ = {
isa = XCSwiftPackageProductDependency;
package = 3AA480F82D3DF0820052A05C /* XCRemoteSwiftPackageReference "SwiftLintPlugins" */;
productName = "plugin:SwiftLintBuildToolPlugin";
};
3AA481012D3DF20D0052A05C /* SwiftLintBuildToolPlugin */ = {
isa = XCSwiftPackageProductDependency;
package = 3AA480F82D3DF0820052A05C /* XCRemoteSwiftPackageReference "SwiftLintPlugins" */;
productName = "plugin:SwiftLintBuildToolPlugin";
};
/* End XCSwiftPackageProductDependency section */
}; };
rootObject = 3AA480B02D3DECF10052A05C /* Project object */; rootObject = 3AA480B02D3DECF10052A05C /* Project object */;
} }

View File

@@ -0,0 +1,15 @@
{
"originHash" : "1fa961aa1dc717cea452f3389668f0f99a254f07e4eb11d190768a53798f744f",
"pins" : [
{
"identity" : "swiftlintplugins",
"kind" : "remoteSourceControl",
"location" : "https://github.com/SimplyDanny/SwiftLintPlugins",
"state" : {
"revision" : "7a3d77f3dd9f91d5cea138e52c20cfceabf352de",
"version" : "0.58.2"
}
}
],
"version" : 3
}

View File

@@ -11,7 +11,7 @@ import SwiftData
@Model @Model
final class Item { final class Item {
var timestamp: Date var timestamp: Date
init(timestamp: Date) { init(timestamp: Date) {
self.timestamp = timestamp self.timestamp = timestamp
} }

View File

@@ -12,7 +12,7 @@ import SwiftData
struct YetiApp: App { struct YetiApp: App {
var sharedModelContainer: ModelContainer = { var sharedModelContainer: ModelContainer = {
let schema = Schema([ let schema = Schema([
Item.self, Item.self
]) ])
let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false) let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)

View File

@@ -15,7 +15,8 @@ final class YetiUITests: XCTestCase {
// In UI tests it is usually best to stop immediately when a failure occurs. // In UI tests it is usually best to stop immediately when a failure occurs.
continueAfterFailure = false continueAfterFailure = false
// In UI tests its 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 its 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 { override func tearDownWithError() throws {

View File

@@ -9,7 +9,7 @@ import XCTest
final class YetiUITestsLaunchTests: XCTestCase { final class YetiUITestsLaunchTests: XCTestCase {
override class var runsForEachTargetApplicationUIConfiguration: Bool { override static var runsForEachTargetApplicationUIConfiguration: Bool {
true true
} }