Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
Brakeman
提交
37047a8b
B
Brakeman
项目概览
李少辉-开发者
/
Brakeman
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
Brakeman
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
37047a8b
编写于
7月 10, 2012
作者:
J
Justin Collins
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add links to warning type descriptions on website
Thanks to @daveworth
上级
10751a9c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
31 addition
and
1 deletion
+31
-1
lib/brakeman/format/style.css
lib/brakeman/format/style.css
+4
-0
lib/brakeman/report.rb
lib/brakeman/report.rb
+8
-0
lib/brakeman/warning.rb
lib/brakeman/warning.rb
+19
-1
未找到文件。
lib/brakeman/format/style.css
浏览文件 @
37047a8b
...
...
@@ -5,6 +5,10 @@ body {
color
:
#161616
;
}
a
{
color
:
#161616
;
}
p
{
font-weight
:
bold
;
font-size
:
11pt
;
...
...
lib/brakeman/report.rb
浏览文件 @
37047a8b
...
...
@@ -96,6 +96,7 @@ class Brakeman::Report
if
html
w
[
"Confidence"
]
=
HTML_CONFIDENCE
[
w
[
"Confidence"
]]
w
[
"Message"
]
=
with_context
warning
,
w
[
"Message"
]
w
[
"Warning Type"
]
=
with_link
warning
,
w
[
"Warning Type"
]
else
w
[
"Confidence"
]
=
TEXT_CONFIDENCE
[
w
[
"Confidence"
]]
w
[
"Message"
]
=
text_message
warning
,
w
[
"Message"
]
...
...
@@ -134,6 +135,7 @@ class Brakeman::Report
if
html
w
[
"Confidence"
]
=
HTML_CONFIDENCE
[
w
[
"Confidence"
]]
w
[
"Message"
]
=
with_context
warning
,
w
[
"Message"
]
w
[
"Warning Type"
]
=
with_link
warning
,
w
[
"Warning Type"
]
else
w
[
"Confidence"
]
=
TEXT_CONFIDENCE
[
w
[
"Confidence"
]]
w
[
"Message"
]
=
text_message
warning
,
w
[
"Message"
]
...
...
@@ -170,6 +172,7 @@ class Brakeman::Report
if
html
w
[
"Confidence"
]
=
HTML_CONFIDENCE
[
w
[
"Confidence"
]]
w
[
"Message"
]
=
with_context
warning
,
w
[
"Message"
]
w
[
"Warning Type"
]
=
with_link
warning
,
w
[
"Warning Type"
]
else
w
[
"Confidence"
]
=
TEXT_CONFIDENCE
[
w
[
"Confidence"
]]
w
[
"Message"
]
=
text_message
warning
,
w
[
"Message"
]
...
...
@@ -206,6 +209,7 @@ class Brakeman::Report
if
html
w
[
"Confidence"
]
=
HTML_CONFIDENCE
[
w
[
"Confidence"
]]
w
[
"Message"
]
=
with_context
warning
,
w
[
"Message"
]
w
[
"Warning Type"
]
=
with_link
warning
,
w
[
"Warning Type"
]
else
w
[
"Confidence"
]
=
TEXT_CONFIDENCE
[
w
[
"Confidence"
]]
w
[
"Message"
]
=
text_message
warning
,
w
[
"Message"
]
...
...
@@ -595,6 +599,10 @@ class Brakeman::Report
output
<<
"</table></div>"
end
def
with_link
warning
,
message
"<a href=
\"
#{
warning
.
link
}
\"
>
#{
message
}
</a>"
end
#Generated tab-separated output suitable for the Jenkins Brakeman Plugin:
#https://github.com/presidentbeef/brakeman-jenkins-plugin
def
to_tabs
...
...
lib/brakeman/warning.rb
浏览文件 @
37047a8b
...
...
@@ -11,7 +11,7 @@ class Brakeman::Warning
def
initialize
options
=
{}
@view_name
=
nil
[
:called_from
,
:check
,
:class
,
:code
,
:confidence
,
:controller
,
:file
,
:line
,
[
:called_from
,
:check
,
:class
,
:code
,
:confidence
,
:controller
,
:file
,
:line
,
:link_path
,
:message
,
:method
,
:model
,
:template
,
:user_input
,
:warning_set
,
:warning_type
].
each
do
|
option
|
self
.
instance_variable_set
(
"@
#{
option
}
"
,
options
[
option
])
...
...
@@ -101,6 +101,23 @@ class Brakeman::Warning
@format_message
end
def
link
return
@link
if
@link
if
@link_path
if
@link_path
.
start_with?
"http"
@link
=
@link_path
else
@link
=
"http://brakemanscanner.org/docs/warning_types/
#{
@link_path
}
"
end
else
warning_path
=
self
.
warning_type
.
to_s
.
downcase
.
gsub
(
/\s+/
,
'_'
)
+
"/"
@link
=
"http://brakemanscanner.org/docs/warning_types/
#{
warning_path
}
"
end
@link
end
#Generates a hash suitable for inserting into a table
def
to_row
type
=
:warning
@row
=
{
"Confidence"
=>
self
.
confidence
,
...
...
@@ -151,6 +168,7 @@ class Brakeman::Warning
:message
=>
self
.
message
,
:file
=>
self
.
file
,
:line
=>
self
.
line
,
:link
=>
self
.
link
,
:code
=>
(
@code
&&
self
.
format_code
),
:location
=>
location
,
:user_input
=>
(
@user_input
&&
self
.
format_user_input
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录