1- /* eslint no-underscore-dangle: ["error", { "allowAfterThis": true }] */
1+ /* eslint-disable no-underscore-dangle */
22
33'use strict' ;
44
@@ -200,7 +200,7 @@ class BitbucketScm extends Scm {
200200 }
201201
202202 return this . breaker . runCommand ( params )
203- . then ( checkResponseError ) ;
203+ . then ( checkResponseError ) ;
204204 }
205205
206206 /**
@@ -224,14 +224,14 @@ class BitbucketScm extends Scm {
224224 token : config . token ,
225225 url : config . url
226226 } )
227- . then ( hookInfo =>
228- this . _createWebhook ( {
229- hookInfo,
230- repoId : repoInfo . repoId ,
231- token : config . token ,
232- url : config . url
233- } )
234- ) ;
227+ . then ( hookInfo =>
228+ this . _createWebhook ( {
229+ hookInfo,
230+ repoId : repoInfo . repoId ,
231+ token : config . token ,
232+ url : config . url
233+ } )
234+ ) ;
235235 }
236236
237237 /**
@@ -376,16 +376,16 @@ class BitbucketScm extends Scm {
376376 } ) ;
377377 }
378378
379- /**
380- * Decorate a given SCM URI with additional data to better display
381- * related information. If a branch suffix is not provided, it will default
382- * to the master branch
383- * @method decorateUrl
384- * @param {Config } config Configuration object
385- * @param {String } config.scmUri The scmUri
386- * @param {String } config.token Service token to authenticate with Bitbucket
387- * @return {Object } Resolves to a decoratedUrl with url, name, and branch
388- */
379+ /**
380+ * Decorate a given SCM URI with additional data to better display
381+ * related information. If a branch suffix is not provided, it will default
382+ * to the master branch
383+ * @method decorateUrl
384+ * @param {Config } config Configuration object
385+ * @param {String } config.scmUri The scmUri
386+ * @param {String } config.token Service token to authenticate with Bitbucket
387+ * @return {Object } Resolves to a decoratedUrl with url, name, and branch
388+ */
389389 _decorateUrl ( config ) {
390390 const scm = getScmUriParts ( config . scmUri ) ;
391391 const options = {
@@ -491,6 +491,21 @@ class BitbucketScm extends Scm {
491491 } ) ;
492492 }
493493
494+ /**
495+ * Bitbucket doesn't have an equivalent endpoint to get the changed files,
496+ * so returning null for now
497+ * @method getFile
498+ * @param {Object } config Configuration
499+ * @param {String } config.type Can be 'pr' or 'repo'
500+ * @param {Object } config.webhookPayload The webhook payload received from the
501+ * SCM service.
502+ * @param {String } config.token Service token to authenticate with Github
503+ * @return {Promise } Resolves to the content of the file
504+ */
505+ _getChangedFiles ( ) {
506+ return Promise . resolve ( null ) ;
507+ }
508+
494509 /**
495510 * Fetch content of a file from Bitbucket
496511 * @method getFile
@@ -621,11 +636,11 @@ class BitbucketScm extends Scm {
621636 } ) ;
622637 }
623638
624- /**
625- * Return a valid Bell configuration (for OAuth)
626- * @method getBellConfiguration
627- * @return {Promise }
628- */
639+ /**
640+ * Return a valid Bell configuration (for OAuth)
641+ * @method getBellConfiguration
642+ * @return {Promise }
643+ */
629644 _getBellConfiguration ( ) {
630645 const scmContexts = this . _getScmContexts ( ) ;
631646 const scmContext = scmContexts [ 0 ] ;
@@ -643,18 +658,18 @@ class BitbucketScm extends Scm {
643658 } ) ;
644659 }
645660
646- /**
647- * Checkout the source code from a repository; resolves as an object with checkout commands
648- * @method getCheckoutCommand
649- * @param {Object } config
650- * @param {String } config.branch Pipeline branch
651- * @param {String } config.host Scm host to checkout source code from
652- * @param {String } config.org Scm org name
653- * @param {String } config.repo Scm repo name
654- * @param {String } config.sha Commit sha
655- * @param {String } [config.prRef] PR reference (can be a PR branch or reference)
656- * @return {Promise }
657- */
661+ /**
662+ * Checkout the source code from a repository; resolves as an object with checkout commands
663+ * @method getCheckoutCommand
664+ * @param {Object } config
665+ * @param {String } config.branch Pipeline branch
666+ * @param {String } config.host Scm host to checkout source code from
667+ * @param {String } config.org Scm org name
668+ * @param {String } config.repo Scm repo name
669+ * @param {String } config.sha Commit sha
670+ * @param {String } [config.prRef] PR reference (can be a PR branch or reference)
671+ * @return {Promise }
672+ */
658673 _getCheckoutCommand ( config ) {
659674 const checkoutUrl = `${ config . host } /${ config . org } /${ config . repo } ` ;
660675 const sshCheckoutUrl = `git@${ config . host } :${ config . org } /${ config . repo } ` ;
@@ -695,13 +710,13 @@ class BitbucketScm extends Scm {
695710 }
696711
697712 /**
698- * Get list of objects (each consists of opened PR name and ref (branch)) of a pipeline
699- * @method getOpenedPRs
700- * @param {Object } config Configuration
701- * @param {String } config.scmUri The scmUri to get opened PRs
702- * @param {String } config.token The token used to authenticate to the SCM
703- * @return {Promise }
704- */
713+ * Get list of objects (each consists of opened PR name and ref (branch)) of a pipeline
714+ * @method getOpenedPRs
715+ * @param {Object } config Configuration
716+ * @param {String } config.scmUri The scmUri to get opened PRs
717+ * @param {String } config.token The token used to authenticate to the SCM
718+ * @return {Promise }
719+ */
705720 _getOpenedPRs ( config ) {
706721 const repoId = getScmUriParts ( config . scmUri ) . repoId ;
707722
@@ -725,14 +740,14 @@ class BitbucketScm extends Scm {
725740 }
726741
727742 /**
728- * Resolve a pull request object based on the config
729- * @method getPrRef
730- * @param {Object } config Configuration
731- * @param {String } config.scmUri The scmUri to get PR info of
732- * @param {String } config.token The token used to authenticate to the SCM
733- * @param {Integer } config.prNum The PR number used to fetch the PR
734- * @return {Promise }
735- */
743+ * Resolve a pull request object based on the config
744+ * @method getPrRef
745+ * @param {Object } config Configuration
746+ * @param {String } config.scmUri The scmUri to get PR info of
747+ * @param {String } config.token The token used to authenticate to the SCM
748+ * @param {Integer } config.prNum The PR number used to fetch the PR
749+ * @return {Promise }
750+ */
736751 _getPrInfo ( config ) {
737752 const repoId = getScmUriParts ( config . scmUri ) . repoId ;
738753
@@ -769,24 +784,24 @@ class BitbucketScm extends Scm {
769784 return { [ scmContext ] : stats } ;
770785 }
771786
772- /**
773- * Get an array of scm context (e.g. bitbucket:bitbucket.org)
774- * @method getScmContexts
775- * @return {Array }
776- */
787+ /**
788+ * Get an array of scm context (e.g. bitbucket:bitbucket.org)
789+ * @method getScmContexts
790+ * @return {Array }
791+ */
777792 _getScmContexts ( ) {
778793 const contextName = [ `bitbucket:${ this . hostname } ` ] ;
779794
780795 return contextName ;
781796 }
782797
783- /**
784- * Determine if a scm module can handle the received webhook
785- * @method canHandleWebhook
786- * @param {Object } headers The request headers associated with the webhook payload
787- * @param {Object } payload The webhook payload received from the SCM service
788- * @return {Promise }
789- * */
798+ /**
799+ * Determine if a scm module can handle the received webhook
800+ * @method canHandleWebhook
801+ * @param {Object } headers The request headers associated with the webhook payload
802+ * @param {Object } payload The webhook payload received from the SCM service
803+ * @return {Promise }
804+ */
790805 _canHandleWebhook ( headers , payload ) {
791806 return this . _parseHook ( headers , payload ) . then ( ( parseResult ) => {
792807 if ( parseResult === null ) {
0 commit comments