Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
社会瑞弟呀
brakeman
提交
0568be46
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,发现更多精彩内容 >>
提交
0568be46
编写于
12月 05, 2012
作者:
J
Justin Collins
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove more uses of Sexp#args
上级
eb3d2b89
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
15 deletion
+16
-15
lib/brakeman/processors/controller_processor.rb
lib/brakeman/processors/controller_processor.rb
+8
-7
lib/brakeman/processors/model_processor.rb
lib/brakeman/processors/model_processor.rb
+8
-8
未找到文件。
lib/brakeman/processors/controller_processor.rb
浏览文件 @
0568be46
...
...
@@ -64,12 +64,13 @@ class Brakeman::ControllerProcessor < Brakeman::BaseProcessor
end
method
=
exp
.
method
args
=
exp
.
args
first_arg
=
exp
.
first_arg
last_arg
=
exp
.
last_arg
#Methods called inside class definition
#like attr_* and other settings
if
@current_method
.
nil?
and
target
.
nil?
and
@controller
if
args
.
empty?
if
first_arg
.
nil?
#No args
case
method
when
:private
,
:protected
,
:public
@visibility
=
method
...
...
@@ -81,21 +82,21 @@ class Brakeman::ControllerProcessor < Brakeman::BaseProcessor
else
case
method
when
:include
@controller
[
:includes
]
<<
class_name
(
args
.
first
)
if
@controller
@controller
[
:includes
]
<<
class_name
(
first_arg
)
if
@controller
when
:before_filter
@controller
[
:options
][
:before_filters
]
||=
[]
@controller
[
:options
][
:before_filters
]
<<
args
@controller
[
:options
][
:before_filters
]
<<
exp
.
args
when
:layout
if
string?
args
.
last
if
string?
last_arg
#layout "some_layout"
name
=
args
.
last
.
value
.
to_s
name
=
last_arg
.
value
.
to_s
if
@app_tree
.
layout_exists?
(
name
)
@controller
[
:layout
]
=
"layouts/
#{
name
}
"
else
Brakeman
.
debug
"[Notice] Layout not found:
#{
name
}
"
end
elsif
node_type?
args
.
last
,
:nil
,
:false
elsif
node_type?
last_arg
,
:nil
,
:false
#layout :false or layout nil
@controller
[
:layout
]
=
false
end
...
...
lib/brakeman/processors/model_processor.rb
浏览文件 @
0568be46
...
...
@@ -60,12 +60,12 @@ class Brakeman::ModelProcessor < Brakeman::BaseProcessor
end
method
=
exp
.
method
args
=
exp
.
args
first_arg
=
exp
.
first_arg
#Methods called inside class definition
#like attr_* and other settings
if
@current_method
.
nil?
and
target
.
nil?
if
args
.
empty
?
if
first_arg
.
nil
?
case
method
when
:private
,
:protected
,
:public
@visibility
=
method
...
...
@@ -77,16 +77,16 @@ class Brakeman::ModelProcessor < Brakeman::BaseProcessor
else
case
method
when
:include
@model
[
:includes
]
<<
class_name
(
args
.
first
)
if
@model
@model
[
:includes
]
<<
class_name
(
first_arg
)
if
@model
when
:attr_accessible
@model
[
:attr_accessible
]
||=
[]
args
=
args
.
map
do
|
e
|
args
=
[]
exp
.
each_arg
do
|
e
|
if
node_type?
e
,
:lit
e
.
value
else
nil
args
<<
e
.
value
end
end
.
compact
end
@model
[
:attr_accessible
].
concat
args
else
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录