Skip to content

Commit 1623db9

Browse files
authored
Merge pull request #187 from codacy/feat/CF-2031-tools-upd
feat: Call `cli discover reset` on startup CF-2031
2 parents 22dc4a0 + 1d7afbb commit 1623db9

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

src/cli/CodacyCli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export abstract class CodacyCli {
3838
public abstract analyze(options: { file?: string; tool?: string }): Promise<ProcessedSarifResult[] | null>
3939

4040
public abstract configDiscover(filePath: string): Promise<void>
41-
41+
4242
public getCliCommand(): string {
4343
return this._cliCommand
4444
}

src/cli/MacCodacyCli.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,8 @@ export class MacCodacyCli extends CodacyCli {
2323

2424
if (fs.existsSync(fullPath)) {
2525
this.setCliCommand(this._cliVersion ? `CODACY_CLI_V2_VERSION=${this._cliVersion} ${localPath}` : localPath)
26-
2726
// CLI found, update it if necessary
28-
if (!this._cliVersion) {
29-
await this.update()
30-
}
31-
32-
return
27+
return await this.update()
3328
}
3429

3530
// CLI not found, attempt to install it
@@ -133,7 +128,10 @@ export class MacCodacyCli extends CodacyCli {
133128
Logger.debug('CLI mode is remote and no identification parameters provided. Skipping update and config reset.')
134129
return
135130
}
136-
await this.execAsync(updateCommand)
131+
//Call Update if CLI version is not set
132+
if (!this._cliVersion) {
133+
await this.execAsync(updateCommand)
134+
}
137135
await this.execAsync(resetCommand, resetParams)
138136

139137
// Initialize codacy-cli after update

0 commit comments

Comments
 (0)