Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
社会瑞弟呀
brakeman
提交
b904ee56
B
brakeman
项目概览
社会瑞弟呀
/
brakeman
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
brakeman
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b904ee56
编写于
5月 08, 2013
作者:
J
Justin Collins
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'clearer_handling_of_quiet_default'
上级
f1ac8eea
374b516b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
39 addition
and
4 deletion
+39
-4
bin/brakeman
bin/brakeman
+4
-0
lib/brakeman.rb
lib/brakeman.rb
+10
-2
test/tests/test_brakeman.rb
test/tests/test_brakeman.rb
+25
-2
未找到文件。
bin/brakeman
浏览文件 @
b904ee56
...
...
@@ -52,6 +52,10 @@ trap("INT") do
exit!
end
if
options
[
:quiet
].
nil?
options
[
:quiet
]
=
:command_line
end
if
options
[
:previous_results_json
]
vulns
=
Brakeman
.
compare
options
.
merge
(
:quiet
=>
options
[
:quiet
])
puts
MultiJson
.
dump
(
vulns
,
:pretty
=>
true
)
...
...
lib/brakeman.rb
浏览文件 @
b904ee56
...
...
@@ -62,9 +62,18 @@ module Brakeman
if
options
.
is_a?
String
options
=
{
:app_path
=>
options
}
end
if
options
[
:quiet
]
==
:command_line
command_line
=
true
options
.
delete
:quiet
end
options
=
default_options
.
merge
(
load_options
(
options
[
:config_file
],
options
[
:quiet
])).
merge
(
options
)
if
options
[
:quiet
].
nil?
and
not
command_line
options
[
:quiet
]
=
true
end
options
[
:app_path
]
=
File
.
expand_path
(
options
[
:app_path
])
options
[
:output_formats
]
=
get_output_formats
options
...
...
@@ -112,7 +121,6 @@ module Brakeman
:message_limit
=>
100
,
:parallel_checks
=>
true
,
:relative_path
=>
false
,
:quiet
=>
true
,
:report_progress
=>
true
,
:html_style
=>
"
#{
File
.
expand_path
(
File
.
dirname
(
__FILE__
))
}
/brakeman/format/style.css"
}
...
...
test/tests/test_brakeman.rb
浏览文件 @
b904ee56
...
...
@@ -131,9 +131,9 @@ class ConfigTests < Test::Unit::TestCase
assert
final_options
[
:quiet
],
"Expected quiet option to be true, but was
#{
final_options
[
:quiet
]
}
"
end
def
test_quiet_
option_with_nil
def
test_quiet_
command_line_default
options
=
{
:quiet
=>
nil
,
:quiet
=>
:command_line
,
:app_path
=>
"/tmp"
#doesn't need to be real
}
...
...
@@ -141,6 +141,29 @@ class ConfigTests < Test::Unit::TestCase
assert_nil
final_options
[
:quiet
]
end
def
test_quiet_inconfig_with_command_line
config
=
Tempfile
.
new
(
"config"
)
config
.
write
<<-
YAML
.
strip
---
:quiet: true
YAML
config
.
close
options
=
{
:quiet
=>
:command_line
,
:config_file
=>
config
.
path
,
:app_path
=>
"
#{
TEST_PATH
}
/apps/rails4"
,
:run_checks
=>
[]
}
assert_equal
""
,
capture_output
{
Brakeman
.
run
options
config
.
unlink
}[
1
]
end
def
output_format_tester
options
,
expected_options
output_formats
=
Brakeman
.
get_output_formats
(
options
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录