Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
社会瑞弟呀
brakeman
提交
5fda10cd
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,发现更多精彩内容 >>
提交
5fda10cd
编写于
4月 10, 2012
作者:
N
Neil Matatall
提交者:
oreoshake
4月 19, 2012
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
extract common table building to a method
上级
a961c562
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
16 addition
and
22 deletion
+16
-22
lib/brakeman/report.rb
lib/brakeman/report.rb
+16
-22
未找到文件。
lib/brakeman/report.rb
浏览文件 @
5fda10cd
...
...
@@ -48,9 +48,7 @@ class Brakeman::Report
if
html
load_and_render_erb
(
'overview'
,
binding
)
else
table
=
Terminal
::
Table
.
new
do
|
t
|
t
<<
[
'Scanned/Reported'
,
'Total'
]
t
<<
:separator
table
=
build_text_table
([
'Scanned/Reported'
,
'Total'
])
do
|
t
|
t
<<
[
'Controllers'
,
tracker
.
controllers
.
length
]
t
<<
[
'Models'
,
tracker
.
models
.
length
-
1
]
t
<<
[
'Templates'
,
templates
]
...
...
@@ -68,10 +66,7 @@ class Brakeman::Report
if
html
load_and_render_erb
(
'warning_overview'
,
binding
)
else
table
=
Terminal
::
Table
.
new
do
|
t
|
t
<<
[
'Warning Type'
,
'Total'
]
t
<<
:separator
table
=
build_text_table
([
'Warning Type'
,
'Total'
])
do
|
t
|
types
.
sort
.
each
do
|
warning_type
|
t
<<
[
warning_type
,
warnings_summary
[
warning_type
]]
end
...
...
@@ -85,10 +80,7 @@ class Brakeman::Report
if
html
load_and_render_erb
(
'error_overview'
,
binding
)
else
table
=
Terminal
::
Table
.
new
do
|
t
|
t
<<
[
'Error'
,
'Location'
]
t
<<
:separator
table
=
build_text_table
([
'Error'
,
'Location'
])
do
|
t
|
tracker
.
errors
.
each
do
|
error
|
t
<<
error
[
:error
]
t
<<
error
[
:backtrace
][
0
]
...
...
@@ -256,10 +248,7 @@ class Brakeman::Report
if
html
load_and_render_erb
(
'controller_overview'
,
binding
)
else
table
=
Terminal
::
Table
.
new
do
|
t
|
t
<<
[
'Name'
,
'Parent'
,
'Includes'
,
'Routes'
]
t
<<
:separator
table
=
build_text_table
([
'Name'
,
'Parent'
,
'Includes'
,
'Routes'
])
do
|
t
|
contoller_rows
.
each
do
|
row
|
t
<<
[
row
[
'Name'
],
row
[
'Parent'
],
row
[
'Includes'
],
row
[
'Routes'
]]
end
...
...
@@ -290,10 +279,7 @@ class Brakeman::Report
output
=
''
template_rows
.
each_pair
do
|
template_name
,
calls
|
output
<<
template_name
.
to_s
<<
"
\n\n
"
table
=
Terminal
::
Table
.
new
do
|
t
|
t
<<
[
'Output'
]
t
<<
:separator
table
=
build_text_table
([
'Output'
])
do
|
t
|
calls
.
each
do
|
v
|
t
<<
v
end
...
...
@@ -346,7 +332,7 @@ class Brakeman::Report
def
to_s
out
=
text_header
<<
"
\n
+SUMMARY+
\n
"
<<
generate_overview
.
to_s
<<
"
\n
"
<<
generate_overview
.
to_s
<<
"
\n
\n
"
<<
generate_warning_overview
.
to_s
<<
"
\n
"
#Return output early if only summarizing
...
...
@@ -355,12 +341,12 @@ class Brakeman::Report
end
if
tracker
.
options
[
:report_routes
]
or
tracker
.
options
[
:debug
]
out
<<
"+CONTROLLERS+
\n
"
<<
out
<<
"
\n
+CONTROLLERS+
\n
"
<<
generate_controllers
.
to_s
<<
"
\n
"
end
if
tracker
.
options
[
:debug
]
out
<<
"+TEMPLATES+
\n\n
"
<<
out
<<
"
\n
+TEMPLATES+
\n\n
"
<<
generate_templates
.
to_s
<<
"
\n
"
end
...
...
@@ -615,4 +601,12 @@ class Brakeman::Report
template
=
ERB
.
new
(
content
)
template
.
result
(
bind
)
end
def
build_text_table
(
header
,
&
block
)
table
=
Terminal
::
Table
.
new
do
|
t
|
t
<<
header
t
<<
:separator
yield
t
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录