Skip to content

Migrate linting and style configs to Swift-App-Template patterns #54

Description

@leogdion

Overview

The current linting, style, and CI workflow files are outdated compared to the patterns established in Swift-App-Template and brightdigit/swift-build. This issue tracks migrating all relevant files to match the latest standards.

Reference repos: use Swift-App-Template as the primary template, but also cross-check the config and CI patterns in MistKit and SundialKit — both are maintained BrightDigit library packages and may carry more current or library-tuned variants of these configs. Where the three diverge, prefer the most recent/strictest pattern and note the choice in the PR.

Files to Migrate

.swiftlint.yml — Major overhaul needed

Current config has minimal rules with relaxed limits suited for a content-heavy project. The template uses a much stricter, opt-in rules approach:

  • Add opt_in_rules — ~80 opt-in rules enabled (e.g. explicit_acl, missing_docs, force_unwrapping, implicit_return, etc.)
  • Add disabled_rules — selectively disable rules like trailing_comma, nesting, todo
  • Tighten limits:
    • cyclomatic_complexity: 12 → [6, 8]
    • type_body_length: 300 → [125, 200]
    • file_length: 550 → [275, 300]
    • function_body_length: 80 → [35, 50]
    • line_length: 150 → [90, 90]
  • Add indentation_width: 2 rule config
  • Add file_name and fatal_error_message with severity: error
  • Update excluded to add .swiftpm and */.swiftpm, */.build
  • Add db to identifier_name.excluded
  • Remove Tests/*/XCTestManifests.swift exclusion (no longer needed)

.swiftformat.swift-format — Format and tool change

The template uses Apple's swift-format tool (JSON config) instead of the swiftformat CLI:

  • Rename .swiftformat.swift-format
  • Replace contents with a JSON config covering ~50 rules
  • Key settings: lineLength: 100, indentation: spaces: 2, NeverForceUnwrap: true, NeverUseForceTry: true, OrderedImports: true, etc.

.gitattributes — New file

Add Git LFS configuration for binary assets:

  • Marketing assets (*.png, *.jpg, *.jpeg, *.pdf under Marketing/)
  • Design files (*.sketch, *.fig, *.psd)
  • Video assets (*.mov, *.mp4)
  • Archives/binaries (*.zip, *.dmg, *.pkg)

.mise.toml — New file

Add tool version pinning via mise:

  • swiftlint = "0.63.2"
  • "spm:swiftlang/swift-format" = "602.0.0" (switches from swiftformat CLI to Apple's swift-format)
  • ruby = "3.3.7" (if fastlane is used)

.github/workflows/main.yaml — Migrate to brightdigit/swift-build

The current workflow manually runs swift build and swift test in the build-linux job using the custom brightdigit/publish-xml Docker image. Replace with the brightdigit/swift-build action where possible:

build-linux job — Replace manual steps with the action:

- name: Build and Test
  uses: brightdigit/swift-build@v1
  # No `scheme` needed for Ubuntu SPM builds; no `type` needed (defaults to swift build/test)

This handles caching, swift build, and swift test automatically with optimized cache hit rates.

package-linux job — Remains mostly manual since it produces a release binary artifact; swift-build does not currently handle release packaging. Keep this job but consider using build-only: true on the build step.

Jobs that do NOT migrate (remain custom):

  • automate-content — content import logic is specific to this project
  • deploy — Netlify deployment is project-specific

Notes

  • Cross-reference MistKit and SundialKit alongside Swift-App-Template when migrating each config file — they are active library packages and may show the most current BrightDigit conventions.
  • Switching from swiftformat to Apple's swift-format is the most impactful change — the tool, config format, and rule names all differ
  • The stricter swiftlint limits will likely produce many new violations that need to be fixed or suppressed
  • This should be done as a dedicated PR with a lint-fix pass following the config migration
  • The brightdigit/swift-build action requires no scheme for Ubuntu SPM builds — just drop it in as a step replacement

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions