1 | # Project Reviewers
|
2 | Project Reviewers are functions that can run across projects, identifying any problems that should be addressed. They are used in Atomist automations.
|
3 |
|
4 | ## The ProjectReviewer Function
|
5 | The core interface is `ProjectReviewer`:
|
6 |
|
7 | ```typescript
|
8 | export type ProjectReviewer<P = undefined, PR extends ProjectReview = ProjectReview> =
|
9 | (p: Project, context: HandlerContext, params?: P) => Promise<PR>;
|
10 | ```
|
11 |
|
12 |
|
13 | ## Implementing Project Reviewer Command Handlers
|
14 |
|
15 | `ReviewerCommandSupport` is a convenience superclass for writing
|
16 | command handlers that review (look at the contents of and possibly
|
17 | comment on) multiple projects.
|
18 |
|
19 | It works with the `ProjectReviewer` type, and takes care of cloning repos:
|
20 |
|
21 | ```typescript
|
22 | export type ProjectReviewer<RR extends ProjectReview> =
|
23 | (id: RepoId, p: Project, context: HandlerContext) => Promise<RR>;
|
24 | ```
|
25 |
|
26 | `ProjectReview` contains repo identification and comments:
|
27 |
|
28 | ```typescript
|
29 | export interface ProjectReview {
|
30 |
|
31 | repoId: RepoId;
|
32 |
|
33 | comments: ReviewComment[];
|
34 | }
|
35 | ```
|
36 |
|
37 | `ReviewerCommandSupport` implements the `handle` method and takes care
|
38 | of cloning all repos within an org. Subclasses need to implement only
|
39 | one method to return a `ProjectReviewer` function that will review
|
40 | individual projects:
|
41 |
|
42 | ```typescript
|
43 | projectReviewer(context: HandlerContext): ProjectReviewer<PR>;
|
44 | ```
|
45 |
|
46 | Like the editor convenience class, `ReviewCommandSupport` can run
|
47 | either locally or remotely, depending on the provision of a `local`
|
48 | flag.
|