New Issue Checklist
Describe the bug
The vertical_whitespace_between_cases rule doesn't trigger when using @unknown before default in a switch.
Complete output when running SwiftLint, including the stack trace and command used
> ./swiftlint lint
Linting Swift files in current working directory
Linting 'Test2.swift' (1/2)
Linting 'Test1.swift' (2/2)
/Users/revolt/Downloads/swiftlint-unknown/Test1.swift:11:1: warning: Vertical Whitespace Between Cases Violation: Include a single empty line between switch cases. (vertical_whitespace_between_cases)
/Users/revolt/Downloads/swiftlint-unknown/Test2.swift:11:1: warning: Vertical Whitespace Between Cases Violation: Include a single empty line between switch cases. (vertical_whitespace_between_cases)
/Users/revolt/Downloads/swiftlint-unknown/Test2.swift:13:1: warning: Vertical Whitespace Between Cases Violation: Include a single empty line between switch cases. (vertical_whitespace_between_cases)
Done linting! Found 3 violations, 0 serious in 2 files.
Environment
- SwiftLint version (run
swiftlint version to be sure)? 0.43.0-rc.2
- Installation method used (Homebrew, CocoaPods, building from source, etc)?
https://github.com/realm/SwiftLint/releases/download/0.43.0-rc.2/portable_swiftlint.zip
- Paste your configuration file:
opt_in_rules:
- vertical_whitespace_between_cases
- Are you using nested configurations? No
If so, paste their relative paths and respective contents.
- Which Xcode version are you using (check
xcodebuild -version)? Xcode 12.2 Build version 12B45b
- 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.
Test1.swift:
enum Test {
case first
case second
}
let test = Test.first
switch test {
case .first:
print("first")
case .second:
print("second")
@unknown default:
print("default")
}
Test2.swift (that works correctly):
enum Test {
case first
case second
}
let test = Test.first
switch test {
case .first:
print("first")
case .second:
print("second")
default:
print("default")
}
New Issue Checklist
Describe the bug
The
vertical_whitespace_between_casesrule doesn't trigger when using@unknownbeforedefaultin aswitch.Complete output when running SwiftLint, including the stack trace and command used
Environment
swiftlint versionto be sure)?0.43.0-rc.2https://github.com/realm/SwiftLint/releases/download/0.43.0-rc.2/portable_swiftlint.zipIf so, paste their relative paths and respective contents.
xcodebuild -version)?Xcode 12.2 Build version 12B45becho "[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.Test1.swift:Test2.swift(that works correctly):