Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Annlix
ShellCheck
提交
2e13cedc
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,发现更多精彩内容 >>
提交
2e13cedc
编写于
11月 12, 2013
作者:
V
Vidar Holen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Removed jsoncheck. Use 'shellcheck -f json -' instead
上级
17515ad7
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
25 addition
and
43 deletion
+25
-43
Makefile
Makefile
+2
-5
ShellCheck.cabal
ShellCheck.cabal
+1
-5
jsoncheck.hs
jsoncheck.hs
+0
-33
shellcheck.hs
shellcheck.hs
+22
-0
未找到文件。
Makefile
浏览文件 @
2e13cedc
...
...
@@ -9,15 +9,12 @@ shellcheck: regardless
: Conditionally compiling shellcheck
ghc
$(GHCFLAGS)
--make
shellcheck
jsoncheck
:
regardless
: Conditionally compiling shellcheck
ghc
$(GHCFLAGS)
--make
jsoncheck
.tests
:
*.hs */*.hs
: Running unit tests
./test/runQuack
&&
touch
.tests
clean
:
rm
-f
.tests dist shellcheck jsoncheck
*
.hi
*
.o ShellCheck/
*
.hi ShellCheck/
*
.o
rm
-f
.tests shellcheck
*
.hi
*
.o ShellCheck/
*
.hi ShellCheck/
*
.o
rm
-rf
dist
regardless
:
ShellCheck.cabal
浏览文件 @
2e13cedc
...
...
@@ -9,12 +9,8 @@ Build-Type: Simple
Cabal-Version: >= 1.2
library
build-depends: base >= 4, parsec, containers, regex-compat, mtl, directory
build-depends: base >= 4, parsec, containers, regex-compat, mtl, directory
, json
exposed-modules: ShellCheck.AST, ShellCheck.Data, ShellCheck.Parser, ShellCheck.Analytics, ShellCheck.Simple
executable shellcheck
main-is: shellcheck.hs
executable jsoncheck
build-depends: json
main-is: jsoncheck.hs
jsoncheck.hs
已删除
100644 → 0
浏览文件 @
17515ad7
{-
This file is part of ShellCheck.
http://www.vidarholen.net/contents/shellcheck
ShellCheck is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ShellCheck is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-}
import
ShellCheck.Simple
import
Text.JSON
instance
JSON
ShellCheckComment
where
showJSON
c
=
makeObj
[
(
"line"
,
showJSON
$
scLine
c
),
(
"column"
,
showJSON
$
scColumn
c
),
(
"level"
,
showJSON
$
scSeverity
c
),
(
"code"
,
showJSON
$
scCode
c
),
(
"message"
,
showJSON
$
scMessage
c
)
]
readJSON
=
undefined
main
=
do
script
<-
getContents
putStrLn
$
encodeStrict
$
shellCheck
script
shellcheck.hs
浏览文件 @
2e13cedc
...
...
@@ -24,6 +24,7 @@ import System.Directory
import
System.Environment
import
System.Exit
import
System.IO
import
Text.JSON
import
qualified
Data.Map
as
Map
data
Flag
=
Flag
String
String
...
...
@@ -36,6 +37,16 @@ options = [
printErr
=
hPutStrLn
stderr
instance
JSON
ShellCheckComment
where
showJSON
c
=
makeObj
[
(
"line"
,
showJSON
$
scLine
c
),
(
"column"
,
showJSON
$
scColumn
c
),
(
"level"
,
showJSON
$
scSeverity
c
),
(
"code"
,
showJSON
$
scCode
c
),
(
"message"
,
showJSON
$
scMessage
c
)
]
readJSON
=
undefined
parseArguments
argv
=
case
getOpt
Permute
options
argv
of
(
opts
,
files
,
[]
)
->
...
...
@@ -55,6 +66,7 @@ parseArguments argv =
specials
x
=
x
formats
=
Map
.
fromList
[
(
"json"
,
forJson
),
(
"tty"
,
forTty
)
]
...
...
@@ -114,6 +126,16 @@ forTty options files = do
term
<-
hIsTerminalDevice
stdout
return
$
if
term
then
colorComment
else
const
id
-- This totally ignores the filenames. Fixme?
forJson
options
files
=
do
comments
<-
liftM
concat
$
mapM
process
files
putStrLn
$
encodeStrict
$
comments
return
.
null
$
comments
where
process
file
=
do
script
<-
readFile
file
return
$
shellCheck
script
getOption
[]
_
def
=
def
getOption
((
Flag
var
val
)
:
_
)
name
_
|
name
==
var
=
val
getOption
(
_
:
rest
)
flag
def
=
getOption
rest
flag
def
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录