Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Table Widget requests to specify text replace formatting in dashboards #1993

Merged

Conversation

api-clients-generation-pipeline[bot]
Copy link
Contributor

@@ -242,6 +247,12 @@ def initialize(attributes = {})
if attributes.key?(:'sort')
self.sort = attributes[:'sort']
end

if attributes.key?(:'text_formats')
if (value = attributes[:'text_formats']).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/3069 branch 4 times, most recently from a7139ca to abb52bb Compare September 9, 2024 19:49
@api-clients-generation-pipeline api-clients-generation-pipeline bot force-pushed the datadog-api-spec/generated/3069 branch 3 times, most recently from f2e95c2 to 75c72bf Compare September 13, 2024 17:12
@api-clients-generation-pipeline api-clients-generation-pipeline bot changed the title [dashboards] Allow Table Widget requests to specify text replace formatting Allow Table Widget requests to specify text replace formatting in dashboards Sep 16, 2024
@api-clients-generation-pipeline api-clients-generation-pipeline bot force-pushed the datadog-api-spec/generated/3069 branch from 75c72bf to 1cf7d0f Compare September 16, 2024 14:03
@api-clients-generation-pipeline api-clients-generation-pipeline bot merged commit 98e6cb6 into master Sep 16, 2024
17 checks passed
@api-clients-generation-pipeline api-clients-generation-pipeline bot deleted the datadog-api-spec/generated/3069 branch September 16, 2024 14:58
github-actions bot pushed a commit that referenced this pull request Sep 16, 2024
…hboards (#1993)

Co-authored-by: ci.datadog-api-spec <[email protected]>
Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com> 98e6cb6
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