review_ratio: Review to pull request ratio#

The review to pull request ratio of the author compared with a number.

Holds when the state review_ratio: Review to pull request ratio of the author of the pull request, counted in all repositories of the project, compares with the input ratio as the input comparison says, such as below 1: the author gave fewer reviews than they opened pull requests that others had to look at. The ratio is

reviews_given / (pull_requests_opened - own_pull_requests_closed)

of the states reviews_given: Reviews given, pull_requests_opened: Pull requests opened and own_pull_requests_closed: Own pull requests closed. For example:

  • 1: as many reviews as pull requests,

  • 0.5: half as many reviews as pull requests,

  • 2: twice as many reviews as pull requests.

It is checked on pull requests only. While the data of a repository of the project is not complete, the condition cannot be assessed yet.

Inputs#

Name

Type

Required

What it is

comparison

comparison

no, above

How the ratio compares with the number: above, below, at_most, at_least or exactly, see reviews: Reviews; at most and at least include the number.

ratio

number

yes

The reviews given for each pull request opened and not closed by the author.

kinds

review-kinds

no, all of them

The kinds of reviews that count: approved, changes_requested, commented and dismissed.

The input kinds comes from the state review_ratio: Review to pull request ratio, which has it from reviews_given: Reviews given: the inputs of a state travel to the conditions and states that use it.

The type number is a number with a point before a fraction, from 0 up.

The inputs as JSON:

{"comparison": "below", "ratio": 1}

Data#

The update of the repository reads in the background:

issue

Whether the pull request is open, closed or merged. Permissions of the GitHub App: pull_requests: read; webhooks: pull_request.

reviews

The reviews of the pull requests and who closed them. Permissions of the GitHub App: pull_requests: read; webhooks: pull_request_review, pull_request.

API reference#

class pycal_dashboard.conditions.condition.review_ratio.ReviewRatioCompared#

Bases: Condition

The review to pull request ratio of the author of a pull request, compared with a number.

Holds when the state review_ratio of the author, counted in all repositories of the project, compares with the input ratio as the input comparison says, such as below 1: the author gave fewer reviews than they opened pull requests that others had to look at. 1 is as many reviews as pull requests, 0.5 half as many, 2 twice as many.

classmethod assess(issue, values, scope=None)#

Whether the ratio of the author compares with the input.

Parameters:
  • issue – The pull request.

  • values – comparison, ratio and the inputs of the state, such as kinds.

  • scope – The repositories of the project.

Returns:

True if it holds; False for a pull request without an author.