Skip to content

Commit

Permalink
Opt in to swift 5.9 rules for swiftformat
Browse files Browse the repository at this point in the history
  • Loading branch information
alexdeem committed Jun 2, 2024
1 parent 8430a6a commit 0cc13b1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5.9
1 change: 0 additions & 1 deletion .swiftformat
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
--swiftversion 5.7
--exclude .build

# rules
Expand Down
7 changes: 3 additions & 4 deletions Sources/ScreamURITemplate/Internal/ValueFormatting.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ func percentEncode(string: String, withAllowedCharacters allowedCharacterSet: Ch

extension StringProtocol {
func formatForTemplateExpansion(variableSpec: VariableSpec, expansionConfiguration: ExpansionConfiguration) throws -> String {
let modifiedValue: String
if let prefixLength = variableSpec.prefixLength() {
modifiedValue = String(prefix(prefixLength))
let modifiedValue = if let prefixLength = variableSpec.prefixLength() {
String(prefix(prefixLength))
} else {
modifiedValue = String(self)
String(self)
}
let encodedExpansion = try percentEncode(string: modifiedValue, withAllowedCharacters: expansionConfiguration.percentEncodingAllowedCharacterSet, allowPercentEncodedTriplets: expansionConfiguration.allowPercentEncodedTriplets)
if expansionConfiguration.named {
Expand Down

0 comments on commit 0cc13b1

Please sign in to comment.