You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’d like to discuss the current behavior of Tokei regarding JSON files and the code counting mode.
Background
Right now, Tokei includes .json files in the code count by default. However, JSON is a data format, not executable code. This means that projects with large or auto-generated JSON files (like package-lock.json) can have their code statistics heavily skewed, sometimes making the codebase look much larger than it really is.
As you can see, the JSON files are much larger than the actual codebase.
Current Workaround
To get accurate code statistics, I have to add **/*.json to my .tokeignore file:
**/*.json
But this means I lose the ability to count all lines (including JSON) in lines mode, since the files are ignored entirely. (There is a --no-ignore-dot option to disable custom ignore rules, but that affects all ignored files, not just JSON.) Additionally, if I want to display two Tokei badges—one showing the total number of lines (including JSON) and another showing lines of code excluding JSON files—this is not possible with the current configuration.
Related Issues
#313: Suggests excluding package-lock.json because it is big and auto-generated.
Badges
Tokei offers badges for lines, code, etc. Including JSON in the code count can make these badges misleading for some projects.
Summary
I believe excluding JSON from the code count, but keeping them in the lines count would be a more sensible default, as it better reflects the actual amount of source code.
What do you think? Please vote and share your thoughts below!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I’d like to discuss the current behavior of Tokei regarding JSON files and the
codecounting mode.Background
Right now, Tokei includes
.jsonfiles in thecodecount by default. However, JSON is a data format, not executable code. This means that projects with large or auto-generated JSON files (likepackage-lock.json) can have their code statistics heavily skewed, sometimes making the codebase look much larger than it really is.For example, here’s my output:
As you can see, the JSON files are much larger than the actual codebase.
Current Workaround
To get accurate code statistics, I have to add
**/*.jsonto my.tokeignorefile:But this means I lose the ability to count all lines (including JSON) in
linesmode, since the files are ignored entirely. (There is a--no-ignore-dotoption to disable custom ignore rules, but that affects all ignored files, not just JSON.) Additionally, if I want to display two Tokei badges—one showing the total number of lines (including JSON) and another showing lines of code excluding JSON files—this is not possible with the current configuration.Related Issues
package-lock.jsonbecause it is big and auto-generated.Badges
Tokei offers badges for
lines,code, etc. Including JSON in the code count can make these badges misleading for some projects.Summary
I believe excluding JSON from the
codecount, but keeping them in thelinescount would be a more sensible default, as it better reflects the actual amount of source code.What do you think? Please vote and share your thoughts below!
1 vote ·
Beta Was this translation helpful? Give feedback.
All reactions