Dev Rating is a command-line tool that suggests minimal Pull Request size for each contributor so that the PRs have the same impact to codebase. Having PRs with the same impact makes it easy to calculate the amount of work done.
It counts the deleted lines of code in the PRs and builds a contributor rating based on code stability. Low-rated members are encouraged to post more code in PR because their code statistically lives less.
Merge commits authors treated as authors of the PRs. In the case of rebased PRs, it treats each commit as a separate PR.
Usage with .NET
Install the tool:
$ dotnet tool install -g devrating.consoleapp
Add a previous PR:
$ devrating add commit -p <path-to-repo> -m <merge-commit>
Where:
<path-to-repo>
— path to a local git repository.<merge-commit>
— a merge or squash commit of a merged PR.
It updates the rating. Repeat this step for other PRs in historical order. The rating is stored in devrating.sqlite3
SQLite file in a working directory.
Print the suggested PR sizes for each contributor:
$ devrating top
Usage with Docker
Add a previous PR:
$ docker run -it --rm -v <path-to-repo>:/repo -v <working-dir>:/workspace victorx64/devrating:latest add commit -p /repo -m <merge-commit>
Where:
<path-to-repo>
— path to a local git repository.<working-dir>
— path where the rating will be stored asdevrating.sqlite3
SQLite file.<merge-commit>
— a merge or squash commit of a merged PR.
It updates the rating. Repeat this step for other PRs in historical order. The rating is stored in devrating.sqlite3
SQLite file in a working directory.
Print the suggested PR sizes for each contributor:
$ docker run -it --rm -v <path-to-repo>:/repo -v <working-dir>:/workspace victorx64/devrating:latest top
Where:
<path-to-repo>
— path to a local git repository.<working-dir>
— path where the rating is stored asdevrating.sqlite3
SQLite file.
How it works
When Developer A deletes lines of code, he increases his rating and lowers the rating of the deleted lines author (Developer B). The Elo rating system is used:
where
- $Add_{Bi}$ - number of added lines by Developer B in the $i$-th PR,
- $Del_{Ai}$ - number of deleted lines by Developer A from the $i$-th PR,
- $R_A$ - initial rating of Developer A,
- $R_B$ - initial rating of Developer B,
- $R_A^{'}$ - new rating of Developer A,
- $R_B^{'}$ - new rating of Developer B.
When the system meets a new author it sets
Minimal additions per PR:
where
- $M_A$ - the minimal added lines number for Developer A in his PRs.
An average-rated member suggested to add 25 lines of code in PRs.
Ignoring too old lines
The tool doesn't change rating if deleted line was introduced in previous major versions of code. It reads git tags with semver
to figure out when was the last major update.
Build and run
dotnet run --project ./consoleapp