使用ShellCheck对shell脚本进行静态代码分析-预定义规则

使用ShellCheck对shell脚本进行静态代码分析-预定义规则,shell,static-code-analysis,shellcheck,Shell,Static Code Analysis,Shellcheck,我正在尝试使用Shellcheck对shell脚本进行静态代码分析。我想知道用于执行分析的规则。在哪里可以买到 下面是我为简单helloworld程序获得的示例输出: 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

我正在尝试使用Shellcheck对shell脚本进行静态代码分析。我想知道用于执行分析的规则。在哪里可以买到

下面是我为简单helloworld程序获得的示例输出:

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' .
下面是ShellCheck中使用的所有规则的列表

我建议您使用在Shell脚本上运行分析。DeepSource检测到210多个问题,并为您提供自动修复这些问题的选项

如果您使用DeepSource,则无需在任何地方查找规则信息,因为DeepSource为您提供了查看其检测到的每个问题的描述以及解决该问题的原因的选项。

看起来是一个很好的起点。