UNPKG

1.48 kBMarkdownView Raw
1# Project Reviewers
2Project 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
5The core interface is `ProjectReviewer`:
6
7```typescript
8export 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
16command handlers that review (look at the contents of and possibly
17comment on) multiple projects.
18
19It works with the `ProjectReviewer` type, and takes care of cloning repos:
20
21```typescript
22export 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
29export interface ProjectReview {
30
31 repoId: RepoId;
32
33 comments: ReviewComment[];
34}
35```
36
37`ReviewerCommandSupport` implements the `handle` method and takes care
38of cloning all repos within an org. Subclasses need to implement only
39one method to return a `ProjectReviewer` function that will review
40individual projects:
41
42```typescript
43projectReviewer(context: HandlerContext): ProjectReviewer<PR>;
44```
45
46Like the editor convenience class, `ReviewCommandSupport` can run
47either locally or remotely, depending on the provision of a `local`
48flag.