mirror of
https://github.com/status-im/sourcecred.git
synced 2025-02-21 08:48:14 +00:00
This commit adds a new CLI command, `pagerank`, which runs PageRank on a given repository. At present, the command only ever uses the default weights, although I plan to make this configurable in the future. The command then saves the resultant pagerank graph in the SourceCred directory. On its own, this command is not yet very compelling, as it doesn't present any easily-consumed information (e.g. users' scores). However, it is the first step for building other commands which do just that. My intention is to make running this command the last step of `sourcecred load`, so that future commands may assume the existence of pagerank scores for any loaded repository. Test plan: The new command is thoroughly tested; see `cli/pagerank.test.js`. It also has nearly perfect code coverage (one line missing, the dependency-injected real function for loading graphs). Additionally, the following sequence of commands works: ``` $ yarn backend $ node bin/sourcecred.js load sourcecred/pm $ node bin/sourcecred.js pagerank sourcecred/pm $ cat $SOURCECRED_DIRECTORY/data/sourcecred/pm/pagerankGraph.json ``` Material progress on #967.