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

Add include or exclude languages parameter to top languages api #307

Closed
wants to merge 7 commits into from
Closed

Add include or exclude languages parameter to top languages api #307

wants to merge 7 commits into from

Conversation

vn7n24fzkq
Copy link

@vn7n24fzkq vn7n24fzkq commented Aug 4, 2020

Thanks for your awesome work first.

I add two parameter to include or exclude languages.
Because some framework generate a lot of file which repository owner not actually write those language by self.
So maybe some developer will need this to exclude some language they not good at.

If someone want exclude c++,c# ,Visual Basic, css, html, and javascript.
It would be.

http://localhost:3000/api/top-langs/?username={username}&layout=compact&exclude_lang=cplusplus+csharp+visualbasic+CSS+HTML+javascript

Because url not allowed some special character, like C++ contains + or C# contains #.
So they need replace + with plus , # with sharp and trim space character.

In my case, I don't write c and c# actually.

http://localhost:3000/api/top-langs/?username=vn7n24fzkq&layout=compact&count_private=true

image

So I want ignore it.
And after I add exclude language.

http://localhost:3000/api/top-langs/?username=vn7n24fzkq&layout=compact&count_private=true&exclude_lang=C+csharp

image

If I only want display some language

http://localhost:3000/api/top-langs/?username=vn7n24fzkq&layout=compact&count_private=true&theme=dark&include_lang=javascript+java+kotlin+dart+rust

image

@codecov
Copy link

codecov bot commented Aug 4, 2020

Codecov Report

Merging #307 into master will decrease coverage by 0.52%.
The diff coverage is 80.95%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #307      +/-   ##
==========================================
- Coverage   93.91%   93.39%   -0.53%     
==========================================
  Files          17       17              
  Lines         526      545      +19     
  Branches      143      153      +10     
==========================================
+ Hits          494      509      +15     
- Misses         28       32       +4     
  Partials        4        4              
Impacted Files Coverage Δ
api/top-langs.js 82.75% <69.23%> (-11.36%) ⬇️
src/fetchers/top-languages-fetcher.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 389c3ab...f1f897a. Read the comment docs.

@vn7n24fzkq
Copy link
Author

vn7n24fzkq commented Aug 4, 2020

Found an error.
I will push after fix it.

@vn7n24fzkq
Copy link
Author

I am enhancing, make that can include and exclude language

@vn7n24fzkq
Copy link
Author

Done

@vn7n24fzkq vn7n24fzkq changed the title Add ignore languages parameter to top languages Add include or exclude languages parameter to top languages api Aug 4, 2020
@tobiasvl
Copy link

tobiasvl commented Aug 4, 2020

This would be a great change. To me, the current behavior of hiding languages without replacing them with lesser used languages doesn't make much sense (and yes, I know that @anuraghazra intended it to work like that, but I don't understand why). The main use case for hiding languages must surely be to hide vendored/generated code.

@vn7n24fzkq
Copy link
Author

vn7n24fzkq commented Aug 6, 2020

@anuraghazra Hi, wondering can this PR be merged, or I need optimize performance.

@X3llus
Copy link

X3llus commented Aug 6, 2020

@anuraghazra I also think this should be merged, I have languages I don't even program with being shown in my top 5 just because of file size/auto generated files from projects.

@alexxxdev
Copy link

@vn7n24fzkq resolve conflicts, maybe the PR will budge

@vn7n24fzkq
Copy link
Author

vn7n24fzkq commented Aug 14, 2020

@alexxxdev Thanks.
Theme preview failed, because this PR doesn't change theme.

@alexxxdev
Copy link

@anuraghazra Will there be any movement on this PR?

@jha-vineet69
Copy link
Contributor

This is exactly what I'm looking for. Kindly merge this feature @anuraghazra.

@hbollon
Copy link

hbollon commented Aug 28, 2020

Any update on this PR @anuraghazra?

@will-molloy
Copy link

Merge pls!

@itsalb3rt
Copy link

itsalb3rt commented Sep 12, 2020

While this applies, they can exclude languages with special symbols like for example in my case c++ with the coded the plus symbol equivalent %2b: c%2b%2b

Normal:
itsalb3rt

Modify: Exclude c++

itsalb3rt

For Sharp symbol use %23.

Reference: https://en.wikipedia.org/wiki/Percent-encoding

@will-molloy
Copy link

#445 was recently merged so you can (kind of) achieve this with a combination of hide and langs_count. But it's not really a robust solution, the languages you hide could one day fall out of the top languages, so you suddenly have more showing on the card.

I'm not sure why @anuraghazra chooses to merge #445 but completely ignore #307.

@stale
Copy link

stale bot commented Dec 6, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale Issue is marked as stale. label Dec 6, 2020
@stale stale bot closed this Dec 13, 2020
@vn7n24fzkq vn7n24fzkq mentioned this pull request Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Issue is marked as stale.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants