Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Annlix
ShellCheck
提交
7b3c4025
S
ShellCheck
项目概览
Annlix
/
ShellCheck
与 Fork 源项目一致
Fork自
镜像 / koalaman / ShellCheck
通知
1
Star
0
Fork
0
代码
文件
提交
分支
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,发现更多精彩内容 >>
提交
7b3c4025
编写于
1月 21, 2018
作者:
V
Vidar Holen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Warn about redirs in the middle of 'find' commands. Fixes #405
上级
3b004275
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
20 addition
and
0 deletion
+20
-0
CHANGELOG.md
CHANGELOG.md
+1
-0
ShellCheck/Checks/Commands.hs
ShellCheck/Checks/Commands.hs
+19
-0
未找到文件。
CHANGELOG.md
浏览文件 @
7b3c4025
## Latest - ???
## Latest - ???
### Added
### Added
-
SC2227: Warn about redirections in the middle of 'find' commands
-
SC2224,SC2225,SC2226: Warn when using mv/cp/ln without a destination
-
SC2224,SC2225,SC2226: Warn when using mv/cp/ln without a destination
-
SC2223: Quote warning specific to
`: ${var=value}`
-
SC2223: Quote warning specific to
`: ${var=value}`
-
SC1127: Warn about C-style comments
-
SC1127: Warn about C-style comments
...
...
ShellCheck/Checks/Commands.hs
浏览文件 @
7b3c4025
...
@@ -89,6 +89,7 @@ commandChecks = [
...
@@ -89,6 +89,7 @@ commandChecks = [
,
checkCatastrophicRm
,
checkCatastrophicRm
,
checkLetUsage
,
checkLetUsage
,
checkMvArguments
,
checkCpArguments
,
checkLnArguments
,
checkMvArguments
,
checkCpArguments
,
checkLnArguments
,
checkFindRedirections
]
]
buildCommandMap
::
[
CommandCheck
]
->
Map
.
Map
CommandName
(
Token
->
Analysis
)
buildCommandMap
::
[
CommandCheck
]
->
Map
.
Map
CommandName
(
Token
->
Analysis
)
...
@@ -887,5 +888,23 @@ checkLnArguments = CommandCheck (Basename "ln") $ missingDestination f
...
@@ -887,5 +888,23 @@ checkLnArguments = CommandCheck (Basename "ln") $ missingDestination f
f
t
=
warn
(
getId
t
)
2226
"This ln has no destination. Check the arguments, or specify '.' explicitly."
f
t
=
warn
(
getId
t
)
2226
"This ln has no destination. Check the arguments, or specify '.' explicitly."
prop_checkFindRedirections1
=
verify
checkFindRedirections
"find . -exec echo {} > file
\\
;"
prop_checkFindRedirections2
=
verifyNot
checkFindRedirections
"find . -exec echo {}
\\
; > file"
prop_checkFindRedirections3
=
verifyNot
checkFindRedirections
"find . -execdir sh -c 'foo > file'
\\
;"
checkFindRedirections
=
CommandCheck
(
Basename
"find"
)
f
where
f
t
=
do
redirecting
<-
getClosestCommandM
t
case
redirecting
of
Just
(
T_Redirecting
_
redirs
@
(
_
:
_
)
(
T_SimpleCommand
_
_
args
@
(
_
:
_
:
_
)))
->
do
-- This assumes IDs are sequential, which is mostly but not always true.
let
minRedir
=
minimum
$
map
getId
redirs
let
maxArg
=
maximum
$
map
getId
args
when
(
minRedir
<
maxArg
)
$
warn
minRedir
2227
"Redirection applies to the find command itself. Rewrite to work per action (or move to end)."
_
->
return
()
return
[]
return
[]
runTests
=
$
(
[
|
$
(
forAllProperties
)
(
quickCheckWithResult
(
stdArgs
{
maxSuccess
=
1
})
)
|
])
runTests
=
$
(
[
|
$
(
forAllProperties
)
(
quickCheckWithResult
(
stdArgs
{
maxSuccess
=
1
})
)
|
])
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录