Skip to content

Commit

Permalink
rename nil: true option to nilable: true
Browse files Browse the repository at this point in the history
  • Loading branch information
GustavoCaso committed Jul 19, 2023
1 parent 29a62b3 commit b3af7d3
Show file tree
Hide file tree
Showing 36 changed files with 48 additions and 48 deletions.
4 changes: 2 additions & 2 deletions lib/datadog/core/configuration/option.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ def validate_type(value)
valid_type = validate(@definition.type, value)

unless valid_type
raise_error = if @definition.type_options[:nil]
raise_error = if @definition.type_options[:nilable]
!value.is_a?(NilClass)
else
true
end
end

if raise_error
error_msg = if @definition.type_options[:nil]
error_msg = if @definition.type_options[:nilable]
"The option #{@definition.name} support this type `#{@definition.type}` "\
"and `nil` but the value provided is #{value.class}"
else
Expand Down
8 changes: 4 additions & 4 deletions lib/datadog/core/configuration/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def initialize(*_)
# @default `DD_API_KEY` environment variable, otherwise `nil`
# @return [String,nil]
option :api_key do |o|
o.type :string, nil: true
o.type :string, nilable: true
o.env Core::Environment::Ext::ENV_API_KEY
end

Expand Down Expand Up @@ -457,7 +457,7 @@ def initialize(*_)
# @default `DD_SITE` environment variable, otherwise `nil` which sends data to `app.datadoghq.com`
# @return [String,nil]
option :site do |o|
o.type :string, nil: true
o.type :string, nilable: true
o.env Core::Environment::Ext::ENV_SITE
end

Expand All @@ -468,7 +468,7 @@ def initialize(*_)
# @default `DD_TAGS` environment variable (in the format `'tag1:value1,tag2:value2'`), otherwise `{}`
# @return [Hash<String,String>]
option :tags do |o|
o.type :hash, nil: true
o.type :hash, nilable: true
o.env Core::Environment::Ext::ENV_TAGS
o.env_parser do |env_value|
values = if env_value.include?(',')
Expand Down Expand Up @@ -553,7 +553,7 @@ def initialize(*_)
# @return [String,nil]
option :version do |o|
# NOTE: version also gets set as a side effect of tags. See the WORKAROUND note in #initialize for details.
o.type :string, nil: true
o.type :string, nilable: true
o.env Core::Environment::Ext::ENV_VERSION
end

Expand Down
12 changes: 6 additions & 6 deletions lib/datadog/tracing/configuration/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def self.extended(base)
# @default `DD_TRACE_ANALYTICS_ENABLED` environment variable, otherwise `nil`
# @return [Boolean,nil]
option :enabled do |o|
o.type :bool, nil: true
o.type :bool, nilable: true
o.env Tracing::Configuration::Ext::Analytics::ENV_TRACE_ANALYTICS_ENABLED
end
end
Expand Down Expand Up @@ -295,7 +295,7 @@ def self.extended(base)
# @default `DD_TRACE_SAMPLE_RATE` environment variable, otherwise `nil`.
# @return [Float]
option :default_rate do |o|
o.type :float, nil: true
o.type :float, nilable: true
o.env Tracing::Configuration::Ext::Sampling::ENV_SAMPLE_RATE
end

Expand All @@ -307,7 +307,7 @@ def self.extended(base)
# @default `DD_TRACE_RATE_LIMIT` environment variable, otherwise 100.
# @return [Numeric,nil]
option :rate_limit do |o|
o.type :int, nil: true
o.type :int, nilable: true
o.env Tracing::Configuration::Ext::Sampling::ENV_RATE_LIMIT
o.default 100
end
Expand Down Expand Up @@ -340,7 +340,7 @@ def self.extended(base)
# @return [String,nil]
# @public_api
option :span_rules do |o|
o.type :string, nil: true
o.type :string, nilable: true
o.default do
rules = ENV[Tracing::Configuration::Ext::Sampling::Span::ENV_SPAN_SAMPLING_RULES]
rules_file = ENV[Tracing::Configuration::Ext::Sampling::Span::ENV_SPAN_SAMPLING_RULES_FILE]
Expand Down Expand Up @@ -402,7 +402,7 @@ def self.extended(base)
# @default `nil`
# @return [Proc,nil]
option :transport_options do |o|
o.type :proc, nil: true
o.type :proc, nilable: true
o.default nil
end
# A custom writer instance.
Expand Down Expand Up @@ -462,7 +462,7 @@ def self.extended(base)
# @default `DD_TRACE_CLIENT_IP_HEADER` environment variable, otherwise `nil`.
# @return [String,nil]
option :header_name do |o|
o.type :string, nil: true
o.type :string, nilable: true
o.env Tracing::Configuration::Ext::ClientIp::ENV_HEADER_NAME
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Settings < Contrib::Configuration::Settings
end

option :analytics_enabled do |o|
o.type :bool, nil: true
o.type :bool, nilable: true
o.env Ext::ENV_ANALYTICS_ENABLED
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Settings < Contrib::Configuration::Settings

option :service_name
option :error_handler do |o|
o.type :proc, nil: true
o.type :proc, nilable: true
o.experimental_default_proc Tracing::SpanOperation::Events::DEFAULT_ON_ERROR
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/datadog/tracing/contrib/aws/configuration/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Settings < Contrib::Configuration::Settings
end

option :service_name do |o|
o.type :string, nil: true
o.type :string, nilable: true
o.env Ext::ENV_SERVICE_NAME
o.setter do |value|
Contrib::SpanAttributeSchema.fetch_service_name(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Settings < Contrib::Configuration::Settings
end

option :service_name do |o|
o.type :string, nil: true
o.type :string, nilable: true
o.env Ext::ENV_SERVICE_NAME
o.setter do |value|
Contrib::SpanAttributeSchema.fetch_service_name(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Settings < Contrib::Configuration::Settings
option :service_name
option :client_service_name
option :error_handler do |o|
o.type :proc, nil: true
o.type :proc, nilable: true
o.experimental_default_proc Tracing::SpanOperation::Events::DEFAULT_ON_ERROR
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Settings < Contrib::Configuration::Settings
option :quantize, default: {}

option :service_name do |o|
o.type :string, nil: true
o.type :string, nilable: true
o.env Ext::ENV_SERVICE_NAME
o.setter do |value|
Contrib::SpanAttributeSchema.fetch_service_name(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Settings < Contrib::Configuration::Settings
option :split_by_domain, default: false, type: :bool

option :service_name do |o|
o.type :string, nil: true
o.type :string, nilable: true
o.env Ext::ENV_SERVICE_NAME
o.setter do |value|
Contrib::SpanAttributeSchema.fetch_service_name(
Expand Down
4 changes: 2 additions & 2 deletions lib/datadog/tracing/contrib/excon/configuration/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ class Settings < Contrib::Configuration::Settings

option :distributed_tracing, default: true, type: :bool
option :error_handler do |o|
o.type :proc, nil: true
o.type :proc, nilable: true
end
option :split_by_domain, default: false, type: :bool

option :service_name do |o|
o.type :string, nil: true
o.type :string, nilable: true
o.env Ext::ENV_SERVICE_NAME
o.setter do |value|
Contrib::SpanAttributeSchema.fetch_service_name(
Expand Down
4 changes: 2 additions & 2 deletions lib/datadog/tracing/contrib/faraday/configuration/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ class Settings < Contrib::Configuration::Settings

option :distributed_tracing, default: true, type: :bool
option :error_handler do |o|
o.type :proc, nil: true
o.type :proc, nilable: true
o.experimental_default_proc DEFAULT_ERROR_HANDLER
end
option :split_by_domain, default: false, type: :bool

option :service_name do |o|
o.type :string, nil: true
o.type :string, nilable: true
o.env Ext::ENV_SERVICE_NAME
o.setter do |value|
Contrib::SpanAttributeSchema.fetch_service_name(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Settings < Contrib::Configuration::Settings
end

option :analytics_enabled do |o|
o.type :bool, nil: true
o.type :bool, nilable: true
o.env Ext::ENV_ANALYTICS_ENABLED
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Settings < Contrib::Configuration::Settings
end

option :analytics_enabled do |o|
o.type :bool, nil: true
o.type :bool, nilable: true
o.env Ext::ENV_ANALYTICS_ENABLED
end

Expand Down
4 changes: 2 additions & 2 deletions lib/datadog/tracing/contrib/grpc/configuration/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Settings < Contrib::Configuration::Settings
option :distributed_tracing, default: true, type: :bool

option :service_name do |o|
o.type :string, nil: true
o.type :string, nilable: true
o.env Ext::ENV_SERVICE_NAME
o.setter do |value|
Contrib::SpanAttributeSchema.fetch_service_name(
Expand All @@ -44,7 +44,7 @@ class Settings < Contrib::Configuration::Settings
end

option :error_handler do |o|
o.type :proc, nil: true
o.type :proc, nilable: true
o.experimental_default_proc Tracing::SpanOperation::Events::DEFAULT_ON_ERROR
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/datadog/tracing/contrib/http/configuration/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Settings < Contrib::Configuration::Settings
option :distributed_tracing, default: true, type: :bool

option :service_name do |o|
o.type :string, nil: true
o.type :string, nilable: true
o.env Ext::ENV_SERVICE_NAME
o.setter do |value|
Contrib::SpanAttributeSchema.fetch_service_name(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Settings < Contrib::Configuration::Settings
option :distributed_tracing, default: true, type: :bool

option :service_name do |o|
o.type :string, nil: true
o.type :string, nilable: true
o.env Ext::ENV_SERVICE_NAME
o.setter do |value|
Contrib::SpanAttributeSchema.fetch_service_name(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Settings < Contrib::Configuration::Settings
option :distributed_tracing, default: true, type: :bool

option :service_name do |o|
o.type :string, nil: true
o.type :string, nilable: true
o.env Ext::ENV_SERVICE_NAME
o.setter do |value|
Contrib::SpanAttributeSchema.fetch_service_name(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Settings < Contrib::Configuration::Settings
option :quantize, default: DEFAULT_QUANTIZE

option :service_name do |o|
o.type :string, nil: true
o.type :string, nilable: true
o.env Ext::ENV_SERVICE_NAME
o.setter do |value|
Contrib::SpanAttributeSchema.fetch_service_name(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Settings < Contrib::Configuration::Settings
end

option :service_name do |o|
o.type :string, nil: true
o.type :string, nilable: true
o.env Ext::ENV_SERVICE_NAME
o.setter do |value|
Contrib::SpanAttributeSchema.fetch_service_name(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Settings < Contrib::Configuration::Settings
option :quantize, default: {}

option :service_name do |o|
o.type :string, nil: true
o.type :string, nilable: true
o.env Ext::ENV_SERVICE_NAME
o.setter do |value|
Contrib::SpanAttributeSchema.fetch_service_name(
Expand Down
2 changes: 1 addition & 1 deletion lib/datadog/tracing/contrib/pg/configuration/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Settings < Contrib::Configuration::Settings
end

option :service_name do |o|
o.type :string, nil: true
o.type :string, nilable: true
o.env Ext::ENV_SERVICE_NAME
o.setter do |value|
Contrib::SpanAttributeSchema.fetch_service_name(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Settings < Contrib::Configuration::Settings
end

option :service_name do |o|
o.type :string, nil: true
o.type :string, nilable: true
o.env Ext::ENV_SERVICE_NAME
o.setter do |value|
Contrib::SpanAttributeSchema.fetch_service_name(
Expand Down
2 changes: 1 addition & 1 deletion lib/datadog/tracing/contrib/que/configuration/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class Settings < Contrib::Configuration::Settings
end

option :error_handler do |o|
o.type :proc, nil: true
o.type :proc, nilable: true
o.experimental_default_proc Tracing::SpanOperation::Events::DEFAULT_ON_ERROR
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Settings < Contrib::Configuration::Settings
end

option :service_name do |o|
o.type :string, nil: true
o.type :string, nilable: true
o.setter do |value|
Contrib::SpanAttributeSchema.fetch_service_name(
value,
Expand Down
2 changes: 1 addition & 1 deletion lib/datadog/tracing/contrib/rack/configuration/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class Settings < Contrib::Configuration::Settings
end

option :analytics_enabled do |o|
o.type :bool, nil: true
o.type :bool, nilable: true
o.env Ext::ENV_ANALYTICS_ENABLED
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def initialize(options = {})
end

option :analytics_enabled do |o|
o.type :bool, nil: true
o.type :bool, nilable: true
o.env Ext::ENV_ANALYTICS_ENABLED
o.on_set do |value|
# Update ActionPack analytics too
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Settings < Contrib::Configuration::Settings
end

option :service_name do |o|
o.type :string, nil: true
o.type :string, nilable: true
o.env Ext::ENV_SERVICE_NAME
o.setter do |value|
Contrib::SpanAttributeSchema.fetch_service_name(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Settings < Contrib::Configuration::Settings

option :service_name
option :error_handler do |o|
o.type :proc, nil: true
o.type :proc, nilable: true
o.experimental_default_proc Tracing::SpanOperation::Events::DEFAULT_ON_ERROR
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Settings < Contrib::Configuration::Settings
option :distributed_tracing, default: true, type: :bool

option :service_name do |o|
o.type :string, nil: true
o.type :string, nilable: true
o.env Ext::ENV_SERVICE_NAME
o.setter do |value|
Contrib::SpanAttributeSchema.fetch_service_name(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Settings < Contrib::Configuration::Settings

option :service_name
option :error_handler do |o|
o.type :proc, nil: true
o.type :proc, nilable: true
o.experimental_default_proc Tracing::SpanOperation::Events::DEFAULT_ON_ERROR
end
option :tag_body, default: false, type: :bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Settings < Contrib::Configuration::Settings
option :service_name
option :client_service_name
option :error_handler do |o|
o.type :proc, nil: true
o.type :proc, nilable: true
o.experimental_default_proc Tracing::SpanOperation::Events::DEFAULT_ON_ERROR
end
option :quantize, default: {}, type: :hash
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Settings < Contrib::Configuration::Settings
end

option :analytics_enabled do |o|
o.type :bool, nil: true
o.type :bool, nilable: true
o.env Ext::ENV_ANALYTICS_ENABLED
end

Expand Down
Loading

0 comments on commit b3af7d3

Please sign in to comment.