kas-elvirov / gloc

:calendar: Browser extension: counts lines of code on GitHub

Home Page:https://chrome.google.com/webstore/detail/gloc/kaodcnpebhdbpaeeemkiobcokcnegdki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No longer works on a lot of repositories (presumably > 10k commits)

paulie-g opened this issue · comments

Describe the bug
Github returns 422 when GLOC queries for stats

To Reproduce
Steps to reproduce the behavior:

  1. Go to (https://github.com/paulie-g/redis-archive)
  2. Look at GLOC counter, it will say 'unavailable'
  3. Examine return code in dev tools
  4. It will say 422

Expected behavior
Number to be shown, 200 return code for stats query

Additional context
The github API docs for the stats/code_frequency endpoint now say:

Note: This endpoint can only be used for repositories with fewer than 10,000 commits. If the repository contains 10,000 or more commits, a 422 status code will be returned.

Presumably this is what's breaking GLOC? If it is, I can't think of a way around it using the current model.

Maybe detect a 422 and use this 3rd-party API when we can't use Github?
https://codetabs.com/count-loc/count-loc-online.html

It's got a 1 request/5 seconds rate limit, so maybe only use on individual repo page.