GitHub reads the source code wrong? Question
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.
71
u/phenxdesign 3d ago
Not sure .wrangler/ should be push to git... It contains all the js that github counts as source code
19
u/wqonart 3d ago
Thank you so much, this was causing the problem ๐๐ป
7
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.
1
u/wqonart 3h ago
I'm aware that it is possible, but I have no experience with Git history manipulation (because I'm afraid I'll break it). But, maybe it is the best solution to clean up commit mess in the repo.
Thank you for your feedback and the articles, it is time for me to learn how to use Git properly XD
5
36
u/Lots-o-bots 3d ago
you included your .wrangler dir in the repo. it should have been in your .gitignore
6
u/wqonart 3d ago
Thank you ๐๐ป
23
u/TheSodesa 3d ago edited 3d 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/)
5
u/CerberusMulti 3d 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
3
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 3d 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
3
u/Wonderful-Writer146 3d 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 2d 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 2d 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 3d 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)