Thanks for awesome badges
:question: Question
Code size badge on my repo shows only 350 kb, and repo size badge 22.6 MB.and I am not able to figure out following doubts --
Hello @Kulbhushan-Chand,
Regarding repository size, this StackOverflow answer may help you - we use the described API underneath the hood.
Code size is the total size for all the files in your repository that GitHub detects as being code. On your GitHub repository, there's a header with details for each programming language being used with the relative percentage for each one. The percentages are based on the code size for each language, our badge simply sums all the sizes up rather than computing percentages.
Hope this helps! 馃槈
@PyvesB thanks for the nice explanation.
The repo size badge is including files in your repo which are not code, such as images. For example, none these files are code: https://github.com/Kulbhushan-Chand/Kulbhushan-Chand.github.io/tree/master/assets/images (so they're not included in the 'code size') but they are in your repository, (so they are included in the 'repo size'). Neither account for any compression.
@chris48s Thanks for reply.
Are you sure all the md, js, css, sass, html files in my repo add upto 350 kb only ?
Upon resuming work, I will check this as the first thing.
GitHub reports the size (in bytes) by language for your repo as follows:
$ curl "https://api.github.com/repos/Kulbhushan-Chand/Kulbhushan-Chand.github.io/languages"
{
"JavaScript": 162812,
"CSS": 95655,
"HTML": 89026,
"Ruby": 2885
}
The sum of those numbers (formatted as kb/mb etc) is what we report on the "code size" badge.
In general there are some file types (such as those commonly associated with documentation or configuration) which aren't considered as "code" by default in GitHub. Markdown files would fall under that category. So does stuff like yaml. The GitHub component responsible for working out which types of files are in your repo and deciding if they are "code" or not is called linguist and you can manually configure its behaviour by declaring settings in a .gitattributes file in your repo. See the docs at https://github.com/github/linguist#overrides
:bowing_man: Thanks @chris48s for clearing my doubts. I understand it now.
:bowing_man: Thanks @PyvesB for answer.
Perfect! Feel free to reopen/open a new issue if you have any more questions. :wink:
Most helpful comment
Hello @Kulbhushan-Chand,
Regarding repository size, this StackOverflow answer may help you - we use the described API underneath the hood.
Code size is the total size for all the files in your repository that GitHub detects as being code. On your GitHub repository, there's a header with details for each programming language being used with the relative percentage for each one. The percentages are based on the code size for each language, our badge simply sums all the sizes up rather than computing percentages.
Hope this helps! 馃槈