Skip to content
代码片段 群组 项目
未验证 提交 849324fe 编辑于 作者: Peter Leitzen's avatar Peter Leitzen
浏览文件

Rake/Require: Allow use of `require` in "static" method definitions

上级 4b68056e
未找到相关分支
未找到相关标签
无相关合并请求
......@@ -17,6 +17,14 @@ module Rake
# Gitlab::Json.parse(...)
# end
#
# namespace :json do
# require_relative 'gitlab/json'
# require 'json'
#
# task :parse_json do
# end
# end
#
# # good
#
# task :parse_json do
......@@ -26,6 +34,15 @@ module Rake
# Gitlab::Json.parse(...)
# end
#
# namespace :json do
# task :parse_json do
# require_relative 'gitlab/json'
# require 'json'
#
# Gitlab::Json.parse(...)
# end
# end
#
# RSpec::Core::RakeTask.new(:parse_json) do |t, args|
# require_relative 'gitlab/json'
# require 'json'
......@@ -95,7 +112,7 @@ def inside_block(node, skip:)
end
def inside_method?(node)
node.each_ancestor(:def).any?
node.each_ancestor(:def, :defs).any?
end
end
end
......
......@@ -83,8 +83,13 @@ def load_deps
require 'json'
end
def self.run
require 'yaml'
end
task :parse do
load_deps
run
end
RUBY
end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
想要评论请 注册