Skip to content

Commit 4a209c9

Browse files
committed
fix: more linting issues
1 parent e492e0f commit 4a209c9

File tree

16 files changed

+69
-33
lines changed

16 files changed

+69
-33
lines changed

.swiftformat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
--indent 4
44
--trimwhitespace always
55
--header "{file}\nCopyright (c) {year} GetAutomaApp\nAll source code and related assets are the property of GetAutomaApp.\nAll rights reserved.\n\nThis package is freely distributable under the MIT license.\nThis Package is a modified fork of https://github.com/ashi-psn/SwiftWebDriver."
6+
--disable redundantInternal
7+
--enable prioritizeKeepingFunctionOutputTogether

.swiftlint.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ disabled_rules:
55
- trailing_whitespace
66
- trailing_comma
77
- nesting
8+
- opening_brace
89

910
opt_in_rules:
1011
- empty_count
1112
- force_unwrapping
13+
- missing_docs
1214
- file_name
1315
- fallthrough
1416
- identical_operands
@@ -31,9 +33,9 @@ opt_in_rules:
3133
- direct_return
3234
- discouraged_none_name
3335
- explicit_acl
34-
- explicit_enum_raw_value
3536
- explicit_init
3637
- explicit_top_level_acl
38+
- local_doc_comment
3739
- modifier_order
3840
- multiline_arguments
3941
- multiline_arguments_brackets
@@ -61,6 +63,7 @@ opt_in_rules:
6163
- unused_parameter
6264

6365
excluded:
66+
- '**/Package.swift'
6467
- '**/.build/**' # Exclude all .build directories, including nested ones
6568
- '**/Carthage/**' # Exclude Carthage build directory (recursive)
6669
- '**/Pods/**' # Exclude Pods directory (recursive)
@@ -80,4 +83,8 @@ identifier_name:
8083
cyclomatic_complexity:
8184
ignores_case_statements: true
8285

86+
type_body_length:
87+
warning: 1000
88+
error: 1000
89+
8390
reporter: github-actions-logging

Example/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ let package = Package(
99
.macOS(.v12),
1010
],
1111
dependencies: [
12-
.package(url: "https://github.com/GetAutomaApp/SwiftWebDriver.git", from: "0.2.0")
12+
.package(url: "https://github.com/GetAutomaApp/SwiftWebDriver.git", from: "0.2.0"),
1313
],
1414
targets: [
1515
.executableTarget(

Example/Sources/SeleniumSwiftExample/main.swift

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,33 @@
88

99
import SwiftWebDriver
1010

11-
let chromeOption = ChromeOptions(
12-
args: [
13-
Args(.headless),
14-
]
15-
)
11+
internal struct Main {
12+
public static func main() async throws {
13+
let chromeOption = ChromeOptions(
14+
args: [
15+
Args(.headless),
16+
]
17+
)
1618

17-
let chromeDriver = try ChromeDriver(
18-
driverURLString: "http://localhost:9515",
19-
browserObject: chromeOption
20-
)
19+
let chromeDriver = try ChromeDriver(
20+
driverURLString: "http://localhost:4444",
21+
browserObject: chromeOption
22+
)
2123

22-
let driver = WebDriver(
23-
driver: chromeDriver
24-
)
24+
let driver = WebDriver(
25+
driver: chromeDriver
26+
)
2527

26-
Task.detached {
27-
do {
28-
let status = try await driver.status()
29-
print(status)
30-
let sessionId = try await driver.start()
31-
print(sessionId)
32-
try await driver.stop()
33-
} catch {
34-
print(error)
28+
do {
29+
let status = try await driver.status()
30+
print(status)
31+
let sessionId = try await driver.start()
32+
print(sessionId)
33+
try await driver.stop()
34+
} catch {
35+
print(error)
36+
}
3537
}
3638
}
39+
40+
try await Main.main()

Sources/SwiftWebDriver/API/APIClient.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ internal struct APIClient {
3636
guard response.status == .ok else {
3737
if
3838
let buffer = response.body,
39-
let error = try? JSONDecoder().decode(SeleniumError.self, from: buffer) {
39+
let error = try? JSONDecoder().decode(SeleniumError.self, from: buffer)
40+
{
4041
print(error.localizedDescription)
4142
return .failure(error)
4243
}

Sources/SwiftWebDriver/API/Request/DevTools/DevToolTypes.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
// This package is freely distributable under the MIT license.
77
// This Package is a modified fork of https://github.com/ashi-psn/SwiftWebDriver.
88

9-
public struct DevToolTypes {
9+
public enum DevToolTypes {
1010
public enum JavascriptExecutionTypes {
11-
case sync, async
11+
case async, sync
1212
}
1313
}

Sources/SwiftWebDriver/API/Request/Elements/ElementsTypes.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
// This package is freely distributable under the MIT license.
77
// This Package is a modified fork of https://github.com/ashi-psn/SwiftWebDriver.
88

9-
public struct ElementsTypes {
9+
public enum ElementsTypes {
1010
public enum SendValueActionKeyTypes: String {
1111
case ENTER1 = "\u{E007}"
1212
case RETURN1 = "\u{E006}"

Sources/SwiftWebDriver/API/Request/Navigation/PostNavigationBackRequest.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
// PostNavigationBackRequest.swift
2+
// Copyright (c) 2025 GetAutomaApp
3+
// All source code and related assets are the property of GetAutomaApp.
4+
// All rights reserved.
5+
//
6+
// This package is freely distributable under the MIT license.
7+
// This Package is a modified fork of https://github.com/ashi-psn/SwiftWebDriver.
8+
19
// PostNavigatioinBackRequest.swift
210
// Copyright (c) 2025 GetAutomaApp
311
// All source code and related assets are the property of GetAutomaApp.

Sources/SwiftWebDriver/API/Request/Navigation/PostNavigationForwardRequest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// PostNavigatoinForwardRequest.swift
1+
// PostNavigationForwardRequest.swift
22
// Copyright (c) 2025 GetAutomaApp
33
// All source code and related assets are the property of GetAutomaApp.
44
// All rights reserved.

Sources/SwiftWebDriver/API/Response/Elements/GetElementNamePropertyResponse.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// GetElementNameProperty.response.swift
1+
// GetElementNamePropertyResponse.swift
22
// Copyright (c) 2025 GetAutomaApp
33
// All source code and related assets are the property of GetAutomaApp.
44
// All rights reserved.

0 commit comments

Comments
 (0)