Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: kickoff release #3460

Merged
merged 6 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Resolve SwiftLint errors and warnings
# https://github.com/aws-amplify/amplify-swift/pull/3451
659e8615da059eea5b6a4ce1b77120eae293ebec
34 changes: 0 additions & 34 deletions .github/workflows/notify_issue_comment.yml

This file was deleted.

46 changes: 46 additions & 0 deletions .github/workflows/swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: SwiftLint
on:
workflow_dispatch:
workflow_call:
inputs:
identifier:
required: true
type: string

push:
branches-ignore:
- main
- v1
- release
- release-v1

permissions:
contents: read

concurrency:
group: ${{ inputs.identifier || github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref_name != 'main'}}

jobs:
run-swiftlint:
runs-on: ubuntu-latest
container:
image: ghcr.io/realm/swiftlint:0.54.0
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3
with:
persist-credentials: false

- name: SwiftLint
run: |
swiftlint --reporter github-actions-logging

confirm-pass:
runs-on: ubuntu-latest
name: Confirm Passing SwiftLint
if: ${{ !cancelled() }}
needs: [ run-swiftlint ]
env:
EXIT_CODE: ${{ contains(needs.*.result, 'failure') && 1 || 0 }}
steps:
- run: exit $EXIT_CODE
27 changes: 23 additions & 4 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
# Do not specify an `included` section at this top-level file. Specify the
# `--config` option pointing to this file, and the `--path` option to the files
# you wish to lint
included:
- Amplify
- AmplifyPlugins

excluded:
- Pods
- .build
- AmplifyAsyncTesting
- AmplifyFunctionalTests
- AmplifyTestApp
- AmplifyTestCommon
- AmplifyTests
- AmplifyPlugins/Core/AWSPluginsCoreTests
- AmplifyPlugins/Core/AWSPluginsTestCommon
- AmplifyPlugins/Notifications/Push/Tests
- AmplifyPlugins/*/Tests

analyzer_rules:
- unused_import
Expand All @@ -18,22 +30,29 @@ closing_brace: error
colon:
severity: error
comma: error
empty_count: warning
empty_count:
severity: warning
empty_enum_arguments: error
function_body_length:
warning: 100
warning: 150
error: 150
identifier_name:
excluded:
- id
- of
- or
line_length:
warning: 120
ignores_urls: true
ignores_function_declarations: true
ignores_comments: true
warning: 160
error: 160
opening_brace: error
opening_brace:
severity: error
return_arrow_whitespace: error
statement_position:
severity: error
todo: warning
trailing_semicolon: error
non_optional_string_data_conversion:
severity: error
4 changes: 2 additions & 2 deletions Amplify/Categories/API/APICategory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ final public class APICategory: Category {
public var categoryType: CategoryType {
.api
}

var plugins = [PluginKey: APICategoryPlugin]()

/// Returns the plugin added to the category, if only one plugin is added. Accessing this property if no plugins
Expand Down Expand Up @@ -49,7 +49,7 @@ final public class APICategory: Category {
public var isConfigured = false

// MARK: - Plugin handling

/// Adds `plugin` to the list of Plugins that implement functionality for this category.
///
/// - Parameter plugin: The Plugin to add
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
//

extension APICategory: APICategoryGraphQLBehavior {

// MARK: - Request-based GraphQL operations
public func query<R: Decodable>(request: GraphQLRequest<R>) async throws -> GraphQLTask<R>.Success {
try await plugin.query(request: request)
}

public func mutate<R: Decodable>(request: GraphQLRequest<R>) async throws -> GraphQLTask<R>.Success {
try await plugin.mutate(request: request)
}

public func subscribe<R>(request: GraphQLRequest<R>) -> AmplifyAsyncThrowingSequence<GraphQLSubscriptionEvent<R>> {
plugin.subscribe(request: request)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation

extension APICategory: APICategoryRESTBehavior {

public func get(request: RESTRequest) async throws -> RESTTask.Success {
try await plugin.get(request: request)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public protocol APICategoryGraphQLBehavior: AnyObject {
/// - listener: The event listener for the operation
/// - Returns: The AmplifyOperation being enqueued
func query<R: Decodable>(request: GraphQLRequest<R>) async throws -> GraphQLTask<R>.Success

/// Perform a GraphQL mutate operation against a previously configured API. This operation
/// will be asynchronous, with the callback accessible both locally and via the Hub.
///
Expand All @@ -36,5 +36,7 @@ public protocol APICategoryGraphQLBehavior: AnyObject {
/// - valueListener: Invoked when the GraphQL subscription receives a new value from the service
/// - completionListener: Invoked when the subscription has terminated
/// - Returns: The AmplifyInProcessReportingOperation being enqueued
func subscribe<R: Decodable>(request: GraphQLRequest<R>) -> AmplifyAsyncThrowingSequence<GraphQLSubscriptionEvent<R>>
func subscribe<R: Decodable>(
request: GraphQLRequest<R>
) -> AmplifyAsyncThrowingSequence<GraphQLSubscriptionEvent<R>>
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ public protocol APICategoryRESTBehavior {
/// - Parameter request: Contains information such as path, query parameters, body.
/// - Returns: An operation that can be observed for its value
func post(request: RESTRequest) async throws -> RESTTask.Success

/// Perform an HTTP DELETE operation
///
/// - Parameter request: Contains information such as path, query parameters, body.
/// - Returns: An operation that can be observed for its value
func delete(request: RESTRequest) async throws -> RESTTask.Success

/// Perform an HTTP HEAD operation
///
/// - Parameter request: Contains information such as path, query parameters, body.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public final class RetryableGraphQLOperation<Payload: Decodable>: Operation, Ret
self.operationFactory = operationFactory
self.resultListener = resultListener
}

public override func main() {
Task {
start(request: await requestFactory())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ extension AnalyticsCategory {
public func unregisterGlobalProperties(_ keys: String...) {
plugin.unregisterGlobalProperties(keys.isEmpty ? nil : Set<String>(keys))
}

/// Registered global properties can be unregistered though this method. In case no keys are provided, *all*
/// registered global properties will be unregistered. Duplicate keys will be ignored. This method can be called
/// from `Amplify.Analytics` and is a wrapper for `unregisterGlobalProperties(_ keys: Set<String>? = nil)`
Expand Down
32 changes: 25 additions & 7 deletions Amplify/Categories/Auth/AuthCategory+ClientBehavior.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import Foundation

extension AuthCategory: AuthCategoryBehavior {

public func signUp( username: String, password: String? = nil, options: AuthSignUpRequest.Options? = nil) async throws -> AuthSignUpResult {
public func signUp(
username: String,
password: String? = nil,
options: AuthSignUpRequest.Options? = nil
) async throws -> AuthSignUpResult {
return try await plugin.signUp(username: username, password: password, options: options)
}

Expand All @@ -19,7 +23,10 @@ extension AuthCategory: AuthCategoryBehavior {
return try await plugin.confirmSignUp(for: username, confirmationCode: confirmationCode, options: options)
}

public func resendSignUpCode(for username: String, options: AuthResendSignUpCodeRequest.Options? = nil) async throws -> AuthCodeDeliveryDetails {
public func resendSignUpCode(
for username: String,
options: AuthResendSignUpCodeRequest.Options? = nil
) async throws -> AuthCodeDeliveryDetails {
return try await plugin.resendSignUpCode(for: username, options: options)
}

Expand All @@ -46,14 +53,17 @@ extension AuthCategory: AuthCategoryBehavior {
}
#endif

public func confirmSignIn(challengeResponse: String, options: AuthConfirmSignInRequest.Options? = nil) async throws -> AuthSignInResult {
public func confirmSignIn(
challengeResponse: String,
options: AuthConfirmSignInRequest.Options? = nil
) async throws -> AuthSignInResult {
return try await plugin.confirmSignIn(challengeResponse: challengeResponse, options: options)
}

public func signOut(options: AuthSignOutRequest.Options? = nil) async -> AuthSignOutResult {
return await plugin.signOut(options: options)
}

public func deleteUser() async throws {
try await plugin.deleteUser()
}
Expand All @@ -62,8 +72,11 @@ extension AuthCategory: AuthCategoryBehavior {
return try await plugin.fetchAuthSession(options: options)
}

public func resetPassword(for username: String, options: AuthResetPasswordRequest.Options? = nil) async throws -> AuthResetPasswordResult {
return try await plugin.resetPassword(for: username,options: options)
public func resetPassword(
for username: String,
options: AuthResetPasswordRequest.Options? = nil
) async throws -> AuthResetPasswordResult {
return try await plugin.resetPassword(for: username, options: options)
}

public func confirmResetPassword(
Expand All @@ -72,7 +85,12 @@ extension AuthCategory: AuthCategoryBehavior {
confirmationCode: String,
options: AuthConfirmResetPasswordRequest.Options? = nil
) async throws {
try await plugin.confirmResetPassword(for: username, with: newPassword, confirmationCode: confirmationCode, options: options)
try await plugin.confirmResetPassword(
for: username,
with: newPassword,
confirmationCode: confirmationCode,
options: options
)
}

public func setUpTOTP() async throws -> TOTPSetupDetails {
Expand Down
9 changes: 7 additions & 2 deletions Amplify/Categories/Auth/AuthCategory+DeviceBehavior.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ import Foundation

extension AuthCategory: AuthCategoryDeviceBehavior {

public func fetchDevices( options: AuthFetchDevicesRequest.Options? = nil) async throws -> [AuthDevice] {
public func fetchDevices(
options: AuthFetchDevicesRequest.Options? = nil
) async throws -> [AuthDevice] {
return try await plugin.fetchDevices(options: options)
}

public func forgetDevice( _ device: AuthDevice? = nil, options: AuthForgetDeviceRequest.Options? = nil) async throws {
public func forgetDevice(
_ device: AuthDevice? = nil,
options: AuthForgetDeviceRequest.Options? = nil
) async throws {
try await plugin.forgetDevice(device, options: options)
}

Expand Down
21 changes: 17 additions & 4 deletions Amplify/Categories/Auth/AuthCategory+UserBehavior.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,16 @@ extension AuthCategory: AuthCategoryUserBehavior {
try await plugin.getCurrentUser()
}

public func fetchUserAttributes(options: AuthFetchUserAttributesRequest.Options? = nil) async throws -> [AuthUserAttribute] {
public func fetchUserAttributes(
options: AuthFetchUserAttributesRequest.Options? = nil
) async throws -> [AuthUserAttribute] {
try await plugin.fetchUserAttributes(options: options)
}

public func update(userAttribute: AuthUserAttribute, options: AuthUpdateUserAttributeRequest.Options? = nil) async throws -> AuthUpdateAttributeResult {
public func update(
userAttribute: AuthUserAttribute,
options: AuthUpdateUserAttributeRequest.Options? = nil
) async throws -> AuthUpdateAttributeResult {
try await plugin.update(userAttribute: userAttribute, options: options)
}

Expand Down Expand Up @@ -45,10 +50,18 @@ extension AuthCategory: AuthCategoryUserBehavior {
public func confirm(userAttribute: AuthUserAttributeKey,
confirmationCode: String,
options: AuthConfirmUserAttributeRequest.Options? = nil) async throws {
try await plugin.confirm(userAttribute: userAttribute, confirmationCode: confirmationCode, options: options)
try await plugin.confirm(
userAttribute: userAttribute,
confirmationCode: confirmationCode,
options: options
)
}

public func update(oldPassword: String, to newPassword: String, options: AuthChangePasswordRequest.Options? = nil) async throws {
public func update(
oldPassword: String,
to newPassword: String,
options: AuthChangePasswordRequest.Options? = nil
) async throws {
try await plugin.update(oldPassword: oldPassword, to: newPassword, options: options)
}

Expand Down
Loading
Loading