提交 cd485d80 编写于 作者: I Ian Ehlert

refactor selecting paths so it works in 1.8.7

上级 90ce517e
......@@ -79,24 +79,22 @@ module Brakeman
def find_paths(directory, extensions = "*.rb")
pattern = @root + "/#{directory}/**/#{extensions}"
Dir.glob(pattern).sort.tap do |paths|
select_files(paths)
end
select_files(Dir.glob(pattern).sort)
end
def select_files(paths)
select_only_files(paths)
paths = select_only_files(paths)
reject_skipped_files(paths)
end
def select_only_files(paths)
return unless @only_files
paths.select! { |f| @only_files.match f }
return paths unless @only_files
paths.select { |f| @only_files.match f }
end
def reject_skipped_files(paths)
return unless @skip_files
paths.reject! { |f| @skip_files.match f }
return paths unless @skip_files
paths.reject { |f| @skip_files.match f }
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册