Commit 39b6f31c authored by Lin Jen-Shin's avatar Lin Jen-Shin

Eliminate constants warnings by:

* Replace `require` or `require_relative` with `require_dependency`
* Remove unneeded `autoload`
parent db40a7c4
require 'gitlab/webpack/manifest'
module WebpackHelper module WebpackHelper
def webpack_bundle_tag(bundle) def webpack_bundle_tag(bundle)
javascript_include_tag(*webpack_entrypoint_paths(bundle)) javascript_include_tag(*webpack_entrypoint_paths(bundle))
......
require_relative '../../lib/gitlab' require_dependency 'gitlab'
...@@ -20,11 +20,10 @@ end ...@@ -20,11 +20,10 @@ end
if Gitlab.config.omniauth.enabled if Gitlab.config.omniauth.enabled
provider_names = Gitlab.config.omniauth.providers.map(&:name) provider_names = Gitlab.config.omniauth.providers.map(&:name)
require 'omniauth-kerberos' if provider_names.include?('kerberos') require 'omniauth-kerberos' if provider_names.include?('kerberos')
end
module OmniAuth Gitlab::Auth.omniauth_providers.each do |provider|
module Strategies if provider_names.include?(provider)
autoload :Bitbucket, Rails.root.join('lib', 'omni_auth', 'strategies', 'bitbucket') require_dependency "omni_auth/strategies/#{provider}"
autoload :Jwt, Rails.root.join('lib', 'omni_auth', 'strategies', 'jwt') end
end end
end end
...@@ -14,6 +14,10 @@ module Gitlab ...@@ -14,6 +14,10 @@ module Gitlab
DEFAULT_SCOPES = [:api].freeze DEFAULT_SCOPES = [:api].freeze
class << self class << self
def omniauth_providers
%w[bitbucket jwt]
end
def find_for_git_client(login, password, project:, ip:) def find_for_git_client(login, password, project:, ip:)
raise "Must provide an IP for rate limiting" if ip.nil? raise "Must provide an IP for rate limiting" if ip.nil?
......
...@@ -3,7 +3,7 @@ require 'jwt' ...@@ -3,7 +3,7 @@ require 'jwt'
module OmniAuth module OmniAuth
module Strategies module Strategies
class JWT class Jwt
ClaimInvalid = Class.new(StandardError) ClaimInvalid = Class.new(StandardError)
include OmniAuth::Strategy include OmniAuth::Strategy
...@@ -56,7 +56,5 @@ module OmniAuth ...@@ -56,7 +56,5 @@ module OmniAuth
fail! :claim_invalid, e fail! :claim_invalid, e
end end
end end
class Jwt < JWT; end
end end
end end
require 'json' require 'json'
require_relative 'config' require_dependency 'rspec_flaky/config'
require_relative 'example' require_dependency 'rspec_flaky/example'
require_relative 'flaky_example' require_dependency 'rspec_flaky/flaky_example'
require_relative 'flaky_examples_collection' require_dependency 'rspec_flaky/flaky_examples_collection'
require_relative 'report' require_dependency 'rspec_flaky/report'
module RspecFlaky module RspecFlaky
class Listener class Listener
......
require 'json' require 'json'
require 'time' require 'time'
require_relative 'config' require_dependency 'rspec_flaky/config'
require_relative 'flaky_examples_collection' require_dependency 'rspec_flaky/flaky_examples_collection'
module RspecFlaky module RspecFlaky
# This class is responsible for loading/saving JSON reports, and pruning # This class is responsible for loading/saving JSON reports, and pruning
......
...@@ -5,7 +5,10 @@ ...@@ -5,7 +5,10 @@
# gem manually on the CI # gem manually on the CI
require 'rubygems' require 'rubygems'
require_relative '../lib/rspec_flaky/report' singleton_class.__send__(:alias_method, :require_dependency, :require)
$LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
require 'rspec_flaky/report'
report_file = ARGV.shift report_file = ARGV.shift
unless report_file unless report_file
......
...@@ -43,7 +43,7 @@ describe OmniAuth::Strategies::Jwt do ...@@ -43,7 +43,7 @@ describe OmniAuth::Strategies::Jwt do
end end
it 'raises error' do it 'raises error' do
expect { strategy.decoded }.to raise_error(OmniAuth::Strategies::JWT::ClaimInvalid) expect { strategy.decoded }.to raise_error(OmniAuth::Strategies::Jwt::ClaimInvalid)
end end
end end
...@@ -61,7 +61,7 @@ describe OmniAuth::Strategies::Jwt do ...@@ -61,7 +61,7 @@ describe OmniAuth::Strategies::Jwt do
end end
it 'raises error' do it 'raises error' do
expect { strategy.decoded }.to raise_error(OmniAuth::Strategies::JWT::ClaimInvalid) expect { strategy.decoded }.to raise_error(OmniAuth::Strategies::Jwt::ClaimInvalid)
end end
end end
...@@ -80,7 +80,7 @@ describe OmniAuth::Strategies::Jwt do ...@@ -80,7 +80,7 @@ describe OmniAuth::Strategies::Jwt do
end end
it 'raises error' do it 'raises error' do
expect { strategy.decoded }.to raise_error(OmniAuth::Strategies::JWT::ClaimInvalid) expect { strategy.decoded }.to raise_error(OmniAuth::Strategies::Jwt::ClaimInvalid)
end end
end end
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment