MCPcopy
hub / github.com/danger/danger-js / BitBucketCloud

Class BitBucketCloud

source/platforms/BitBucketCloud.ts:10–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8import { debug } from "../debug"
9
10export class BitBucketCloud implements Platform {
11 private readonly d = debug("BitBucketCloud")
12 name: string
13
14 constructor(public readonly api: BitBucketCloudAPI) {
15 this.name = "BitBucketCloud"
16 }
17
18 /**
19 * Get the Code Review description metadata
20 *
21 * @returns {Promise<any>} JSON representation
22 */
23 getReviewInfo = (): Promise<BitBucketCloudPRDSL> => this.api.getPullRequestInfo()
24
25 /**
26 * Get the Code Review diff representation
27 *
28 * @returns {Promise<GitDSL>} the git DSL
29 */
30 getPlatformGitRepresentation = (): Promise<GitJSONDSL> => gitDSLForBitBucketCloud(this.api)
31
32 /**
33 * Returns the `bitbucket_cloud` object on the Danger DSL
34 *
35 * @returns {Promise<BitBucketCloudJSONDSL>} JSON response of the DSL
36 */
37
38 getPlatformReviewDSLRepresentation = async (): Promise<BitBucketCloudJSONDSL> => {
39 let pr: BitBucketCloudPRDSL
40 try {
41 pr = await this.getReviewInfo()
42 } catch {
43 process.exitCode = 1
44 throw `
45 Could not find pull request information,
46 perhaps Danger does not have permission to access the repo.
47 `
48 }
49
50 const commits = await this.api.getPullRequestCommits()
51 const comments = await this.api.getPullRequestComments()
52 const activities = await this.api.getPullRequestActivities()
53 return {
54 metadata: this.api.repoMetadata,
55 pr,
56 commits,
57 comments,
58 activities,
59 }
60 }
61
62 supportsCommenting() {
63 return true
64 }
65
66 supportsInlineComments() {
67 return true

Callers

nothing calls this directly

Calls 7

debugFunction · 0.90
gitDSLForBitBucketCloudFunction · 0.85
getPullRequestInfoMethod · 0.45
getReviewInfoMethod · 0.45
getPullRequestCommitsMethod · 0.45

Tested by

no test coverage detected