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

Clarify how Tokei counts blank lines inside comment blocks #498

Open
Luni-4 opened this issue Apr 10, 2020 · 6 comments
Open

Clarify how Tokei counts blank lines inside comment blocks #498

Luni-4 opened this issue Apr 10, 2020 · 6 comments

Comments

@Luni-4
Copy link

Luni-4 commented Apr 10, 2020

Tokei counts blank lines inside comment blocks as blank lines. Wouldn't they be considered as comment lines?

For example:

/* Copyright (C) 2007-2008 Foo
   Copyright (C) 2008      Foo

   File: test.c
  
*/

Tokei output:

-------------------------------------------------------------------------------
 Language            Files        Lines         Code     Comments       Blanks
-------------------------------------------------------------------------------
 C                     1            6            0            4            2
-------------------------------------------------------------------------------
 Total                 1            6            0            4            2
-------------------------------------------------------------------------------

In this case, Blanks should be 0, while Comments 6.

Thanks in advance for your clarification! :)

@foxpy
Copy link

foxpy commented May 2, 2020

What is the point of blank line inside of a comment? I believe it makes more sense to count these as blanks.

@Luni-4
Copy link
Author

Luni-4 commented May 2, 2020

Yep, I agree with you, but I was just looking at that from a parent-child perspective. Since a blank line is inside a comment block, it is indeed a comment. Furthermore there are metrics, like the LOCbl, that count the number of blank lines in a file, but they exclude the blank lines inside a comment block because they are considered to be a comment line. That's why I'm asking for a clarification :)

@XAMPPRocky
Copy link
Owner

XAMPPRocky commented May 2, 2020

Thank you for your issue! I can definitely see the of why one could see it as comments in this case. I haven't really given much thought on whether it should be one or the other.

@Luni-4
Copy link
Author

Luni-4 commented May 3, 2020

Thanks to you for accepting my issue!
In order to not break the current implementation, perhaps we could add a cli option, something like: --blank-as-comment-block

@XAMPPRocky
Copy link
Owner

I would be hesitant about making an option, I want to keep the amount of bespoke behaviour flags to a minimum. I would prefer to change the implementation if I was going to make a change.

@foxpy
Copy link

foxpy commented May 4, 2020

I really think that current implementation makes more sense. When counting the number of comment lines, I will possibly like to know how much of the comments are meaningful.

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

No branches or pull requests

3 participants