Repository navigation
Support relative paths in config file search - #6920
Open
tomotakatakahashi wants to merge 1 commit into
Open
tomotakatakahashi wants to merge 1 commit into
tomotakatakahashi wants to merge 1 commit into
Conversation
Generated by 🚫 Danger |
tomotakatakahashi
force-pushed
the
SwiftLint2
branch
2 times, most recently
from
September 22, 2026 00:40
501fdc4 to
7fb0d46
Compare
tomotakatakahashi
marked this pull request as ready for review
September 22, 2026 00:55
tomotakatakahashi
force-pushed
the
SwiftLint2
branch
from
September 22, 2026 01:22
7fb0d46 to
77a8807
Compare
tomotakatakahashi
force-pushed
the
SwiftLint2
branch
from
September 22, 2026 01:46
77a8807 to
acf2dd0
Compare
7 tasks done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes a bug where relative paths are not resolved when configuration files are searched.
When a file is passed as a relative path (e.g.
swiftlint lint Sources/App.swift), the nested configuration search does not recognize that it has reached the root directory, so it keeps walking up the file tree and merges.swiftlint.ymlfiles from directories outside the project.Context
According to Claude Code, another PR of mine ( #6825 ) would worsen this bug (although I haven't confirmed whether it is true or not). Maybe I should fix this bug before the other PR is merged.
Test
Sourcechanges are not applied.lint --no-cache Sources/Core/Service.swiftarguments and/Users/tomotaka/projects/SwiftLint2/Tests/IntegrationTests/Resources/_2_parent_child_different_dirs/projectworking directory:file_nameandno_empty_block).swiftlint.yml(opt_in_rules: all) is used instead of the working dir's.swiftlint.yml.Comment
URLAPI to use for the comparison.standardizedFileURL,path(percentEncoded:)andabsoluteStringall resolve the relative URL:MultipleConfigurationsTests, but this test case does not necessarily catch a regression. If the Source changes are reverted, the test suite becomes flaky (due to the caching mechanism ofConfigurationaccording to Claude Code).