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

"no_empty_block" causes default functions in protocols to be detected #5749

Open
2 tasks done
inotetw opened this issue Aug 12, 2024 · 1 comment
Open
2 tasks done
Labels
discussion Topics that cannot be categorized as bugs or enhancements yet. They require further discussions.

Comments

@inotetw
Copy link

inotetw commented Aug 12, 2024

New Issue Checklist

The rule "no_empty_block" causes default functions in protocols to be detected. It should specifically exclude functions in protocols from this detection.

for example

protocol Animal {
    func run()
}
extension Animal {
    func run() {}
}
@SimplyDanny
Copy link
Collaborator

The thing is that SwiftLint doesn't know that extension Animal is an extension of a protocol as it works only on the syntax level.

I wonder, though, why you think the rule shouldn't trigger in this case. The fact that the default behavior of a method is to do nothing, doesn't seem obvious and could be worth a comment. This would already silence the rule.

@SimplyDanny SimplyDanny added the discussion Topics that cannot be categorized as bugs or enhancements yet. They require further discussions. label Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Topics that cannot be categorized as bugs or enhancements yet. They require further discussions.
Projects
None yet
Development

No branches or pull requests

2 participants