Skip to content

Commit

Permalink
Refine swiftlint config
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdeem committed Jun 12, 2024
1 parent b0d833a commit cac20ba
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
6 changes: 5 additions & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
disabled_rules:
- line_length
- trailing_comma
- redundant_optional_initialization

opt_in_rules:
Expand All @@ -10,3 +9,8 @@ included:
excluded:
.build

trailing_comma:
mandatory_comma: true

vertical_whitespace:
max_empty_lines: 2
8 changes: 5 additions & 3 deletions Sources/ScreamURITemplateExample/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ import Foundation
import ScreamURITemplate

let template = try URITemplate(string: "https://api.github.com/repos/{owner}/{repo}/collaborators/{username}")
let variables = ["owner": "SwiftScream",
"repo": "URITemplate",
"username": "alexdeem"]
let variables = [
"owner": "SwiftScream",
"repo": "URITemplate",
"username": "alexdeem",
]

let urlString = try template.process(variables: variables)

Expand Down
16 changes: 10 additions & 6 deletions Tests/ScreamURITemplateTests/Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ class Tests: XCTestCase {

func testStringStringDictionary() throws {
let template: URITemplate = "https://api.github.com/repos/{owner}/{repo}/collaborators/{username}"
let variables = ["owner": "SwiftScream",
"repo": "URITemplate",
"username": "alexdeem"]
let variables = [
"owner": "SwiftScream",
"repo": "URITemplate",
"username": "alexdeem",
]
let urlString = try template.process(variables: variables)
XCTAssertEqual(urlString, "https://api.github.com/repos/SwiftScream/URITemplate/collaborators/alexdeem")
}
Expand Down Expand Up @@ -177,9 +179,11 @@ class Tests: XCTestCase {

func testProcessPerformance() {
let template: URITemplate = "https://api.github.com/repos/{owner}/{repo}/collaborators/{username}"
let variables = ["owner": "SwiftScream",
"repo": "URITemplate",
"username": "alexdeem"]
let variables = [
"owner": "SwiftScream",
"repo": "URITemplate",
"username": "alexdeem",
]

measure {
for _ in 1...5000 {
Expand Down

0 comments on commit cac20ba

Please sign in to comment.