This extension provides a build task for updating PR titles with an indicator of
the PR size and test coverage. It works with Azure DevOps, GitHub, and GitHub
Enterprise PRs.
It is designed to help software engineers create PRs of an appropriate size,
with appropriate levels of test coverage. It furthermore helps reviewers
understand the time they will likely need to spend reviewing a PR, allowing for
more efficient time management.

It also adds detailed metrics as a comment within the PR, highlights missing PR
descriptions and indicates files that may not need to be reviewed.



How to Use
After sharing the extension with your Azure DevOps instance, you can add the
task to a new or existing build definition.

Or you can use YAML:
steps:
- task: PRMetrics@1
  displayName: PR Metrics
  env:
    PR_METRICS_ACCESS_TOKEN: $(PR_Metrics_Access_Token)
  continueOnError: true
If you wish to modify the inputs, YAML akin the to the following can be used:
steps:
- task: PRMetrics@1
  displayName: PR Metrics
  env:
    PR_METRICS_ACCESS_TOKEN: $(PR_Metrics_Access_Token)
  inputs:
    BaseSize: 200
    GrowthRate: 2.0
    TestFactor: 1.0
    FileMatchingPatterns: |
      **/*
      !Ignore.cs
    CodeFileExtensions: |
      cs
      ps1
  continueOnError: true
Comprehensive documentation can be located here.
Parameters
The task parameters are:
- Base Size: The maximum number of new lines in an extra small PR. If left
blank, a default of 200will be used.
- Growth Rate: The growth rate applied to the base size for calculating the
size of larger PRs. If left blank, a default of 2.0will be used. With a
base size of200and a growth rate of2.0,400new lines would
constitute a medium PR while800new lines would constitute a large PR.
- Test Factor: The lines of test code expected for each line of product
code. If left blank, a default of 1.0will be used. This can be set to0.0in order to skip the reporting of the test code coverage.
- File Matching Patterns: Azure DevOps file matching patterns
specifying the files and folders to include. Autogenerated files should
typically be excluded. Excluded files will contain a comment to inform
reviewers that they are unlikely to need to review those files. If left
blank, a default of **/*(all files) will be used.
- Code File Extensions: Extensions for files containing code, so that
non-code files can be excluded. If left blank,
a default set of file extensions will be used.
- Workload Identity Federation: This is recommended instead of Personal
Access Tokens (PATs) for security reasons, but getting started with PATs is
easier. See the instructions for more
information.

Source Code
The source for this extension is on GitHub. Take, fork, and extend.
Privacy
The Azure DevOps extensions in this repository collect no user information.
Further information can be found in Microsoft's privacy statement.
Feedback & Issues
A more thorough description of the extension can be found here.
If you have feedback or encounter errors, please file an issue on
GitHub.