Skip to content

Commit

Permalink
Merge branch 'master' into dedup-logs
Browse files Browse the repository at this point in the history
  • Loading branch information
marcotc authored Dec 13, 2024
2 parents 341b234 + ef81a2f commit 35c01fb
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 356 deletions.
40 changes: 40 additions & 0 deletions Steepfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,48 @@
# Declare shortcuts for Steep::Signature::Ruby to make this file easier to read
# as well as facilitating the findability of violation types emitted by the CLI
# (e.g. the CLI emits `Diagnostic ID: Ruby::UnknownConstant` when finding errors).
Ruby = Steep::Diagnostic::Ruby

target :datadog do
signature 'sig'

check 'lib/'

# This makes Steep check the codebase with the strictest settings.
# We are free to disable checks if needed inside the block.
#
# The default level is `Ruby.default`, and there's an even stricter level called `Ruby.all_error`.
configure_code_diagnostics(Ruby.strict) do |hash|
# These checks can be gradually enabled as the codebase cleans up.
# The reporting levels are:
# * `:error`, `:warning`: These will fail `rake typecheck` and are always reported by default.
# * `:information`, `:hint`: To see these, run `rake 'typecheck[--severity-level=information]'`
# or `rake 'typecheck[--severity-level=hint]'`

# These first checks are likely the easiest to fix, given they capture a mismatch
# between the already declared type in `.rbs` and the actual type inferred by Steep.
hash[Ruby::DifferentMethodParameterKind] = :information
hash[Ruby::IncompatibleAssignment] = :information

# These checks are a bit harder, because they represent the lack of sufficient type information.
hash[Ruby::FallbackAny] = :information
hash[Ruby::UnknownInstanceVariable] = :information
hash[Ruby::UnknownRecordKey] = :information

# This check asks you to type every empty collection used in
# local variables with an inline type annotation (e.g. `ret = {} #: Hash[Symbol,untyped]`).
# This pollutes the code base, and demands seemingly unnecessary typing of internal variables.
# Ideally, these empty collections automatically assume a signature based on its usage inside its method.
# @see https://github.com/soutaro/steep/pull/1338
hash[Ruby::UnannotatedEmptyCollection] = :information

# This one is funny: it is raised whenever we use `super` from a method in a Module.
# Since there's no guarantee that the module will be included in a class with the matching method,
# Steep cannot know if the `super` call will be valid.
# But this is very common in the codebase, as such module are used for monkey-patching.
hash[Ruby::UnexpectedSuper] = :information
end

ignore 'lib/datadog/appsec.rb'
ignore 'lib/datadog/appsec/component.rb'
# Excluded due to https://github.com/soutaro/steep/issues/1232
Expand Down
3 changes: 0 additions & 3 deletions lib/datadog/appsec/processor/rule_loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ def passlist_exclusions(ip_passlist) # rubocop:disable Metrics/MethodLength
when Hash
pass = ip_passlist[:pass]
monitor = ip_passlist[:monitor]
else
pass = []
monitor = []
end

exclusions = []
Expand Down
4 changes: 2 additions & 2 deletions ruby-3.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ gem 'webmock', '>= 3.10.0'
gem 'webrick', '>= 1.7.0'

group :check do
gem 'rbs', '~> 3.6', require: false
gem 'steep', '~> 1.7.0', require: false
gem 'rbs', '>= 3.6.1', require: false
gem 'steep', '~> 1', '>= 1.7.1', require: false
gem 'standard', require: false
end

Expand Down
4 changes: 2 additions & 2 deletions ruby-3.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ gem 'webmock', '>= 3.10.0'
gem 'webrick', '>= 1.7.0'

group :check do
gem 'rbs', '~> 3.6', require: false
gem 'steep', '~> 1.7.0', require: false
gem 'rbs', '>= 3.6.1', require: false
gem 'steep', '~> 1', '>= 1.7.1', require: false
gem 'standard', require: false
end

Expand Down
4 changes: 2 additions & 2 deletions ruby-3.2.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ gem 'webmock', '>= 3.10.0'
gem 'webrick', '>= 1.7.0'

group :check do
gem 'rbs', '~> 3.6', require: false
gem 'steep', '~> 1.7.0', require: false
gem 'rbs', '>= 3.6.1', require: false
gem 'steep', '~> 1', '>= 1.7.1', require: false
gem 'standard', require: false
end

Expand Down
4 changes: 2 additions & 2 deletions ruby-3.3.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ gem 'webmock', '>= 3.10.0'
gem 'webrick', '>= 1.7.0'

group :check do
gem 'rbs', '~> 3.6', require: false
gem 'steep', '~> 1.7.0', require: false
gem 'rbs', '>= 3.6.1', require: false
gem 'steep', '~> 1', '>= 1.7.1', require: false
gem 'standard', require: false
end

Expand Down
4 changes: 2 additions & 2 deletions ruby-3.4.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ gem 'webmock', '>= 3.10.0'
gem 'webrick', '>= 1.8.2'

group :check do
gem 'rbs', '~> 3.6', require: false
gem 'steep', '~> 1.7.0', require: false
gem 'rbs', '>= 3.6.1', require: false
gem 'steep', '~> 1', '>= 1.7.1', require: false
gem 'ruby_memcheck', '>= 3'
gem 'standard', require: false
end
Expand Down
Loading

0 comments on commit 35c01fb

Please sign in to comment.