lint command paths argument is unexpectedly case sensitive when applying exclude rules
Nobody has claimed this yet.
- Dominant language
- Swift
- Stars
- 19.7k
- Forks
- 2.3k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 11
Description
swiftlint lint [] [ ...]
If my code is held in /home/a/b/c and I pass in the argument /home/a/b/C then SwiftLint scans the directory /home/a/b/c/.
That's cool, and expected. it's a Mac, it's not case sensitive.
BUT. If my config.yml file contains an exclusion rule:
excluded: # paths to ignore during linting.
- build
😀 then the exclusion works when the invocation looks like this:
swiftlint lint --config config.yml /home/a/b/C
😡 but the exclusion is not honored in this case:
swiftlint lint --config config.yml /home/a/b/C
and then my /home/a/b/c/build directory gets scanned, with horrible errors as a result.
Reproduce:
Death-Star:myCode apple$ pwd
/tmp/myCode
Death-Star:myCode apple$ find . -print -exec cat '{}' ';'
.
cat: .: Is a directory
./lint.yml
excluded: # paths to ignore during linting.
- badCode
./1.swift
if a = 3 {
print("hi")
}
./badCode
cat: ./badCode: Is a directory
./badCode/bad.swift
if a = 3 {
print("hi")
}
Death-Star:myCode apple$ swiftlint --config lint.yml /tmp/myCode/
Linting Swift files at paths /tmp/myCode/
Linting '1.swift' (1/1)
Done linting! Found 0 violations, 0 serious in 1 file.
Death-Star:myCode apple$ swiftlint --config lint.yml /tmp/MYCODE/
Linting Swift files at paths /tmp/MYCODE/
Linting '1.swift' (1/2)
Linting 'bad.swift' (2/2)
Done linting! Found 0 violations, 0 serious in 2 files.
Death-Star:myCode apple$
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 by reproducing the case-sensitive path behavior with the swiftlint lint commands and the lint.yml or config.yml exclusion rule shown in the issue. Trace how the lint entry point resolves paths and applies exclusions; done means the excluded badCode or build directory is skipped for both correctly and incorrectly cased invocation paths.
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
- Mostly clear
- Newbie friendliness
- 35/100