Excluded paths in nested configurations seem to resolve to invalid paths
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 19.7k
- Forks
- 2.3k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 11
Description
New Issue Checklist
- Updated SwiftLint to the latest version
- I searched for existing GitHub issues
Describe the bug
Exluded paths in nested configurations currently do not seem to work.
Environment
- SwiftLint version (run
swiftlint versionto be sure)? 50.3 - Installation method used (Homebrew, CocoaPods, building from source, etc)? Building from source and using Homebrew
- Paste your configuration file:
allow_zero_lintable_files: true
- Are you using nested configurations? Yes
If so, paste their relative paths and respective contents. -> See below - Which Xcode version are you using (check
xcodebuild -version)? 14.1 - Do you have a sample that shows the issue?
I created a small Test:
TestFolder
├── .swiftlint.yml
└── SubFolder
├── .swiftlint.yml
└── testFile.swift
yml at TestFolder/.swiftlint.yml
allow_zero_lintable_files: true
yml at TestFolder/SubFolder/.swiflint.yml
disabled_rules:
- nesting
excluded:
- testFile.swift
allow_zero_lintable_files: true
Contents of testFile.swift:
import Foundation
struct TestStruct {
let a = 1
let b = 2
struct Nested {
let c = 3
struct Nested {
let d = 4
}
}
}
The result being that if SwiftLint is run in TestFolder the file does not get excluded but if it is run in SubFolder it is excluded
I used the debugger with the current master and the excluded paths for the child resolve to TestFolder/SubFolder/SubFolder/testFile.swift instead of TestFolder/SubFolder/testFile.swift which causes the file to not be skipped in Configuration+CommandLine groupFiles. But I don't know if this is caused by a code issue or user error on my side.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Configuration+CommandLine and its groupFiles path handling. Reproduce the nested TestFolder/SubFolder layout using the configurations and testFile.swift described in the issue, then trace why the child exclusion resolves to TestFolder/SubFolder/SubFolder/testFile.swift. Done means running SwiftLint from TestFolder correctly excludes testFile.swift, while the existing SubFolder behavior remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100