Raj*_*ari 3 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:
# This is a comment!
^-- SC1017: Literal carriage return. Run script through tr -d '\r' .
Run Code Online (Sandbox Code Playgroud)
以下是ShellCheck 中使用的所有规则的列表。
我建议您使用DeepSource对 Shell 脚本进行分析。DeepSource 检测超过 210 个问题,并为您提供自动修复这些问题的选项。
如果您使用 DeepSource,那么您无需在任何地方查找规则信息,因为 DeepSource 为您提供了查看其检测到的每个问题的描述以及为何应修复该问题的选项。