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

Consistency check? physical = source + comment + empty? #90

Closed
manatarms opened this issue Apr 6, 2017 · 4 comments
Closed

Consistency check? physical = source + comment + empty? #90

manatarms opened this issue Apr 6, 2017 · 4 comments

Comments

@manatarms
Copy link

I wanted to make sure I wasn't losing my mind.
I wanted to confirm if the total physical lines of code should = source + comment + empty?
I am getting results where it does not. Does that mean something is wrong, or am I assuming something here?
Thanks!

@zwrawr
Copy link
Contributor

zwrawr commented Mar 6, 2018

Based on my repo, it looks like mixed lines get counted as comments and source code (which makes sense). But even when i account for that it doesn't match up exactly.
physical ~= source + comment - mixed + empty is two lines off for my repo.

@flosse
Copy link
Owner

flosse commented Mar 6, 2018

Would you mind to write a testcase?

@flosse
Copy link
Owner

flosse commented Mar 6, 2018

FYI: #99

@zwrawr
Copy link
Contributor

zwrawr commented Mar 7, 2018

Figured it out from looking at source.

The equation in the source is source = total - comment - empty + blockEmpty + mixed
Which is source = physical - comment - empty + empty_lines_in_block_comments + mixed

Empty lines in block comments contribute to the number of block comment lines and the number of empty lines (similar to how mixed works) so we need to add the number back on to stop them being counted twice.

The output looked wrong because the formatter doesn't output the number of empty lines in block comments, but sloc was working fine.

flosse added a commit that referenced this issue Mar 7, 2018
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