Skip to content

Commit

Permalink
Merge pull request #31 from brokenhandsio/swift-format
Browse files Browse the repository at this point in the history
Swift Format
  • Loading branch information
0xTim authored Jan 1, 2025
2 parents 383ada9 + e6c17b8 commit e4c4590
Show file tree
Hide file tree
Showing 46 changed files with 676 additions and 585 deletions.
22 changes: 16 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,31 @@ jobs:
ubuntu_test:
name: Ubuntu Build & Test
runs-on: ubuntu-22.04
container: swift:5.7.3-jammy
container: swift:6.0-jammy
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Build
run: swift build -v
- name: Run tests
run: swift test
macos_test:
name: macOS Build & Test
env:
DEVELOPER_DIR: /Applications/Xcode_14.2.app/Contents/Developer
runs-on: macos-12
runs-on: macos-15
steps:
- uses: actions/checkout@v3
- name: Select appropriate Xcode version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- uses: actions/checkout@v4
- name: Build
run: swift build -v
- name: Run tests
run: swift test
format:
name: Lint Formatting
runs-on: ubuntu-22.04
container: swift:6.0-jammy
steps:
- uses: actions/checkout@v4
- name: Lint
run: swift format lint --strict --recursive .
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ DerivedData/
.DS_Store
db.sqlite
.swiftpm

Package.resolved
70 changes: 70 additions & 0 deletions .swift-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"fileScopedDeclarationPrivacy": {
"accessLevel": "private"
},
"indentation": {
"spaces": 4
},
"indentConditionalCompilationBlocks": true,
"indentSwitchCaseLabels": false,
"lineBreakAroundMultilineExpressionChainComponents": false,
"lineBreakBeforeControlFlowKeywords": false,
"lineBreakBeforeEachArgument": false,
"lineBreakBeforeEachGenericRequirement": false,
"lineLength": 140,
"maximumBlankLines": 1,
"multiElementCollectionTrailingCommas": true,
"noAssignmentInExpressions": {
"allowedFunctions": [
"XCTAssertNoThrow"
]
},
"prioritizeKeepingFunctionOutputTogether": false,
"respectsExistingLineBreaks": true,
"rules": {
"AllPublicDeclarationsHaveDocumentation": false,
"AlwaysUseLiteralForEmptyCollectionInit": false,
"AlwaysUseLowerCamelCase": true,
"AmbiguousTrailingClosureOverload": true,
"BeginDocumentationCommentWithOneLineSummary": false,
"DoNotUseSemicolons": true,
"DontRepeatTypeInStaticProperties": true,
"FileScopedDeclarationPrivacy": true,
"FullyIndirectEnum": true,
"GroupNumericLiterals": true,
"IdentifiersMustBeASCII": true,
"NeverForceUnwrap": false,
"NeverUseForceTry": false,
"NeverUseImplicitlyUnwrappedOptionals": false,
"NoAccessLevelOnExtensionDeclaration": true,
"NoAssignmentInExpressions": true,
"NoBlockComments": true,
"NoCasesWithOnlyFallthrough": true,
"NoEmptyTrailingClosureParentheses": true,
"NoLabelsInCasePatterns": true,
"NoLeadingUnderscores": false,
"NoParensAroundConditions": true,
"NoPlaygroundLiterals": true,
"NoVoidReturnOnFunctionSignature": true,
"OmitExplicitReturns": false,
"OneCasePerLine": true,
"OneVariableDeclarationPerLine": true,
"OnlyOneTrailingClosureArgument": true,
"OrderedImports": true,
"ReplaceForEachWithForLoop": true,
"ReturnVoidInsteadOfEmptyTuple": true,
"TypeNamesShouldBeCapitalized": true,
"UseEarlyExits": false,
"UseExplicitNilCheckInConditions": true,
"UseLetInEveryBoundCaseVariable": true,
"UseShorthandTypeNames": true,
"UseSingleLinePropertyGetter": true,
"UseSynthesizedInitializer": true,
"UseTripleSlashForDocumentationComments": true,
"UseWhereClausesInForLoops": false,
"ValidateDocumentationComments": false
},
"spacesAroundRangeFormationOperators": false,
"tabWidth": 4,
"version": 1
}
185 changes: 0 additions & 185 deletions Package.resolved

This file was deleted.

12 changes: 7 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,18 @@ let package = Package(
)
],
dependencies: [
.package(url: "https://github.com/vapor/vapor.git", from: "4.0.0")
.package(url: "https://github.com/vapor/vapor.git", from: "4.111.0")
],
targets: [
.target(
name: "VaporOAuth",
dependencies: [.product(name: "Vapor", package: "vapor")]
),
.testTarget(name: "VaporOAuthTests", dependencies: [
.target(name: "VaporOAuth"),
.product(name: "XCTVapor", package: "vapor")
])
.testTarget(
name: "VaporOAuthTests",
dependencies: [
.target(name: "VaporOAuth"),
.product(name: "XCTVapor", package: "vapor"),
]),
]
)
7 changes: 4 additions & 3 deletions Sources/VaporOAuth/Helper/OAuthHelper+remote.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,10 @@ extension OAuthHelper {
guard let username: String = tokenInfoJSON[OAuthResponseParameters.username] else {
throw Abort(.internalServerError)
}
oauthUser = OAuthUser(userID: userID, username: username,
emailAddress: tokenInfoJSON[String.self, at: OAuthResponseParameters.email],
password: "")
oauthUser = OAuthUser(
userID: userID, username: username,
emailAddress: tokenInfoJSON[String.self, at: OAuthResponseParameters.email],
password: "")
}

remoteTokenResponse = RemoteTokenResponse(scopes: scopes, user: oauthUser)
Expand Down
2 changes: 1 addition & 1 deletion Sources/VaporOAuth/Helper/OAuthHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public struct OAuthHelper {

public init(
assertScopes: @escaping ([String]?, Request) async throws -> Void,
user: @escaping (Request) async throws -> OAuthUser
user: @escaping (Request) async throws -> OAuthUser
) {
self.assertScopes = assertScopes
self.user = user
Expand Down
6 changes: 4 additions & 2 deletions Sources/VaporOAuth/Models/OAuthClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ public final class OAuthClient: Extendable {

public var extend: Vapor.Extend = .init()

public init(clientID: String, redirectURIs: [String]?, clientSecret: String? = nil, validScopes: [String]? = nil,
confidential: Bool? = nil, firstParty: Bool = false, allowedGrantType: OAuthFlowType) {
public init(
clientID: String, redirectURIs: [String]?, clientSecret: String? = nil, validScopes: [String]? = nil,
confidential: Bool? = nil, firstParty: Bool = false, allowedGrantType: OAuthFlowType
) {
self.clientID = clientID
self.redirectURIs = redirectURIs
self.clientSecret = clientSecret
Expand Down
Loading

0 comments on commit e4c4590

Please sign in to comment.