File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 310310 "type" : " string" ,
311311 "description" : " API Personal Token"
312312 },
313+ "codacy.cliVersion" : {
314+ "type" : " string" ,
315+ "description" : " The version of the Codacy CLI to use" ,
316+ "default" : " 1.0.0-main.232.a6a6368"
317+ },
313318 "codacy.analysisMode" : {
314319 "type" : " string" ,
315320 "title" : " Local code analysis" ,
Original file line number Diff line number Diff line change @@ -15,10 +15,11 @@ const MAX_BUFFER_SIZE = 1024 * 1024 * 10
1515
1616const execAsync = ( command : string ) => {
1717 const workspacePath = vscode . workspace . workspaceFolders ?. [ 0 ] ?. uri . fsPath || ''
18+ const cliVersion = vscode . workspace . getConfiguration ( ) . get ( 'codacy.cliVersion' )
1819
1920 return new Promise ( ( resolve , reject ) => {
2021 exec (
21- `CODACY_CLI_V2_VERSION=1.0.0-main.232.a6a6368 ${ command } ` ,
22+ `${ cliVersion ? ` CODACY_CLI_V2_VERSION=${ cliVersion } ` : '' } ${ command } ` ,
2223 {
2324 cwd : workspacePath ,
2425 maxBuffer : MAX_BUFFER_SIZE , // To solve: stdout maxBuffer exceeded
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ export async function runCodacyAnalyze(filePath?: string) {
1818 try {
1919 // Get workspace folder (to solve: mkdir error)
2020 const workspaceFolders = vscode . workspace . workspaceFolders
21+ const cliVersion = vscode . workspace . getConfiguration ( ) . get ( 'codacy.cliVersion' )
2122 if ( ! workspaceFolders || workspaceFolders . length === 0 ) {
2223 throw new Error ( 'No workspace folder found' )
2324 }
@@ -27,7 +28,7 @@ export async function runCodacyAnalyze(filePath?: string) {
2728 const relativeFilePath = sanitizeFilePath ( workspaceRoot , filePath )
2829
2930 // Construct the command
30- const command = `CODACY_CLI_V2_VERSION=1.0.0-main.232.a6a6368 .codacy/cli.sh analyze --format sarif ${
31+ const command = `${ cliVersion ? ` CODACY_CLI_V2_VERSION=${ cliVersion } ` : '' } .codacy/cli.sh analyze --format sarif ${
3132 relativeFilePath || ''
3233 } `
3334
You can’t perform that action at this time.
0 commit comments