Skip to content
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

Top Languages card results are incorrect #1801

Open
JmKanmo opened this issue Jun 3, 2022 · 9 comments
Open

Top Languages card results are incorrect #1801

JmKanmo opened this issue Jun 3, 2022 · 9 comments
Labels
bug Something isn't working. high-priority High priority issue or PR. lang-card Issues related to the language card. ⭐ top bug Top bug. ⭐ top issue Top issue.

Comments

@JmKanmo
Copy link

JmKanmo commented Jun 3, 2022

I write it in my read.me file like below

Top Langs

but I don't use python language code ...
My major used language is java.

So I test it other below site.
http://ionicabizau.github.io/github-profile-languages/?user=JmKanmo

and the result is like it.

bb

Why is this?

@MSBivens
Copy link

MSBivens commented Jun 5, 2022

Having a similar issue where it seems more like mine just hasn't updated in weeks

@rickstaa rickstaa added the bug Something isn't working. label Jun 5, 2022
@Zordon1337
Copy link

same here

@nicolasfara
Copy link

Same

@amandie-ct
Copy link

Same :( my contribution to private repositories is not being accounted for, even though I added the param to show them.

@rickstaa
Copy link
Collaborator

rickstaa commented Jul 6, 2022

@JmKanmo Thanks for your issue. We are aware of the inaccuracy of the language card. Limitations of the current GraphQL implementation cause it (see #1803 and #1122 (comment) for more information).

Currently, the GraphQL API does not allow us to fetch language results for individual users. It only returns language results for repositories. As a result, the language card is not showing the correct statistics. I created a feature request with GitHub that improves this behaviour. You can show your support at community/community#18230. If enough people show their support, we might be able to improve the language results of github-readme-stats in the future. Additionally, we currently only fetch the first 100 repositories causing the language card to be incorrect (see #1852).

I also checked https://ionicabizau.github.io/github-profile-languages to see if it produced better results. That repository used the Github Rest API to fetch all repositories of a user to get the language results. Consequently, since this also includes forks, the results given by that tool will be worse for most user accounts.

You can also show your support for #1732, which slightly improves the language card behaviour by allowing users to scale their language results.

@rickstaa rickstaa added the lang-card Issues related to the language card. label Jul 6, 2022
@rickstaa rickstaa changed the title github Top Langs (most used languages rank) function doesn't work correctly Top Languages card results are incorrect Jul 6, 2022
@rickstaa
Copy link
Collaborator

rickstaa commented Jul 7, 2022

To summarize the following things can be done to improve the language card:

@rickstaa rickstaa added the high-priority High priority issue or PR. label Oct 10, 2022
AnthonyLzq added a commit to AnthonyLzq/AnthonyLzq that referenced this issue Nov 25, 2022
This was referenced Apr 24, 2023
Closed
@rickstaa rickstaa added the ⭐ top bug Top bug. label May 9, 2023
@fsantamaria1
Copy link

Hey @JmKanmo

Are you using the default language weight?

The top languages card shows the percentage based on the size of the repositories by default.

Also: By default, the language card shows language results only from public repositories. To include languages used in private repositories, you should deploy your own instance using your own GitHub API token.

Algorithm

It uses the following algorithm to calculate the languages percentages on the language card:

ranking_index = (byte_count ^ size_weight) * (repo_count ^ count_weight)

By default, only the byte count is used for determining the languages percentages shown on the language card (i.e. size_weight=1 and count_weight=0). You can, however, use the &size_weight= and &count_weight= options to weight the language usage calculation. The values must be positive real numbers. More details about the algorithm can be found here.

  • &size_weight=1&count_weight=0 - (default) Orders by byte count.
  • &size_weight=0.5&count_weight=0.5 - (recommended) Uses both byte and repo count for ranking
  • &size_weight=0&count_weight=1 - Orders by repo count

In my case, I am using &size_weight=0&count_weight=1 because I usually code in Python, but I have one repository with huge Google Collab notebook that uses 60% of my card if I use the default settings.

@JmKanmo
Copy link
Author

JmKanmo commented Aug 30, 2023

Thank you all for your kind replies. I checked the answer and then updated README.MD like below

![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=JmKanmo&size_weight=0.5&count_weight=0.5&layout=compact&theme=dark)](https:/JmKanmo/JmKanmo) </br> </br>

I have python repositories like below.
https:/JmKanmo/UserManagerWebsite
https:/JmKanmo/PetService_Web
https:/JmKanmo/PythonBasicStudy

If we were to calculate percentage statistics based on byte count, perhaps more code would be counted in the Python repository. At this level, I don't think it's that bad. Thank you for your detailed answer and guide.

ds

@JmKanmo JmKanmo closed this as completed Aug 30, 2023
@rickstaa rickstaa reopened this Sep 11, 2023
@rickstaa
Copy link
Collaborator

@JmKanmo, there are still some issues with the language algorithm that require attention:

  1. Currently, the algorithm only considers the first 100 repositories of a user, as documented in this GitHub issue (Stats and languages results incorrect due to graphql 100 records limit #1852).
  2. Forks and organization repositories are not included in the language calculation, as reported in these two issues ([Feature Request] Add organization stats #1 and Add option to include forks #3109).
  3. The algorithm relies on the languages found in a repository rather than the languages a user has actively used, which is discussed in this issue (Top Languages card results are incorrect #1801 (comment)).

Addressing the first three points could be accomplished by releasing a GitHub Action, as suggested in this issue (#2179). However, the last point requires intervention from GitHub itself, and you can just express your support for this improvement in the GitHub Community Discussions at (https:/orgs/community/discussions/18230). Let's keep this issue open to monitor progress on resolving these problems. 🚀

@github-actions github-actions bot added the ⭐ top issue Top issue. label Dec 28, 2023
@github-actions github-actions bot removed the ⭐ top issue Top issue. label Feb 25, 2024
@github-actions github-actions bot added the ⭐ top issue Top issue. label Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working. high-priority High priority issue or PR. lang-card Issues related to the language card. ⭐ top bug Top bug. ⭐ top issue Top issue.
Projects
None yet
Development

No branches or pull requests

7 participants