diff --git a/Gemfile b/Gemfile index 38384131c01..d25788ece52 100644 --- a/Gemfile +++ b/Gemfile @@ -82,8 +82,8 @@ end group :check do if RUBY_VERSION >= '3.0.0' && RUBY_PLATFORM != 'java' - gem 'rbs', '~> 3.2.0', require: false - gem 'steep', '~> 1.6.0', require: false + gem 'rbs', '~> 3.5.0', require: false + gem 'steep', '~> 1.7.0', require: false end gem 'ruby_memcheck', '>= 3' if RUBY_VERSION >= '3.4.0' && RUBY_PLATFORM != 'java' gem 'standard', require: false diff --git a/Steepfile b/Steepfile index dfae78bba26..853aa813e01 100644 --- a/Steepfile +++ b/Steepfile @@ -5,6 +5,8 @@ target :datadog do ignore 'lib/datadog/appsec.rb' ignore 'lib/datadog/appsec/component.rb' + # Excluded due to https://github.com/soutaro/steep/issues/1232 + ignore 'lib/datadog/appsec/configuration/settings.rb' ignore 'lib/datadog/appsec/contrib/' ignore 'lib/datadog/appsec/contrib/auto_instrument.rb' ignore 'lib/datadog/appsec/contrib/integration.rb' @@ -69,6 +71,8 @@ target :datadog do ignore 'lib/datadog/core/metrics/options.rb' ignore 'lib/datadog/core/pin.rb' ignore 'lib/datadog/core/rate_limiter.rb' + # steep fails in this file due to https://github.com/soutaro/steep/issues/1231 + ignore 'lib/datadog/core/remote/tie.rb' ignore 'lib/datadog/core/runtime/ext.rb' ignore 'lib/datadog/core/runtime/metrics.rb' ignore 'lib/datadog/core/transport/ext.rb' diff --git a/lib/datadog/core/environment/execution.rb b/lib/datadog/core/environment/execution.rb index 2049773a8d4..6d4a084ebec 100644 --- a/lib/datadog/core/environment/execution.rb +++ b/lib/datadog/core/environment/execution.rb @@ -25,9 +25,9 @@ def development? # 2. Checking if `Net::HTTP` is referring to the original one # => ::Net::HTTP.equal?(::WebMock::HttpLibAdapters::NetHttpAdapter::OriginalNetHTTP) def webmock_enabled? - defined?(::WebMock::HttpLibAdapters::NetHttpAdapter) && + !!(defined?(::WebMock::HttpLibAdapters::NetHttpAdapter) && defined?(::Net::HTTP) && - ::Net::HTTP.equal?(::WebMock::HttpLibAdapters::NetHttpAdapter.instance_variable_get(:@webMockNetHTTP)) + ::Net::HTTP.equal?(::WebMock::HttpLibAdapters::NetHttpAdapter.instance_variable_get(:@webMockNetHTTP))) end private @@ -68,7 +68,7 @@ def minitest? # Check if we are running from `bin/cucumber` or `cucumber/rake/task`. def cucumber? - defined?(::Cucumber::Cli) + !!defined?(::Cucumber::Cli) end # If this is a Rails application, use different heuristics to detect @@ -80,7 +80,7 @@ def rails_development? # detecting its presence is enough to deduct if this is a development environment. # # @see https://github.com/rails/spring/blob/48b299348ace2188444489a0c216a6f3e9687281/README.md?plain=1#L204-L207 - defined?(::Spring) || rails_env_development? + !!defined?(::Spring) || rails_env_development? end RAILS_ENV_DEVELOPMENT = Set['development', 'test'].freeze @@ -94,7 +94,7 @@ def rails_development? # it's common to have a custom "staging" environment, and such environment normally want to run as close # to production as possible. def rails_env_development? - defined?(::Rails.env) && RAILS_ENV_DEVELOPMENT.include?(::Rails.env) + !!defined?(::Rails.env) && RAILS_ENV_DEVELOPMENT.include?(::Rails.env) end end end diff --git a/lib/datadog/core/remote/tie.rb b/lib/datadog/core/remote/tie.rb index f4279a471ba..ef0d331529a 100644 --- a/lib/datadog/core/remote/tie.rb +++ b/lib/datadog/core/remote/tie.rb @@ -19,6 +19,8 @@ def self.boot barrier = Datadog::Core::Remote.active_remote.barrier(:once) end + # steep does not permit the next line due to + # https://github.com/soutaro/steep/issues/1231 Boot.new(barrier, t) end end diff --git a/sig/datadog/core/remote/tie.rbs b/sig/datadog/core/remote/tie.rbs index b4af9d4f2d4..793db6c802d 100644 --- a/sig/datadog/core/remote/tie.rbs +++ b/sig/datadog/core/remote/tie.rbs @@ -2,14 +2,14 @@ module Datadog module Core module Remote module Tie - class Boot < ::Struct[untyped] + class Boot < ::Struct[[Component::Barrier, Numeric]] def initialize: (Component::Barrier? barrier, Numeric? time) -> void attr_reader barrier: Component::Barrier attr_reader time: Numeric end - def self.boot: () -> (nil | Boot) + def self.boot: () -> Boot? end end end diff --git a/sig/datadog/core/telemetry/event.rbs b/sig/datadog/core/telemetry/event.rbs index 12fd27713c1..4818992176f 100644 --- a/sig/datadog/core/telemetry/event.rbs +++ b/sig/datadog/core/telemetry/event.rbs @@ -24,7 +24,7 @@ module Datadog def agent_transport: (untyped config) -> String - def conf_value: (String name, Object value, Integer seq_id, ?String origin) -> Hash[Symbol, untyped] + def conf_value: (String name, untyped value, Integer seq_id, ?String origin) -> Hash[Symbol, untyped] def to_value: (Object value) -> Object