GithubRepoStatistics

This is a standalone ruby executable that allows you to collect statistics

Installation

Prerequisite: You will need at least Ruby 3.1.0 to run this gem. You can install it throug rbenv or rvm. (e.g. brew install rvm && rvm install 3.2.2 && rvm use defaukt 3.2.2)

Installing the gem: gem install github_repo_statistics

Usage

github_repo_statistics -h
Usage: github_repo_statistics [options]
        --debug                      Enable debug mode
        --ci                         Do not print the info messages for better CI text parsing [default: false]
        --codeowners                 Print CODEOWNERS info [default: false]
        --hotspot-files              Print the found hotspot files (big files touched by many) [default: false]
        --excluded-contributors STRING
                                     Comma-delimited list of excluded contributors [example: WEB,RAILS,MOBILE]
        --excluded-files STRING      Comma-delimited list of excluded keywords [example: ViewController,AppDelegate.swift]
        --steps STRING               Number of steps the script will go into the past [default: 1]
        --duration-in-days STRING    Number of days to aggregate the changes for [default: 30]
        --path STRING                Path to the directory or file to calculate the ownership [default: "."]
        --team-regex STRING          Regex that will identify the team name [default: "[A-Za-z]+"]
        --codeowners-path STRING     Path to CODEOWNERS file [default: .github/CODEOWNERS]
        --big-file-size STRING       The amount of lines in the file to be considered big [default: 250]
        --default-branch STRING      The default branch to pull and run metrics for [default: master]
        --code-extensions STRING     The file extensions that consider to be code [default: ".kt,.swift"]
        --output-to-files            Puts the output for hotspot and codeowners into files instead of the STDOUT (useful for CI and big amount of data) [default:false]
    -v, --version                    Display the version of the gem
    -h, --help                       Display this help message

Examples of usage:
  github_repo_statistics --path src/test --exclusions WEB,RAILS --steps 2 --duration-in-days 90 --hotspot-files --debug


*Timeframe:* 2023-11-01 to 2024-01-30
     *Code files with a single contributor:* 94.4%
        *Existing files changed by many teams:* 101
        *Current existing [".swift"] files:* 1805
     *Cross-Squad Dependency:*
        *Contributions by multiple squads to the same files:* 282
        *Contributions by single squads contributing to single files:* 501
     *Hotspot Code Changes:* 42.48%
        *Churn count(commits to files by multiple teams):* 701
        *Total amount of commits:* 1650
     *Total lines of hotspot code:* 19965
     *[".swift"] files with multiple contributors:* 101
     *[".swift"] files exceeding 250 lines with multiple contributors:* 37
     *Total amount of commits to [".swift"] files:* 1650
     *Total [".swift"] files changed:* 602
     *Current total number of code files longer than 250 lines:* 102
     *Current total of [".swift"] files in the folder:* 1805
     *Contributors:* {"CCE"=>245, "SQDREACT"=>145, "DSAT"=>124, "PROD"=>111, "ORGANIC"=>92, "CS"=>75, "SF"=>61, "PCON"=>55, "ER"=>48, "VIRRCH"=>45, "PACC"=>37, "MN"=>31, "CAWLAPP"=>28, "CMT"=>25, "PAYS"=>24, "EX"=>12, "REF"=>11, "ZEST"=>3, "UFI"=>2, "VRIRRCH"=>2, "CHANGED"=>1, "CLEANUPS"=>1, "DPLAN"=>1}
force_merge_report --help
Usage: github_repo_statistics [options]
        --ci                         Do not print the info messages for better CI text parsing [default: false]
        --default-branch STRING      The default branch to pull and run metrics for [default: master]
        --github-token STRING        GitHub API token [default: ""]
        --duration-in-days STRING    Number of days to aggregate the changes for [default: 90]
        --github-repo STRING         GitHub repository name and owner (e.g. octokit/octokit) [default: ""]
    -v, --version                    Display the version of the gem
    -h, --help                       Display this help message

Examples of usage:
    force_merge_report --github-token ghp_SAKLGSJHG8asgiasKASGkhsa --github-repo octokit/octokit --duration-in-days 7

PR #12315 - Merged at: 2024-02-26 16:20:22 UTC
Failed Checks:
- Workflow: Mergeable: Size check, Conclusion: failure
---

PR #312455 - Merged at: 2024-02-26 15:01:09 UTC
Failed Checks:
- Workflow: Mergeable: PR Review, Conclusion: failure
---

Weekly Summary:
Calendar week 2022-05: Total PRs: 11, Force-merged PRs: 2
Failed Workflows:
  - Mergeable: Size check: 1
  - Mergeable: PR Review: 1
review_report -h
Usage: github_repo_statistics [options]
        --duration-in-days STRING    Number of days to aggregate the changes for [default: 90]
        --default-branch STRING      The default branch to pull and run metrics for [default: master]
        --github-token STRING        GitHub API token [default: ""]
        --github-repo STRING         GitHub repository name and owner (e.g. octokit/octokit) [default: ""]
    -v, --version                    Display the version of the gem
    -h, --help                       Display this help message

Examples of usage:
    review_report --github-token ghp_SAKLGSJHG8asgiasKASGkhsa --github-repo octokit/octokit

Calendar week 2023-04: Average time taken for 24 pull requests is 2.49 hours.
  Total reviews: 440
  Reviews with comments: 247
  Change requested reviews: 7