Skip to content

Warn and skip linting when swift-format config is incompatible#2

Merged
heirloomlogic merged 1 commit intomainfrom
heirloomlogic/graceful-config-error
Apr 14, 2026
Merged

Warn and skip linting when swift-format config is incompatible#2
heirloomlogic merged 1 commit intomainfrom
heirloomlogic/graceful-config-error

Conversation

@heirloomlogic
Copy link
Copy Markdown
Owner

Summary

  • When the active toolchain's swift-format cannot parse the .swift-format config (e.g. Swift 6.1 CI runner vs a config authored under 6.2+), all plugin paths now emit a detailed warning and skip linting/formatting instead of failing the build.
  • Build tool plugin runs a preflight probe against a trivial file before returning the prebuild command — if the config is unparseable, it returns no commands with a Diagnostics.warning.
  • Command plugins (SPM + Xcode) detect config errors in stderr and downgrade from Diagnostics.error to Diagnostics.warning.
  • bin/lint captures stderr, detects config/toolchain mismatches, and exits 0 with a warning instead of failing CI.
  • Adds Links section to README; updates fallback-config diagnostic messages with repo URLs.

Test plan

  • Plug into a downstream package with a mismatched toolchain and confirm the build warns but succeeds
  • Confirm real lint violations still fail the build as before
  • Run bin/lint with a config containing unknown keys and verify it warns and exits 0
  • Run bin/lint with a valid config and intentional violations and verify it exits non-zero

🤖 Generated with Claude Code

When the active toolchain's swift-format is incompatible with the
.swift-format config schema (e.g. Swift 6.1 CI vs 6.2+ config), the
plugins now emit a detailed warning and skip linting/formatting instead
of failing the build. Real lint violations still fail as before.

Build tool plugin: preflight probe runs swift-format against a trivial
file before returning the prebuild command. If the config is
unparseable, returns [] with a warning diagnostic.

Command plugin: config-related failures downgraded from
Diagnostics.error to Diagnostics.warning with actionable context.

bin/lint: captures stderr, detects config errors, exits 0 with warning.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@heirloomlogic heirloomlogic merged commit 76b239e into main Apr 14, 2026
1 check passed
@heirloomlogic heirloomlogic deleted the heirloomlogic/graceful-config-error branch April 14, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants