How are lines of code counted? #840
-
I've noticed that it seems a bit irregular in how it handles line counting. I've tried replicating the behavior using |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
We use tokei for not only detecting languages, but getting lines of code for each language. Tokei identifies not only blank lines, but also comments. So the count you're seeing should be specifically code, excluding blank lines and comments. https://docs.rs/tokei/12.1.2/tokei/struct.Language.html#structfield.code onefetch/src/info/langs/mod.rs Lines 33 to 51 in 6b852c8 Also, moving this to the Q&A category 🙂 |
Beta Was this translation helpful? Give feedback.
-
I notice there is often a difference between running tokei and onefetch when it comes to lines of code (onefetch Is there a reason that could be the case? For example, on the onefetch repo itself:
Note the 4954 vs 8358. |
Beta Was this translation helpful? Give feedback.
We use tokei for not only detecting languages, but getting lines of code for each language. Tokei identifies not only blank lines, but also comments. So the count you're seeing should be specifically code, excluding blank lines and comments.
https://docs.rs/tokei/12.1.2/tokei/struct.Language.html#structfield.code
onefetch/src/info/langs/mod.rs
Lines 33 to 51 in 6b852c8