Skip to content

fix(config): fall back when nested YAML is invalid#6647

Open
leno23 wants to merge 2 commits into
realm:mainfrom
leno23:fix/nested-config-invalid-yaml-6052
Open

fix(config): fall back when nested YAML is invalid#6647
leno23 wants to merge 2 commits into
realm:mainfrom
leno23:fix/nested-config-invalid-yaml-6052

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 17, 2026

Summary

  • When SwiftLint discovers a nested .swiftlint.yml while grouping files by directory, invalid YAML (e.g. duplicate keys) now warns and falls back to the default configuration instead of calling abort().
  • Improves Issue.errorDescription for yamlParsing so the YAML parse message is surfaced correctly.

Fixes #6052

Test plan

  • Added testNestedConfigurationWithInvalidYamlFallsBackToDefault with a fixture mirroring the issue report (duplicate opt_in_rules in subdir/.swiftlint.yml).
  • CI (Buildkite)

Notes

This complements the existing error-reporting improvement for #6052 on main; it specifically fixes the crash when linting from a parent directory with an invalid nested config.

Made with Cursor

leno23 added 2 commits May 17, 2026 23:30
Use default configuration when auto-discovered nested .swiftlint.yml
files cannot be parsed, matching behavior when linting from that directory.

Fixes realm#6052
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.

swiftlint crashes due to duplicate keys in configuration

1 participant