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

Fix check_indent false positives on comment blocks #2169

Merged
merged 1 commit into from Jan 23, 2016
Merged

Conversation

pjrobertson
Copy link
Member

@pjrobertson pjrobertson commented Dec 22, 2015

Don't worry about indents inside comment blocks

I saw that the test on @skurfer's objectchosen branch were failing because of bad spaces/tabs in comment blocks. This change allows spaces/tabs/anything in comment blocks, although I'm still not sure if we should do this. If we're enforcing one format over the other, then shouldn't we also do that inside comment blocks?

Discuss ;-)

Don't worry about indents inside comment blocks
pjrobertson
Copy link
Member Author

@pjrobertson pjrobertson commented on dc228c1 Dec 22, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work for comment blocks that are like this:

/** COMMENT
Just a short one **/

If we agree that people should be allowed to use spaces in comments, then I'll fix this, otherwise I'll wait and see (after writing this PR I'm of the mindset that we should enforce the code 'standards' everywhere

tiennou
Copy link
Member

@tiennou tiennou commented on dc228c1 Dec 24, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^(\+)(\s*?)(.*)\*?\*\/ should match

+ a comment **/
+ another comment */
+  */
+ **/
+ */

@skurfer
Copy link
Member

@skurfer skurfer commented Dec 23, 2015

I thought this was an easy one because:

  1. Making exceptions would be a pain; especially for multi-line comments
  2. The whole point of picking an indentation and sticking with it is to ensure that things stay lined up for readability. So… should comments be readable? 😃

But then I realized it probably tripped up on all the Doxygen stuff I added. Now I’m not so sure.

  1. I haven’t looked for any official guidelines, but that seems to be the standard format for Doxygen comments (and maybe all multi-line comments in C).
  2. Even if you tell Xcode to use tabs, typing /** results in a line indented one space.

So maybe we should allow spaces there.

I’ve found that hitting tab inside a comment block even inserts one space, but if you hit tab twice, the space is removed and replaced with a tab. So it is possible and not too much of a pain to use tabs in comments. I can be convinced to just say tabs everywhere.

@tiennou
Copy link
Member

@tiennou tiennou commented Dec 24, 2015

IMHO my own personal style guide says "Comments are indented with spaces", the rationale being that I have a tendency to *-prefix lines and OCD forces me keep them 1 space from the left gutter, like this :

/**
 * Some insightful comment on the meaning of life.
 */

I don't think tabs would pass the OCD test here 😆. My take on this would be ignore indentation in comments altogether.

skurfer added a commit that referenced this issue Jan 23, 2016
Fix check_indent false positives on comment blocks
@skurfer skurfer merged commit 2691bbd into master Jan 23, 2016
2 checks passed
@skurfer skurfer deleted the commentblocks branch Jan 23, 2016
skurfer added a commit that referenced this issue Jan 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants