From 298dbda4fbf810f7bd00f3beea36d470e878621c Mon Sep 17 00:00:00 2001 From: Christopher Fuller Date: Fri, 20 Feb 2026 13:03:00 -0800 Subject: [PATCH 1/7] Apply standard Swift package configuration --- .github/workflows/docc.yml | 14 ++++---------- .github/workflows/swift.yml | 15 +++++---------- .swiftlint-rules.yml | 8 +++++--- CONTRIBUTING.md | 11 ++++++++++- Makefile | 18 +++++++++++++----- Package.resolved | 33 +++++++++++++++++---------------- Package.swift | 36 ++++++++++++++++++++++++++---------- 7 files changed, 80 insertions(+), 55 deletions(-) diff --git a/.github/workflows/docc.yml b/.github/workflows/docc.yml index d2d1eaa..c1cc6ac 100644 --- a/.github/workflows/docc.yml +++ b/.github/workflows/docc.yml @@ -7,22 +7,16 @@ on: branches: [ main ] env: - DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer + DEVELOPER_DIR: /Applications/Xcode_26.3.app/Contents/Developer jobs: docc: name: DocC runs-on: macos-latest - env: - SSH_AUTH_SOCK: /tmp/ssh_agent.sock + permissions: + contents: read steps: - - name: Add ssh key - run: | - mkdir -p ~/.ssh - ssh-keyscan github.com >> ~/.ssh/known_hosts - ssh-agent -a "$SSH_AUTH_SOCK" > /dev/null - ssh-add - <<< "${{ secrets.TINDER_GITHUB_SSH_KEY }}" - name: Checkout source - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Build run: make docs open="no" DERIVED_DATA_PATH="$(mktemp -d)" diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index a46c736..f07b962 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -7,29 +7,24 @@ on: branches: [ main ] env: - DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer + DEVELOPER_DIR: /Applications/Xcode_26.3.app/Contents/Developer jobs: swift: name: Swift runs-on: macos-latest + permissions: + contents: read env: SIMULATOR: iPhone 15 - SSH_AUTH_SOCK: /tmp/ssh_agent.sock steps: - - name: Add ssh key - run: | - mkdir -p ~/.ssh - ssh-keyscan github.com >> ~/.ssh/known_hosts - ssh-agent -a "$SSH_AUTH_SOCK" > /dev/null - ssh-add - <<< "${{ secrets.TINDER_GITHUB_SSH_KEY }}" - name: Checkout source - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Download swiftlint binary run: swift package resolve - name: Lint run: > - "$(find ".build/artifacts/swiftlint" -type f -name swiftlint -perm +111 -print -quit)" + "$(find ".build/artifacts/swiftlint" -path "*macos*" -type f -name swiftlint -perm +111 -print -quit)" lint --strict --reporter github-actions-logging - name: Resolve package dependencies run: xcodebuild -resolvePackageDependencies diff --git a/.swiftlint-rules.yml b/.swiftlint-rules.yml index 58fa60d..2ab21c9 100644 --- a/.swiftlint-rules.yml +++ b/.swiftlint-rules.yml @@ -9,8 +9,9 @@ only_rules: - accessibility_label_for_image - accessibility_trait_for_button - anonymous_argument_in_multiline_closure -- anyobject_protocol - array_init +- async_without_await +- attribute_name_spacing # - attributes - balanced_xctest_lifecycle - blanket_disable_command @@ -94,7 +95,6 @@ only_rules: - implicitly_unwrapped_optional - inclusive_language # - indentation_width -- inert_defer - invalid_swiftlint_command - is_disjoint - joined_default_parameter @@ -145,6 +145,7 @@ only_rules: - opening_brace - operator_usage_whitespace - operator_whitespace +- optional_data_string_conversion - optional_enum_case_matching - orphaned_doc_comment - overridden_super_call @@ -155,6 +156,7 @@ only_rules: - prefer_nimble - prefer_self_in_static_references - prefer_self_type_over_type_of_self +- prefer_type_checking - prefer_zero_over_explicit_init # - prefixed_toplevel_constant - private_action @@ -177,6 +179,7 @@ only_rules: - redundant_objc_attribute - redundant_optional_initialization - redundant_self_in_closure +- redundant_sendable - redundant_set_access_control # - redundant_string_enum_value - redundant_type_annotation @@ -224,7 +227,6 @@ only_rules: - unneeded_synthesized_initializer - unowned_variable_capture - untyped_error_in_catch -- unused_capture_list - unused_closure_parameter - unused_control_flow_label - unused_enumerated diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8495bc2..73e589c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,6 +2,7 @@ - [Open Package](#open-package) - [Lint Package](#lint-package) +- [Testing](#testing) - [Creating Releases](#creating-releases) ## Open Package @@ -28,6 +29,14 @@ To run analysis rules: make analyze ``` +## Testing + +To re-record all existing snapshot references, delete all using the following command and then run the tests. + +``` +make delete-snapshots +``` + ## Creating Releases Releases are made [on the GitHub website](https://github.com/Tinder/Nodes-Tree-Visualizer/releases/new). @@ -36,7 +45,7 @@ In all of the following steps, `X.X.X` is a placeholder to be substituted with t - Enter a semantic version as the new tag (__WITHOUT__ `v` prefix) - Set the `main` branch as the target (it should be the default) -- Enter the release title formatted as `Nodes-Tree-Visualizer vX.X.X` (__WITH__ `v` prefix) +- Enter the release title formatted as `Nodes Tree Visualizer vX.X.X` (__WITH__ `v` prefix) - Click on `Generate release notes` - Leave `Set as a pre-release` unchecked - Leave `Set as the latest release` checked diff --git a/Makefile b/Makefile index 2ccccb6..bad98d4 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,3 @@ -.PHONY: serve -serve: - @npm install --prefix server >/dev/null 2>&1 - node server/index.js - .PHONY: open open: fix open: @@ -44,6 +39,14 @@ analyze: swift package plugin \ swiftlint analyze --strict --progress --reporter "$(format)" --compiler-log-path "$$XCODEBUILD_LOG" +.PHONY: delete-snapshots +delete-snapshots: + @for snapshots in $$(find Tests -type d -name "__Snapshots__"); \ + do \ + rm -rf "$$snapshots"; \ + echo "Deleted $$snapshots"; \ + done + .PHONY: docs docs: target ?= Nodes-Tree-Visualizer docs: destination ?= generic/platform=iOS @@ -63,3 +66,8 @@ docs: -name "$(target).doccarchive" \ -exec cp -R {} "$(ARCHIVE_PATH)/" \; $(if $(filter $(open),OPEN),@open "$(ARCHIVE_PATH)/$(target).doccarchive",) + +.PHONY: serve +serve: + @npm install --prefix server >/dev/null 2>&1 + node server/index.js diff --git a/Package.resolved b/Package.resolved index 4de6798..bf4f300 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,4 +1,5 @@ { + "originHash" : "cca295a85151094afeec7d8350fd266fe258bd3a1450feaa54eedaedc2bbec9d", "pins" : [ { "identity" : "codextended", @@ -23,8 +24,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/krzyzanowskim/CryptoSwift.git", "state" : { - "revision" : "678d442c6f7828def400a70ae15968aef67ef52d", - "version" : "1.8.3" + "revision" : "e45a26384239e028ec87fbcc788f513b67e10d8f", + "version" : "1.9.0" } }, { @@ -59,17 +60,17 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Quick/Nimble.git", "state" : { - "revision" : "54b4e52183f16fe806014cbfd63718a84f8ba072", - "version" : "13.4.0" + "revision" : "035b88ad6ae8035f5ce2b50b0a6d69c3b16d2120", + "version" : "14.0.0" } }, { "identity" : "nodes", "kind" : "remoteSourceControl", - "location" : "git@github.com:Tinder/Nodes.git", + "location" : "https://github.com/Tinder/Nodes.git", "state" : { - "revision" : "b9eb0b3b93544b97e8dd2e216fe7af5877e08bd4", - "version" : "0.0.36" + "revision" : "43fc53d52062fc49743505c2cf9a73778b051bb0", + "version" : "0.0.34" } }, { @@ -95,8 +96,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/jpsim/SourceKitten.git", "state" : { - "revision" : "fd4df99170f5e9d7cf9aa8312aa8506e0e7a44e7", - "version" : "0.35.0" + "revision" : "453f75b8a3bb2c3596c0d2dd422c289788233a22", + "version" : "0.37.1" } }, { @@ -140,8 +141,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/swiftlang/swift-syntax.git", "state" : { - "revision" : "515f79b522918f83483068d99c68daeb5116342d", - "version" : "600.0.0-prerelease-2024-08-14" + "revision" : "1103c45ece4f7fe160b8f75b4ea1ee2e5fac1841", + "version" : "601.0.0" } }, { @@ -149,8 +150,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/realm/SwiftLint.git", "state" : { - "revision" : "a24488f26e60247d8fff7bbb03d51910af3dc91c", - "version" : "0.56.2" + "revision" : "625792423014cc49b0a1e5a1a5c0d6b8b3de10f9", + "version" : "0.59.1" } }, { @@ -176,10 +177,10 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/jpsim/Yams.git", "state" : { - "revision" : "3036ba9d69cf1fd04d433527bc339dc0dc75433d", - "version" : "5.1.3" + "revision" : "3d6871d5b4a5cd519adf233fbb576e0a2af71c17", + "version" : "5.4.0" } } ], - "version" : 2 + "version" : 3 } diff --git a/Package.swift b/Package.swift index 7676ab3..d881dae 100644 --- a/Package.swift +++ b/Package.swift @@ -1,7 +1,13 @@ -// swift-tools-version:5.8 +// swift-tools-version:5.10 +import Foundation import PackageDescription +let environment = ProcessInfo.processInfo.environment + +let treatWarningsAsErrors = environment["CI"] == "true" +let enableSwiftLintBuildToolPlugin = environment["CODEQL_DIST"] == nil + let package = Package( name: "Nodes-Tree-Visualizer", platforms: [ @@ -15,17 +21,17 @@ let package = Package( ], dependencies: [ .package( - url: "git@github.com:Tinder/Nodes.git", + url: "https://github.com/Tinder/Nodes.git", "0.0.0"..<"2.0.0"), .package( url: "https://github.com/socketio/socket.io-client-swift.git", exact: "16.1.1"), .package( url: "https://github.com/realm/SwiftLint.git", - exact: "0.56.2"), + exact: "0.59.1"), .package( url: "https://github.com/Quick/Nimble.git", - exact: "13.4.0"), + exact: "14.0.0"), ], targets: [ .target( @@ -45,11 +51,21 @@ let package = Package( package.targets.forEach { target in - target.swiftSettings = [ - .enableExperimentalFeature("StrictConcurrency"), - ] + // TODO: Remove upon enabling Swift 6 language mode: + target.swiftSettings = (target.swiftSettings ?? []) + [.enableExperimentalFeature("StrictConcurrency")] - target.plugins = [ - .plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLint"), - ] + if treatWarningsAsErrors { + target.swiftSettings = (target.swiftSettings ?? []) + [ + // TODO: Remove unsafe flag upon upgrading to Swift tools v6.2 and uncomment subsequent settings: + .unsafeFlags(["-warnings-as-errors"]), +// .treatAllWarnings(as: .error), +// .treatWarning("DeprecatedDeclaration", as: .warning), + ] + } + + if enableSwiftLintBuildToolPlugin { + target.plugins = (target.plugins ?? []) + [ + .plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLint"), + ] + } } From 0edde1c157f9e1cfaa84c6fc8a58414b40ac5fd1 Mon Sep 17 00:00:00 2001 From: Christopher Fuller Date: Fri, 20 Feb 2026 13:03:41 -0800 Subject: [PATCH 2/7] Use iPhone 17 --- .github/workflows/swift.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/swift.yml b/.github/workflows/swift.yml index f07b962..aab43c0 100644 --- a/.github/workflows/swift.yml +++ b/.github/workflows/swift.yml @@ -16,7 +16,7 @@ jobs: permissions: contents: read env: - SIMULATOR: iPhone 15 + SIMULATOR: iPhone 17 steps: - name: Checkout source uses: actions/checkout@v6 From b7c49207fe820a740a14057a176c5b14fe264ebd Mon Sep 17 00:00:00 2001 From: Christopher Fuller Date: Fri, 20 Feb 2026 14:00:49 -0800 Subject: [PATCH 3/7] Do not treat DocC warnings as errors --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index bad98d4..497f9e1 100644 --- a/Makefile +++ b/Makefile @@ -59,8 +59,7 @@ docs: -scheme "$(target)" \ -destination "$(destination)" \ -derivedDataPath "$(DERIVED_DATA_PATH)" \ - -skipPackagePluginValidation \ - OTHER_DOCC_FLAGS="--warnings-as-errors" + -skipPackagePluginValidation @find "$(DERIVED_DATA_PATH)" \ -type d \ -name "$(target).doccarchive" \ From cb22fa1bd048302f39d01fb8a368477f79b8913e Mon Sep 17 00:00:00 2001 From: Christopher Fuller Date: Tue, 24 Feb 2026 18:03:51 -0800 Subject: [PATCH 4/7] Upgrade to Nodes `v0.0.42` --- Package.resolved | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Package.resolved b/Package.resolved index bf4f300..64c1272 100644 --- a/Package.resolved +++ b/Package.resolved @@ -69,8 +69,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Tinder/Nodes.git", "state" : { - "revision" : "43fc53d52062fc49743505c2cf9a73778b051bb0", - "version" : "0.0.34" + "revision" : "73254bc2754633b186cc4af3c836b29440ff8625", + "version" : "0.0.42" } }, { From e02c320c927a0d9c9e18cb73ffa1c8f74fcf8d6d Mon Sep 17 00:00:00 2001 From: Christopher Fuller Date: Thu, 26 Feb 2026 19:31:40 -0800 Subject: [PATCH 5/7] Upgrade to Nodes `v0.0.43` --- Package.resolved | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Package.resolved b/Package.resolved index 64c1272..e4a38d3 100644 --- a/Package.resolved +++ b/Package.resolved @@ -69,8 +69,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/Tinder/Nodes.git", "state" : { - "revision" : "73254bc2754633b186cc4af3c836b29440ff8625", - "version" : "0.0.42" + "revision" : "c4bd6dd9f74f50437675c6ae4d879e9ab6d41808", + "version" : "0.0.43" } }, { From 4b64d71e93c5e6cf60d1655019ff498e5a34d7fb Mon Sep 17 00:00:00 2001 From: Christopher Fuller Date: Thu, 26 Feb 2026 19:31:57 -0800 Subject: [PATCH 6/7] Update package dependencies --- Package.resolved | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Package.resolved b/Package.resolved index e4a38d3..ba22075 100644 --- a/Package.resolved +++ b/Package.resolved @@ -132,8 +132,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-argument-parser.git", "state" : { - "revision" : "41982a3656a71c768319979febd796c6fd111d5c", - "version" : "1.5.0" + "revision" : "c5d11a805e765f52ba34ec7284bd4fcd6ba68615", + "version" : "1.7.0" } }, { From af579d5c4fea495c8fd2f964b7ef0969a2c49f25 Mon Sep 17 00:00:00 2001 From: Christopher Fuller Date: Thu, 26 Feb 2026 19:35:07 -0800 Subject: [PATCH 7/7] Apply standard Swift package configuration --- Makefile | 5 +++-- Package.swift | 20 +++++++++++++------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 497f9e1..1de058c 100644 --- a/Makefile +++ b/Makefile @@ -59,12 +59,13 @@ docs: -scheme "$(target)" \ -destination "$(destination)" \ -derivedDataPath "$(DERIVED_DATA_PATH)" \ - -skipPackagePluginValidation + -skipPackagePluginValidation \ + $(if $(filter $(open),OPEN),OTHER_DOCC_FLAGS="--warnings-as-errors",) @find "$(DERIVED_DATA_PATH)" \ -type d \ -name "$(target).doccarchive" \ -exec cp -R {} "$(ARCHIVE_PATH)/" \; - $(if $(filter $(open),OPEN),@open "$(ARCHIVE_PATH)/$(target).doccarchive",) + @$(if $(filter $(open),OPEN),open "$(ARCHIVE_PATH)/$(target).doccarchive",:) .PHONY: serve serve: diff --git a/Package.swift b/Package.swift index d881dae..e4d4785 100644 --- a/Package.swift +++ b/Package.swift @@ -51,17 +51,23 @@ let package = Package( package.targets.forEach { target in - // TODO: Remove upon enabling Swift 6 language mode: + let types: [Target.TargetType] = [ + .regular, + .test, + .executable, + ] + + guard types.contains(target.type) + else { return } + target.swiftSettings = (target.swiftSettings ?? []) + [.enableExperimentalFeature("StrictConcurrency")] - if treatWarningsAsErrors { - target.swiftSettings = (target.swiftSettings ?? []) + [ - // TODO: Remove unsafe flag upon upgrading to Swift tools v6.2 and uncomment subsequent settings: - .unsafeFlags(["-warnings-as-errors"]), +// if treatWarningsAsErrors { +// target.swiftSettings = (target.swiftSettings ?? []) + [ // .treatAllWarnings(as: .error), // .treatWarning("DeprecatedDeclaration", as: .warning), - ] - } +// ] +// } if enableSwiftLintBuildToolPlugin { target.plugins = (target.plugins ?? []) + [