Skip to content

Honor parent_config / child_config in nested .swiftlint.yml files#6774

Open
JulianKahnert wants to merge 1 commit into
realm:mainfrom
JulianKahnert:nested-parent-config-3540
Open

Honor parent_config / child_config in nested .swiftlint.yml files#6774
JulianKahnert wants to merge 1 commit into
realm:mainfrom
JulianKahnert:nested-parent-config-3540

Conversation

@JulianKahnert

@JulianKahnert JulianKahnert commented Jun 15, 2026

Copy link
Copy Markdown

Re-opens #6773 (the original PR's head branch was lost when I deleted my fork — GitHub doesn't allow reopening in that case). Same commit, same changes.

Previously, nested .swiftlint.yml files discovered during linting were loaded with ignoreParentAndChildConfigs: true, silently dropping any parent_config / child_config keys they contained. Resolving them through the same FileGraph as the main config lets fleets of packages share a central rule set via parent_config in per-directory stubs (e.g. Tests/.swiftlint.yml referencing a common tests.yml) — the documented use case in #3540.

The existing !fileGraph.includesFile(atPath:) guard still prevents re-merging a file already in the main config chain; FileGraph's per-graph cycle detection covers the nested case.

Fixes #3540.

Previously, nested .swiftlint.yml files discovered during linting were
loaded with ignoreParentAndChildConfigs: true, silently dropping any
parent_config / child_config keys they contained. Resolving them through
the same FileGraph as the main config lets fleets of packages share a
central rule set via parent_config in per-directory stubs (e.g.
Tests/.swiftlint.yml referencing a common tests.yml) — the documented
use case in realm#3540.

The existing !fileGraph.includesFile(atPath:) guard still prevents
re-merging a file already in the main config chain; FileGraph's
per-graph cycle detection covers the nested case.

Fixes realm#3540.
@SwiftLintBot

Copy link
Copy Markdown
19 Messages
📖 Building this branch resulted in the same binary size as when built on main.
📖 Linting Aerial with this PR took 0.64 s vs 0.64 s on main (0% slower).
📖 Linting Alamofire with this PR took 0.91 s vs 0.94 s on main (3% faster).
📖 Linting Brave with this PR took 6.04 s vs 6.04 s on main (0% slower).
📖 Linting DuckDuckGo with this PR took 25.11 s vs 25.11 s on main (0% slower).
📖 Linting Firefox with this PR took 10.3 s vs 10.28 s on main (0% slower).
📖 Linting Kickstarter with this PR took 7.39 s vs 7.29 s on main (1% slower).
📖 Linting Moya with this PR took 0.36 s vs 0.4 s on main (10% faster).
📖 Linting NetNewsWire with this PR took 2.33 s vs 2.39 s on main (2% faster).
📖 Linting Nimble with this PR took 0.56 s vs 0.56 s on main (0% slower).
📖 Linting PocketCasts with this PR took 6.8 s vs 6.77 s on main (0% slower).
📖 Linting Quick with this PR took 0.36 s vs 0.35 s on main (2% slower).
📖 Linting Realm with this PR took 2.47 s vs 2.51 s on main (1% faster).
📖 Linting Sourcery with this PR took 1.51 s vs 1.48 s on main (2% slower).
📖 Linting Swift with this PR took 4.28 s vs 4.27 s on main (0% slower).
📖 Linting SwiftLintPerformanceTests with this PR took 0.16 s vs 0.16 s on main (0% slower).
📖 Linting VLC with this PR took 1.04 s vs 1.04 s on main (0% slower).
📖 Linting Wire with this PR took 15.17 s vs 15.14 s on main (0% slower).
📖 Linting WordPress with this PR took 9.98 s vs 10.01 s on main (0% faster).

Generated by 🚫 Danger

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.

Allow nested configs to specify parent/child configs.

2 participants