Skip to content

Commit 7783600

Browse files
authored
Merge pull request #1 from swift-libp2p/soundness
Soundness
2 parents d64ce18 + 5e022e9 commit 7783600

25 files changed

+3099
-2339
lines changed

.license_header_template

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@@===----------------------------------------------------------------------===@@
2+
@@
3+
@@ This source file is part of the swift-libp2p open source project
4+
@@
5+
@@ Copyright (c) YEARS swift-libp2p project authors
6+
@@ Licensed under MIT
7+
@@
8+
@@ See LICENSE for license information
9+
@@ See CONTRIBUTORS for the list of swift-libp2p project authors
10+
@@
11+
@@ SPDX-License-Identifier: MIT
12+
@@
13+
@@===----------------------------------------------------------------------===@@

.licenseignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.github/workflows/configs/.flake8
2+
**/*.yml
3+
*.md
4+
*.txt
5+
Package.swift
6+
Package.resolved
7+
.gitignore
8+
.swift-format
9+
.licenseignore
10+
.license_header_template

.swift-format

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
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+
"noAssignmentInExpressions" : {
22+
"allowedFunctions" : [
23+
"XCTAssertNoThrow",
24+
"XCTAssertThrowsError"
25+
]
26+
},
27+
"rules" : {
28+
"AllPublicDeclarationsHaveDocumentation" : false,
29+
"AlwaysUseLiteralForEmptyCollectionInit" : false,
30+
"AlwaysUseLowerCamelCase" : false,
31+
"AmbiguousTrailingClosureOverload" : true,
32+
"BeginDocumentationCommentWithOneLineSummary" : false,
33+
"DoNotUseSemicolons" : true,
34+
"DontRepeatTypeInStaticProperties" : true,
35+
"FileScopedDeclarationPrivacy" : true,
36+
"FullyIndirectEnum" : true,
37+
"GroupNumericLiterals" : true,
38+
"IdentifiersMustBeASCII" : true,
39+
"NeverForceUnwrap" : false,
40+
"NeverUseForceTry" : false,
41+
"NeverUseImplicitlyUnwrappedOptionals" : false,
42+
"NoAccessLevelOnExtensionDeclaration" : true,
43+
"NoAssignmentInExpressions" : true,
44+
"NoBlockComments" : true,
45+
"NoCasesWithOnlyFallthrough" : true,
46+
"NoEmptyTrailingClosureParentheses" : true,
47+
"NoLabelsInCasePatterns" : true,
48+
"NoLeadingUnderscores" : false,
49+
"NoParensAroundConditions" : true,
50+
"NoVoidReturnOnFunctionSignature" : true,
51+
"OmitExplicitReturns" : true,
52+
"OneCasePerLine" : true,
53+
"OneVariableDeclarationPerLine" : true,
54+
"OnlyOneTrailingClosureArgument" : true,
55+
"OrderedImports" : true,
56+
"ReplaceForEachWithForLoop" : true,
57+
"ReturnVoidInsteadOfEmptyTuple" : true,
58+
"UseEarlyExits" : false,
59+
"UseExplicitNilCheckInConditions" : false,
60+
"UseLetInEveryBoundCaseVariable" : false,
61+
"UseShorthandTypeNames" : true,
62+
"UseSingleLinePropertyGetter" : false,
63+
"UseSynthesizedInitializer" : false,
64+
"UseTripleSlashForDocumentationComments" : true,
65+
"UseWhereClausesInForLoops" : false,
66+
"ValidateDocumentationComments" : false
67+
}
68+
}

LICENSE.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2025 swift-libp2p
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in all
11+
copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
15+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
18+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
19+
OR OTHER DEALINGS IN THE SOFTWARE.

Package.swift

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,52 @@
11
// swift-tools-version: 5.6
2-
// The swift-tools-version declares the minimum version of Swift required to build this package.
2+
//===----------------------------------------------------------------------===//
3+
//
4+
// This source file is part of the swift-libp2p open source project
5+
//
6+
// Copyright (c) 2022-2025 swift-libp2p project authors
7+
// Licensed under MIT
8+
//
9+
// See LICENSE for license information
10+
// See CONTRIBUTORS for the list of swift-libp2p project authors
11+
//
12+
// SPDX-License-Identifier: MIT
13+
//
14+
//===----------------------------------------------------------------------===//
315

416
import PackageDescription
517

618
let package = Package(
719
name: "swift-libp2p-pubsub",
820
platforms: [
921
.macOS(.v10_15),
10-
.iOS(.v13)
22+
.iOS(.v13),
1123
],
1224
products: [
1325
// Products define the executables and libraries a package produces, and make them visible to other packages.
1426
.library(
1527
name: "LibP2PPubSub",
16-
targets: ["LibP2PPubSub"]),
28+
targets: ["LibP2PPubSub"]
29+
)
1730
],
1831
dependencies: [
1932
// Dependencies declare other packages that this package depends on.
20-
// .package(url: /* package url */, from: "1.0.0"),
21-
.package(url: "https://github.com/swift-libp2p/swift-libp2p.git", .upToNextMajor(from: "0.1.0")),
22-
.package(url: "https://github.com/swift-libp2p/swift-libp2p-noise.git", .upToNextMajor(from: "0.1.0")),
23-
.package(url: "https://github.com/swift-libp2p/swift-libp2p-mplex.git", .upToNextMajor(from: "0.1.0")),
33+
.package(url: "https://github.com/swift-libp2p/swift-libp2p.git", .upToNextMinor(from: "0.2.0")),
34+
35+
// Test dependencies
36+
.package(url: "https://github.com/swift-libp2p/swift-libp2p-noise.git", .upToNextMinor(from: "0.1.0")),
37+
.package(url: "https://github.com/swift-libp2p/swift-libp2p-mplex.git", .upToNextMinor(from: "0.1.0")),
2438
],
2539
targets: [
2640
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
2741
// Targets can depend on other targets in this package, and on products in packages this package depends on.
2842
.target(
2943
name: "LibP2PPubSub",
3044
dependencies: [
31-
.product(name: "LibP2P", package: "swift-libp2p"),
45+
.product(name: "LibP2P", package: "swift-libp2p")
3246
],
3347
resources: [
3448
.copy("Protobufs/RPC.proto"),
35-
.copy("Protobufs/RPC2.proto")
49+
.copy("Protobufs/RPC2.proto"),
3650
]
3751
),
3852
.testTarget(
@@ -41,6 +55,7 @@ let package = Package(
4155
"LibP2PPubSub",
4256
.product(name: "LibP2PNoise", package: "swift-libp2p-noise"),
4357
.product(name: "LibP2PMPLEX", package: "swift-libp2p-mplex"),
44-
]),
58+
]
59+
),
4560
]
4661
)

0 commit comments

Comments
 (0)