New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion: if .gitattributes has an override with linguist-language=UNKNOWN, then add it with a new random color to code line stats anyway #7
Comments
Hi thanks for your suggestion :) I really don't remember how this thing works or how to code in general anymore, does what you're asking have anything to do with this: #5 ? If not or "sort of but not really", I'd be glad to add/change whatever needs doing. It will probably take me some time to get around to it myself, so it might be more expeditious if you wanted to try to tackle it yourself and I could merge it or whatever EDIT: it looks like I made this at some point: https://github.com/dayvonjersen/linguist/compare/feature/gitattributes |
Well currently, This feature request is basically "carry through made up languages in .gitattributes to the final stats." If that leaves any associated properties like the color for the bar (if that is also configured in go linguist) missing then just pick any color e.g. based on a name hash, randomness, or whatever. This basically allows people to make up new languages the gitea instance doesn't globally know about on the spot by just setting a new name in the overrides. Useful for projects that implement & contain files in a niche language that isn't otherwise really tracked by any linguist library since it's too niche, so that these niche languages aren't just entirely ignored in the project's code stats. |
Ah, I understand now. I believe this would do that as it doesn't appear to cross-check the linguist-language specified against anything: https://github.com/dayvonjersen/linguist/compare/feature/gitattributes I guess I never merged it because I expected to merge #5 once it was working ... If something is reading a .gitattributes file it isn't using this library currently. I know you said you were trying to avoid taking this issue over to @gitea but they're quite nice from what I remember. I don't know if they're using this library; I remember I made a language bar prototype for gogs which got rejected and someone at gitea saw it and wanted to add that feature, and I know that they did eventually but I honestly don't know if they used any of my code or designs. Unfortunately, you're gonna have to take this up with them because even if I do add this feature (and I think I will, thank you sincerely for making me aware of it) I don't think it will solve your problem there :\ -day EDIT: ofc I got curious and looked and yes they have their own thing here: https://github.com/go-gitea/gitea/blob/511f6138d4b5b7a464a8fa3d7f8fc52bec3789a4/modules/git/repo_language_stats_nogogit.go very interesting i feel like we're solving a mystery 🔍 |
@dayvonjersen thanks so much for finding this out! I made a gitea ticket now: go-gitea/gitea#14528 |
Closing this since gitea implemented this now! 🎉 |
I have the following suggestion which would be really great to have on gitea which at least from my googling uses this library: it would be great if when a repo's
.gitattributes
file contains an override with linguist-language=UNKNOWN (as in the language isn't known to linguist) if then that language would be added with the given nameUNKNOWN
and any choice of unused color to the statistics such that it shows up on gitea's stats bar. This would be a really great addition for creators of small languages that have repos on gitea instances without admin access to allow them to mark their source files such that the overall repo stats are correct, even though that obviously still won't fix the missing syntax highlighting.The text was updated successfully, but these errors were encountered: