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

Prevent block comments #486

Open
emretoptanci opened this issue Mar 21, 2023 · 2 comments
Open

Prevent block comments #486

emretoptanci opened this issue Mar 21, 2023 · 2 comments

Comments

@emretoptanci
Copy link

emretoptanci commented Mar 21, 2023

"Block comments" are evil. They are especially used to disable a large part of code easily but when you do that it becomes hard to read the code. The difference is not obvious in the Pull Request. Just two lines of difference which in fact disables maybe hundreds of lines of code. You inspect lines and lines of code just to realize that that code does not run because it is put inside a block comment.
Line comments on the other hand are angels. Every affected line of code is changed when a line comment is applied so you never miss that line in the Pull Request.
IDEs like IntelliJ, VsCode usually print the commented block with a different color so the hardship I mentioned is not felt so deeply. But when going through the Pull Request outside the IDE, the issue becomes prominent.
A new configuration option should be introduced to "Prevent block comments" or "automatically turn block comments into line comments".

@cxw42
Copy link
Member

cxw42 commented Mar 26, 2023

I agree that line comments are preferable. However, finding block comments requires semantic analysis, in the general case. EditorConfig supports editors that do not have analysis capability. I am therefore not sure if EditorConfig is the right place for this setting. E.g., I would expect to see this in a linter config.

@Astrabacus
Copy link

👍

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

3 participants