Skip to content

Conversation

@api-clients-generation-pipeline
Copy link
Contributor

@api-clients-generation-pipeline api-clients-generation-pipeline bot requested review from a team as code owners May 30, 2025 17:18
end

if attributes.key?(:'samplings')
if (value = attributes[:'samplings']).is_a?(Array)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Quality Violation

Consider using Array() to ensure the type is that of an array (...read more)

The rule "Use Array() to ensure your variable is an array" is important for ensuring your code behaves as expected, regardless of the type of data it receives. It is common in Ruby to need to iterate through an array of items. However, if the variable is not an array, this can lead to unexpected behavior or errors.

The Array() method in Ruby is a Kernel method that converts its argument to an Array. If the argument is already an Array, it returns the argument. If the argument is nil, it returns an empty Array. This can be used to ensure that a variable is an array before trying to iterate over it, preventing potential errors or unexpected behavior.

By using Array(foos), you can ensure that foos is an array before you try to iterate over it with each. This prevents the need to check if foos is an array with foos.is_a?(Array) and makes your code cleaner and easier to understand.

View in Datadog  Leave us feedback  Documentation

@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented May 30, 2025

Datadog Report

Branch report: datadog-api-spec/generated/3919
Commit report: 1501c7d
Test service: datadog-api-client-ruby

✅ 0 Failed, 3072 Passed, 87 Skipped, 3m 5.45s Total Time

@api-clients-generation-pipeline api-clients-generation-pipeline bot force-pushed the datadog-api-spec/generated/3919 branch 2 times, most recently from 7580014 to bbfe4fc Compare June 2, 2025 15:09
end

if attributes.key?(:'labels')
if (value = attributes[:'labels']).is_a?(Array)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Quality Violation

Consider using Array() to ensure the type is that of an array (...read more)

The rule "Use Array() to ensure your variable is an array" is important for ensuring your code behaves as expected, regardless of the type of data it receives. It is common in Ruby to need to iterate through an array of items. However, if the variable is not an array, this can lead to unexpected behavior or errors.

The Array() method in Ruby is a Kernel method that converts its argument to an Array. If the argument is already an Array, it returns the argument. If the argument is nil, it returns an empty Array. This can be used to ensure that a variable is an array before trying to iterate over it, preventing potential errors or unexpected behavior.

By using Array(foos), you can ensure that foos is an array before you try to iterate over it with each. This prevents the need to check if foos is an array with foos.is_a?(Array) and makes your code cleaner and easier to understand.

View in Datadog  Leave us feedback  Documentation

@api-clients-generation-pipeline api-clients-generation-pipeline bot force-pushed the datadog-api-spec/generated/3919 branch 2 times, most recently from 61e910f to 9555f65 Compare June 2, 2025 16:15
@api-clients-generation-pipeline api-clients-generation-pipeline bot force-pushed the datadog-api-spec/generated/3919 branch 2 times, most recently from 85ca4b9 to a93bfa9 Compare June 12, 2025 17:25
@api-clients-generation-pipeline api-clients-generation-pipeline bot changed the title [SDS] Add sampling fields to SDS spec Add sampling fields to SDS spec Jun 17, 2025
@api-clients-generation-pipeline api-clients-generation-pipeline bot force-pushed the datadog-api-spec/generated/3919 branch from a93bfa9 to 84f3249 Compare June 17, 2025 18:22
@api-clients-generation-pipeline api-clients-generation-pipeline bot merged commit dc072ed into master Jun 17, 2025
17 checks passed
@api-clients-generation-pipeline api-clients-generation-pipeline bot deleted the datadog-api-spec/generated/3919 branch June 17, 2025 19:30
github-actions bot pushed a commit that referenced this pull request Jun 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants