File tree Expand file tree Collapse file tree 4 files changed +16
-0
lines changed
Expand file tree Collapse file tree 4 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 22 - rubocop-performance
33 - rubocop-rake
44 - rubocop-rspec
5+ - rubocop-thread_safety
56
67AllCops :
78 TargetRubyVersion : ' 3.2'
Original file line number Diff line number Diff line change 3232# for the gem's classes.
3333module Minfraud
3434 class << self
35+ # rubocop:disable ThreadSafety/ClassAndModuleAttributes
36+ # This is a false positive - these configuration attributes are set during initialization
37+
3538 # The MaxMind account ID that is used for authorization.
3639 #
3740 # @return [Integer, nil]
@@ -57,6 +60,8 @@ class << self
5760 # @return [String, nil]
5861 attr_accessor :license_key
5962
63+ # rubocop:enable ThreadSafety/ClassAndModuleAttributes
64+
6065 # @!visibility private
6166 attr_reader :connection_pool
6267
@@ -67,19 +72,25 @@ def configure
6772 yield self
6873
6974 pool_size = 5
75+ # rubocop:disable ThreadSafety/ClassInstanceVariable
76+ # This is a false positive - this configuration is set during initialization
7077 host = @host . nil? ? 'minfraud.maxmind.com' : @host
7178 @connection_pool = ConnectionPool . new ( size : pool_size ) do
79+ # rubocop:enable ThreadSafety/ClassInstanceVariable
7280 make_http_client . persistent ( "https://#{ host } " )
7381 end
7482 end
7583
7684 private
7785
7886 def make_http_client
87+ # rubocop:disable ThreadSafety/ClassInstanceVariable
88+ # This is a false positive - this configuration is set during initialization
7989 HTTP . basic_auth (
8090 user : @account_id ,
8191 pass : @license_key ,
8292 ) . headers (
93+ # rubocop:enable ThreadSafety/ClassInstanceVariable
8394 accept : 'application/json' ,
8495 user_agent : "minfraud-api-ruby/#{ Minfraud ::VERSION } ruby/#{ RUBY_VERSION } http/#{ HTTP ::VERSION } " ,
8596 )
Original file line number Diff line number Diff line change @@ -15,7 +15,10 @@ module ClassMethods
1515 #
1616 # @return [Hash]
1717 def mapping
18+ # rubocop:disable ThreadSafety/ClassInstanceVariable
19+ # This is a false positive - this is set during class definition and then only read
1820 @mapping ||= { }
21+ # rubocop:enable ThreadSafety/ClassInstanceVariable
1922 end
2023
2124 # Create a set of methods for enum-like behavior of the attribute.
Original file line number Diff line number Diff line change @@ -34,6 +34,7 @@ Gem::Specification.new do |spec|
3434 spec . add_development_dependency 'rubocop-performance'
3535 spec . add_development_dependency 'rubocop-rake'
3636 spec . add_development_dependency 'rubocop-rspec'
37+ spec . add_development_dependency 'rubocop-thread_safety'
3738 spec . add_development_dependency 'webmock' , '~> 3.14'
3839 spec . metadata = {
3940 'rubygems_mfa_required' => 'true'
You can’t perform that action at this time.
0 commit comments