Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Annlix
ShellCheck
提交
9ca7d577
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,发现更多精彩内容 >>
提交
9ca7d577
编写于
11月 06, 2012
作者:
V
Vidar Holen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Renamed much of the ShellCheck.Simple interface
上级
e264f642
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
11 addition
and
11 deletion
+11
-11
ShellCheck/Simple.hs
ShellCheck/Simple.hs
+5
-5
shellcheck.hs
shellcheck.hs
+6
-6
未找到文件。
ShellCheck/Simple.hs
浏览文件 @
9ca7d577
module
ShellCheck.Simple
(
shell
checkCheck
,
ShellCheckComment
,
shellcheckLine
,
shellcheckColumn
,
shellcheckSeverity
,
shellcheckComment
)
where
module
ShellCheck.Simple
(
shell
Check
,
ShellCheckComment
,
scLine
,
scColumn
,
scSeverity
,
scMessage
)
where
import
ShellCheck.Parser
import
ShellCheck.Analytics
...
...
@@ -6,8 +6,8 @@ import Data.Maybe
import
Text.Parsec.Pos
import
Data.List
shell
check
Check
::
String
->
[
ShellCheckComment
]
shell
check
Check
script
=
shellCheck
::
String
->
[
ShellCheckComment
]
shellCheck
script
=
let
(
ParseResult
result
notes
)
=
parseShell
"-"
script
in
let
allNotes
=
notes
++
(
concat
$
maybeToList
$
do
(
tree
,
map
)
<-
result
...
...
@@ -17,11 +17,11 @@ shellcheckCheck script =
in
map
formatNote
$
nub
$
sortNotes
allNotes
data
ShellCheckComment
=
ShellCheckComment
{
s
hellcheckLine
::
Int
,
shellcheckColumn
::
Int
,
shellcheckSeverity
::
String
,
shellcheckComment
::
String
}
data
ShellCheckComment
=
ShellCheckComment
{
s
cLine
::
Int
,
scColumn
::
Int
,
scSeverity
::
String
,
scMessage
::
String
}
instance
Show
ShellCheckComment
where
show
c
=
concat
[
"("
,
show
$
s
hellcheckLine
c
,
","
,
show
$
shellcheckColumn
c
,
") "
,
shellcheckSeverity
c
,
": "
,
shellcheckComment
c
]
show
c
=
concat
[
"("
,
show
$
s
cLine
c
,
","
,
show
$
scColumn
c
,
") "
,
scSeverity
c
,
": "
,
scMessage
c
]
severityToString
s
=
case
s
of
...
...
shellcheck.hs
浏览文件 @
9ca7d577
...
...
@@ -33,25 +33,25 @@ doFile path colorFunc = do
doInput
filename
contents
colorFunc
=
do
let
fileLines
=
lines
contents
let
lineCount
=
length
fileLines
let
comments
=
shell
check
Check
contents
let
groups
=
groupWith
s
hellcheck
Line
comments
let
comments
=
shellCheck
contents
let
groups
=
groupWith
s
c
Line
comments
if
not
$
null
comments
then
do
mapM_
(
\
x
->
do
let
lineNum
=
s
hellcheck
Line
(
head
x
)
let
lineNum
=
s
c
Line
(
head
x
)
let
line
=
if
lineNum
<
1
||
lineNum
>
lineCount
then
""
else
fileLines
!!
(
lineNum
-
1
)
putStrLn
""
putStrLn
$
colorFunc
"message"
(
"In "
++
filename
++
" line "
++
(
show
$
lineNum
)
++
":"
)
putStrLn
(
colorFunc
"source"
line
)
mapM
(
\
c
->
putStrLn
(
colorFunc
(
s
hellcheck
Severity
c
)
$
cuteIndent
c
))
x
mapM
(
\
c
->
putStrLn
(
colorFunc
(
s
c
Severity
c
)
$
cuteIndent
c
))
x
putStrLn
""
)
groups
else
do
putStrLn
(
"No comments for "
++
filename
)
cuteIndent
comment
=
(
replicate
((
s
hellcheckColumn
comment
)
-
1
)
' '
)
++
"^-- "
++
(
shellcheckComment
comment
)
(
replicate
((
s
cColumn
comment
)
-
1
)
' '
)
++
"^-- "
++
(
scMessage
comment
)
getColorFunc
=
do
term
<-
hIsTerminalDevice
stdout
...
...
@@ -61,7 +61,7 @@ main = do
args
<-
getArgs
colors
<-
getColorFunc
if
null
args
then
do
hPutStrLn
stderr
"shellcheck -- bash/sh s
hell s
cript static analysis tool"
hPutStrLn
stderr
"shellcheck -- bash/sh script static analysis tool"
hPutStrLn
stderr
"Usage: shellcheck filenames..."
exitFailure
else
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录