[HN Gopher] Show HN: Codestat.dev - Stats from 2M open-source re...
___________________________________________________________________
Show HN: Codestat.dev - Stats from 2M open-source repositories
Hi HN! This is a little site I put together while learning the Elm
language as part of a hackathon at my work, I thought you might
enjoy it. Be sure to click the `(source)` buttons next to the
graphs: you can edit them interactively & write your own queries
against the entire data set. The syntax isn't well documented yet,
but you can probably get the general idea pretty quickly based on
the examples there. If you like it, have questions, etc. let me
know! If folks think this is cool, maybe I can get it turned into a
legit project. :)
Author : slimsag
Score : 29 points
Date : 2022-04-07 03:13 UTC (19 hours ago)
(HTM) web link (codestat.dev)
(TXT) w3m dump (codestat.dev)
| [deleted]
| [deleted]
| slimsag wrote:
| Details about the query syntax you can play with at
| https://codestat.dev/explorer
|
| Basic format is: content:output((REGEXP) -> $1)
|
| For example, this query will find all `License: <word>` instances
| in code/text files across all 2 million repos. It selects (`->
| $1`) the first regexp capture group `(\w+)`:
| content:output(License: (\w+)\n -> $1) count:all
|
| There are some options you can add, like `count:all` (get all
| results it can find, will timeout after 60s),
| `repo:github\\.com/myorg/` (regexp filter to just your repos)
|
| Can use this for code mining, too: to find out what the most
| common delimiter passed to `strings.Split` in Go is, for example:
| lang:go content:output(strings\.Split\(.*, (.*)\) -> $1)
| count:all
| eatonphil wrote:
| Interesting! Why are the numbers/bar chart values bouncing
| around? Is it making the same query from everyone's browser when
| you load the page?
| plibither8 wrote:
| Checked the network logs - it seems to perform an API query [0]
| which returns a stream of data, that's then computed upon on-
| the-fly in the browser.
|
| [0]:
| https://sourcegraph.com/.api/compute/stream?q=context%3A%40r...
| slimsag wrote:
| That's right, it streams every search result match back to
| your browser and the Elm code on the frontend then calculates
| the stats live.
|
| So the reason they bounce around is because new results are
| streaming in, and it's updating the chart live based on
| those.
|
| After a little bit it will stop & have found all results
___________________________________________________________________
(page generated 2022-04-07 23:01 UTC)