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

tokei seems to be dramatically mis-estimating Go code #1113

Open
masklinn opened this issue Jun 15, 2024 · 0 comments
Open

tokei seems to be dramatically mis-estimating Go code #1113

masklinn opened this issue Jun 15, 2024 · 0 comments

Comments

@masklinn
Copy link

I was looking at https://go.dev/src/net/http/server.go in a local copy, using tokei 12.1.2 reports

===============================================================================
 Language            Files        Lines         Code     Comments       Blanks
===============================================================================
 Go                      1         3911         2906          764          241
===============================================================================
 Total                   1         3911         2906          764          241
===============================================================================

This seems credible, however while the extreme ratio of comments to code in the early part of the file does dry up some further down the file it never actually disappears. And indeed, using some basic rg filters for classification reveals a very different picture:

> rg '^$' src/net/http/server.go | wc -l # blank lines
     387
> rg '^\s*//' src/net/http/server.go | wc -l # comments
    1340
> rg -v '^(\s*//|$)' src/net/http/server.go | wc -l # code
    2184

I'm sure tokei has a smarter morel than trivial regex, but the discrepancies seem really extreme, especially for a language which should be relatively easy to parse and classify. For what that's worth, loc returns the same things as the rg/wc values.

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

1 participant