Skip to content

vertical_whitespace_between_cases considers comments #6412

@jshier

Description

@jshier

New Issue Checklist

Bug Description

Since 0.63, vertical_whitespace_between_cases considers inline comments in whether a newline is needed. For example, previously, this produced no warning with the setting enabled, as the cases were handled in a single line.

switch myEnum {
case .a: print("a")
// Now we handle b.
case .b: print("b")
}

However, now it requires a newline before the comment, despite the fact that the structure of the actual code doesn't trigger the warning.

switch myEnum {
case .a: print("a")

// Now we handle b.
case .b: print("b")
}

It seems to me that only the structure of the switch itself should be considered when determining the newline requirement, as was the case before. If this was an intentional change, perhaps an additional parameter can be added for better control?

Environment

  • SwiftLint version: 0.63.0
  • Xcode version: 26.2
  • Installation method used: CocoaPods
  • Configuration file: directly enabled the rule, no configuration yet.

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionTopics that cannot be categorized as bugs or enhancements yet. They require further discussions.enhancementIdeas for improvements of existing features and rules.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions