Skip to content
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
30 changes: 0 additions & 30 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,6 @@ concurrency:
cancel-in-progress: true

jobs:
SwiftLint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: GitHub Action for SwiftLint
uses: norio-nomura/action-swiftlint@3.2.1
with:
args: --strict
env:
DIFF_BASE: ${{ github.base_ref }}
macOS:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runsOn }}
Expand Down Expand Up @@ -205,23 +195,3 @@ jobs:
with:
name: MergedResult
path: test_output/final

discover-typos:
name: Discover Typos
runs-on: macos-15
env:
DEVELOPER_DIR: /Applications/Xcode_16.4.app/Contents/Developer
steps:
- uses: actions/checkout@v5

- name: Set up Python environment
run: |
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install codespell

- name: Discover typos
run: |
source .venv/bin/activate
codespell --ignore-words-list="hart,inout,msdos,sur" --skip="./.build/*,./.git/*"
47 changes: 47 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: lint

on:
push:
branches:
- main
pull_request:
paths:
- "Sources/**"
- ".github/workflows/ci.yml"
- "Tests/**"

concurrency:
group: lint-${{ github.head_ref }}
cancel-in-progress: true

jobs:
lint:
name: lint
runs-on: macos-15
steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0
- uses: jdx/mise-action@v3
- name: Run
run: mise run lint

discover-typos:
name: discover-typos
runs-on: macos-15
env:
DEVELOPER_DIR: /Applications/Xcode_16.4.app/Contents/Developer
steps:
- uses: actions/checkout@v5

- name: Set up Python environment
run: |
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install codespell

- name: Discover typos
run: |
source .venv/bin/activate
codespell --ignore-words-list="hart,inout,msdos,sur" --skip="./.build/*,./.git/*"
2 changes: 1 addition & 1 deletion .swiftformat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Stream rules

--swiftversion 6.2
--swiftversion 5.10

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

Expand Down
4 changes: 1 addition & 3 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
excluded:
- Tests
- Package.swift
- Package@swift-5.10.swift
- Package@swift-6.0.swift
Expand All @@ -12,9 +11,9 @@ disabled_rules:
- trailing_comma
- todo
- opening_brace
- statement_position

opt_in_rules: # some rules are only opt-in
- anyobject_protocol
- array_init
- closure_body_length
- closure_end_indentation
Expand Down Expand Up @@ -43,7 +42,6 @@ opt_in_rules: # some rules are only opt-in
- ibinspectable_in_extension
- identical_operands
- implicit_return
- inert_defer
- joined_default_parameter
- last_where
- legacy_multiple
Expand Down
19 changes: 0 additions & 19 deletions Makefile

This file was deleted.

2 changes: 0 additions & 2 deletions Mintfile

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ dependencies: [
Bootstrapping development environment

```
make bootstrap
mise install
```

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!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ extension ValidationResult: Equatable {
public static func == (lhs: ValidationResult, rhs: ValidationResult) -> Bool {
switch (lhs, rhs) {
case (.valid, .valid):
return true
true
case let (.invalid(errors: lhs), .invalid(errors: rhs)):
return lhs.map(\.message).joined() == rhs.map(\.message).joined()
lhs.map(\.message).joined() == rhs.map(\.message).joined()
default:
return false
false
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// Validator
// Copyright © 2025 Space Code. All rights reserved.
// Copyright © 2023 Space Code. All rights reserved.
//

import Foundation
Expand Down
2 changes: 1 addition & 1 deletion Sources/ValidatorUI/Classes/IUIValidatable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public protocol IUIValidatable: AnyObject {
/// - rule: The validation rule.
///
/// - Returns: A validation result.
func validate<T>(rule: some IValidationRule<T>) -> ValidationResult where T == Input
func validate(rule: some IValidationRule<Input>) -> ValidationResult

/// Validates an input value.
///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public typealias ValidationPublisher = AnyPublisher<ValidationResult, Never>
public final class FormField<Value>: IFormField {
// MARK: Properties

@Published
/// The value to validate.
@Published
private var value: Value

/// The validation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public struct FormValidationViewModifier<ErrorView: View>: ViewModifier {
content
validationMessageView
}.onReceive(validationContainer.publisher) { result in
self.validationResult = result
validationResult = result
}
}

Expand All @@ -44,9 +44,9 @@ public struct FormValidationViewModifier<ErrorView: View>: ViewModifier {
private var validationMessageView: some View {
switch validationResult {
case .valid:
return EmptyView().eraseToAnyView()
EmptyView().eraseToAnyView()
case let .invalid(errors):
return content(errors).eraseToAnyView()
content(errors).eraseToAnyView()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public struct ValidationViewModifier<T, ErrorView: View>: ViewModifier {
content
.validation($item, rules: rules) { result in
DispatchQueue.main.async {
self.validationResult = result
validationResult = result
}
}
validationMessageView
Expand All @@ -86,9 +86,9 @@ public struct ValidationViewModifier<T, ErrorView: View>: ViewModifier {
private var validationMessageView: some View {
switch validationResult {
case .valid:
return EmptyView().eraseToAnyView()
EmptyView().eraseToAnyView()
case let .invalid(errors):
return content(errors).eraseToAnyView()
content(errors).eraseToAnyView()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ final class CreditCardValidationRuleTests: XCTestCase {
func test_validate_masterCardValid_shouldReturnTrue() {
// given
let rule = CreditCardValidationRule(types: [.masterCard], error: String.error)
let validMaster = "5500000000000004"
let validMasterCard = "5500000000000004"

// when
let isValid = rule.validate(input: validMaster)
let isValid = rule.validate(input: validMasterCard)

// then
XCTAssertTrue(isValid)
Expand All @@ -52,10 +52,10 @@ final class CreditCardValidationRuleTests: XCTestCase {
func test_validate_masterCardInvalid_shouldReturnFalse() {
// given
let rule = CreditCardValidationRule(types: [.masterCard], error: String.error)
let invalidMaster = "550000000000"
let invalidMasterCard = "550000000000"

// when
let isValid = rule.validate(input: invalidMaster)
let isValid = rule.validate(input: invalidMasterCard)

// then
XCTAssertFalse(isValid)
Expand Down
4 changes: 2 additions & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ coverage:
project:
default:
# The required coverage value
target: 50%
target: 75%

# The leniency in hitting the target. Allow coverage to drop by X%
threshold: 5%
Expand All @@ -29,7 +29,7 @@ coverage:
patch:
default:
# The required coverage value
target: 85%
target: 50%

# Allow coverage to drop by X%
threshold: 5%
Expand Down
38 changes: 0 additions & 38 deletions hooks/pre-commit

This file was deleted.

10 changes: 6 additions & 4 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[tools]
git-cliff = "2.9.1"

[hooks]
postinstall = "mise run install"
swiftlint = "0.62.2"
swiftformat = "0.58.6"

[settings]
experimental = true
experimental = true

[hooks]
postinstall = "mise run install"
Loading