Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SwiftLint Support #8

Merged
merged 2 commits into from
Dec 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
excluded:
- .build

opt_in_rules:
- empty_count
- explicit_init
- closure_spacing
- overridden_super_call
- redundant_nil_coalescing
- private_outlet
- nimble_operator
- attributes
- operator_usage_whitespace
- closure_end_indentation
- first_where
- prohibited_super_call
- fatal_error_message
- vertical_parameter_alignment_on_call
- let_var_whitespace
- unneeded_parentheses_in_closure_argument
- extension_access_modifier
- pattern_matching_keywords
- array_init
- literal_expression_end_indentation

disabled_rules:
- void_return
- multiple_closures_with_trailing_closure
- vertical_parameter_alignment_on_call

identifier_name:
excluded:
- id

type_name:
excluded:
- ID

function_body_length: 50

line_length: 200

file_length:
warning: 500
error: 1000

nesting:
type_level:
warning: 2
function_level:
warning: 10

large_tuple:
warning: 6
error: 10

cyclomatic_complexity:
ignores_case_statements: true
81 changes: 81 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -18,6 +18,24 @@
"version" : "0.32.0"
}
},
{
"identity" : "collectionconcurrencykit",
"kind" : "remoteSourceControl",
"location" : "https://github.com/JohnSundell/CollectionConcurrencyKit.git",
"state" : {
"revision" : "b4f23e24b5a1bff301efc5e70871083ca029ff95",
"version" : "0.2.0"
}
},
{
"identity" : "cryptoswift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/krzyzanowskim/CryptoSwift.git",
"state" : {
"revision" : "db51c407d3be4a051484a141bf0bff36c43d3b1e",
"version" : "1.8.0"
}
},
{
"identity" : "smithy-swift",
"kind" : "remoteSourceControl",
@@ -27,6 +45,24 @@
"version" : "0.36.0"
}
},
{
"identity" : "sourcekitten",
"kind" : "remoteSourceControl",
"location" : "https://github.com/jpsim/SourceKitten.git",
"state" : {
"revision" : "b6dc09ee51dfb0c66e042d2328c017483a1a5d56",
"version" : "0.34.1"
}
},
{
"identity" : "swift-argument-parser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser.git",
"state" : {
"revision" : "8f4d2753f0e4778c76d5f05ad16c74f707390531",
"version" : "1.2.3"
}
},
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
@@ -45,6 +81,42 @@
"version" : "1.5.3"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"state" : {
"revision" : "6ad4ea24b01559dde0773e3d091f1b9e36175036",
"version" : "509.0.2"
}
},
{
"identity" : "swiftlint",
"kind" : "remoteSourceControl",
"location" : "https://github.com/realm/SwiftLint.git",
"state" : {
"revision" : "f17a4f9dfb6a6afb0408426354e4180daaf49cee",
"version" : "0.54.0"
}
},
{
"identity" : "swiftytexttable",
"kind" : "remoteSourceControl",
"location" : "https://github.com/scottrhoyt/SwiftyTextTable.git",
"state" : {
"revision" : "c6df6cf533d120716bff38f8ff9885e1ce2a4ac3",
"version" : "0.9.0"
}
},
{
"identity" : "swxmlhash",
"kind" : "remoteSourceControl",
"location" : "https://github.com/drmohundro/SWXMLHash.git",
"state" : {
"revision" : "a853604c9e9a83ad9954c7e3d2a565273982471f",
"version" : "7.0.2"
}
},
{
"identity" : "xmlcoder",
"kind" : "remoteSourceControl",
@@ -53,6 +125,15 @@
"revision" : "80b4a1646399b8e4e0ce80711653476a85bd5e37",
"version" : "0.17.0"
}
},
{
"identity" : "yams",
"kind" : "remoteSourceControl",
"location" : "https://github.com/jpsim/Yams.git",
"state" : {
"revision" : "0d9ee7ea8c4ebd4a489ad7a73d5c6cad55d6fed3",
"version" : "5.0.6"
}
}
],
"version" : 2
49 changes: 30 additions & 19 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -15,25 +15,6 @@ let package = Package(
.package(url: "https://github.com/awslabs/aws-sdk-swift.git", from: "0.19.0")
],
targets: [
.target(
name: "EmailSender",
dependencies: [
.product(name: "AWSSES", package: "aws-sdk-swift")
]
),
.target(
name: "Persistence",
dependencies: [
.product(name: "AWSDynamoDB", package: "aws-sdk-swift")
]
),
.target(
name: "Secrets",
dependencies: [
.product(name: "AWSSecretsManager", package: "aws-sdk-swift")
]
),
// MARK: - Tests
.testTarget(
name: "EmailSenderTests",
dependencies: ["EmailSender"]
@@ -48,3 +29,33 @@ let package = Package(
)
]
)

let genericTargets: [Target] = [
.target(
name: "EmailSender",
dependencies: [
.product(name: "AWSSES", package: "aws-sdk-swift")
]
),
.target(
name: "Persistence",
dependencies: [
.product(name: "AWSDynamoDB", package: "aws-sdk-swift")
]
),
.target(
name: "Secrets",
dependencies: [
.product(name: "AWSSecretsManager", package: "aws-sdk-swift")
]
)
]

#if os(macOS)
package.dependencies.append(.package(url: "https://github.com/realm/SwiftLint.git", exact: "0.54.0"))
for target in genericTargets {
target.plugins = [.plugin(name: "SwiftLintPlugin", package: "SwiftLint")]
}
#endif

package.targets.append(contentsOf: genericTargets)
4 changes: 2 additions & 2 deletions Sources/Persistence/Persistence.swift
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ public struct Persistence {
/// Persists the given value.
///
/// - Parameter contact: The value to persist.
public func put<T: AttributeValueConvertible>(_ value: T) async throws -> Void {
public func put<T: AttributeValueConvertible>(_ value: T) async throws {
try await put(value.attributes)
}
}
@@ -72,7 +72,7 @@ public extension PersistenceFactory {
if let attributeProvider {
inputProvider = { attributes in
PutItemInput(
item: try attributes.merging(attributeProvider()) { (_, new) in new },
item: try attributes.merging(attributeProvider()) { _, new in new },
tableName: tableName
)
}