We recommend setting these values as environment variables, but you can also pass them as command-line arguments.
Copy npm install dotenv dotenv-cli
Copy {
"scripts" : {
"promyze-cli" : "dotenv -e .env.promyze promyze-cli scan ."
}
}
Run a scan in standalone mode
Copy promyze-cli scan .
//or npm run promyze-cli if you 've followed above instructions
If yes, you can check the section below to configure the code analysis.
Copy Usage: Promyze scan [options] [sources]
Scan the comma-separated list of files/directories to detect negative examples of best practices
Options:
-e, --exclude < exclud e > Comma-separated list of patterns to exclude files that contain one of them (ex: "Listener" ). These are only string patterns, not regular expressions ( default: "dist/,node_modules,.min.,.map.,.git/" )
-ext, --extensions < severit y > Comma-separated list of extensions to exclusively include, ex: ".js,.ts" . (default: "" )
-m, --mode < mod e > Execution mode:
* "all" : scan all the codebase
* "onlyChanged" : Should only scan edited files on SCM (only Git is supported ): ( default: "all" )
-g, --grouped < groupe d > For the "console" formatter, group the result by files or practices: [ "files" , "practices" ]. (default: "files" )
-f, --formatters < formatter s > Comma-separated list of formatters: [ "console" , "sonarqube" , "sarif" ]. (default: "console" )
-o, --output < outputFil e > File output when formatters do not only include "console" (default: "promyze-scan.json" )
-s, --severity < severit y > Severity of the issues in the report, such as "WARNING" , "MAJOR" , "BLOCKER" , .... Only relevant when formatter is "sonarqube" or "sarif" . (default: "MAJOR" )
-t, --type < issueTyp e > Exclude file patterns, such as "CODE_SMELL" , "VULNERABILITY" , "BUG" , ... Only relevant when formatter is "sonarqube" or "sarif" (default: "CODE_SMELL" )
-sp, --spaces < space s > Restrict the results to practices included into specific spaces, separated with commas. (default: "" )
-k, --apiKey < apiKe y > Indicate the full Packmind API Key. We recommend to use instead the PROMYZE_API_KEY (or PACKMIND_API_KEY ) environment variable. ( default: "" )
-exit, --errorIfResults < errorIfResult s > If true , will stop with an error code 1 if at least one suggestion is found (default: "false" )
-ca, --caSSL < pathToSSLCertificat e > If specified, the CLI will trust this certificate (default: "" )
-ruleIdSarif, --ruleIdSarif < ruleIdSari f > Specify what will be the ruleId property if the Sarif Report. Either "practiceId" or "practiceName" (default: "practiceId" )
--gitlabMR < true /fals e > Will attempt to scan files involved in the current GitLab Merge Request, if scan is done within a MR. A ` PACKMIND_GITLAB_TOKEN ` environment variable must be set to query Gitlab API (default: "false" )
-bs, --batchSize < batchSiz e > If specified, the batch size for the analysis. Use with cautious. (Max : 30 ) ( default: "10" )
-bc, --batchConcurrent < batchConcurren t > If specified, the number of concurrent calls for batch chunks. Use with cautious. (Max : 30 ) ( default: "10" )
-h, --help display help for command
For any suggestion to improve this package, feel free to submit us your suggestion, and we'd be happy to consider it: