Skip to content

Commit

Permalink
more fixes and ignores
Browse files Browse the repository at this point in the history
  • Loading branch information
anmarchenko committed Jun 3, 2024
1 parent b63752e commit 2699969
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 24 deletions.
2 changes: 1 addition & 1 deletion lib/datadog/ci/contrib/cucumber/formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def extract_parameters_hash(test_case)
def ok?(result, strict)
# in minor update in Cucumber 9.2.0, the arity of the `ok?` method changed
parameters = result.method(:ok?).parameters
if parameters == [[:opt, :be_strict]]
if parameters == [%i[opt be_strict]]
result.ok?(strict)
else
result.ok?(strict: strict)
Expand Down
11 changes: 7 additions & 4 deletions lib/datadog/ci/contrib/rspec/example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def run(*args)
test_name = full_description.strip
if metadata[:description].empty?
# for unnamed it blocks this appends something like "example at ./spec/some_spec.rb:10"
test_name += " #{description}"
test_name << " #{description}"
end

test_suite_description = fetch_top_level_example_group[:description]
Expand All @@ -33,7 +33,7 @@ def run(*args)
test_name = test_name.sub(test_suite_description, "").strip

if ci_queue?
suite_name += " (ci-queue running example [#{test_name}])"
suite_name << " (ci-queue running example [#{test_name}])"
test_suite_span = CI.start_test_suite(suite_name)
end

Expand Down Expand Up @@ -83,9 +83,12 @@ def run(*args)
private

def fetch_top_level_example_group
return metadata[:example_group] unless metadata[:example_group][:parent_example_group]
example_group = metadata[:example_group]
parent_example_group = example_group[:parent_example_group]

res = metadata[:example_group][:parent_example_group]
return example_group unless parent_example_group

res = parent_example_group
while (parent = res[:parent_example_group])
res = parent
end
Expand Down
8 changes: 1 addition & 7 deletions lib/datadog/ci/test_visibility/serializers/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,7 @@ class Base
"type" => "span_type"
].freeze

REQUIRED_FIELDS = [
"error",
"name",
"resource",
"start",
"duration"
].freeze
REQUIRED_FIELDS = %w[error name resource start duration].freeze

attr_reader :trace, :span, :meta, :options

Expand Down
4 changes: 2 additions & 2 deletions lib/datadog/ci/test_visibility/serializers/test_module.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ module CI
module TestVisibility
module Serializers
class TestModule < Base
CONTENT_FIELDS = (["test_session_id", "test_module_id"] + Base::CONTENT_FIELDS).freeze
CONTENT_FIELDS = (%w[test_session_id test_module_id] + Base::CONTENT_FIELDS).freeze

CONTENT_MAP_SIZE = calculate_content_map_size(CONTENT_FIELDS)

REQUIRED_FIELDS = (["test_session_id", "test_module_id"] + Base::REQUIRED_FIELDS).freeze
REQUIRED_FIELDS = (%w[test_session_id test_module_id] + Base::REQUIRED_FIELDS).freeze

def content_fields
CONTENT_FIELDS
Expand Down
4 changes: 2 additions & 2 deletions lib/datadog/ci/test_visibility/serializers/test_session.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ module CI
module TestVisibility
module Serializers
class TestSession < Base
CONTENT_FIELDS = (["test_session_id"] + Base::CONTENT_FIELDS).freeze
CONTENT_FIELDS = (%w[test_session_id] + Base::CONTENT_FIELDS).freeze

CONTENT_MAP_SIZE = calculate_content_map_size(CONTENT_FIELDS)

REQUIRED_FIELDS = (["test_session_id"] + Base::REQUIRED_FIELDS).freeze
REQUIRED_FIELDS = (%w[test_session_id] + Base::REQUIRED_FIELDS).freeze

def content_fields
CONTENT_FIELDS
Expand Down
4 changes: 2 additions & 2 deletions lib/datadog/ci/test_visibility/serializers/test_suite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ module CI
module TestVisibility
module Serializers
class TestSuite < Base
CONTENT_FIELDS = (["test_session_id", "test_module_id", "test_suite_id"] + Base::CONTENT_FIELDS).freeze
CONTENT_FIELDS = (%w[test_session_id test_module_id test_suite_id] + Base::CONTENT_FIELDS).freeze

CONTENT_MAP_SIZE = calculate_content_map_size(CONTENT_FIELDS)

REQUIRED_FIELDS = (["test_session_id", "test_module_id", "test_suite_id"] + Base::REQUIRED_FIELDS).freeze
REQUIRED_FIELDS = (%w[test_session_id test_module_id test_suite_id] + Base::REQUIRED_FIELDS).freeze

def content_fields
CONTENT_FIELDS
Expand Down
4 changes: 2 additions & 2 deletions lib/datadog/ci/test_visibility/serializers/test_v1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ module CI
module TestVisibility
module Serializers
class TestV1 < Base
CONTENT_FIELDS = (["trace_id", "span_id"] + Base::CONTENT_FIELDS).freeze
CONTENT_FIELDS = (%w[trace_id span_id] + Base::CONTENT_FIELDS).freeze

CONTENT_MAP_SIZE = calculate_content_map_size(CONTENT_FIELDS)

REQUIRED_FIELDS = (["trace_id", "span_id"] + Base::REQUIRED_FIELDS).freeze
REQUIRED_FIELDS = (%w[trace_id span_id] + Base::REQUIRED_FIELDS).freeze

def content_fields
CONTENT_FIELDS
Expand Down
6 changes: 3 additions & 3 deletions lib/datadog/ci/test_visibility/serializers/test_v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ module CI
module TestVisibility
module Serializers
class TestV2 < TestV1
CONTENT_FIELDS = (["test_session_id", "test_module_id", "test_suite_id"] + TestV1::CONTENT_FIELDS).freeze
CONTENT_FIELDS = (%w[test_session_id test_module_id test_suite_id] + TestV1::CONTENT_FIELDS).freeze

CONTENT_FIELDS_WITH_ITR_CORRELATION_ID = (CONTENT_FIELDS + ["itr_correlation_id"]).freeze
CONTENT_FIELDS_WITH_ITR_CORRELATION_ID = (CONTENT_FIELDS + %w[itr_correlation_id]).freeze

CONTENT_MAP_SIZE = calculate_content_map_size(CONTENT_FIELDS)

CONTENT_MAP_SIZE_WITH_ITR_CORRELATION_ID = calculate_content_map_size(CONTENT_FIELDS_WITH_ITR_CORRELATION_ID)

REQUIRED_FIELDS = (["test_session_id", "test_module_id", "test_suite_id"] + TestV1::REQUIRED_FIELDS).freeze
REQUIRED_FIELDS = (%w[test_session_id test_module_id test_suite_id] + TestV1::REQUIRED_FIELDS).freeze

def content_fields
return CONTENT_FIELDS if itr_correlation_id.nil?
Expand Down
2 changes: 1 addition & 1 deletion static-analysis.datadog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ rulesets:
- '**'
hash-fetch:
ignore:
- spec/**/*
- '**'
percent-w:
ignore:
- spec/**/*
Expand Down

0 comments on commit 2699969

Please sign in to comment.