Skip to content
John Gardner edited this page Dec 22, 2021 · 2 revisions

ShellCheck is installed by default on the ubuntu-latest host in Azure Pipelines. To see all installed software, consult the Azure documentation.

Caveats

Trying to run ShellCheck as usual within the pipeline will produce an error:

$ shellcheck myscripts/*.sh
myscripts/*.sh: myscripts/*.sh: openBinaryFile: does not exist (No such file or directory)

The recommended approach is to use find to search the files and pass a list of those to ShellCheck:

$ shellcheck $(find $(pwd)/myscripts/ -name "*.sh")

Example pipeline

Copy the following YAML to run ShellCheck in Azure Pipelines against all *.sh files in the current directory:

trigger:
- master

jobs:
- job: shellcheck
  displayName: ShellCheck
  pool:
    vmImage: 'ubuntu-latest'

  steps:
  - script: shellcheck $(find $(pwd) -name "*.sh")
    displayName: 'Running ShellCheck'

ShellCheck

Each individual ShellCheck warning has its own wiki page like SC1000. Use GitHub Wiki's "Pages" feature above to find a specific one, or see Checks.

Clone this wiki locally