Changes from Swift-App-Template#125
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Review: Changes from Swift-App-TemplateThanks for the additions! This PR brings several useful features: access modifier support for Bugs / Correctness1.
parameters: FunctionParameterListSyntax([]),This means every generated 2. if argument.hasPrefix("\"") && argument.hasSuffix("\"") && argument.count >= 2 {
let content = String(argument.dropFirst().dropLast())This heuristic fails on:
A more robust approach would be to use 3. Force unwrap in let publicRange = generated.range(of: "public")!
let finalRange = generated.range(of: "final")!Force unwrapping in tests causes a crash rather than a clean test failure. Prefer: let publicRange = try #require(generated.range(of: "public"))
let finalRange = try #require(generated.range(of: "final"))Code Quality4.
5. Inconsistent trivia fix for
6. Non-deterministic test assertions in #expect(generated.contains("@Suite(\"App Model\")") || generated.contains("@Suite( \"App Model\")"))The Missing Coverage7. The new IfCanImport("Foundation") { Import("Foundation") }produces: #if canImport(Foundation)
import Foundation
#endifwould prevent regressions. 8. No test for
Minor
Summary
The access modifier work and the |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## v0.0.5 #125 +/- ##
==========================================
+ Coverage 78.54% 80.20% +1.66%
==========================================
Files 147 153 +6
Lines 4978 5209 +231
==========================================
+ Hits 3910 4178 +268
+ Misses 1068 1031 -37
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
feat: Swift App Template v1.0.0-beta.1 (#11) - Copy and restructure MonthBar infrastructure into template layout - Replace all hardcoded values with `{{TEMPLATE_*}}` placeholder tokens - Add `Packages/TemplateGenerator` — Swift executable that generates app skeleton files using SyntaxKit - Add `Scripts/setup.sh` — interactive/automated setup with 19 token substitutions, Swift file generation, CI activation, full-stack mode, cleanup, and git reset - Add `README.md`, `README.template.md`, and `CLAUDE.template.md` template documentation - Move `workflows/app.yml` → `.github/app.workflow.yml` so GitHub skips parsing it until `setup.sh` activates it - Add `.github/workflows/validate-template.yml` — CI that confirms placeholder tokens haven't been replaced on the template repo - Replace placeholder-specific icon assets with a generic gradient placeholder - Sync `_reference/MonthBar` to latest upstream - Add `_reference/AtLeast` — iOS/watchOS companion app reference with multi-platform Fastlane and dynamic CI matrix - Extract `private_lane :setup_api_key` in Fastfile; add `sync_build_number`, `sync_last_release`, `upload_metadata`, `upload_privacy_details`, `submit_for_review` lanes - Add `pull_request` trigger, concurrency group, and dynamic matrix to CI workflow - Split `build-macos` into always-run and full-matrix jobs; gate Windows/Android on cross-platform condition - Add conditional server test jobs wrapped in `FULL_STACK_ONLY` markers for `setup.sh` processing - Bump actions: `checkout@v6`, `swift-build@v1.5.2`, `swift-coverage-action@v5`, `codecov-action@v6`, `mise-action@v4` - Prefix all Makefile `fastlane` calls with `mise exec --`; add screenshot targets - Expand CLAUDE.md Commands and Code Signing sections with new Fastlane lanes and make targets - Add automation guide TODO tracker linked to issues #28–#50 - Fix `bundle install` and git section in `setup.sh`; harden with `printf -v`, required-field validation, and `swift` availability check - Replace `keywords.txt` with lorem ipsum placeholder to force users to update before App Store submission - Bump Dockerfile base image from `swift:6.0-jammy` to `swift:6.3-noble` - Add `client` to `openapi-generator-config.yaml` generate list - Remove LFS exclusion section from `.gitattributes` --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Resolve all swift-format and swiftlint findings in the V1.0.0 code and make Scripts/lint.sh self-recover when mise.toml is untrusted. - lint.sh: trust + install via mise before sourcing its env, so the mise-managed tools (swiftlint, periphery) land on PATH instead of silently no-op'ing on a fresh/untrusted mise.toml. - IfCanImport: add doc comment on `syntax`, order instance properties before the initializer, and flatten nested calls to satisfy multiline_arguments_brackets. - Class: split modifier methods into Class+Modifiers.swift (mirroring Function/Function+Modifiers.swift) to clear file_length; stored properties widened private -> internal to match. - ClassTests / AttributeTests: split into parent @suite namespace enums with per-category child suites to clear file_length; replace force unwraps with try #require. swift build + 468 tests pass; lint.sh completes clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
d680855 to
1fd6c9e
Compare
Resolve all three review comments on PR #125. - Rename Initializer -> InitializerDecl (mirrors InitializerDeclSyntax) to disambiguate from the existing Init expression DSL. Updates the matching test struct and call sites. - Replace IfCanImport with a generic PoundIf #if/#elseif/#else/#endif block (split across PoundIf.swift, PoundIf+Condition.swift, and PoundIf+Rendering.swift). PoundIf.Condition covers canImport, flag, os, arch, targetEnvironment, swift, compiler, hasFeature, hasAttribute, and boolean combinators (and/or/not). Also accepts raw String and any CodeBlock conditions plus .elseif / .else modifiers. Delivers the core of #140 under the PoundIf name; see issue #140 for the SwiftSyntax pound taxonomy and the boundary against MacroExp (#141). - New PoundIfTests covers each helper case, raw/CodeBlock conditions, elseif/else chaining, and the former IfCanImport shape (17 tests). - Revert the mise-trust/install block added to Scripts/lint.sh in 1fd6c9e per review request. swift build + 485 tests pass; swift-format and swiftlint clean. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…& params - Convert global buildAttributeArgumentExpr(from:) to an ExprSyntax initializer (ExprSyntax(attributeArgument:)), satisfying the "no global functions" convention; update all 8 call sites and rename the file to ExprSyntax+AttributeArgument.swift. - InitializerDecl: render `init() async throws` with single spacing (drop redundant async trailing space) and use throwsClause instead of the deprecated throwsSpecifier. - InitializerDecl: support parameters via a @ParameterBuilderResult overload, reusing FunctionParameterSyntax.create. - Add regression tests for async-throws spacing and init parameters. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Code Review — PR #125: Changes from Swift-App-TemplateOverview: This PR adds ✅ What's Working Well
🐛 Bugs / Correctness1. // Suggestion: assert or log in debug builds
private static func parseExpression(_ source: String) -> ExprSyntax? {
let file = Parser.parse(source: source)
for item in file.statements {
if let expr = item.item.as(ExprSyntax.self) { return expr }
}
// assertionFailure("PoundIf: could not parse condition: \(source)")
return nil
}2. // Prefer:
default:
assertionFailure("Unexpected leaf condition in renderCombinator")
return ""3.
|
| New feature | Test file | Notes |
|---|---|---|
InitializerDecl |
InitializerDeclTests.swift |
Good: empty, public, async, throws, params, defaults, async+throws ordering |
PoundIf |
PoundIfTests.swift |
Good: all condition cases + elseif + else chains |
Class.access() |
ClassTests+Modifiers.swift |
Good: ordering assertion (public before final) |
ExprSyntax(attributeArgument:) |
AttributeTests+Arguments.swift |
Good: regression tests for both quoted and unquoted |
Function.access() / .throwing() |
FunctionTests.swift |
Adequate |
Import trivia fix |
ImportTests.swift |
Good: positive + negative assertions |
No integration-level tests covering PoundIf nested inside a type declaration (e.g., #if canImport(SwiftUI) inside a Struct body) — worth adding one to catch trivia edge cases at type scope.
Overall: The PR is in good shape. The PoundIf implementation is well-structured, the attribute-argument fix is correct, and the test refactor improves maintainability. The main items to address before merging are the silent nil condition path (#1), the unexplained private → internal widening (#4), and the duplicate / misleading test name (#6).
No description provided.