Rajeswari
Rajeswari

Reputation: 71

Static code analysis using ShellCheck for shell script - predefined rules

I am trying to use Shellcheck for doing static code analysis for shell scripts. I want to know the rules used to perform the analysis. Where can I get them?

Below is the sample output I got for simple helloworld program:

In C:\Users\~\Desktop\hello.sh line 1:
#!/bin/sh
         ^-- SC1017: Literal carriage return. Run script through tr -d '\r' .


In C:\Users\~\Desktop\hello.sh line 2:
# This is a comment!
                    ^-- SC1017: Literal carriage return. Run script through tr -d '\r' .

Upvotes: 3

Views: 1086

Answers (1)

camelcaseguy
camelcaseguy

Reputation: 71

Here's the list of all the rules used in ShellCheck.

I'd suggest you to use DeepSource to run analysis on Shell scripts. DeepSource detects more than 210 issues and gives you the option to Autofix them.

If you use DeepSource then you won't have to look anywhere for the information of rules as DeepSource gives you the option to see the description of each and every issue it detects and why you should fix that issue.

Upvotes: 5

Related Questions