Skip to content

Add on-call schedules endpoint #3013

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

Merged

Conversation

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

@api-clients-generation-pipeline api-clients-generation-pipeline bot added the changelog/Changed Changed features results into a major version bump label Apr 2, 2025
@api-clients-generation-pipeline api-clients-generation-pipeline bot force-pushed the datadog-api-spec/generated/3653 branch 6 times, most recently from 1abe1b6 to 28a3d92 Compare April 3, 2025 06:03
@@ -35,6 +35,10 @@ def camel_case(value):
def untitle_case(value):
return value[0].lower() + value[1:]

def class_name(value):
value = re.sub(r'[^a-zA-Z0-9]', '', value)

Choose a reason for hiding this comment

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

🟠 Code Quality Violation

variable name is the same as a function parameter (...read more)

A function parameter should only be read and not be modified. If your intent is to modify the value of the parameter, return the value in the function and handle the new value in the caller of the function.

View in Datadog  Leave us feedback  Documentation

@api-clients-generation-pipeline api-clients-generation-pipeline bot force-pushed the datadog-api-spec/generated/3653 branch from 28a3d92 to e53f579 Compare April 3, 2025 21:55
@@ -284,6 +284,7 @@ func GetClient(ctx gobdd.Context) reflect.Value {

// GetApiByVersionAndName get reflected value of api.
func GetApiByVersionAndName(ctx gobdd.Context, version string, name string) reflect.Value {
name = strings.Replace(name, "-", "", -1)

Choose a reason for hiding this comment

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

🟠 Code Quality Violation

Suggested change
name = strings.Replace(name, "-", "", -1)
name = strings.ReplaceAll(name, "-", "")
Do not call Replace with a negative limit, use ReplaceAll instead (...read more)

In Go, the strings.Replace() function is used to replace a certain substring within a string with another substring. The function takes in four parameters: the original string, the old substring to be replaced, the new substring that will replace the old one, and an integer limit dictating how many replacements to be made.

Calling strings.Replace() with a negative limit doesn't really make sense. According to the Go documentation, if limit is negative, there is no limit on the number of replacements. Which means it will replace all instances of old substring in the original string with a new substring.

For example:

fmt.Println(strings.Replace("oink oink oink", "k", "ky", -2))

In this example, Replace returns a copy of the string "oink oink oink" where "k" is replaced by "ky" everywhere it appears, because limit is -2.

So it's not necessarily "incorrect" to use a negative limit, but it can create misunderstandings in your code. It's best to use a limit of -1 when you want to replace all instances, as this convention is more commonly understood to mean "no limit".

But if you specifically want to avoid using negative limit for Replace or looking for replace method with better efficiency, using strings.NewReplacer() could be a better option when there are multiple string pairs need to be replaced, where you can specify a list of old-new string pairs.

Or you can use strings.ReplaceAll(). It is equivalent to Replace with a limit of -1. It's arguably clearer and more self-explanatory than using a negative limit with strings.Replace().

For example:

fmt.Println(strings.ReplaceAll("oink oink oink", "o", "ky"))

It replaces all instances of "o" in the string "oink oink oink" by "ky".

View in Datadog  Leave us feedback  Documentation

@api-clients-generation-pipeline api-clients-generation-pipeline bot force-pushed the datadog-api-spec/generated/3653 branch 9 times, most recently from 5802e79 to 6770582 Compare April 4, 2025 07:41
@api-clients-generation-pipeline api-clients-generation-pipeline bot force-pushed the datadog-api-spec/generated/3653 branch 4 times, most recently from bb6200d to 4753007 Compare April 7, 2025 04:36
@api-clients-generation-pipeline api-clients-generation-pipeline bot force-pushed the datadog-api-spec/generated/3653 branch from 4753007 to 49cc853 Compare April 8, 2025 05:07
@api-clients-generation-pipeline api-clients-generation-pipeline bot force-pushed the datadog-api-spec/generated/3653 branch from 49cc853 to 42eb189 Compare April 8, 2025 17:25
@api-clients-generation-pipeline api-clients-generation-pipeline bot force-pushed the datadog-api-spec/generated/3653 branch from 42eb189 to 5df722c Compare April 8, 2025 19:22
@api-clients-generation-pipeline api-clients-generation-pipeline bot force-pushed the datadog-api-spec/generated/3653 branch 2 times, most recently from 968f9c4 to 978b25b Compare April 9, 2025 17:12
@api-clients-generation-pipeline api-clients-generation-pipeline bot force-pushed the datadog-api-spec/generated/3653 branch from 978b25b to 5f1188b Compare April 11, 2025 13:00
@api-clients-generation-pipeline api-clients-generation-pipeline bot merged commit 511b9b1 into master Apr 11, 2025
11 checks passed
@api-clients-generation-pipeline api-clients-generation-pipeline bot deleted the datadog-api-spec/generated/3653 branch April 11, 2025 14:59
github-actions bot pushed a commit that referenced this pull request Apr 11, 2025
* handle dashes in tag names

* fix example api tag

* fix dash in test api initialization

* Regenerate client from commit 7307da21 of spec repo

---------

Co-authored-by: Kevin Zou <[email protected]>
Co-authored-by: api-clients-generation-pipeline[bot] <54105614+api-clients-generation-pipeline[bot]@users.noreply.github.com>
Co-authored-by: ci.datadog-api-spec <[email protected]> 511b9b1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog/Changed Changed features results into a major version bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants