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

iOS: Add swiftlint as ios test #364

Merged
merged 15 commits into from
Jun 5, 2024
8 changes: 6 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ jobs:
$(bazel query "kind(ios_unit_test, //ios/...)") \
$(bazel query "kind(ios_unit_test, //plugins/...)") \
$(bazel query "kind(ios_ui_test, //ios/...)") \
$(bazel query "kind(ios_ui_test, //plugins/...)")
$(bazel query "kind(ios_ui_test, //plugins/...)") \
$(bazel query "attr(name, '.*SwiftLint', //ios/...)") \
$(bazel query "attr(name, '.*SwiftLint', //plugins/...)")
- run:
name: Tests
command: |
Expand All @@ -148,7 +150,9 @@ jobs:
$(bazel query "kind(ios_unit_test, //ios/...)") \
$(bazel query "kind(ios_unit_test, //plugins/...)") \
$(bazel query "kind(ios_ui_test, //ios/...)") \
$(bazel query "kind(ios_ui_test, //plugins/...)")
$(bazel query "kind(ios_ui_test, //plugins/...)") \
$(bazel query "attr(name, '.*SwiftLint', //ios/...)") \
$(bazel query "attr(name, '.*SwiftLint', //plugins/...)")
- run:
when: always
Expand Down
3 changes: 3 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ identifier_name:
- drop_down
- radio_button
- search_input
included:
- ios
- plugins
3 changes: 3 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,6 @@ gazelle(
name = "update_build_files",
gazelle = ":gazelle_bin",
)

#SwiftLint
exports_files([".swiftlint.yml"])
4 changes: 3 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ bazel_dep(name = "rules_xcodeproj", version = "2.2.0")

bazel_dep(name = "gazelle", version = "0.34.0", repo_name = "bazel_gazelle")
bazel_dep(name = "rules_swift_package_manager", version = "0.22.0")
bazel_dep(name = "swiftlint", version = "0.54.0", repo_name = "SwiftLint")

## This section is handled by rules_swift_package_manager
swift_deps = use_extension(
Expand All @@ -48,7 +49,8 @@ swift_deps.from_file(
use_repo(
swift_deps,
"swiftpkg_swift_hooks",
"swiftpkg_viewinspector"
"swiftpkg_viewinspector",
"swiftpkg_swiftlint"
)
###### End iOS ######
npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm")
Expand Down
4 changes: 2 additions & 2 deletions ios/demo/Sources/PluginsAndPlayerCollection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public struct PluginsAndPlayerCollection: View {

switch eventData {
case .string(data: let string):
$beaconAndPubsubInfo.wrappedValue = $beaconAndPubsubInfo.wrappedValue + "Published: `\(eventName)` with message: `\(string)` \n"
$beaconAndPubsubInfo.wrappedValue += "Published: `\(eventName)` with message: `\(string)` \n"
default: break
}
})])
Expand All @@ -87,7 +87,7 @@ public struct PluginsAndPlayerCollection: View {
$alertPresented.wrappedValue = true
let encoder = JSONEncoder()
if let data = try? encoder.encode(beaconStruct), let jsonString = String(data: data, encoding: .utf8) {
$beaconAndPubsubInfo.wrappedValue = $beaconAndPubsubInfo.wrappedValue + "Beacon: \(jsonString) \n"
$beaconAndPubsubInfo.wrappedValue += "Beacon: \(jsonString) \n"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ public class SwiftUIPendingTransactionPlugin<T>: NativePlugin where T: Identifia
/**
Constructs the SwiftUIPendingTransactionPlugin
- parameters:
- keypath: Takes a keypath from the EnvironmentValues extension with generics of the TransactionContext<T> matching a user defined object, `\.transactionContext` which uses TransactionContext<PendingTransactionPhases> is the default.
- keypath: Takes a keypath from the EnvironmentValues extension with generics of the TransactionContext<T> matching a user defined object,
`\.transactionContext` which uses TransactionContext<PendingTransactionPhases> is the default.
*/
public init(keyPath: WritableKeyPath<EnvironmentValues, TransactionContext<T>>) {
self.keyPath = keyPath
Expand Down
66 changes: 65 additions & 1 deletion swift_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@ def swift_dependencies():
remote = "https://github.com/tadija/AEXML.git",
)

# version: 0.2.0
swift_package(
name = "swiftpkg_collectionconcurrencykit",
commit = "b4f23e24b5a1bff301efc5e70871083ca029ff95",
dependencies_index = "@//:swift_deps_index.json",
remote = "https://github.com/JohnSundell/CollectionConcurrencyKit.git",
)

# version: 1.8.2
swift_package(
name = "swiftpkg_cryptoswift",
commit = "c9c3df6ab812de32bae61fc0cd1bf6d45170ebf0",
dependencies_index = "@//:swift_deps_index.json",
remote = "https://github.com/krzyzanowskim/CryptoSwift.git",
)

# version: 8.9.1
swift_package(
name = "swiftpkg_eyes_xcui_swift_package",
Expand Down Expand Up @@ -49,6 +65,14 @@ def swift_dependencies():
remote = "https://github.com/onevcat/Rainbow.git",
)

# version: 0.34.1
swift_package(
name = "swiftpkg_sourcekitten",
commit = "b6dc09ee51dfb0c66e042d2328c017483a1a5d56",
dependencies_index = "@//:swift_deps_index.json",
remote = "https://github.com/jpsim/SourceKitten.git",
)

# version: 0.10.1
swift_package(
name = "swiftpkg_spectre",
Expand All @@ -57,6 +81,14 @@ def swift_dependencies():
remote = "https://github.com/kylef/Spectre.git",
)

# version: 1.2.3
swift_package(
name = "swiftpkg_swift_argument_parser",
commit = "8f4d2753f0e4778c76d5f05ad16c74f707390531",
dependencies_index = "@//:swift_deps_index.json",
remote = "https://github.com/apple/swift-argument-parser.git",
)

# version: 0.1.0
swift_package(
name = "swiftpkg_swift_hooks",
Expand All @@ -65,6 +97,14 @@ def swift_dependencies():
remote = "https://github.com/intuit/swift-hooks.git",
)

# version: 509.0.2
swift_package(
name = "swiftpkg_swift_syntax",
commit = "6ad4ea24b01559dde0773e3d091f1b9e36175036",
dependencies_index = "@//:swift_deps_index.json",
remote = "https://github.com/apple/swift-syntax.git",
)

# version: 6.0.3
swift_package(
name = "swiftpkg_swiftcli",
Expand All @@ -73,6 +113,30 @@ def swift_dependencies():
remote = "https://github.com/jakeheis/SwiftCLI.git",
)

# version: 0.54.0
swift_package(
name = "swiftpkg_swiftlint",
commit = "f17a4f9dfb6a6afb0408426354e4180daaf49cee",
dependencies_index = "@//:swift_deps_index.json",
remote = "https://github.com/realm/SwiftLint.git",
)

# version: 0.9.0
swift_package(
name = "swiftpkg_swiftytexttable",
commit = "c6df6cf533d120716bff38f8ff9885e1ce2a4ac3",
dependencies_index = "@//:swift_deps_index.json",
remote = "https://github.com/scottrhoyt/SwiftyTextTable.git",
)

# version: 7.0.2
swift_package(
name = "swiftpkg_swxmlhash",
commit = "a853604c9e9a83ad9954c7e3d2a565273982471f",
dependencies_index = "@//:swift_deps_index.json",
remote = "https://github.com/drmohundro/SWXMLHash.git",
)

# version: 2.0.1
swift_package(
name = "swiftpkg_version",
Expand Down Expand Up @@ -108,7 +172,7 @@ def swift_dependencies():
# version: 5.0.6
swift_package(
name = "swiftpkg_yams",
commit = "0d9ee7ea8c4ebd4a489ad7a73d5c6cad55d6fed3",
commit = "9234124cff5e22e178988c18d8b95a8ae8007f76",
dependencies_index = "@//:swift_deps_index.json",
remote = "https://github.com/jpsim/Yams.git",
)
Loading