Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
社会瑞弟呀
brakeman
提交
ef83e361
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,发现更多精彩内容 >>
提交
ef83e361
编写于
12月 05, 2011
作者:
J
Justin Collins
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update some documentation
上级
a0e5f7e1
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
34 addition
and
3 deletion
+34
-3
lib/brakeman/call_index.rb
lib/brakeman/call_index.rb
+11
-0
lib/brakeman/checks/check_execute.rb
lib/brakeman/checks/check_execute.rb
+1
-1
lib/brakeman/checks/check_sql.rb
lib/brakeman/checks/check_sql.rb
+1
-1
lib/brakeman/tracker.rb
lib/brakeman/tracker.rb
+20
-0
lib/brakeman/warning.rb
lib/brakeman/warning.rb
+1
-1
未找到文件。
lib/brakeman/call_index.rb
浏览文件 @
ef83e361
require
'set'
#Stores call sites to look up later.
class
Brakeman::CallIndex
#Initialize index with calls from FindAllCalls
def
initialize
calls
@calls_by_method
=
Hash
.
new
{
|
h
,
k
|
h
[
k
]
=
[]
}
@calls_by_target
=
Hash
.
new
{
|
h
,
k
|
h
[
k
]
=
[]
}
...
...
@@ -10,6 +13,14 @@ class Brakeman::CallIndex
index_calls
calls
end
#Find calls matching specified option hash.
#
#Options:
#
# * :target - symbol, array of symbols, or regular expression to match target(s)
# * :method - symbol, array of symbols, or regular expression to match method(s)
# * :chained - boolean, whether or not to match against a whole method chain (false by default)
# * :nested - boolean, whether or not to match against a method call that is a target itself (false by default)
def
find_calls
options
target
=
options
[
:target
]
||
options
[
:targets
]
method
=
options
[
:method
]
||
options
[
:methods
]
...
...
lib/brakeman/checks/check_execute.rb
浏览文件 @
ef83e361
...
...
@@ -25,7 +25,7 @@ class Brakeman::CheckExecute < Brakeman::BaseCheck
end
end
#Processes results from
FindC
all.
#Processes results from
Tracker#find_c
all.
def
process_result
result
call
=
result
[
:call
]
...
...
lib/brakeman/checks/check_sql.rb
浏览文件 @
ef83e361
...
...
@@ -37,7 +37,7 @@ class Brakeman::CheckSQL < Brakeman::BaseCheck
end
end
#Process result from
FindC
all.
#Process result from
Tracker#find_c
all.
def
process_result
result
call
=
result
[
:call
]
...
...
lib/brakeman/tracker.rb
浏览文件 @
ef83e361
...
...
@@ -97,6 +97,26 @@ class Brakeman::Tracker
end
#Find a method call.
#
#Options:
# * :target => target name(s)
# * :method => method name(s)
# * :chained => search in method chains
#
#If :target => false or :target => nil, searches for methods without a target.
#Targets and methods can be specified as a symbol, an array of symbols,
#or a regular expression.
#
#If :chained => true, matches target at head of method chain and method at end.
#
#For example:
#
# find_call :target => User, :method => :all, :chained => true
#
#could match
#
# User.human.active.all(...)
#
def
find_call
options
index_calls
unless
@call_index
@call_index
.
find_calls
options
...
...
lib/brakeman/warning.rb
浏览文件 @
ef83e361
...
...
@@ -5,7 +5,7 @@ class Brakeman::Warning
attr_accessor
:code
,
:context
,
:file
,
:message
#+options[:result]+ can be a result
Sexp from FindC
all. Otherwise, it can be +nil+.
#+options[:result]+ can be a result
from Tracker#find_c
all. Otherwise, it can be +nil+.
def
initialize
options
=
{}
@view_name
=
nil
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录