.swiftlint.yml not always taken into account
Closed this issue · 3 comments
New Issue Checklist
- Updated SwiftLint to the latest version
- I searched for existing GitHub issues
Bug Report
Create the following 2 files in a subdirectory.
# subdir/.swiftlint.yml
disabled_rules:
- todo
// subdir/MyCode.swift
// TODO: ABCDEFG
Specifying the path to the file causes the directory's .swiftlint.yml
to be ignored.
$ swiftlint lint --no-cache --quiet # Not path specified, no warning as expected
$ swiftlint lint --no-cache --quiet --path subdir # Directory path specified, no warning
$ swiftlint lint --no-cache --quiet --path subdir/MyCode.swift # Specifying the file path gets you an unexpected warning
.../subdir/MyCode.swift:1:4: warning: Todo Violation: TODOs should be avoided (ABCDEFG). (todo)
$ swiftlint lint --no-cache --quiet --path $PWD/subdir/MyCode.swift # Same problem with the full path
.../subdir/MyCode.swift:1:4: warning: Todo Violation: TODOs should be avoided (ABCDEFG). (todo)
It seems to me that SwiftLint should automatically look if there is a .swiftlint.yml the directory the file is in, and then its parent directories.
Note if you are in the directory the file is in, no warning is displayed.
Environment
- SwiftLint version (run
swiftlint version
to be sure)?- 0.23.0
- Installation method used (Homebrew, CocoaPods, building from source, etc)?
- HomeBrew
- Are you using nested configurations?
- No
- Which Xcode version are you using?
- 9.0
@vincentisambart, please see this comment. The issue may be slightly different, but the same advice applies.
(For the sake of GitHub’s indexing, I’ll add that this is issue is intrinsically related to #1825.)
@SDGGiesbrecht, I wouldn't have been surprised even if SwiftLint was looking for .swiftlint.yml
up to the /
root directory (starting from where the Swift file is).
What you name A) --subdirectory
and B) --project
would probably cover all my use cases (but I would need both).
This issue has been automatically marked as stale because it has not had any recent activity. Please comment to prevent this issue from being closed. Thank you for your contributions!