New Issue Checklist
Describe the bug
Assume a file exists called Path/To/My/File.swift, and assume Path/To/My is a directory that contains a .swiftlint.yml file. When you tell SwiftLint to lint only the file, it uses the default configuration instead of the YAML file in Path/To/My.
I believe the root cause is due to these lines, which return the default configuration immediately instead of checking the directory for any configurations.
Complete output when running SwiftLint, including the stack trace and command used
$ swiftlint lint -- Path/To/My/File.swift
Environment
- SwiftLint version (run
swiftlint version to be sure)? 0.40.2
- Installation method used (Homebrew, CocoaPods, building from source, etc)? Homebrew
- Paste your configuration file:
disabled_rules:
- cyclomatic_complexity
- force_cast
- function_body_length
- Are you using nested configurations?
Yes, see above.
- Which Xcode version are you using (check
xcodebuild -version)?
Xcode 11.7
Build version 11E801a
- 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 use swiftlint lint --path [file here] --no-cache --enable-all-rules.
See above.
// This triggers a violation:
let foo = "Test" as! Array
New Issue Checklist
Describe the bug
Assume a file exists called
Path/To/My/File.swift, and assumePath/To/Myis a directory that contains a.swiftlint.ymlfile. When you tell SwiftLint to lint only the file, it uses the default configuration instead of the YAML file inPath/To/My.I believe the root cause is due to these lines, which return the default configuration immediately instead of checking the directory for any configurations.
Complete output when running SwiftLint, including the stack trace and command used
Environment
swiftlint versionto be sure)? 0.40.2Yes, see above.
xcodebuild -version)?Xcode 11.7
Build version 11E801a
echo "[string here]" | swiftlint lint --no-cache --use-stdin --enable-all-rulesto quickly test if your example is really demonstrating the issue. If your example is more
complex, you can use
swiftlint lint --path [file here] --no-cache --enable-all-rules.See above.