Kudos for Code is a tool that generates recognition (kudos) for contributors based on their contributions to a project's dependencies. It takes input from ORT (OSS Review Toolkit) in the form of analyzer-result.json, which contains information about the project's dependencies. The tool then performs the following steps:
- Collecting Dependencies: It extracts the dependencies from
analyzer-result.json
based on a given depth. - Cloning Git Repositories: The tool clones the Git repositories of the extracted dependencies to gather further information.
- Collecting Author Emails: Author emails are collected from the cloned repositories, which are essential for identifying contributors.
- Calculating Kudos Weight: The kudos weight is calculated based on the dependency depth and the number of commits attributed to each author email.
- Generating Kudos: Kudos are generated in ndjson (newline delimited JSON) format, providing a clear and structured output.
To use Kudos for Code, follow these steps:
- Ensure you have Go installed.
- Run the following command in the terminal, providing the
projectName
and the path to theanalyzer-result.json
file as arguments:
go run . generate -i [ORTAnalyzerResultFilePath]
Example:
go run . generate -i ./test/analyzer-result.json
For advanced use:
go run . generate \
--inputfilepath ./test/analyzer-result.json \
--nomerges true \
--validemails false \
--limitdepth 3 \
--projectname test
or
go run . generate \
-i ./test/analyzer-result.json \
-m true \
-v false \
-d 3 \
-n test
For help:
go run . help
To ink kudos with generated kudos from generate
command, follow the following script:
% go run . generate \ (main)kudos-for-code
--inputfilepath ./test/analyzer-result.json \
--nomerges true \
--validemails false \
--limitdepth 2 \
--projectname test \
| go run . ink -i [pool-id] -e https://api.semicolons.com
With -v
option, it will validate result between kudos from generate
and ink
. It is just for test purpose.
Kudos for Code generates output in ndjson format, with each kudos entry having the following structure:
{
"traceId": "bPNAr45YSfytbQyGz6FaGA",
"id": "oPSbCm4SQNG4Z12z4-bjtg",
"identifier": "email:demo@demoemail.com",
"ts": "2023-07-31T04:16:36.88501Z",
"weight": "0.008929",
"description": "NPM::p-timeout:6.1.2 contribution"
}
- traceId: A transaction ID for the entire ndjson.
- id: A unique ID for each kudos entry.
- identifier: A DID (Decentralized Identifier) representing each contributor identified by their email.
- ts: The timestamp of when the kudos was generated.
- weight: The contribution weight of the identifier to the package.
- description: A formatted string indicating the contribution details, including package manager, package name, and version.
Kudos for Code requires input in the form of analyzer-result.json
, which is generated by the OSS Review Toolkit (ORT) for a specific project folder. This JSON file contains information about the project's dependencies and is used as the basis for generating kudos.
Kudos for Code generates recognition for contributors in ndjson format, as explained in the "Sample Output" section above.
We hope you find Kudos for Code helpful in acknowledging and appreciating your project's contributors!