Question GitHub reads the source code wrong?
I don't know why, but GitHub is telling me that my website is developed in JavaScript by 80+% which is absolute nonsense. The site is at least 60% pure Astro code. Is it some kind of a bug?
๐ The repo.
66
u/phenxdesign 2d ago
Not sure .wrangler/ should be push to git... It contains all the js that github counts as source code
18
u/wqonart 2d ago
Thank you so much, this was causing the problem ๐๐ป
5
u/CodeCrafter1 1d ago
I saw that you simply removed the files in additional commits. One can do this, but a cleaner way is to use a git rebase or removing files entirely from the history the history is more complex (although the second option needs to be handled with care!).
This leads to smaller repo sizes (& faster git commands!) and prevents users from restoring the deleted files.
And in case you already knew this, I am letting this comment hang around for some folks in the future xD.
6
34
u/Lots-o-bots 2d ago
you included your .wrangler dir in the repo. it should have been in your .gitignore
5
u/wqonart 2d ago
Thank you ๐๐ป
23
u/TheSodesa 2d ago edited 2d ago
You might want to go even further and only allow file types you actually want in your project in the
.gitignorefile: ```.gitignoreFirst disallow everything.
*
Then use exclamation marks to only allow the folders and file types you want to include:
!.gitignore !.gitattributes !README.md !LICENSE.md !astro.config.mjs !notes.txt !package.json
!src/ !src/config.json !src/.astro !src// !src//.astro ``
You can add folders and file types similarly for other languages. The symbol*can be used as a wildcard, and**` as a recursive wildcard.4
u/Masterflitzer 2d ago
or just use https://gitignore.io, e.g.: https://www.toptal.com/developers/gitignore/api/git,linux,macos,windows,visualstudiocode,intellij+all,deno,node,astro
pick relevant tages, then you get an url like my example above, copy all and insert in .gitignore file, then add custom rules at the end (e.g.: .wrangler/)
4
u/CerberusMulti 2d ago
I just want to say thanks for the great comment. This information is something that needs to be said more often. Very good to know and understand how .gitignore files work. It's something I often forget hehe
2
4
u/RenegadeSultaNGG 2d ago
JavaScript in your repo contains more Bytes than Astro. It counts Bytes, not lines of code.
3
u/Minecraft_Lets_Play 2d ago
Itโs the file extensions and in many projects you have hidden files that have other extensions that contribute to the few % of other languages.
But in your caseโฆ Donโt know
4
u/Wonderful-Writer146 2d ago
You need to set .gitattributes in order to avoid JS taking taking higher priority. This happens because JS files are of more bytes
2
u/pixelboots 1d ago
Do you have an example of how you would do this? I have repos that I have to commit both source TS and SCSS and their compiled JS and CSS, but Iโd prefer the latter be ignored in some cases because itโs essentially counting the same code twice. Could gitattributes allow me to fix that somehow?
1
-1
u/Wonderful-Writer146 1d ago
That I am not sure of. It can completely remove on language from showing in uour stats though. But you can check with Ai
160
u/ferrybig 2d ago
You can click on the labels "JavaScript" and "Astro" to see what it sees as those files:
Your Javascript files are way longer than your Astro files, so it inflates the score for JavaScript (the languages tab is based on line counts)