Skip to content

LoremLabs/kudos-for-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kudos for Code

Overview

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:

  1. Collecting Dependencies: It extracts the dependencies from analyzer-result.json based on a given depth.
  2. Cloning Git Repositories: The tool clones the Git repositories of the extracted dependencies to gather further information.
  3. Collecting Author Emails: Author emails are collected from the cloned repositories, which are essential for identifying contributors.
  4. Calculating Kudos Weight: The kudos weight is calculated based on the dependency depth and the number of commits attributed to each author email.
  5. Generating Kudos: Kudos are generated in ndjson (newline delimited JSON) format, providing a clear and structured output.

How to Run

Generate

To use Kudos for Code, follow these steps:

  1. Ensure you have Go installed.
  2. Run the following command in the terminal, providing the projectName and the path to the analyzer-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

Ink

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.

Sample Output

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.

Input and Output

Input from ORT

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.

Output by Kudos for Code

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!