Better language state detect rule #13893

Open
opened 2025-11-02 10:56:24 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @yp05327 on GitHub (Dec 29, 2024).

Description

ff96873e3e/modules/git/repo_language_stats_nogogit.go (L73)
ff96873e3e/modules/git/repo_language_stats_nogogit.go (L76)

When there's many non programming language or non markup language files in a repo, but if there's only one language, it will show this language no matter what type it is. This logic may confuse user in some cases.
e.g. there's only one python file, and many SQL file in the repo, then you will see that the language is 100% Python.
image
But if you remove the python file, you will see the language is 100% SQL.
image

It seems like a bug to the end user.

Gitea Version

latest

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

build

Database

None

Originally created by @yp05327 on GitHub (Dec 29, 2024). ### Description https://github.com/go-gitea/gitea/blob/ff96873e3e14f6eae853ec8eee59ab4482962c43/modules/git/repo_language_stats_nogogit.go#L73 https://github.com/go-gitea/gitea/blob/ff96873e3e14f6eae853ec8eee59ab4482962c43/modules/git/repo_language_stats_nogogit.go#L76 When there's many non programming language or non markup language files in a repo, but if there's only one language, it will show this language no matter what type it is. This logic may confuse user in some cases. e.g. there's only one python file, and many SQL file in the repo, then you will see that the language is 100% Python. ![image](https://github.com/user-attachments/assets/12447040-ce30-42f8-85ed-7a09680a425d) But if you remove the python file, you will see the language is 100% SQL. ![image](https://github.com/user-attachments/assets/c66c1483-a8ff-4b75-a0dd-ba7b7aa94ba2) It seems like a bug to the end user. ### Gitea Version latest ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? build ### Database None
GiteaMirror added the type/bug label 2025-11-02 10:56:24 -06:00
Author
Owner

@henrygoodman commented on GitHub (Dec 31, 2024):

It seems like Github by default does not show any languages that are not configured by linguist (SQL is classified a data language according to them), so a normal GH repo with only SQL files shows no language stats.

https://github.com/github/markup/issues/348

Seems like it might be a deliberate choice here to show some fallback if no languages were detected (my speculation), although I agree it could be muddying the waters (i.e. if you want to show stats for data languages as a fallback, why not just include them by default too)

@henrygoodman commented on GitHub (Dec 31, 2024): It seems like Github by default does not show any languages that are not configured by linguist (SQL is classified a data language according to them), so a normal GH repo with only SQL files shows no language stats. https://github.com/github/markup/issues/348 Seems like it might be a deliberate choice here to show some fallback if no languages were detected (my speculation), although I agree it could be muddying the waters (i.e. if you want to show stats for data languages as a fallback, why not just include them by default too)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#13893