项目作者: azohra

项目描述 :
A Github Action for ShellCheck
高级语言: Shell
项目地址: git://github.com/azohra/shell-linter.git
创建时间: 2019-10-02T19:40:54Z
项目社区:https://github.com/azohra/shell-linter

开源协议:MIT License

下载


Shell Linter

Release
Marketplace
Actions Status

A GitHub Action that performs static analysis for shell scripts using ShellCheck.

🚨 Repository Transferred – Manual Update Required

This repository has moved from azohra/shell-linter to Azbagheri/shell-linter.

Important: Contrary to our understanding, GitHub is NOT automatically redirecting workflows. You must manually update your YAML configuration:

  1. - uses: azohra/shell-linter@latest
  2. + uses: Azbagheri/shell-linter@latest

We sincerely apologize for any inconvenience this has caused.

Usage

Shell Linter can perform static analysis in various ways. By default it scans all the ShellCheck-supported shell scripts (sh, bash, dash, ksh) in your project. However, you can use the path parameter to scan a specific file or folder or use the exclude-paths parameter to exclude files or folders from the scan. With Shell Linter, you can also specify the minimum severity of errors to consider using the severity parameter. Specific use cases along with examples are shown below:

Run static analysis for all the supported shell scripts in your repository:

  1. jobs:
  2. lint:
  3. runs-on: ubuntu-latest
  4. steps:
  5. - name: Checkout code
  6. uses: actions/checkout@v4
  7. - name: Run ShellCheck
  8. uses: Azbagheri/shell-linter@latest

Run static analysis for a single shell script:

  1. - name: Run ShellCheck
  2. uses: Azbagheri/shell-linter@latest
  3. with:
  4. path: "setup.sh"

Run static analysis for multiple shell scripts with or without extension:

  1. - name: Run ShellCheck
  2. uses: Azbagheri/shell-linter@latest
  3. with:
  4. path: "setup,deploy.sh"

Run static analysis for all the shell scripts in a folder:

  1. - name: Run ShellCheck
  2. uses: Azbagheri/shell-linter@latest
  3. with:
  4. path: "src"

Run static analysis using a wildcard path:

  1. - name: Run ShellCheck
  2. uses: Azbagheri/shell-linter@latest
  3. with:
  4. path: "src/*.sh"

Exclude files and folders from the static analysis:

  1. - name: Run ShellCheck
  2. uses: Azbagheri/shell-linter@latest
  3. with:
  4. exclude-paths: "src/setup.sh,tests/unit_tests"

Note that exclude-paths only accepts paths relative to your project’s root directory. However, do not include ./ at the beginning of the paths.

To exclude a folder and it’s content recursively just provide the path of the folder without a / at the end. In the example above, the entire folder at the path tests/unit_tests will be excluded from linting.

Run static analysis for all the shell scripts and only report issues with error severity while excluding specific issues:

  1. - name: Run ShellCheck
  2. uses: Azbagheri/shell-linter@latest
  3. with:
  4. path: "src/*.sh"
  5. severity: "error"
  6. exclude-issues: "SC1068,SC1066"

Note that exclude-issues contains a comma-separated list of ShellCheck issues (example: “SC1068”) to ignore.

Run analysis by using a specific version of Shell Linter:

  1. - name: Run ShellCheck
  2. uses: Azbagheri/shell-linter@v0.8.0

Input

exclude-issues

Optional. Specify shellcheck issues to exclude during scan. For more information refer to Checks. Default: scan all issues.

exclude-paths

Optional. Exclude files and folders from ShellCheck scan.

path

Optional. Execute lint check on a specific file or folder. Default: .

severity

Optional. Specify minimum severity of errors to consider [style, info, warning, error]. Default: style

License

This software is available as open source under the terms of the MIT License.