Adding Dynamic Lines-of-Code and File Count Badges to your Github/Gitlab Repositories
When publishing my open source projects, I often want to give potential users or contributors an idea of the project's scope and complexity of the codebase. Although not perfect, Lines of Code (LoC) can often be a good metric for determining this.
Tokei is a written in Rust that counts lines of code very fast. They host a web-service that automatically generates badges for Github and Gitlab repositories showing these statistics.
Using Tokei in Your Repositories
Using the Tokei badge service couldn't be easier: Simply add a small link to your project's README.md
file and reload the page!
The snippet looks like this: ![](https://tokei.rs/b1/github/Ameobea/cryptoviz)
Replace github
with gitlab
if you're using that, replace Ameobea
with your Github/Gitlab username, and replace cryptoviz
with whatever your repository is named. That will automatically generate and display the small LoC badge.
If you want to view the file count as well, Use this snippet: ![](https://tokei.rs/b1/github/Ameobea/cryptoviz?category=files)
, making the same replacements as the first snippet. Additional categories that are available include code
(default), blanks
, comments
, and lines
(total of code, comments, and blanks).
I've made a habit out of using Tokei on all of my open-source repositories. Besides being a cool way to track your progress and view some simple stats about your own work, it helps others who many be interested in your work as well!
Check out the Tokei Repository to learn more about the cool tool or install the CLI version!
Congratulations @ameo! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!
Beautiful post