diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a5a121..398d4c5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,10 +12,10 @@ on: - '.github/**.md' - 'README.md' types: [opened, synchronize, reopened, ready_for_review] - + env: DEVELOPER_DIR: /Applications/Xcode_14.3.1.app/Contents/Developer - + jobs: test: runs-on: macos-13 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..9f13a01 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,17 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - id: check-executables-have-shebangs + - id: check-shebang-scripts-are-executable + - repo: https://github.com/realm/SwiftLint + rev: 0.54.0 + hooks: + - id: swiftlint + entry: swiftlint --fix --strict diff --git a/.scripts/ci-test.sh b/.scripts/ci-test.sh index 428d68b..430ce12 100755 --- a/.scripts/ci-test.sh +++ b/.scripts/ci-test.sh @@ -7,4 +7,4 @@ xcodebuild test \ -sdk iphonesimulator \ -derivedDataPath .build \ -skipPackagePluginValidation \ - -destination "platform=iOS Simulator,name=iPhone 14 Pro" + -destination "platform=iOS Simulator,name=iPhone 14 Pro" diff --git a/.swiftlint.yml b/.swiftlint.yml index 184d6cb..a2c9c5a 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -1,26 +1,26 @@ ---- -analyzer_rules: +--- +analyzer_rules: - explicit_self -disabled_rules: +disabled_rules: - multiple_closures_with_trailing_closure -identifier_name: +identifier_name: allowed_symbols: _ - excluded: + excluded: - id - ok - max_length: + max_length: error: 1000 warning: 90 min_length: 2 -nesting: - function_level: +nesting: + function_level: error: 8 warning: 4 - type_level: + type_level: error: 6 warning: 4 -opt_in_rules: +opt_in_rules: - empty_count reporter: xcode -vertical_whitespace: +vertical_whitespace: max_empty_lines: 2 diff --git a/Package.swift b/Package.swift index 0265be1..98a8aea 100644 --- a/Package.swift +++ b/Package.swift @@ -108,7 +108,7 @@ package.dependencies = [ .package(url: "https://github.com/pointfreeco/swift-custom-dump", from: "1.0.0"), .package(url: "https://github.com/pointfreeco/swift-dependencies", from: "1.0.0"), .package(url: "https://github.com/pointfreeco/swift-tagged", exact: "0.10.0"), - .package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "1.0.0"), + .package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "1.0.0") ] /// ✨ Independent 3rd party deps @@ -141,7 +141,6 @@ extension Target.Dependency { } - /// ✂️ Copy everything below this into other Package.swift files /// to re-create the same DSL capabilities. /// ------------------------------------------------------------ diff --git a/Sources/Cache/Cache.swift b/Sources/Cache/Cache.swift index f1fabf4..1d27631 100644 --- a/Sources/Cache/Cache.swift +++ b/Sources/Cache/Cache.swift @@ -143,12 +143,6 @@ extension Cache { public let cost: UInt64 public let expirationDate: Date - init(value: Value, cost: UInt64, expirationDate: Date) { - self.value = value - self.cost = cost - self.expirationDate = expirationDate - } - static func with(value: Value, cost: UInt64 = 0, duration: TimeInterval) -> Self { @Dependency(\.date) var date return Self(