Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
koalaman
ShellCheck
提交
14056a7f
S
ShellCheck
项目概览
镜像
/
koalaman
/
ShellCheck
上一次同步 10 个月
通知
42
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
ShellCheck
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
14056a7f
编写于
10月 12, 2022
作者:
V
Vidar Holen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Don't suggest pgrep for `ps -p .. | grep` (fixes #2597)
上级
a524929b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
3 deletion
+12
-3
src/ShellCheck/Analytics.hs
src/ShellCheck/Analytics.hs
+12
-3
未找到文件。
src/ShellCheck/Analytics.hs
浏览文件 @
14056a7f
...
...
@@ -550,6 +550,7 @@ prop_checkPipePitfalls19 = verifyNot checkPipePitfalls "foo | grep -A2 bar | wc
prop_checkPipePitfalls20
=
verifyNot
checkPipePitfalls
"foo | grep -B999 bar | wc -l"
prop_checkPipePitfalls21
=
verifyNot
checkPipePitfalls
"foo | grep --after-context 999 bar | wc -l"
prop_checkPipePitfalls22
=
verifyNot
checkPipePitfalls
"foo | grep -B 1 --after-context 999 bar | wc -l"
prop_checkPipePitfalls23
=
verifyNot
checkPipePitfalls
"ps -o pid,args -p $(pgrep java) | grep -F net.shellcheck.Test"
checkPipePitfalls
_
(
T_Pipeline
id
_
commands
)
=
do
for
[
"find"
,
"xargs"
]
$
\
(
find
:
xargs
:
_
)
->
...
...
@@ -563,8 +564,15 @@ checkPipePitfalls _ (T_Pipeline id _ commands) = do
])
$
warn
(
getId
find
)
2038
"Use -print0/-0 or -exec + to allow for non-alphanumeric filenames."
for'
[
"ps"
,
"grep"
]
$
\
x
->
info
x
2009
"Consider using pgrep instead of grepping ps output."
for
[
"ps"
,
"grep"
]
$
\
(
ps
:
grep
:
_
)
->
let
psFlags
=
maybe
[]
(
map
snd
.
getAllFlags
)
$
getCommand
ps
in
-- There are many ways to specify a pid: 1, -1, p 1, wup 1, -q 1, -p 1, --pid 1.
-- For simplicity we only deal with the most canonical looking flags:
unless
(
any
(`
elem
`
[
"p"
,
"pid"
,
"q"
,
"quick-pid"
])
psFlags
)
$
info
(
getId
ps
)
2009
"Consider using pgrep instead of grepping ps output."
for
[
"grep"
,
"wc"
]
$
\
(
grep
:
wc
:
_
)
->
...
...
@@ -782,6 +790,7 @@ prop_checkUnquotedExpansions7 = verifyNot checkUnquotedExpansions "cat << foo\n$
prop_checkUnquotedExpansions8
=
verifyNot
checkUnquotedExpansions
"set -- $(seq 1 4)"
prop_checkUnquotedExpansions9
=
verifyNot
checkUnquotedExpansions
"echo foo `# inline comment`"
prop_checkUnquotedExpansions10
=
verify
checkUnquotedExpansions
"#!/bin/sh
\n
export var=$(val)"
prop_checkUnquotedExpansions11
=
verifyNot
checkUnquotedExpansions
"ps -p $(pgrep foo)"
checkUnquotedExpansions
params
=
check
where
...
...
@@ -795,7 +804,7 @@ checkUnquotedExpansions params =
warn
(
getId
t
)
2046
"Quote this to prevent word splitting."
shouldBeSplit
t
=
getCommandNameFromExpansion
t
==
Just
"seq"
getCommandNameFromExpansion
t
`
elem
`
[
Just
"seq"
,
Just
"pgrep"
]
prop_checkRedirectToSame
=
verify
checkRedirectToSame
"cat foo > foo"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录