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
def webpack_bundle_tag(bundle)
javascript_include_tag(*webpack_entrypoint_paths(bundle))
......
require_relative '../../lib/gitlab'
require_dependency 'gitlab'
......@@ -20,11 +20,10 @@ end
if Gitlab.config.omniauth.enabled
provider_names = Gitlab.config.omniauth.providers.map(&:name)
require 'omniauth-kerberos' if provider_names.include?('kerberos')
end
module OmniAuth
module Strategies
autoload :Bitbucket, Rails.root.join('lib', 'omni_auth', 'strategies', 'bitbucket')
autoload :Jwt, Rails.root.join('lib', 'omni_auth', 'strategies', 'jwt')
Gitlab::Auth.omniauth_providers.each do |provider|
if provider_names.include?(provider)
require_dependency "omni_auth/strategies/#{provider}"
end
end
end
......@@ -14,6 +14,10 @@ module Gitlab
DEFAULT_SCOPES = [:api].freeze
class << self
def omniauth_providers
%w[bitbucket jwt]
end
def find_for_git_client(login, password, project:, ip:)
raise "Must provide an IP for rate limiting" if ip.nil?
......
......@@ -3,7 +3,7 @@ require 'jwt'
module OmniAuth
module Strategies
class JWT
class Jwt
ClaimInvalid = Class.new(StandardError)
include OmniAuth::Strategy
......@@ -56,7 +56,5 @@ module OmniAuth
fail! :claim_invalid, e
end
end
class Jwt < JWT; end
end
end
require 'json'
require_relative 'config'
require_relative 'example'
require_relative 'flaky_example'
require_relative 'flaky_examples_collection'
require_relative 'report'
require_dependency 'rspec_flaky/config'
require_dependency 'rspec_flaky/example'
require_dependency 'rspec_flaky/flaky_example'
require_dependency 'rspec_flaky/flaky_examples_collection'
require_dependency 'rspec_flaky/report'
module RspecFlaky
class Listener
......
require 'json'
require 'time'
require_relative 'config'
require_relative 'flaky_examples_collection'
require_dependency 'rspec_flaky/config'
require_dependency 'rspec_flaky/flaky_examples_collection'
module RspecFlaky
# This class is responsible for loading/saving JSON reports, and pruning
......
......@@ -5,7 +5,10 @@
# gem manually on the CI
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
unless report_file
......
......@@ -43,7 +43,7 @@ describe OmniAuth::Strategies::Jwt do
end
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
......@@ -61,7 +61,7 @@ describe OmniAuth::Strategies::Jwt do
end
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
......@@ -80,7 +80,7 @@ describe OmniAuth::Strategies::Jwt do
end
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
......
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