Skip to content

Commit 69fda88

Browse files
issyl0skarimo
andauthored
Fix frozen string errors again, more durably this time (#2407)
- The PR #1971 fixed frozen string errors. - But when the templates regenerated, the `+` on each `url` string went away. So now we're seeing these errors again with the current gem version on Ruby 3.4. - This attempts to fix them more durably by persisting the `+` for marking the string as mutable to the template itself. ``` /workspaces/github/vendor/gems/3.4.3/ruby/3.4.0/gems/datadog_api_client-2.33.0/lib/datadog_api_client/configuration.rb:619: warning: literal string will be frozen in the future (run with --debug-frozen-string-literal for more information) ``` Co-authored-by: skarimo <[email protected]>
1 parent eba2825 commit 69fda88

File tree

2 files changed

+33
-33
lines changed

2 files changed

+33
-33
lines changed

.generator/src/generator/templates/configuration.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ module {{ module_name }}
312312
# Returns an array of Server setting
313313
{%- macro server_configuration(server) -%}
314314
{
315-
url: "{{ server.url }}",
315+
url: +"{{ server.url }}",
316316
description: "{{ server.description|default("No description provided") }}",
317317
variables: {
318318
{%- for name, variable in server.get("variables", {}).items() %}
@@ -353,7 +353,7 @@ module {{ module_name }}
353353
"{{ version }}.{{ operation.operationId|snake_case }}": [
354354
{%- endif %}
355355
{{ server_configuration(server)|indent(10) }}{% if not loop.last %},{% endif %}
356-
{%- if loop.last %}
356+
{%- if loop.last %}
357357
],
358358
{%- endif %}
359359
{%- endfor %}

lib/datadog_api_client/configuration.rb

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ def auth_settings
380380
def server_settings
381381
[
382382
{
383-
url: "https://{subdomain}.{site}",
383+
url: +"https://{subdomain}.{site}",
384384
description: "No description provided",
385385
variables: {
386386
site: {
@@ -402,7 +402,7 @@ def server_settings
402402
}
403403
},
404404
{
405-
url: "{protocol}://{name}",
405+
url: +"{protocol}://{name}",
406406
description: "No description provided",
407407
variables: {
408408
name: {
@@ -416,7 +416,7 @@ def server_settings
416416
}
417417
},
418418
{
419-
url: "https://{subdomain}.{site}",
419+
url: +"https://{subdomain}.{site}",
420420
description: "No description provided",
421421
variables: {
422422
site: {
@@ -436,7 +436,7 @@ def operation_server_settings
436436
{
437437
"v1.get_ip_ranges": [
438438
{
439-
url: "https://{subdomain}.{site}",
439+
url: +"https://{subdomain}.{site}",
440440
description: "No description provided",
441441
variables: {
442442
site: {
@@ -458,7 +458,7 @@ def operation_server_settings
458458
}
459459
},
460460
{
461-
url: "{protocol}://{name}",
461+
url: +"{protocol}://{name}",
462462
description: "No description provided",
463463
variables: {
464464
name: {
@@ -472,19 +472,19 @@ def operation_server_settings
472472
}
473473
},
474474
{
475-
url: "https://{subdomain}.datadoghq.com",
475+
url: +"https://{subdomain}.datadoghq.com",
476476
description: "No description provided",
477477
variables: {
478478
subdomain: {
479479
description: "The subdomain where the API is deployed.",
480480
default_value: "ip-ranges",
481481
}
482482
}
483-
}
483+
}
484484
],
485485
"v1.submit_log": [
486486
{
487-
url: "https://{subdomain}.{site}",
487+
url: +"https://{subdomain}.{site}",
488488
description: "No description provided",
489489
variables: {
490490
site: {
@@ -506,7 +506,7 @@ def operation_server_settings
506506
}
507507
},
508508
{
509-
url: "{protocol}://{name}",
509+
url: +"{protocol}://{name}",
510510
description: "No description provided",
511511
variables: {
512512
name: {
@@ -520,7 +520,7 @@ def operation_server_settings
520520
}
521521
},
522522
{
523-
url: "https://{subdomain}.{site}",
523+
url: +"https://{subdomain}.{site}",
524524
description: "No description provided",
525525
variables: {
526526
site: {
@@ -532,11 +532,11 @@ def operation_server_settings
532532
default_value: "http-intake.logs",
533533
}
534534
}
535-
}
535+
}
536536
],
537537
"v2.submit_log": [
538538
{
539-
url: "https://{subdomain}.{site}",
539+
url: +"https://{subdomain}.{site}",
540540
description: "No description provided",
541541
variables: {
542542
site: {
@@ -558,7 +558,7 @@ def operation_server_settings
558558
}
559559
},
560560
{
561-
url: "{protocol}://{name}",
561+
url: +"{protocol}://{name}",
562562
description: "No description provided",
563563
variables: {
564564
name: {
@@ -572,7 +572,7 @@ def operation_server_settings
572572
}
573573
},
574574
{
575-
url: "https://{subdomain}.{site}",
575+
url: +"https://{subdomain}.{site}",
576576
description: "No description provided",
577577
variables: {
578578
site: {
@@ -584,11 +584,11 @@ def operation_server_settings
584584
default_value: "http-intake.logs",
585585
}
586586
}
587-
}
587+
}
588588
],
589589
"v2.create_on_call_page": [
590590
{
591-
url: "https://{site}",
591+
url: +"https://{site}",
592592
description: "No description provided",
593593
variables: {
594594
site: {
@@ -605,7 +605,7 @@ def operation_server_settings
605605
}
606606
},
607607
{
608-
url: "{protocol}://{name}",
608+
url: +"{protocol}://{name}",
609609
description: "No description provided",
610610
variables: {
611611
name: {
@@ -619,7 +619,7 @@ def operation_server_settings
619619
}
620620
},
621621
{
622-
url: "https://{subdomain}.{site}",
622+
url: +"https://{subdomain}.{site}",
623623
description: "No description provided",
624624
variables: {
625625
site: {
@@ -631,11 +631,11 @@ def operation_server_settings
631631
default_value: "api",
632632
}
633633
}
634-
}
634+
}
635635
],
636636
"v2.acknowledge_on_call_page": [
637637
{
638-
url: "https://{site}",
638+
url: +"https://{site}",
639639
description: "No description provided",
640640
variables: {
641641
site: {
@@ -652,7 +652,7 @@ def operation_server_settings
652652
}
653653
},
654654
{
655-
url: "{protocol}://{name}",
655+
url: +"{protocol}://{name}",
656656
description: "No description provided",
657657
variables: {
658658
name: {
@@ -666,7 +666,7 @@ def operation_server_settings
666666
}
667667
},
668668
{
669-
url: "https://{subdomain}.{site}",
669+
url: +"https://{subdomain}.{site}",
670670
description: "No description provided",
671671
variables: {
672672
site: {
@@ -678,11 +678,11 @@ def operation_server_settings
678678
default_value: "api",
679679
}
680680
}
681-
}
681+
}
682682
],
683683
"v2.escalate_on_call_page": [
684684
{
685-
url: "https://{site}",
685+
url: +"https://{site}",
686686
description: "No description provided",
687687
variables: {
688688
site: {
@@ -699,7 +699,7 @@ def operation_server_settings
699699
}
700700
},
701701
{
702-
url: "{protocol}://{name}",
702+
url: +"{protocol}://{name}",
703703
description: "No description provided",
704704
variables: {
705705
name: {
@@ -713,7 +713,7 @@ def operation_server_settings
713713
}
714714
},
715715
{
716-
url: "https://{subdomain}.{site}",
716+
url: +"https://{subdomain}.{site}",
717717
description: "No description provided",
718718
variables: {
719719
site: {
@@ -725,11 +725,11 @@ def operation_server_settings
725725
default_value: "api",
726726
}
727727
}
728-
}
728+
}
729729
],
730730
"v2.resolve_on_call_page": [
731731
{
732-
url: "https://{site}",
732+
url: +"https://{site}",
733733
description: "No description provided",
734734
variables: {
735735
site: {
@@ -746,7 +746,7 @@ def operation_server_settings
746746
}
747747
},
748748
{
749-
url: "{protocol}://{name}",
749+
url: +"{protocol}://{name}",
750750
description: "No description provided",
751751
variables: {
752752
name: {
@@ -760,7 +760,7 @@ def operation_server_settings
760760
}
761761
},
762762
{
763-
url: "https://{subdomain}.{site}",
763+
url: +"https://{subdomain}.{site}",
764764
description: "No description provided",
765765
variables: {
766766
site: {
@@ -772,7 +772,7 @@ def operation_server_settings
772772
default_value: "api",
773773
}
774774
}
775-
}
775+
}
776776
],
777777
}
778778
end

0 commit comments

Comments
 (0)