Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
Brakeman
提交
6ffb3b70
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 搜索 >>
提交
6ffb3b70
编写于
8月 05, 2014
作者:
C
Clint Gibler
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add test for external checks loading
上级
2808c45c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
3 deletion
+22
-3
lib/brakeman/checks.rb
lib/brakeman/checks.rb
+4
-1
test/apps/rails4/external_checks/check_external_check_test.rb
.../apps/rails4/external_checks/check_external_check_test.rb
+11
-0
test/tests/rails4.rb
test/tests/rails4.rb
+7
-2
未找到文件。
lib/brakeman/checks.rb
浏览文件 @
6ffb3b70
...
...
@@ -181,4 +181,7 @@ class Brakeman::Checks
end
end
Brakeman
::
Checks
.
initialize_checks
File
.
expand_path
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"checks"
))
#Load all files in checks/ directory
Dir
.
glob
(
"
#{
File
.
expand_path
(
File
.
dirname
(
__FILE__
))
}
/checks/*.rb"
).
sort
.
each
do
|
f
|
require
f
.
match
(
/(brakeman\/checks\/.*)\.rb$/
)[
0
]
end
test/apps/rails4/external_checks/check_external_check_test.rb
0 → 100644
浏览文件 @
6ffb3b70
require
'brakeman/checks/base_check'
#Verify that checks external to the checks/ dir are added by the additional_checks_path options flag
class
Brakeman::CheckExternalCheckTest
<
Brakeman
::
BaseCheck
Brakeman
::
Checks
.
add
self
@description
=
"An external check that does nothing, used for testing"
def
run_check
end
end
test/tests/rails4.rb
浏览文件 @
6ffb3b70
abort
"Please run using test/test.rb"
unless
defined?
BrakemanTester
Rails4
=
BrakemanTester
.
run_scan
"rails4"
,
"Rails 4"
EXTERNAL_CHECKS_PATH
=
File
.
expand_path
(
File
.
join
(
File
.
dirname
(
__FILE__
),
".."
,
"/apps/rails4/external_checks"
))
Rails4
=
BrakemanTester
.
run_scan
"rails4"
,
"Rails 4"
,
{
additional_checks_path:
[
EXTERNAL_CHECKS_PATH
]}
class
Rails4Tests
<
Test
::
Unit
::
TestCase
include
BrakemanTester
::
FindWarning
include
BrakemanTester
::
CheckExpected
def
report
Rails4
end
...
...
@@ -581,4 +582,8 @@ class Rails4Tests < Test::Unit::TestCase
:relative_path
=>
"app/controllers/application_controller.rb"
,
:user_input
=>
nil
end
def
test_external_checks
# TODO: check for external check class being loaded here
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录