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

new Check: commented code #2982

Open
romani opened this issue Feb 28, 2016 · 2 comments
Open

new Check: commented code #2982

romani opened this issue Feb 28, 2016 · 2 comments

Comments

@romani
Copy link
Member

romani commented Feb 28, 2016

SForge issue: 453
Created: 2007-03-07
Creator: caucabin
Private: No

In source code ,always see like this code:

// int size = p_steps.size();
// for (int i = 0; i < size; i++)

 final int size = p_steps.size();
 for (int i = 0; i < size; i++)

The comment part is a history source code, we can get the history code from the version control tool, and don't want to see it in the code.

This already done in Sonar - http://www.sonarqube.org/commented-out-code-eradication-with-sonar/.
We should think about this.

@daniilyar
Copy link
Contributor

@romani how do we distinguish between commented code and comments?

Detection by existence of some symbols specific to the code would be unreliable and I see to other way to distinguish it.

So I believe this one is impossible to implement in Checkstyle (

@romani
Copy link
Member Author

romani commented Mar 26, 2018

Commented code should be parse able. By wrapping to class or class+method. If it is not parse-able it is a comment that have some code.

Sonar also have problems to detect this properly, there are cases where we need to put code in comment, rare cases but happening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants