Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change excludingSyntaxKinds for VerticalWhitespaceBetweenCasesRule.swift #5612

Closed
ilendemli opened this issue May 29, 2024 · 4 comments · Fixed by #5628
Closed

change excludingSyntaxKinds for VerticalWhitespaceBetweenCasesRule.swift #5612

ilendemli opened this issue May 29, 2024 · 4 comments · Fixed by #5628
Labels
bug Unexpected and reproducible misbehavior. good first issue Issue to be taken up by new contributors yet unfamiliar with the project.

Comments

@ilendemli
Copy link
Contributor

ilendemli commented May 29, 2024

Hi I was applying this ruleset and saw it skip some parts of my code

Regarding this:

return match(pattern: pattern, excludingSyntaxKinds: SyntaxKind.commentAndStringKinds)

I think it should also apply for String cases and only exclude SyntaxKind.commentKinds

@SimplyDanny
Copy link
Collaborator

What's an example that would work correctly with this change?

@SimplyDanny SimplyDanny added the discussion Topics that cannot be categorized as bugs or enhancements yet. They require further discussions. label Jun 12, 2024
@ilendemli
Copy link
Contributor Author

Currently running the fix argument against a file such as:

import Foundation

enum TestCase: String {
    case one = "1"
    case two = "2"
    case three = "3"

    var caseToString: String {
        switch self {
        case .one:
            return "one"
        case .two:
            return "two"
        case .three:
            return "three"
        }
    }

    var rawToString: String {
        switch rawValue {
        case "1":
            return "one"
        case "2":
            return "two"
        case "3":
            return "three"
        }
    }
}

does not change anything. With the above change to only exclude SyntaxKind.commentKinds the file gets corrected to:

import Foundation

enum TestCase: String {
    case one = "1"
    case two = "2"
    case three = "3"

    var caseToString: String {
        switch self {
        case .one:
            return "one"

        case .two:
            return "two"

        case .three:
            return "three"
        }
    }

    var rawToString: String {
        switch rawValue {
        case "1":
            return "one"

        case "2":
            return "two"

        case "3":
            return "three"
        }
    }
}

@SimplyDanny
Copy link
Collaborator

Would you like to open a PR to fix this, @ilendemli?

@SimplyDanny SimplyDanny added bug Unexpected and reproducible misbehavior. good first issue Issue to be taken up by new contributors yet unfamiliar with the project. and removed discussion Topics that cannot be categorized as bugs or enhancements yet. They require further discussions. labels Jun 14, 2024
@ilendemli
Copy link
Contributor Author

@SimplyDanny #5628

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected and reproducible misbehavior. good first issue Issue to be taken up by new contributors yet unfamiliar with the project.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants