-
Notifications
You must be signed in to change notification settings - Fork 20
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
[SC] Add support for Entity kind API #2222
base: master
Are you sure you want to change the base?
[SC] Add support for Entity kind API #2222
Conversation
end | ||
|
||
if attributes.key?(:'events') | ||
if (value = attributes[:'events']).is_a?(Array) |
There was a problem hiding this comment.
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.
# 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::EntityV3API`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect |
There was a problem hiding this comment.
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.
# 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::EntityV3APIDatadog`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect |
There was a problem hiding this comment.
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.
# 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::EntityV3APISpec`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect |
There was a problem hiding this comment.
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.
# 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::EntityV3APISpecInterfaceFileRef`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect |
There was a problem hiding this comment.
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.
} | ||
|
||
if attributes.key?(:'code_locations') | ||
if (value = attributes[:'code_locations']).is_a?(Array) |
There was a problem hiding this comment.
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.
# 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::EntityV3APISpecInterfaceDefinition`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect |
There was a problem hiding this comment.
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.
} | ||
|
||
if attributes.key?(:'implemented_by') | ||
if (value = attributes[:'implemented_by']).is_a?(Array) |
There was a problem hiding this comment.
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.
end | ||
|
||
if attributes.key?(:'logs') | ||
if (value = attributes[:'logs']).is_a?(Array) |
There was a problem hiding this comment.
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.
Datadog ReportBranch report: ✅ 0 Failed, 952 Passed, 1973 Skipped, 1m 43.54s Total duration (59.26s time saved) |
See DataDog/datadog-api-spec#3374
Test branch datadog-api-spec/test/kruthi.vuppala/add-entitykind-api