Skip to content

Commit 3eb7f48

Browse files
authored
chore(Predictions): Cleanup build warnings (#1115)
1 parent 3adac87 commit 3eb7f48

20 files changed

+70
-90
lines changed

AmplifyPlugins/Predictions/AWSPredictionsPlugin/AWSPredictionsPlugin.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ final public class AWSPredictionsPlugin: PredictionsCategoryPlugin {
2626

2727
var config: PredictionsPluginConfiguration!
2828

29-
///public limit rekognition has on number of faces it can detect.
29+
/// public limit rekognition has on number of faces it can detect.
3030
public static let rekognitionMaxEntitiesLimit = 50
3131

3232
/// The unique key of the plugin within the predictions category.

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Requests/PredictionsIdentifyRequest+Validate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import Amplify
1111
public extension PredictionsIdentifyRequest {
1212
/// Performs client side validation and returns a `PredictionsError` for any validation failures.
1313
func validate() -> PredictionsError? {
14-
//TODO: implement
14+
// TODO: implement
1515
return nil
1616
}
1717
}

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Service/CoreML/CoreMLPredictionService.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class CoreMLPredictionService: CoreMLPredictionBehavior {
1313

1414
let coreMLPlugin: CoreMLPredictionsPlugin
1515

16-
init(configuration: Any) throws {
16+
init(configuration: Any?) throws {
1717
self.coreMLPlugin = CoreMLPredictionsPlugin()
1818
try coreMLPlugin.configure(using: configuration)
1919
}

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Service/MultiService/IdentifyMultiService.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ class IdentifyMultiService: MultiServiceBehavior {
110110
let onlineLabelSet = Set<Label>(onlineLabelResult.labels)
111111
let offlineLabelSet = Set<Label>(offlineLabelResult.labels)
112112

113-
//first find the labels that are the same
113+
// first find the labels that are the same
114114
let intersectingLabels = onlineLabelSet.intersection(offlineLabelSet)
115-
//loop through to find higher confidences and retain those labels and add to final result
115+
// loop through to find higher confidences and retain those labels and add to final result
116116
for label in intersectingLabels {
117117
let onlineIndex = onlineLabelSet.firstIndex(of: label)!
118118
let offlineIndex = offlineLabelSet.firstIndex(of: label)!
@@ -122,8 +122,8 @@ class IdentifyMultiService: MultiServiceBehavior {
122122
combinedLabels.insert(labelWithHigherConfidence)
123123
}
124124

125-
//get the differences
126-
//leaving here for performance comparison
125+
// get the differences
126+
// leaving here for performance comparison
127127
// let differingLabels = Array(onlineLabelSet.symmetricDifference(offlineLabelSet))
128128
// combinedLabels.append(contentsOf: differingLabels)
129129
combinedLabels = combinedLabels.union(onlineLabelSet)
@@ -155,8 +155,8 @@ class IdentifyMultiService: MultiServiceBehavior {
155155
combinedLines = combinedLines.union(offlineLineSet)
156156
combinedLines = combinedLines.union(onlineLineSet)
157157

158-
//offline result doesn't return anything except identified lines so
159-
//merging them plus the other stuff from online is a merged result
158+
// offline result doesn't return anything except identified lines so
159+
// merging them plus the other stuff from online is a merged result
160160
return IdentifyTextResult(fullText: onlineTextResult.fullText,
161161
words: onlineTextResult.words,
162162
rawLineText: onlineTextResult.rawLineText,

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Service/Predictions/AWSPredictionsService+Rekognition.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ typealias DetectModerationLabelsCompletedHandler = AWSTask<AWSRekognitionDetectM
1313

1414
typealias DetectLabelsCompletedHandler = AWSTask<AWSRekognitionDetectLabelsResponse>
1515

16+
// swiftlint:disable file_length
1617
extension AWSPredictionsService: AWSRekognitionServiceBehavior {
1718

1819
func detectLabels(image: URL,
@@ -127,7 +128,7 @@ extension AWSPredictionsService: AWSRekognitionServiceBehavior {
127128

128129
func detectEntities(image: URL, onEvent: @escaping AWSPredictionsService.RekognitionServiceEventHandler) {
129130
if let collectionId = predictionsConfig.identify.identifyEntities?.collectionId {
130-
//call detect face from collection if collection id passed in
131+
// call detect face from collection if collection id passed in
131132
return detectFacesFromCollection(image: image, collectionId: collectionId, onEvent: onEvent)
132133

133134
}
@@ -267,8 +268,8 @@ extension AWSPredictionsService: AWSRekognitionServiceBehavior {
267268
}
268269
let identifyTextResult = IdentifyTextResultTransformers.processText(rekognitionTextDetections)
269270

270-
//if limit of words is under 50 return rekognition response
271-
//otherwise call textract because their limit is higher
271+
// if limit of words is under 50 return rekognition response
272+
// otherwise call textract because their limit is higher
272273
if let words = identifyTextResult.words, words.count < self.rekognitionWordLimit {
273274
onEvent(.completed(identifyTextResult))
274275
return nil

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Service/Predictions/AWSPredictionsService+Transcribe.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import AWSPluginsCore
1111

1212
extension AWSPredictionsService: AWSTranscribeStreamingServiceBehavior {
1313

14+
// swiftlint:disable cyclomatic_complexity
1415
func transcribe(speechToText: URL, language: LanguageType?, onEvent: @escaping TranscribeServiceEventHandler) {
1516

1617
guard let audioData = try? Data(contentsOf: speechToText) else {

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Support/Constants/AWSRekognitionErrorMessage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ typealias AWSRekognitionErrorMessageString = (
1414

1515
struct AWSRekognitionErrorMessage {
1616
static let accessDenied: AWSRekognitionErrorMessageString = (
17-
"Access denied!",
17+
"Access denied",
1818
"Please check that your Cognito IAM role has permissions to access Rekognition.")
1919

2020
static let imageTooLarge: AWSRekognitionErrorMessageString = (

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Support/Constants/AWSServiceErrorMessage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ typealias AWSServiceErrorMessageString = (errorDescription: ErrorDescription, re
1212

1313
struct AWSServiceErrorMessage {
1414
static let accessDenied: AWSServiceErrorMessageString = (
15-
"Access denied!",
15+
"Access denied",
1616
"""
1717
Please check that your Cognito IAM role has permissions to access this service and check to make sure the user
1818
is authenticated properly.

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Support/Constants/AWSTextractErrorMessage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ typealias AWSTextractErrorString = (errorDescription: ErrorDescription, recovery
1212

1313
struct AWSTextractErrorMessage {
1414
static let accessDenied: AWSTextractErrorString = (
15-
"Access denied!",
15+
"Access denied",
1616
"Please check that your Cognito IAM role has permissions to access Textract.")
1717

1818
static let limitExceeded: AWSTextractErrorString = (

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Support/Constants/AWSTranslateErrorMessage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ typealias AWSTranslateErrorMessageString = (errorDescription: ErrorDescription,
1212

1313
struct AWSTranslateErrorMessage {
1414
static let accessDenied: AWSTranslateErrorMessageString = (
15-
"Access denied! You do not have sufficient access to perform this action.",
15+
"Access denied. You do not have sufficient access to perform this action.",
1616
"Please check that your Cognito IAM role has permissions to access Translate.")
1717

1818
static let sourceLanguageNotProvided: AWSTranslateErrorMessageString = (

0 commit comments

Comments
 (0)