Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pepicrft committed Dec 3, 2024
1 parent 916cb16 commit 6f088a4
Show file tree
Hide file tree
Showing 21 changed files with 217 additions and 226 deletions.
1 change: 1 addition & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@
"code"
]
},
{
"login": "georgenavarro",
"name": "George Navarro",
"avatar_url": "https://avatars.githubusercontent.com/u/2748028?v=4",
Expand Down
18 changes: 0 additions & 18 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,6 @@
"revision" : "26cc5e9ae0947092c7139ef7ba612e34646086c7",
"version" : "0.10.1"
}
},
{
"identity" : "swift-docc-plugin",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-docc-plugin",
"state" : {
"revision" : "85e4bb4e1cd62cec64a4b8e769dcefdf0c5b9d64",
"version" : "1.4.3"
}
},
{
"identity" : "swift-docc-symbolkit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-docc-symbolkit",
"state" : {
"revision" : "b45d1f2ed151d057b54504d653e0da5552844e34",
"version" : "1.0.0"
}
}
],
"version" : 2
Expand Down
1 change: 0 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ let package = Package(
dependencies: [
.package(url: "https://github.com/tadija/AEXML.git", .upToNextMinor(from: "4.6.1")),
.package(url: "https://github.com/kylef/PathKit.git", .upToNextMinor(from: "1.0.1")),
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.4.3"),
],
targets: [
.target(name: "XcodeProj",
Expand Down
54 changes: 27 additions & 27 deletions Sources/XcodeProj/Errors/Errors.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ public enum XCodeProjError: Error, CustomStringConvertible, Sendable {
public var description: String {
switch self {
case let .notFound(path):
return "The project cannot be found at \(path.string)"
"The project cannot be found at \(path.string)"
case let .pbxprojNotFound(path):
return "The project doesn't contain a .pbxproj file at path: \(path.string)"
"The project doesn't contain a .pbxproj file at path: \(path.string)"
case let .xcworkspaceNotFound(path):
return "The project doesn't contain a .xcworkspace at path: \(path.string)"
"The project doesn't contain a .xcworkspace at path: \(path.string)"
}
}
}
Expand All @@ -36,7 +36,7 @@ public enum XCSharedDataError: Error, CustomStringConvertible {
public var description: String {
switch self {
case let .notFound(path):
return "xcshareddata not found at path \(path.string)"
"xcshareddata not found at path \(path.string)"
}
}
}
Expand All @@ -52,7 +52,7 @@ public enum XCUserDataError: Error, CustomStringConvertible {
public var description: String {
switch self {
case let .notFound(path):
return "xcuserdata not found at path \(path.string)"
"xcuserdata not found at path \(path.string)"
}
}
}
Expand All @@ -68,7 +68,7 @@ public enum XCWorkspaceError: Error, CustomStringConvertible {
public var description: String {
switch self {
case let .notFound(path):
return "The project cannot be found at \(path.string)"
"The project cannot be found at \(path.string)"
}
}
}
Expand All @@ -84,7 +84,7 @@ public enum XCWorkspaceDataError: Error, CustomStringConvertible {
public var description: String {
switch self {
case let .notFound(path):
return "Workspace not found at \(path.string)"
"Workspace not found at \(path.string)"
}
}
}
Expand All @@ -100,7 +100,7 @@ public enum XcodeprojEditingError: Error, CustomStringConvertible {
public var description: String {
switch self {
case let .unexistingFile(path):
return "The file at path \(path.string) doesn't exist"
"The file at path \(path.string) doesn't exist"
}
}
}
Expand All @@ -116,7 +116,7 @@ public enum XcodeprojWritingError: Error, CustomStringConvertible {
public var description: String {
switch self {
case let .invalidType(classType, expected):
return "Invalid type for object \(classType) that expects a \(expected)"
"Invalid type for object \(classType) that expects a \(expected)"
}
}
}
Expand All @@ -140,15 +140,15 @@ public enum PBXObjectError: Error, CustomStringConvertible {
public var description: String {
switch self {
case .missingIsa:
return "Isa property is missing."
"Isa property is missing."
case let .unknownElement(element):
return "The element \(element) is not supported."
"The element \(element) is not supported."
case .objectsReleased:
return "The PBXObjects instance has been released before saving."
"The PBXObjects instance has been released before saving."
case let .objectNotFound(reference):
return "PBXObject with reference \"\(reference)\" not found."
"PBXObject with reference \"\(reference)\" not found."
case let .orphaned(type, reference):
return "Trying to use object \(type) with reference '\(reference)' before being added to any project"
"Trying to use object \(type) with reference '\(reference)' before being added to any project"
}
}
}
Expand All @@ -164,7 +164,7 @@ enum PBXProjEncoderError: Error, CustomStringConvertible {
var description: String {
switch self {
case .emptyProjectReference:
return "PBXProj should contain a reference to the XcodeProj object that represents the project"
"PBXProj should contain a reference to the XcodeProj object that represents the project"
}
}
}
Expand All @@ -187,23 +187,23 @@ enum PBXProjError: Error, CustomStringConvertible, Equatable {
var description: String {
switch self {
case let .notFound(path):
return ".pbxproj not found at path \(path.string)"
".pbxproj not found at path \(path.string)"
case let .invalidGroupPath(sourceRoot, elementPath):
return "Cannot calculate full path for file element \"\(elementPath ?? "")\" in source root: \"\(sourceRoot)\""
"Cannot calculate full path for file element \"\(elementPath ?? "")\" in source root: \"\(sourceRoot)\""
case let .targetNotFound(targetName):
return "Could not find target with \(targetName)"
"Could not find target with \(targetName)"
case let .frameworksBuildPhaseNotFound(targetName):
return "Could not find frameworks build phase for target \(targetName)"
"Could not find frameworks build phase for target \(targetName)"
case let .sourcesBuildPhaseNotFound(targetName):
return "Could not find sources build phase for target \(targetName)"
"Could not find sources build phase for target \(targetName)"
case let .pathIsAbsolute(path):
return "Path must be relative, but path \(path.string) is absolute"
"Path must be relative, but path \(path.string) is absolute"
case let .multipleLocalPackages(productName: productName):
return "Found multiple top-level packages named \(productName)"
"Found multiple top-level packages named \(productName)"
case let .multipleRemotePackages(productName: productName):
return "Can not resolve dependency \(productName) - conflicting version requirements"
"Can not resolve dependency \(productName) - conflicting version requirements"
case .malformed:
return "The .pbxproj is malformed."
"The .pbxproj is malformed."
}
}
}
Expand All @@ -221,9 +221,9 @@ public enum XCBreakpointListError: Error, CustomStringConvertible {
public var description: String {
switch self {
case let .notFound(path):
return "Breakpoints_v2.xcbkptlist couldn't be found at path \(path.string)"
"Breakpoints_v2.xcbkptlist couldn't be found at path \(path.string)"
case let .missing(property):
return "Property \(property) missing"
"Property \(property) missing"
}
}
}
Expand All @@ -238,7 +238,7 @@ public enum XCConfigError: Error, CustomStringConvertible {
public var description: String {
switch self {
case let .notFound(path):
return ".xcconfig file not found at \(path.string)"
".xcconfig file not found at \(path.string)"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ extension KeyedDecodingContainer {

func decodeIntIfPresent(_ key: KeyedDecodingContainer.Key) throws -> UInt? {
if let string: String = try? decodeIfPresent(key) {
return UInt(string)
UInt(string)
} else if let bool: Bool = try? decodeIfPresent(key) {
return bool ? 0 : 1
bool ? 0 : 1
} else if let int: UInt = try decodeIfPresent(key) {
// don't `try?` here in case key _does_ exist but isn't an expected type
// ie. not a string/bool/int
return int
int
} else {
return nil
nil
}
}

Expand Down
24 changes: 12 additions & 12 deletions Sources/XcodeProj/Objects/Files/PBXContainerItemProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ public final class PBXContainerItemProxy: PBXObject {

var uuid: String {
switch self {
case let .reference(reference): return reference.value
case let .string(string): return string
case let .reference(reference): reference.value
case let .string(string): string
}
}

var id: RemoteGlobalID {
switch self {
case let .reference(reference):
if let object = reference.getObject() {
return .object(object)
.object(object)
} else {
return .string(reference.value)
.string(reference.value)
}
case let .string(string): return .string(string)
case let .string(string): .string(string)
}
}
}
Expand All @@ -44,15 +44,15 @@ public final class PBXContainerItemProxy: PBXObject {

var uuid: String {
switch self {
case let .object(object): return object.uuid
case let .string(string): return string
case let .object(object): object.uuid
case let .string(string): string
}
}

var reference: RemoteGlobalIDReference {
switch self {
case let .object(object): return .reference(object.reference)
case let .string(string): return .string(string)
case let .object(object): .reference(object.reference)
case let .string(string): .string(string)
}
}
}
Expand Down Expand Up @@ -185,11 +185,11 @@ private extension PBXContainerItemProxy.ContainerPortal {
var reference: PBXObjectReference? {
switch self {
case let .project(project):
return project.reference
project.reference
case let .fileReference(fileReference):
return fileReference.reference
fileReference.reference
case .unknownObject:
return nil
nil
}
}

Expand Down
11 changes: 5 additions & 6 deletions Sources/XcodeProj/Objects/Files/PBXGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -215,18 +215,17 @@ public extension PBXGroup {
return existingFileReference.value
}

let path: String?
switch sourceTree {
let path: String? = switch sourceTree {
case .group:
path = groupPath.map { filePath.relative(to: $0) }?.string
groupPath.map { filePath.relative(to: $0) }?.string
case .sourceRoot:
path = filePath.relative(to: sourceRoot).string
filePath.relative(to: sourceRoot).string
case .absolute,
.sdkRoot,
.developerDir:
path = filePath.string
filePath.string
default:
path = nil
nil
}
let fileReference = PBXFileReference(
sourceTree: sourceTree,
Expand Down
22 changes: 11 additions & 11 deletions Sources/XcodeProj/Objects/Files/PBXSourceTree.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ public enum PBXSourceTree: CustomStringConvertible, Equatable, Decodable {
(.buildProductsDir, .buildProductsDir),
(.sdkRoot, .sdkRoot),
(.developerDir, .developerDir):
return true
true

case let (.custom(lhsValue), .custom(rhsValue)):
return lhsValue == rhsValue
lhsValue == rhsValue

case (.none, _),
(.absolute, _),
Expand All @@ -67,28 +67,28 @@ public enum PBXSourceTree: CustomStringConvertible, Equatable, Decodable {
(.sdkRoot, _),
(.developerDir, _),
(.custom, _):
return false
false
}
}

public var description: String {
switch self {
case .none:
return PBXSourceTree.noneValue
PBXSourceTree.noneValue
case .absolute:
return PBXSourceTree.absoluteValue
PBXSourceTree.absoluteValue
case .group:
return PBXSourceTree.groupValue
PBXSourceTree.groupValue
case .sourceRoot:
return PBXSourceTree.sourceRootValue
PBXSourceTree.sourceRootValue
case .buildProductsDir:
return PBXSourceTree.buildProductsDirValue
PBXSourceTree.buildProductsDirValue
case .sdkRoot:
return PBXSourceTree.sdkRootValue
PBXSourceTree.sdkRootValue
case .developerDir:
return PBXSourceTree.developerDirValue
PBXSourceTree.developerDirValue
case let .custom(value):
return value
value
}
}
}
Expand Down
Loading

0 comments on commit 6f088a4

Please sign in to comment.