Skip to content

Commit b9f85db

Browse files
committed
ci: automate code formatting and linting with git hooks
1 parent 22b4975 commit b9f85db

16 files changed

Lines changed: 135 additions & 107 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,6 @@ concurrency:
2323
cancel-in-progress: true
2424

2525
jobs:
26-
SwiftLint:
27-
runs-on: ubuntu-latest
28-
steps:
29-
- uses: actions/checkout@v5
30-
- name: GitHub Action for SwiftLint
31-
uses: norio-nomura/action-swiftlint@3.2.1
32-
with:
33-
args: --strict
34-
env:
35-
DIFF_BASE: ${{ github.base_ref }}
3626
macOS:
3727
name: ${{ matrix.name }}
3828
runs-on: ${{ matrix.runsOn }}
@@ -205,23 +195,3 @@ jobs:
205195
with:
206196
name: MergedResult
207197
path: test_output/final
208-
209-
discover-typos:
210-
name: Discover Typos
211-
runs-on: macos-15
212-
env:
213-
DEVELOPER_DIR: /Applications/Xcode_16.4.app/Contents/Developer
214-
steps:
215-
- uses: actions/checkout@v5
216-
217-
- name: Set up Python environment
218-
run: |
219-
python3 -m venv .venv
220-
source .venv/bin/activate
221-
pip install --upgrade pip
222-
pip install codespell
223-
224-
- name: Discover typos
225-
run: |
226-
source .venv/bin/activate
227-
codespell --ignore-words-list="hart,inout,msdos,sur" --skip="./.build/*,./.git/*"

.github/workflows/lint.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
paths:
9+
- "Sources/**"
10+
- ".github/workflows/ci.yml"
11+
- "Tests/**"
12+
13+
concurrency:
14+
group: lint-${{ github.head_ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
lint:
19+
name: lint
20+
runs-on: macos-15
21+
steps:
22+
- uses: actions/checkout@v5
23+
- uses: jdx/mise-action@v3
24+
- name: Run
25+
run: mise run lint
26+
27+
discover-typos:
28+
name: discover-typos
29+
runs-on: macos-15
30+
env:
31+
DEVELOPER_DIR: /Applications/Xcode_16.4.app/Contents/Developer
32+
steps:
33+
- uses: actions/checkout@v5
34+
35+
- name: Set up Python environment
36+
run: |
37+
python3 -m venv .venv
38+
source .venv/bin/activate
39+
pip install --upgrade pip
40+
pip install codespell
41+
42+
- name: Discover typos
43+
run: |
44+
source .venv/bin/activate
45+
codespell --ignore-words-list="hart,inout,msdos,sur" --skip="./.build/*,./.git/*"

.swiftformat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Stream rules
22

3-
--swiftversion 6.2
3+
--swiftversion 5.10
44

55
# Use 'swiftformat --options' to list all of the possible options
66

Makefile

Lines changed: 0 additions & 19 deletions
This file was deleted.

Mintfile

Lines changed: 0 additions & 2 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ dependencies: [
259259
Bootstrapping development environment
260260

261261
```
262-
make bootstrap
262+
mise install
263263
```
264264

265265
Please feel free to help out with this project! If you see something that could be made better or want a new feature, open up an issue or send a Pull Request!

Sources/ValidatorCore/Classes/Extensions/ValidationResult+Equatable.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ extension ValidationResult: Equatable {
99
public static func == (lhs: ValidationResult, rhs: ValidationResult) -> Bool {
1010
switch (lhs, rhs) {
1111
case (.valid, .valid):
12-
return true
12+
true
1313
case let (.invalid(errors: lhs), .invalid(errors: rhs)):
14-
return lhs.map(\.message).joined() == rhs.map(\.message).joined()
14+
lhs.map(\.message).joined() == rhs.map(\.message).joined()
1515
default:
16-
return false
16+
false
1717
}
1818
}
1919
}

Sources/ValidatorCore/Classes/Rules/URLValidationRule.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//
22
// Validator
3-
// Copyright © 2025 Space Code. All rights reserved.
3+
// Copyright © 2023 Space Code. All rights reserved.
44
//
55

66
import Foundation

Sources/ValidatorUI/Classes/IUIValidatable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public protocol IUIValidatable: AnyObject {
2121
/// - rule: The validation rule.
2222
///
2323
/// - Returns: A validation result.
24-
func validate<T>(rule: some IValidationRule<T>) -> ValidationResult where T == Input
24+
func validate(rule: some IValidationRule<Input>) -> ValidationResult
2525

2626
/// Validates an input value.
2727
///

Sources/ValidatorUI/Classes/SUI/Managers/FormField/FormField/FormField.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ public typealias ValidationPublisher = AnyPublisher<ValidationResult, Never>
1515
public final class FormField<Value>: IFormField {
1616
// MARK: Properties
1717

18-
@Published
1918
/// The value to validate.
19+
@Published
2020
private var value: Value
2121

2222
/// The validation.

0 commit comments

Comments
 (0)