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

feat: pre-commit #25

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion .scripts/ci-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
22 changes: 11 additions & 11 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -141,7 +141,6 @@ extension Target.Dependency {
}



/// ✂️ Copy everything below this into other Package.swift files
/// to re-create the same DSL capabilities.
/// ------------------------------------------------------------
Expand Down
6 changes: 0 additions & 6 deletions Sources/Cache/Cache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading