Skip to content

Commit 92df79f

Browse files
authored
ci: automate code formatting and linting with github actions (#30)
1 parent 73bb409 commit 92df79f

7 files changed

Lines changed: 60 additions & 25 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,4 @@ jobs:
111111
with:
112112
name: MergedTestResults
113113
path: test_output/final
114-
retention-days: 30
115-
116-
discover-typos:
117-
name: Discover Typos
118-
runs-on: macos-15
119-
env:
120-
DEVELOPER_DIR: /Applications/Xcode_14.1.app/Contents/Developer
121-
steps:
122-
- name: Checkout code
123-
uses: actions/checkout@v6
124-
- name: Discover typos
125-
run: |
126-
export PATH="$PATH:/Library/Frameworks/Python.framework/Versions/3.11/bin"
127-
python3 -m pip install --upgrade pip
128-
python3 -m pip install codespell
129-
codespell --ignore-words-list="hart,inout,msdos,sur" --skip="./.build/*,./.git/*"
114+
retention-days: 30

.github/workflows/lint.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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+
permissions:
18+
contents: read
19+
20+
jobs:
21+
lint:
22+
name: lint
23+
runs-on: macos-15
24+
steps:
25+
- uses: actions/checkout@v6
26+
with:
27+
fetch-depth: 0
28+
- uses: jdx/mise-action@v3
29+
- name: Run
30+
run: mise run lint
31+
32+
discover-typos:
33+
name: discover-typos
34+
runs-on: macos-15
35+
env:
36+
DEVELOPER_DIR: /Applications/Xcode_16.4.app/Contents/Developer
37+
steps:
38+
- uses: actions/checkout@v6
39+
40+
- name: Set up Python environment
41+
run: |
42+
python3 -m venv .venv
43+
source .venv/bin/activate
44+
pip install --upgrade pip
45+
pip install codespell
46+
47+
- name: Discover typos
48+
run: |
49+
source .venv/bin/activate
50+
codespell --ignore-words-list="hart,inout,msdos,sur" --skip="./.build/*,./.git/*"

Sources/NetworkLayer/Classes/Core/Builders/RequestBuilder/QueryParametersFormatter/QueryParametersFormatter.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ final class QueryParametersFormatter: IQueryParametersFormatter {
3232

3333
func format(rawParameters: [AnyHashable: Any]) -> [String: String] {
3434
var result: [String: String] = [:]
35-
rawParameters.forEach { key, value in
35+
for (key, value) in rawParameters {
3636
guard
3737
let encodedKey = convertKeyToEncodedString(key),
3838
let encodedValue = convertValueToEncodedString(value)
3939
else {
40-
return
40+
continue
4141
}
4242
result[encodedKey] = encodedValue
4343
}
@@ -49,11 +49,11 @@ final class QueryParametersFormatter: IQueryParametersFormatter {
4949
private func convertKeyToEncodedString(_ key: AnyHashable) -> String? {
5050
switch key {
5151
case let string as String:
52-
return encodeQueryComponent(string)
52+
encodeQueryComponent(string)
5353
case let encodedComponent as SpecificEncodedComponent:
54-
return encodedComponent.encodedValue
54+
encodedComponent.encodedValue
5555
case let convertible as CustomStringConvertible:
56-
return encodeQueryComponent(convertible.description)
56+
encodeQueryComponent(convertible.description)
5757
}
5858
}
5959

Sources/NetworkLayer/Classes/Core/Builders/RequestBuilder/RequestBuilder.swift

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

66
import Foundation

Sources/NetworkLayer/Classes/DI/NetworkLayerAssembly.swift

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

66
import Foundation

Tests/NetworkLayerTests/Classes/Helpers/Helpers/RequestProcessor+Mock.swift

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

66
import Foundation

Tests/NetworkLayerTests/Classes/Tests/UnitTests/RequestBuilderTests.swift

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

66
@testable import NetworkLayer

0 commit comments

Comments
 (0)