Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Annlix
ShellCheck
提交
3e2cb261
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,体验更适合开发者的 AI 搜索 >>
提交
3e2cb261
编写于
9月 17, 2018
作者:
V
Vidar Holen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add SC2238 about redirections to command names
上级
1a6ae4f1
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
0 deletion
+11
-0
CHANGELOG.md
CHANGELOG.md
+1
-0
src/ShellCheck/Analytics.hs
src/ShellCheck/Analytics.hs
+10
-0
未找到文件。
CHANGELOG.md
浏览文件 @
3e2cb261
...
...
@@ -2,6 +2,7 @@
### Added
-
Command line option --severity/-S for filtering by minimum severity
-
SC2236/SC2237: Suggest -n/-z instead of ! -z/-n
-
SC2238: Warn when redirecting to a known command name, e.g. ls > rm
### Changed
-
Most warnings now have useful end positions
-
SC1117 about unknown double-quoted escape sequences has been retired
...
...
src/ShellCheck/Analytics.hs
浏览文件 @
3e2cb261
...
...
@@ -169,6 +169,7 @@ nodeChecks = [
,
checkForLoopGlobVariables
,
checkSubshelledTests
,
checkInvertedStringTest
,
checkRedirectionToCommand
]
...
...
@@ -3027,6 +3028,15 @@ checkInvertedStringTest _ t =
_
->
return
()
_
->
return
()
prop_checkRedirectionToCommand1
=
verify
checkRedirectionToCommand
"ls > rm"
prop_checkRedirectionToCommand2
=
verifyNot
checkRedirectionToCommand
"ls > 'rm'"
prop_checkRedirectionToCommand3
=
verifyNot
checkRedirectionToCommand
"ls > myfile"
checkRedirectionToCommand
_
t
=
case
t
of
T_IoFile
_
_
(
T_NormalWord
id
[
T_Literal
_
str
])
|
str
`
elem
`
commonCommands
->
unless
(
str
==
"file"
)
$
-- This would be confusing
warn
id
2238
"Redirecting to/from command name instead of file. Did you want pipes/xargs (or quote to ignore)?"
_
->
return
()
return
[]
runTests
=
$
(
[
|
$
(
forAllProperties
)
(
quickCheckWithResult
(
stdArgs
{
maxSuccess
=
1
})
)
|
])
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录