Pull request size plugin
This plugin adds the size information of pull requests to the pull request search page. It also adds the number of commits ahead and behind the destination branch.
It’s enabled by default, but you can customize it further by:
- Categorizing pull requests by size thresholds
- Enforcing a maximum size threshold using a merge check
- Excluding files when calculating the size
Thresholds
You can define thresholds
for pull request changes to easily group and classify
them into different sizes and understand them at a glance. It also allows you to filter using the sizes you’ve defined.
ts
pullRequestSize ({thresholds : {Small : {maxFiles : 3,maxTotalLines : 25},Medium : {maxTotalLines : 300},Large : {maxLinesAdded : 500,maxLinesRemoved : 300},Huge : {maxFiles : 50,maxTotalLines : 1500},},})
The names are arbitrary, and you can have as many thresholds as necessary. You
can use lines (maxTotalLines
,maxLinesAdded
,maxLinesRemoved
) and files (maxFiles
) to define the threshold criteria. Flowie automatically
creates labels and associates them based on the thresholds.
Enforce a maximum size
Once you have defined your thresholds,
you can optionally set a maximum size using the maxSize
option.
ts
pullRequestSize ({thresholds : {Small : {maxTotalLines : 100},Medium : {maxTotalLines : 300},Large : {maxTotalLines : 800},},maxSize : "Medium",})
In this example, pull requests classified above Medium
will fail the merge checks, thereby preventing them from being merged.
Excluding files
Some files or directories are generated and are usually not relevant during the code review. It’s possible to exclude these files when calculating the pull request size.
ts
pullRequestSize ({exclude : ["package-lock.json"],})
Complete example
ts
import {configure } from "flowie.app"import {pullRequestSize ,merge } from "flowie.app/plugins"configure ({plugins : [// Use merge plugin to enforce merge checksmerge (),pullRequestSize ({thresholds : {Small : {maxTotalLines : 100},Medium : {maxTotalLines : 300},Large : {maxTotalLines : 800},},maxSize : "Medium",exclude : ["package-lock.json"],}),],})