Skip to content

Commit e5e4f8e

Browse files
committed
chore: run swift-format
remove `swiftformat` in favor of bundled `swift-format`
1 parent 4dedc70 commit e5e4f8e

23 files changed

+421
-312
lines changed

.swift-format

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
{
2+
"version": 1,
3+
"tabWidth": 2,
4+
"lineLength": 150,
5+
"indentation": {
6+
"spaces": 2
7+
},
8+
"fileScopedDeclarationPrivacy": {
9+
"accessLevel": "private"
10+
},
11+
"indentConditionalCompilationBlocks": true,
12+
"indentSwitchCaseLabels": false,
13+
"lineBreakAroundMultilineExpressionChainComponents": false,
14+
"lineBreakBeforeControlFlowKeywords": false,
15+
"lineBreakBeforeEachArgument": true,
16+
"lineBreakBeforeEachGenericRequirement": false,
17+
"maximumBlankLines": 1,
18+
"multiElementCollectionTrailingCommas": true,
19+
"noAssignmentInExpressions": {
20+
"allowedFunctions": [
21+
"XCTAssertNoThrow"
22+
]
23+
},
24+
"prioritizeKeepingFunctionOutputTogether": false,
25+
"respectsExistingLineBreaks": true,
26+
"spacesAroundRangeFormationOperators": false,
27+
"rules": {
28+
"AllPublicDeclarationsHaveDocumentation": false,
29+
"AlwaysUseLiteralForEmptyCollectionInit": true,
30+
"AlwaysUseLowerCamelCase": true,
31+
"AmbiguousTrailingClosureOverload": true,
32+
"BeginDocumentationCommentWithOneLineSummary": false,
33+
"DoNotUseSemicolons": true,
34+
"DontRepeatTypeInStaticProperties": true,
35+
"FileScopedDeclarationPrivacy": true,
36+
"FullyIndirectEnum": true,
37+
"GroupNumericLiterals": true,
38+
"IdentifiersMustBeASCII": true,
39+
"NeverForceUnwrap": true,
40+
"NeverUseForceTry": true,
41+
"NeverUseImplicitlyUnwrappedOptionals": true,
42+
"NoAccessLevelOnExtensionDeclaration": true,
43+
"NoAssignmentInExpressions": true,
44+
"NoBlockComments": true,
45+
"NoCasesWithOnlyFallthrough": true,
46+
"NoEmptyTrailingClosureParentheses": true,
47+
"NoLabelsInCasePatterns": true,
48+
"NoLeadingUnderscores": false,
49+
"NoParensAroundConditions": true,
50+
"NoPlaygroundLiterals": true,
51+
"NoVoidReturnOnFunctionSignature": true,
52+
"OmitExplicitReturns": true,
53+
"OneCasePerLine": true,
54+
"OneVariableDeclarationPerLine": true,
55+
"OnlyOneTrailingClosureArgument": false,
56+
"OrderedImports": true,
57+
"ReplaceForEachWithForLoop": true,
58+
"ReturnVoidInsteadOfEmptyTuple": true,
59+
"TypeNamesShouldBeCapitalized": true,
60+
"UseEarlyExits": true,
61+
"UseExplicitNilCheckInConditions": true,
62+
"UseLetInEveryBoundCaseVariable": false,
63+
"UseShorthandTypeNames": true,
64+
"UseSingleLinePropertyGetter": true,
65+
"UseSynthesizedInitializer": true,
66+
"UseTripleSlashForDocumentationComments": true,
67+
"UseWhereClausesInForLoops": true,
68+
"ValidateDocumentationComments": true
69+
}
70+
}

.swiftformat

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

Sources/ActivityClient/Client.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public struct ActivityClient: Sendable {
1313
extension ActivityClient {
1414
public func activity() -> Activity {
1515
.init(
16-
location: self.location(),
16+
location: self.location(),
1717
nowPlaying: self.nowPlaying()
1818
)
1919
}
@@ -57,20 +57,20 @@ extension ActivityClient: DependencyKey {
5757
public static var liveValue: ActivityClient {
5858
let state = LockIsolated((Location?.none, NowPlaying?.none))
5959
return ActivityClient(
60-
location: { state.value.0 },
60+
location: { state.value.0 },
6161
updateLocation: { newLocation in
6262
state.withValue { $0.0 = newLocation }
6363
},
6464
nowPlaying: { state.value.1 },
65-
updateNowPlaying: { nowPlaying in
66-
state.withValue { $0.1 = nowPlaying}
65+
updateNowPlaying: { nowPlaying in
66+
state.withValue { $0.1 = nowPlaying }
6767
}
6868
)
6969
}
7070
}
7171

72-
public extension DependencyValues {
73-
var activityClient: ActivityClient {
72+
extension DependencyValues {
73+
public var activityClient: ActivityClient {
7474
get { self[ActivityClient.self] }
7575
set { self[ActivityClient.self] = newValue }
7676
}

Sources/App/App.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ struct App: AsyncParsableCommand {
2525
} operation: {
2626
let app = self.buildApp()
2727
#if DEBUG
28-
let buildMode = "development"
28+
let buildMode = "development"
2929
#else
30-
let buildMode = "release"
30+
let buildMode = "release"
3131
#endif
3232
logger.info("Running server in '\(buildMode)' mode")
3333
try await app.runService()

Sources/App/Middlewares/SiteMiddleware.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,13 @@ private struct NotFoundMiddleware<Context: RequestContext>: RouterMiddleware {
8181
}
8282
}
8383

84-
fileprivate extension CodeLang {
85-
static func resolve(_ req: Request) -> CodeLang? {
84+
extension CodeLang {
85+
fileprivate static func resolve(_ req: Request) -> CodeLang? {
8686
req.uri.queryParameters["codeLang"]
87-
.flatMap {
88-
$0 == "markdown" || $0 == "md" ? nil :
89-
CodeLang(rawValue: $0.trimmingCharacters(in: .whitespacesAndNewlines).lowercased())
87+
.flatMap {
88+
$0 == "markdown" || $0 == "md"
89+
? nil
90+
: CodeLang(rawValue: $0.trimmingCharacters(in: .whitespacesAndNewlines).lowercased())
9091
}
9192
}
92-
}
93+
}

Sources/EnvVars/Environment+.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ private enum EnvKeys {
77
static let basicAuthPassword = "BASIC_AUTH_PASSWD"
88
}
99

10-
public extension Environment {
11-
var appSecret: String {
10+
extension Environment {
11+
public var appSecret: String {
1212
self.get(EnvKeys.appSecret) ?? "deadbeefdeadbeefdeadbeefdeadbeef"
1313
}
1414

15-
var basicAuth: (String, String) {
15+
public var basicAuth: (String, String) {
1616
(self.get(EnvKeys.basicAuthUsername) ?? "dead", self.get(EnvKeys.basicAuthPassword) ?? "beef")
1717
}
1818
}
@@ -21,9 +21,9 @@ private struct EnvironmentKey: TestDependencyKey {
2121
static let testValue = Environment()
2222
}
2323

24-
public extension DependencyValues {
25-
var envVars: Environment {
24+
extension DependencyValues {
25+
public var envVars: Environment {
2626
get { self[EnvironmentKey.self] }
2727
set { self[EnvironmentKey.self] = newValue }
2828
}
29-
}
29+
}

Sources/Pages/Components/FooterView.swift

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import HTML
21
import Foundation
2+
import HTML
33

44
struct FooterView: HTML {
55
private static let copyrightDateFormatter = {
@@ -18,9 +18,15 @@ struct FooterView: HTML {
1818
"Made with \u{2764} using "
1919
a(.target(.blank), .rel("noopener noreferrer"), .href("https://swift.org")) { "Swift" }
2020
" + "
21-
a(.target(.blank), .rel("noopener noreferrer"), .href("https://hummingbird.codes")) { "Hummingbird" }
21+
a(.target(.blank), .rel("noopener noreferrer"), .href("https://hummingbird.codes")) {
22+
"Hummingbird"
23+
}
2224
" + "
23-
a(.target(.blank), .rel("noopener noreferrer"), .href("https://github.com/vuejs/petite-vue")) { "petite-vue" }
25+
a(
26+
.target(.blank),
27+
.rel("noopener noreferrer"),
28+
.href("https://github.com/vuejs/petite-vue")
29+
) { "petite-vue" }
2430
}
2531
}
2632
.containerStyling()

Sources/Pages/Components/HeaderView.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@ private struct CodeSelector: HTML {
5757
button(
5858
.v.on(
5959
.click,
60-
Expression(rawValue: "\(selected.assign(Expression(codeLang))), \(visible.assign(!visible))")
60+
Expression(
61+
rawValue: "\(selected.assign(Expression(codeLang))), \(visible.assign(!visible))"
62+
)
6163
),
6264
.v.bind(attrOrProp: "aria-selected", selected == Expression(codeLang))
6365
) {

Sources/Pages/Components/Page.swift

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public protocol Page: Sendable, HTMLDocument, ResponseGenerator {
1616

1717
extension Page {
1818
public var title: String { "Erik Bautista Santibanez" }
19-
public var desc: String {
19+
public var desc: String {
2020
"""
2121
A software developer specialized in mobile and web applications.
2222
"""
@@ -57,11 +57,36 @@ extension Page {
5757
meta(.property("twitter:creator"), .content("@erikbautista_"))
5858
meta(.property("twitter:description"), .content(document.desc))
5959

60-
link(.rel("icon"), .custom(name: "type", value: "image/png"), .custom(name: "sizes", value: "16x16"), .href(assets.assets.favicon16x16Png.url.assetString))
61-
link(.rel("icon"), .custom(name: "type", value: "image/png"), .custom(name: "sizes", value: "32x32"), .href(assets.assets.favicon32x32Png.url.assetString))
62-
link(.rel("icon"), .custom(name: "type", value: "image/png"), .custom(name: "sizes", value: "96x96"), .href(assets.assets.favicon96x96Png.url.assetString))
63-
link(.rel("icon"), .custom(name: "type", value: "image/png"), .custom(name: "sizes", value: "128x128"), .href(assets.assets.favicon128x128Png.url.assetString))
64-
link(.rel("icon"), .custom(name: "type", value: "image/png"), .custom(name: "sizes", value: "196x196"), .href(assets.assets.favicon196x196Png.url.assetString))
60+
link(
61+
.rel("icon"),
62+
.custom(name: "type", value: "image/png"),
63+
.custom(name: "sizes", value: "16x16"),
64+
.href(assets.assets.favicon16x16Png.url.assetString)
65+
)
66+
link(
67+
.rel("icon"),
68+
.custom(name: "type", value: "image/png"),
69+
.custom(name: "sizes", value: "32x32"),
70+
.href(assets.assets.favicon32x32Png.url.assetString)
71+
)
72+
link(
73+
.rel("icon"),
74+
.custom(name: "type", value: "image/png"),
75+
.custom(name: "sizes", value: "96x96"),
76+
.href(assets.assets.favicon96x96Png.url.assetString)
77+
)
78+
link(
79+
.rel("icon"),
80+
.custom(name: "type", value: "image/png"),
81+
.custom(name: "sizes", value: "128x128"),
82+
.href(assets.assets.favicon128x128Png.url.assetString)
83+
)
84+
link(
85+
.rel("icon"),
86+
.custom(name: "type", value: "image/png"),
87+
.custom(name: "sizes", value: "196x196"),
88+
.href(assets.assets.favicon196x196Png.url.assetString)
89+
)
6590

6691
style {
6792
"/*! modern-normalize v3.0.1 | MIT License | https://github.com/sindresorhus/modern-normalize */*,::after,::before{box-sizing:border-box}html{font-family:system-ui,'Segoe UI',Roboto,Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji';line-height:1.15;-webkit-text-size-adjust:100%;tab-size:4}body{margin:0}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Consolas,'Liberation Mono',Menlo,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-color:currentcolor}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}legend{padding:0}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}"
@@ -118,12 +143,14 @@ extension Page {
118143
)
119144
script(
120145
.src(
121-
"https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/swift.min.js"),
146+
"https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/swift.min.js"
147+
),
122148
.defer
123149
)
124150
script(
125151
.src(
126-
"https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/rust.min.js"),
152+
"https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/rust.min.js"
153+
),
127154
.defer
128155
)
129156
script(

Sources/Pages/Components/Spacer.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@ struct Spacer: HTML {
66
div {}
77
.containerStyling()
88
.inlineStyle("height", "0.85rem")
9-
.inlineStyle("background", "repeating-linear-gradient(45deg, transparent 0% 35%, #333 35% 50%, transparent 50% 85%, #333 85% 100%)")
9+
.inlineStyle(
10+
"background",
11+
"repeating-linear-gradient(45deg, transparent 0% 35%, #333 35% 50%, transparent 50% 85%, #333 85% 100%)"
12+
)
1013
.inlineStyle("background-size", "5px 5px")
1114
}
1215
.wrappedStyling()
1316
}
14-
}
17+
}

Sources/Pages/Components/Stylings.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ extension HTML {
1212
.inlineStyle("border-left", "1px solid #303030", media: .minWidth(640))
1313
.inlineStyle("border-right", "1px solid #303030", media: .minWidth(640))
1414
}
15-
}
15+
}

0 commit comments

Comments
 (0)