Relative excluded path in a nested configuration is ignored
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
When a relative excluded path is present in a nested configuration it is ignored in SwiftLint 0.43.0 . If I try to run SwiftLint 0.42.0 in the same setup it works fine.
It may be related to #3557 . But that issue mentions the case without any nested configurations.
Complete output when running SwiftLint, including the stack trace and command used
❯ swiftlint version
0.43.0
~/work/test
❯ swiftlint
Linting Swift files in current working directory
Linting 'test.swift' (1/1)
/Users/asolovev/work/test/A/B/test.swift:1:1: warning: Identifier Name Violation: Variable name should be between 10 and 40 characters long: 'abcd' (identifier_name)
Done linting! Found 1 violation, 0 serious in 1 file.
~/work/test
❯ mint run swiftlint@0.42.0
Linting Swift files in current working directory
Done linting! Found 0 violations, 0 serious in 0 files.
Environment
- SwiftLint version (run
swiftlint versionto be sure)?
0.43.0 - Installation method used (Homebrew, CocoaPods, building from source, etc)?
Mint. The same happens when usingmint runand when using a 0.43.0 version linked to /usr/local/bin - Paste your configuration file:
./.swiftlint.yml
identifier_name:
min_length: 10
./A/.swiftlint.yml
excluded:
- B
- Are you using nested configurations?
If so, paste their relative paths and respective contents.
Yes.
❯ find .
.
./.swiftlint.yml
./A
./A/.swiftlint.yml
./A/B
./A/B/test.swift
Configurations are mentioned above
./A/B/test.swift
let abcd = 10
- Which Xcode version are you using (check
xcodebuild -version)?
Xcode 12.4
Build version 12D4e - Do you have a sample that shows the issue? Run
echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rules
to quickly test if your example is really demonstrating the issue. If your example is more
complex, you can useswiftlint lint --path [file here] --no-cache --enable-all-rules.
It is a nested configuration issue, but it can be reproduced with data I mentioned before
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
Reproduce the nested setup with .swiftlint.yml, A/.swiftlint.yml, A/B/test.swift, and SwiftLint 0.43.0, then compare it with 0.42.0 using the listed commands. Trace how the nested configuration resolves the relative excluded path B; done means linting A/B/test.swift reports no violations as it does in 0.42.0.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100