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

EmptyClassBlock should consider comment as "body" (via option?) #1756

Closed
TWiStErRob opened this issue Jul 5, 2019 · 1 comment · Fixed by #1758
Closed

EmptyClassBlock should consider comment as "body" (via option?) #1756

TWiStErRob opened this issue Jul 5, 2019 · 1 comment · Fixed by #1758

Comments

@TWiStErRob
Copy link
Member

Expected Behavior of the rule

class Foo {
    // this is a comment about why Foo doesn't have a body (implementation detail)
}

the above shouldn't report EmptyClassBlock, IMO

Context

Documentation like this belongs to the class, but it's not KDoc as it's not the description of a public API.
Without the class body braces the comment would be just dangling in space, and for example Move (class) refactor wouldn't consider it to be part either and would leave it where it is.

class Foo
// just a random comment unrelated to Foo
@cortinico
Copy link
Member

Agree, here the fix: #1758

@arturbosch arturbosch added this to the 1.0.0 milestone Jul 6, 2019
arturbosch pushed a commit that referenced this issue Jul 12, 2019
* Update EmptyClassBlock to skip classes with comments in the body

Fixes #1756

* Removed extra imports

* Removed extra space
@lock lock bot locked as resolved and limited conversation to collaborators Oct 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants