Skip to content

Conversation

@api-clients-generation-pipeline
Copy link
Contributor

@datadog-datadog-prod-us1
Copy link

datadog-datadog-prod-us1 bot commented Jun 11, 2025

Datadog Report

Branch report: datadog-api-spec/generated/3957
Commit report: 818de82
Test service: datadog-api-client-ruby

❌ 10 Failed (0 Known Flaky), 86 Passed, 1588 Skipped, 40.63s Total duration (35.31s time saved)

❌ Failed Tests (10)

This report shows up to 5 failed tests.

  • Create a Workload Protection agent rule with set action returns "OK" response - CSM Threats at features/v2/csm_threats.feature

  • Create a Workload Protection agent rule with set action returns "OK" response - CSM Threats at features/v2/csm_threats.feature

  • Delete a Workload Protection agent rule returns "OK" response - CSM Threats at features/v2/csm_threats.feature

  • Delete a Workload Protection agent rule returns "OK" response - CSM Threats at features/v2/csm_threats.feature

  • Get all Workload Protection agent rules returns "OK" response - CSM Threats at features/v2/csm_threats.feature - Details

    Expand for error
     uninitialized constant DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleActionHash
     Did you mean?  DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleKill
                    DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleAttributes
                    DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleData
                    DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleType
                    DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleCreateData
                    DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleActionMetadata
                    DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleActionSet
                    DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleUpdateData
                    DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleResponse
    

@api-clients-generation-pipeline api-clients-generation-pipeline bot force-pushed the datadog-api-spec/generated/3957 branch from ad27619 to a689ccb Compare June 11, 2025 13:40
@api-clients-generation-pipeline api-clients-generation-pipeline bot changed the title [CWS] Add hash field to actions in agent rules Add hash field to actions in CWS agent rules Jun 11, 2025
@api-clients-generation-pipeline api-clients-generation-pipeline bot force-pushed the datadog-api-spec/generated/3957 branch from a689ccb to d605aba Compare June 11, 2025 13:53
# Calculates hash code according to all attributes.
# @return [Integer] Hash code
# @!visibility private
def hash

Choose a reason for hiding this comment

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

🔵 Code Quality Violation

Avoid nested methods (...read more)

The Ruby static analysis rule "Prevent nested method" discourages defining a method within another method. This practice is generally discouraged in Ruby because the inner method is not actually defined within the scope of the outer method as one might expect, but rather in the same scope as the outer method. This can lead to unexpected behavior and make code more difficult to understand and maintain.

This rule is important because it promotes good coding practices and helps to prevent potential bugs. Nested methods can lead to confusing code and unintended side effects, making your code more difficult to debug and maintain. Furthermore, nested methods are not a common practice in Ruby and can be surprising to other developers who read your code.

To avoid violating this rule, define all methods at the same level of scope. Instead of defining a method within another method, define each method separately and call them as needed. If you find that you are frequently defining methods within other methods, it may be a sign that your code could be structured more effectively, for example by using classes or modules.

View in Datadog  Leave us feedback  Documentation

# check to see if the attribute exists and convert string to symbol for hash key
attributes = attributes.each_with_object({}) { |(k, v), h|
if (!self.class.attribute_map.key?(k.to_sym))
fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::CloudWorkloadSecurityAgentRuleActionHash`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect

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 string interpolation or formatting instead of concatenation. (...read more)

The rule "Avoid string concatenation" is an important coding practice in Ruby for ensuring efficient and clean code. String concatenation in Ruby using the '+' operator creates a new string object, which can lead to excessive memory usage and slower performance when dealing with large strings or performing the operation multiple times.

Instead, Ruby provides alternatives that are more efficient. The string interpolation syntax #{} allows you to insert variables directly into strings without creating new string objects. This is not only more memory efficient, but also provides cleaner and more readable code.

Another alternative is the format method, which allows you to create a formatted string with placeholders for variables. This method is particularly useful when dealing with more complex strings, as it provides a clear and concise way to format your strings.

By following this rule, you can write more efficient and cleaner Ruby code, leading to better performance and readability.

View in Datadog  Leave us feedback  Documentation

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.

1 participant