@@ -120,7 +120,7 @@ export class AutolinksProvider implements Disposable {
120120 }
121121 }
122122
123- if ( promises . length === 0 ) return ;
123+ if ( ! promises . length ) return ;
124124
125125 await Promise . allSettled ( promises ) ;
126126 }
@@ -144,7 +144,7 @@ export class AutolinksProvider implements Disposable {
144144 }
145145
146146 private async getRefSets ( remote ?: GitRemote , forBranch ?: boolean ) {
147- return this . _refsetCache . get ( remote ?. remoteKey , async ( ) => {
147+ return this . _refsetCache . get ( ` ${ remote ?. remoteKey } ${ forBranch ? ':branch' : '' } ` , async ( ) => {
148148 const refsets : RefSet [ ] = [ ] ;
149149
150150 await this . collectIntegrationAutolinks ( forBranch ? undefined : remote , refsets ) ;
@@ -158,29 +158,21 @@ export class AutolinksProvider implements Disposable {
158158 /** @returns A sorted list of autolinks. the first match is the most relevant */
159159 async getBranchAutolinks ( branchName : string , remote ?: GitRemote ) : Promise < Map < string , Autolink > > {
160160 const refsets = await this . getRefSets ( remote , true ) ;
161- if ( refsets . length === 0 ) return emptyAutolinkMap ;
161+ if ( ! refsets . length ) return emptyAutolinkMap ;
162162
163163 return getBranchAutolinks ( branchName , refsets ) ;
164164 }
165165
166- @debug < AutolinksProvider [ 'getAutolinks' ] > ( {
167- args : {
168- 0 : '<message>' ,
169- 1 : false ,
170- } ,
171- } )
166+ @debug < AutolinksProvider [ 'getAutolinks' ] > ( { args : { 0 : '<message>' , 1 : false } } )
172167 async getAutolinks ( message : string , remote ?: GitRemote ) : Promise < Map < string , Autolink > > {
173168 const refsets = await this . getRefSets ( remote ) ;
174- if ( refsets . length === 0 ) return emptyAutolinkMap ;
169+ if ( ! refsets . length ) return emptyAutolinkMap ;
175170
176171 return getAutolinks ( message , refsets ) ;
177172 }
178173
179174 getAutolinkEnrichableId ( autolink : Autolink ) : { id : string ; key : string } {
180- return {
181- id : autolink . id ,
182- key : `${ autolink . prefix } ${ autolink . id } ` ,
183- } ;
175+ return { id : autolink . id , key : `${ autolink . prefix } ${ autolink . id } ` } ;
184176 }
185177
186178 async getEnrichedAutolinks (
@@ -205,7 +197,7 @@ export class AutolinksProvider implements Disposable {
205197 if ( typeof messageOrAutolinks === 'string' ) {
206198 messageOrAutolinks = await this . getAutolinks ( messageOrAutolinks , remote ) ;
207199 }
208- if ( messageOrAutolinks . size === 0 ) return undefined ;
200+ if ( ! messageOrAutolinks . size ) return undefined ;
209201
210202 let integration = await remote ?. getIntegration ( ) ;
211203 if ( integration != null ) {
@@ -339,7 +331,7 @@ export class AutolinksProvider implements Disposable {
339331 }
340332 }
341333
342- if ( tokenMapping . size !== 0 ) {
334+ if ( tokenMapping . size ) {
343335 // eslint-disable-next-line no-control-regex
344336 text = text . replace ( / ( \x00 \d + \x00 ) / g, ( _ , t : string ) => tokenMapping . get ( t ) ?? t ) ;
345337 }
@@ -388,10 +380,9 @@ export class AutolinksProvider implements Disposable {
388380 if ( issueResult ?. value != null ) {
389381 if ( issueResult . paused ) {
390382 if ( footnotes != null && ! prs ?. has ( num ) ) {
391- let name = ref . description ?. replace ( numRegex , num ) ;
392- if ( name == null ) {
393- name = `Custom Autolink ${ ref . prefix } ${ num } ` ;
394- }
383+ const name =
384+ ref . description ?. replace ( numRegex , num ) ??
385+ `Custom Autolink ${ ref . prefix } ${ num } ` ;
395386 footnoteIndex = footnotes . size + 1 ;
396387 footnotes . set (
397388 footnoteIndex ,
@@ -426,10 +417,9 @@ export class AutolinksProvider implements Disposable {
426417 ) } `;
427418 }
428419 } else if ( footnotes != null && ! prs ?. has ( num ) ) {
429- let name = ref . description ?. replace ( numRegex , num ) ;
430- if ( name == null ) {
431- name = `Custom Autolink ${ ref . prefix } ${ num } ` ;
432- }
420+ const name =
421+ ref . description ?. replace ( numRegex , num ) ??
422+ `Custom Autolink ${ ref . prefix } ${ num } ` ;
433423 footnoteIndex = footnotes . size + 1 ;
434424 footnotes . set (
435425 footnoteIndex ,
@@ -460,10 +450,9 @@ export class AutolinksProvider implements Disposable {
460450 if ( issueResult ?. value != null ) {
461451 if ( issueResult . paused ) {
462452 if ( footnotes != null && ! prs ?. has ( num ) ) {
463- let name = ref . description ?. replace ( numRegex , num ) ;
464- if ( name == null ) {
465- name = `Custom Autolink ${ ref . prefix } ${ num } ` ;
466- }
453+ const name =
454+ ref . description ?. replace ( numRegex , num ) ??
455+ `Custom Autolink ${ ref . prefix } ${ num } ` ;
467456 footnoteIndex = footnotes . size + 1 ;
468457 footnotes . set (
469458 footnoteIndex ,
@@ -498,10 +487,9 @@ export class AutolinksProvider implements Disposable {
498487 ) } `;
499488 }
500489 } else if ( footnotes != null && ! prs ?. has ( num ) ) {
501- let name = ref . description ?. replace ( numRegex , num ) ;
502- if ( name == null ) {
503- name = `Custom Autolink ${ ref . prefix } ${ num } ` ;
504- }
490+ const name =
491+ ref . description ?. replace ( numRegex , num ) ??
492+ `Custom Autolink ${ ref . prefix } ${ num } ` ;
505493 footnoteIndex = footnotes . size + 1 ;
506494 footnotes . set (
507495 footnoteIndex ,
0 commit comments