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-tabs makes it hard to comment out code #116

Open
edg2s opened this issue Nov 20, 2018 · 5 comments
Open

no-tabs makes it hard to comment out code #116

edg2s opened this issue Nov 20, 2018 · 5 comments

Comments

@edg2s
Copy link
Member

edg2s commented Nov 20, 2018

Commenting code line-by-line results in tabs in comments, which trigger a warning :/

@Krinkle
Copy link
Member

Krinkle commented Dec 13, 2018

Hm.. I'm struggling to see what this rule is trying to catch given we use tabs for indentation.

Apart from indentation, tabs can appear in comments and as whitespace separation between syntax. It seems that in comments we would want to allow it.

Between pieces of syntax we want to disallow it. But, I'd expect other rules to catch that already. E.g. a tab between function and () would presumably be caught by rules like space-before-function-paren and such. Just as a new line or multiple spaces would also be caught that way.

@jdforrester
Copy link
Member

Between syntax we want to disallow it. But, I'd expect other rules to catch that already. E.g. a tab between function and () would presumably be caught by rules like space-before-function-paren and such. Just as a new line or multiple spaces would also be caught that way.

Sadly they didn't, hence why we spotted a couple of issues when applying this in repos, e.g. in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/WikimediaEvents/+/475911/1/modules/all/ext.wikimediaEvents.citationUsage.js

I'm not totally happy with how much this made us re-write code comment blocks, but the work is done, and I don't think reverting is worth the effort.

@edg2s
Copy link
Member Author

edg2s commented Dec 13, 2018

Yeah - it caught other errors like var x =\t1; and /*\tComment */

@jdforrester
Copy link
Member

Per discussion, can we just mark this issue as Closed?

@Krinkle
Copy link
Member

Krinkle commented Jul 19, 2019

It should be valid in our rules by default to have documentation blocks that have indented code, and to be able to comment out multiple lines of code with // . In both cases there will be lines like such:

\t\t// {
\t\t// \t"key": :"val"
\t\t// }

and

\t\t/*
\t\t * {
\t\t * \t"key": :"val"
\t\t * }
\t\t */

Unless we change that coding convention, I'm not sure violations from this all over the place are worthwhile the small gain in not having accidental tabs elsewhere in the code. I expect those to be rare mistakes, caught in code review, or otherwise fairly harmless to the readability and quality of the code.

So my preference would be to disable the rule, and then invest in space-before-function-paren instead to be able to detect incorrect types of whitespace (such as tabs and newlines) where we have codified a space to be used.

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

No branches or pull requests

3 participants