Skip to content
This repository has been archived by the owner on Mar 9, 2023. It is now read-only.

Commit

Permalink
#101 - Unrecognized "--from" option
Browse files Browse the repository at this point in the history
  • Loading branch information
bellingard committed Jul 20, 2020
1 parent 204208e commit 0cbae3f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions dist/index.js
Expand Up @@ -28,7 +28,7 @@ function scanCLI(cliArgs, params, callback) {
var optionsExec = prepareExecEnvironment(params, process)

// determine the command to run and execute it
scannerExecutable(sqScannerCommand => {
scannerExecutable((sqScannerCommand) => {
try {
exec(sqScannerCommand, fromParam().concat(cliArgs), optionsExec)
log('Analysis finished.')
Expand All @@ -49,7 +49,7 @@ function scanUsingCustomScanner(params, callback) {
var optionsExec = prepareExecEnvironment(params, process)

// determine the command to run and execute it
localscannerExecutable(sqScannerCommand => {
localscannerExecutable((sqScannerCommand) => {
try {
exec(sqScannerCommand, fromParam(), optionsExec)
log('Analysis finished.')
Expand All @@ -61,5 +61,11 @@ function scanUsingCustomScanner(params, callback) {
}

function fromParam() {
return [`--from=ScannerNpm/${version}`]
const forcedScannerCLIVersion = process.env.SONAR_SCANNER_VERSION || process.env.npm_config_sonar_scanner_version
if (forcedScannerCLIVersion && forcedScannerCLIVersion < '4.4') {
// When the scanner version is forced through SONAR_SCANNER_VERSION, and version is less than 4.4, don't use the scanner identity parameter
return []
} else {
return [`--from=ScannerNpm/${version}`]
}
}

0 comments on commit 0cbae3f

Please sign in to comment.