Shell

The Shell analyzer is designed to perform static code analysis on Bash and POSIX Shell scripts.

Language-specific properties

You can discover and update the Shell-specific properties in: Administration > General Settings > Languages > Shell.

Supported languages and syntaxes

The analyzer is designed to analyze Bash and POSIX shell scripts, which are the only officially supported shell flavors.

However, analysis for other shell flavors (e.g. ksh, zsh) is also possible. This support is partial, and the analyzer will perform best on scripts that use syntax compatible with or similar to POSIX and Bash. You may encounter parsing errors when analyzing scripts that rely on features or syntaxes specific to other shells. This may lead to raising issues unrelated to your shell flavor.

Platform support

The Shell analyzer has a strict platform requirement and is only supported for Linux on the amd64 (x86_64) architecture.

Behavior on unsupported platforms

Attempting to analyze shell scripts on any other platform (e.g., Windows, macOS, or Linux on ARM/aarch64) will not cause the entire scan to fail. Instead, the analyzer will:

  1. Log a warning message stating that the platform is not supported.

  2. Skip the analysis of all shell script files.

The overall scan will continue, but no issues or metrics will be reported for your shell code.

Troubleshooting

Some files are not analyzed or issues are missing

The Shell analyzer processes files in size-based batches, and each batch is given an adaptive timeout to ensure the overall project analysis completes in a timely manner. If you notice that some files are not being analyzed or issues are missing, it is likely that one or more of these batches has timed out. When a batch times out, the analysis of files within that specific batch is skipped, and the scan continues with the next batch.

You can increase the baseline timeout value, which gives each batch more time to complete. This property can be adjusted in the UI:

  1. Go to Administration > General Settings > Declarative Rule Engine.

  2. Find the sonar.dre.baselineTimeout property and increase its value.

The property can be specified during the scanner invocation as well.

Last updated

Was this helpful?