Skip to content

Commit 8fc6d4e

Browse files
authored
remove Example dir (#68)
* link to up-to-date tutorial * remove examples dir * add swift-format config * remove NoAssignmentInExpressions linter warning * remove DontRepeatTypeInStaticProperties linter warning
1 parent 79db2aa commit 8fc6d4e

File tree

11 files changed

+73
-111
lines changed

11 files changed

+73
-111
lines changed

.swift-format

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

.swiftformat

-19
This file was deleted.

Examples/Simple/.dockerignore

-1
This file was deleted.

Examples/Simple/Package.swift

-32
This file was deleted.

Examples/Simple/Sources/APIGateway/APIGatewayProxyLambda.swift

-33
This file was deleted.

Examples/Simple/Tests/LinuxMain.swift

-15
This file was deleted.

Sources/AWSLambdaEvents/Utils/Base64.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ extension Base64 {
4242
) throws -> [UInt8] where Buffer.Element == UInt8 {
4343
let alphabet =
4444
options.contains(.base64UrlAlphabet)
45-
? Base64.decodeBase64Url
46-
: Base64.decodeBase64
45+
? Base64.decodeDataUrl
46+
: Base64.decodeData
4747

4848
// In Base64 4 encoded bytes, become 3 decoded bytes. We pad to the
4949
// nearest multiple of three.
@@ -112,7 +112,7 @@ extension Base64 {
112112
// MARK: Internal
113113

114114
@usableFromInline
115-
static let decodeBase64: [UInt8] = [
115+
static let decodeData: [UInt8] = [
116116
// 0 1 2 3 4 5 6 7 8 9
117117
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 0
118118
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 1
@@ -143,7 +143,7 @@ extension Base64 {
143143
]
144144

145145
@usableFromInline
146-
static let decodeBase64Url: [UInt8] = [
146+
static let decodeDataUrl: [UInt8] = [
147147
// 0 1 2 3 4 5 6 7 8 9
148148
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 0
149149
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, // 1

Tests/AWSLambdaEventsTests/DynamoDBTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ class DynamoDBTests: XCTestCase {
222222
func testAttributeValueEmptyDecoding() {
223223
let json = "{\"haha\": 1}"
224224
XCTAssertThrowsError(
225-
_ = try JSONDecoder().decode(DynamoDBEvent.AttributeValue.self, from: json.data(using: .utf8)!)
225+
try JSONDecoder().decode(DynamoDBEvent.AttributeValue.self, from: json.data(using: .utf8)!)
226226
) { error in
227227
guard case DecodingError.dataCorrupted = error else {
228228
XCTFail("Unexpected error: \(String(describing: error))")

Tests/AWSLambdaEventsTests/Utils/Base64Tests.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ class Base64Tests: XCTestCase {
5555
}
5656

5757
func testBase64DecodingWithPoop() {
58-
XCTAssertThrowsError(_ = try "💩".base64decoded()) { error in
58+
XCTAssertThrowsError(try "💩".base64decoded()) { error in
5959
XCTAssertEqual(error as? Base64.DecodingError, .invalidCharacter(240))
6060
}
6161
}
6262

6363
func testBase64DecodingWithInvalidLength() {
64-
XCTAssertThrowsError(_ = try "AAAAA".base64decoded()) { error in
64+
XCTAssertThrowsError(try "AAAAA".base64decoded()) { error in
6565
XCTAssertEqual(error as? Base64.DecodingError, .invalidLength)
6666
}
6767
}

Tests/AWSLambdaEventsTests/Utils/DateWrapperTests.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class DateWrapperTests: XCTestCase {
3838

3939
let date = "2020-03-26T16:53:05" // missing Z at end
4040
let json = #"{"date":"\#(date)"}"#
41-
XCTAssertThrowsError(_ = try JSONDecoder().decode(TestEvent.self, from: json.data(using: .utf8)!)) { error in
41+
XCTAssertThrowsError(try JSONDecoder().decode(TestEvent.self, from: json.data(using: .utf8)!)) { error in
4242
guard case DecodingError.dataCorrupted(let context) = error else {
4343
XCTFail("Unexpected error: \(error)")
4444
return
@@ -74,7 +74,7 @@ class DateWrapperTests: XCTestCase {
7474

7575
let date = "2020-03-26T16:53:05Z" // missing fractional seconds
7676
let json = #"{"date":"\#(date)"}"#
77-
XCTAssertThrowsError(_ = try JSONDecoder().decode(TestEvent.self, from: json.data(using: .utf8)!)) { error in
77+
XCTAssertThrowsError(try JSONDecoder().decode(TestEvent.self, from: json.data(using: .utf8)!)) { error in
7878
guard case DecodingError.dataCorrupted(let context) = error else {
7979
XCTFail("Unexpected error: \(error)")
8080
return
@@ -149,7 +149,7 @@ class DateWrapperTests: XCTestCase {
149149

150150
let date = "Thu, 5 Apr 2012 23:47 +0200" // missing seconds
151151
let json = #"{"date":"\#(date)"}"#
152-
XCTAssertThrowsError(_ = try JSONDecoder().decode(TestEvent.self, from: json.data(using: .utf8)!)) { error in
152+
XCTAssertThrowsError(try JSONDecoder().decode(TestEvent.self, from: json.data(using: .utf8)!)) { error in
153153
guard case DecodingError.dataCorrupted(let context) = error else {
154154
XCTFail("Unexpected error: \(error)")
155155
return

readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ AWS Lambda functions can be invoked directly from the AWS Lambda console UI, AWS
2222

2323
## Getting started
2424

25-
If you have never used AWS Lambda or Docker before, check out this [getting started guide](https://fabianfett.dev/getting-started-with-swift-aws-lambda-runtime) which helps you with every step from zero to a running Lambda.
25+
If you have never used AWS Lambda or Docker before, check out this [getting started guide](https://swiftpackageindex.com/swift-server/swift-aws-lambda-runtime/1.0.0-alpha.3/tutorials/table-of-content) which helps you with every step from zero to a running Lambda.
2626

2727
Swift AWS Lambda Events is a supporting library for the [Swift AWS Lambda Runtime](http://github.com/swift-server/swift-aws-lambda-runtime) library, where you can find further documentation and examples.
2828

0 commit comments

Comments
 (0)