From ee22c4eac32bc57776de9042fd4f88f9b6f9d11b Mon Sep 17 00:00:00 2001 From: Adam Mika Date: Wed, 31 Jan 2024 09:34:55 -0700 Subject: [PATCH] Formatter --- .swift-format | 69 +++++++++++++++++++++++ Package.swift | 4 +- Sources/Web5/Common/ZBase32.swift | 2 +- Tests/Web5Tests/Common/ZBase32Tests.swift | 2 +- 4 files changed, 73 insertions(+), 4 deletions(-) create mode 100644 .swift-format diff --git a/.swift-format b/.swift-format new file mode 100644 index 0000000..0d5e99f --- /dev/null +++ b/.swift-format @@ -0,0 +1,69 @@ +{ + "fileScopedDeclarationPrivacy" : { + "accessLevel" : "private" + }, + "indentation" : { + "spaces" : 4 + }, + "indentConditionalCompilationBlocks" : true, + "indentSwitchCaseLabels" : false, + "lineBreakAroundMultilineExpressionChainComponents" : false, + "lineBreakBeforeControlFlowKeywords" : false, + "lineBreakBeforeEachArgument" : false, + "lineBreakBeforeEachGenericRequirement" : false, + "lineLength" : 120, + "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, + "UseLetInEveryBoundCaseVariable" : true, + "UseShorthandTypeNames" : true, + "UseSingleLinePropertyGetter" : true, + "UseSynthesizedInitializer" : true, + "UseTripleSlashForDocumentationComments" : true, + "UseWhereClausesInForLoops" : false, + "ValidateDocumentationComments" : false + }, + "spacesAroundRangeFormationOperators" : false, + "tabWidth" : 8, + "version" : 1 +} diff --git a/Package.swift b/Package.swift index 60ea6d5..4f87cf8 100644 --- a/Package.swift +++ b/Package.swift @@ -11,7 +11,7 @@ let package = Package( .library( name: "Web5", targets: ["Web5"] - ), + ) ], dependencies: [ .package(url: "https://github.com/GigaBitcoin/secp256k1.swift.git", from: "0.16.0"), @@ -45,6 +45,6 @@ let package = Package( .copy("Resources/did_web"), .copy("Resources/did"), ] - ) + ), ] ) diff --git a/Sources/Web5/Common/ZBase32.swift b/Sources/Web5/Common/ZBase32.swift index 465ea4d..432d06b 100644 --- a/Sources/Web5/Common/ZBase32.swift +++ b/Sources/Web5/Common/ZBase32.swift @@ -30,7 +30,7 @@ public enum ZBase32 { if data.isEmpty { return "" } - + var result = "" var buffer = 0 var bufferLength = 0 diff --git a/Tests/Web5Tests/Common/ZBase32Tests.swift b/Tests/Web5Tests/Common/ZBase32Tests.swift index 0ece66e..9ffd2ce 100644 --- a/Tests/Web5Tests/Common/ZBase32Tests.swift +++ b/Tests/Web5Tests/Common/ZBase32Tests.swift @@ -3,7 +3,7 @@ import XCTest @testable import Web5 final class ZBase32Tests: XCTestCase { - + // TODO: Make these real web5 test vectors let vectors: [(encoded: String, decoded: Data)] = [ (