Reconsider code percentage heuristics to show more details #12335

Closed
opened 2025-11-02 10:05:59 -06:00 by GiteaMirror · 7 comments
Owner

Originally created by @ghost on GitHub (Jan 15, 2024).

Description

Gitea seems to ignore many files in it's analysis of repos when generating the repo contents graphics. I noticed this on my repo which is a Hugo static site. It claims the repo is Javascript 99.8% which, feels like an inaccurate representation of it's contents.

I can see how Gitea might arrive at this assumption (with my repo) as there are 27 MB of compiled JS files committed and only 2.4 MB of non-JS files. I assume the current heuristic is looking mostly at file size and ignoring images.

However, this seems incorrect representation as the JS files are only 2 or 52 files in total, with 3 image files. There are also .css, .yaml, .sh files in my repo which are ignored.

I suggest Gitea to always show some representation of files and also account for volume of files such as:

  • html
  • md
  • css
  • sh
  • yaml
  • json
  • images

This is a relatively minor UX improvement, but I think it will help with a better experience when glancing at repos.

Screenshots

Screenshot 2024-01-15 at 14-27-02 future

Gitea Version

1.21.3

Can you reproduce the bug on the Gitea demo site?

Yes

Operating System

No response

Browser Version

Firefox 115

Originally created by @ghost on GitHub (Jan 15, 2024). ### Description Gitea seems to ignore many files in it's analysis of repos when generating the repo contents graphics. I noticed this on [my repo](https://gitea.com/basebuilder/future) which is a Hugo static site. It claims the repo is `Javascript 99.8%` which, feels like an inaccurate representation of it's contents. I can see how Gitea might arrive at this assumption (with my repo) as there are 27 MB of compiled JS files committed and only 2.4 MB of non-JS files. I assume the current heuristic is looking mostly at file size and ignoring images. However, this seems incorrect representation as the **JS files are only 2 or 52 files in total**, with 3 image files. There are also `.css, .yaml, .sh` files in my repo which are ignored. I suggest Gitea to always show some representation of files and also account for volume of files such as: - html - md - css - sh - yaml - json - images This is a relatively minor UX improvement, but I think it will help with a better experience when glancing at repos. ### Screenshots ![Screenshot 2024-01-15 at 14-27-02 future](https://github.com/go-gitea/gitea/assets/74658385/22be4f95-40f6-4a5c-b4eb-aa3fb7b3bceb) ### Gitea Version 1.21.3 ### Can you reproduce the bug on the Gitea demo site? Yes ### Operating System _No response_ ### Browser Version Firefox 115
GiteaMirror added the issue/needs-feedbacktopic/uiissue/not-a-bug labels 2025-11-02 10:05:59 -06:00
Author
Owner
@delvh commented on GitHub (Jan 15, 2024): https://docs.github.com/en/repositories/working-with-files/managing-files/customizing-how-changed-files-appear-on-github Also works for Gitea.
Author
Owner

@algernon commented on GitHub (Jan 18, 2024):

FWIW, while you can customize how changed files appear, that does not make it possible to include Markdown or other files Enry considers documentation in the language stats. You can exclude files from the stats, but you can't currently make excluded ones be included instead (unless if they're excluded due to being vendored or generated).

@algernon commented on GitHub (Jan 18, 2024): FWIW, while you can customize how changed files appear, that does not make it possible to include Markdown or other files Enry considers documentation in the language stats. You can *exclude* files from the stats, but you can't currently make excluded ones be included instead (unless if they're excluded due to being vendored or generated).
Author
Owner

@techknowlogick commented on GitHub (Jan 18, 2024):

Thanks for opening this up as a suggestion. As @algernon has said, Gitea uses enry for this analysis, and some upstream changes would need to be made for us to support it here. I'm sure they'd love a PR if you were able to contribute one, or if not, then perhaps a feature request so they could triage it. A Gitea maintainer, is also a maintainer over there.

As we can't do anything with this suggestion yet, I am going to close it, but please feel free to re-open when we can :)

@techknowlogick commented on GitHub (Jan 18, 2024): Thanks for opening this up as a suggestion. As @algernon has said, Gitea uses [enry](https://github.com/go-enry/go-enry) for this analysis, and some upstream changes would need to be made for us to support it here. I'm sure they'd love a PR if you were able to contribute one, or if not, then perhaps a feature request so they could triage it. A Gitea maintainer, is also a maintainer over there. As we can't do anything with this suggestion yet, I am going to close it, but please feel free to re-open when we can :)
Author
Owner

@algernon commented on GitHub (Jan 18, 2024):

The code for this is actually not in Enry, but in Gitea. There's no need to change anything in Enry to support more linguist-* attributes.

@algernon commented on GitHub (Jan 18, 2024): The code for this is actually not in Enry, but [in Gitea](https://github.com/go-gitea/gitea/blob/4674aea25b54baf08594c54f061dee9e44190f02/modules/git/repo_language_stats_nogogit.go#L142-L145). There's no need to change anything in Enry to support more `linguist-*` attributes.
Author
Owner

@techknowlogick commented on GitHub (Jan 19, 2024):

@algernon thanks, I've re-opened this :)

@techknowlogick commented on GitHub (Jan 19, 2024): @algernon thanks, I've re-opened this :)
Author
Owner

@GiteaBot commented on GitHub (Feb 18, 2024):

We close issues that need feedback from the author if there were no new comments for a month. 🍵

@GiteaBot commented on GitHub (Feb 18, 2024): We close issues that need feedback from the author if there were no new comments for a month. :tea:
Author
Owner

@github-actions[bot] commented on GitHub (Feb 29, 2024):

Automatically locked because of our CONTRIBUTING guidelines

@github-actions[bot] commented on GitHub (Feb 29, 2024): Automatically locked because of our [CONTRIBUTING guidelines](https://github.com/go-gitea/gitea/blob/main/CONTRIBUTING.md#issue-locking)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12335