@datadog/mobile-react-native 2.12.1 → 2.12.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,16 +34,17 @@ Pod::Spec.new do |s|
34
34
  test_spec.platforms = { :ios => "13.4", :tvos => "13.4" }
35
35
  end
36
36
 
37
-
38
- # This guard prevents installing the dependencies when we run `pod install` in the old architecture.
39
- # The `install_modules_dependencies` function is only available from RN 0.71, the new architecture is not
40
- # supported on earlier RN versions.
41
- if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
37
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1'
42
38
  s.pod_target_xcconfig = {
43
39
  "DEFINES_MODULE" => "YES",
44
40
  "OTHER_CPLUSPLUSFLAGS" => "-DRCT_NEW_ARCH_ENABLED=1"
45
41
  }
46
42
 
47
- install_modules_dependencies(s)
43
+ # install_modules_dependencies is only available on RN >= 0.71
44
+ if respond_to?(:install_modules_dependencies, true)
45
+ install_modules_dependencies(s)
46
+ else
47
+ Pod::UI.warn "Using Datadog React Native SDK with new architecture on RN < 0.71 is discouraged and not officially supported."
48
+ end
48
49
  end
49
50
  end
@@ -1,6 +1,8 @@
1
1
  import java.nio.file.Paths
2
2
  import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
3
3
 
4
+ apply plugin: "io.gitlab.arturbosch.detekt"
5
+
4
6
  buildscript {
5
7
  // Buildscript is evaluated before everything else so we can't use getExtOrDefault
6
8
  def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['DdSdkReactNative_kotlinVersion']
@@ -16,7 +18,7 @@ buildscript {
16
18
  // noinspection DifferentKotlinGradleVersion
17
19
  classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
18
20
  classpath "org.jlleitschuh.gradle:ktlint-gradle:11.5.1"
19
- classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.18.0"
21
+ classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.8"
20
22
  classpath 'com.github.bjoernq:unmockplugin:0.7.9'
21
23
  // Uncomment here and in settings.gradle for getting rid of IDE errors for new architecture:
22
24
  // classpath "com.facebook.react:react-native-gradle-plugin"
@@ -36,7 +38,7 @@ if (isNewArchitectureEnabled()) {
36
38
  }
37
39
  apply plugin: 'kotlin-android'
38
40
  apply plugin: 'org.jlleitschuh.gradle.ktlint'
39
- apply plugin: "io.gitlab.arturbosch.detekt"
41
+
40
42
 
41
43
  /**
42
44
  * Finds the path of the installed npm package with the given name using Node's
@@ -96,6 +98,7 @@ def getExtOrIntegerDefault(name) {
96
98
  }
97
99
 
98
100
  android {
101
+ compileSdk getExtOrIntegerDefault('compileSdkVersion')
99
102
  compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
100
103
  buildToolsVersion getExtOrDefault('buildToolsVersion')
101
104
 
@@ -122,6 +125,7 @@ android {
122
125
  }
123
126
 
124
127
  defaultConfig {
128
+ compileSdk getExtOrIntegerDefault('compileSdkVersion')
125
129
  minSdkVersion getExtOrIntegerDefault('minSdkVersion')
126
130
  targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
127
131
  versionCode 1
@@ -222,6 +226,8 @@ dependencies {
222
226
  testImplementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
223
227
 
224
228
  unmock 'org.robolectric:android-all:4.4_r1-robolectric-r2'
229
+ detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:1.23.8"
230
+ detektPlugins "io.gitlab.arturbosch.detekt:detekt-rules-libraries:1.23.8"
225
231
  }
226
232
 
227
233
  unMock {
@@ -1,14 +1,13 @@
1
1
  build:
2
2
  maxIssues: 0
3
- weights:
4
- # complexity: 2
5
- # LongParameterList: 1
6
- # style: 1
7
- # comments: 1
3
+
4
+ libraries:
5
+ LibraryCodeMustSpecifyReturnType:
6
+ active: true
8
7
 
9
8
  processors:
10
9
  active: true
11
- exclude:
10
+ exclude: []
12
11
  # - 'DetektProgressListener'
13
12
  # - 'FunctionCountProcessor'
14
13
  # - 'PropertyCountProcessor'
@@ -23,7 +22,7 @@ console-reports:
23
22
  # - 'ComplexityReport'
24
23
  # - 'NotificationReport'
25
24
  # - 'FindingsReport'
26
- - 'FileBasedFindingsReport'
25
+ - "FileBasedFindingsReport"
27
26
  # - 'BuildFailureReport'
28
27
 
29
28
  comments:
@@ -37,17 +36,38 @@ comments:
37
36
  endOfSentenceFormat: ([.?!][ \t\n\r\f<])|([.?!:]$)
38
37
  UndocumentedPublicClass:
39
38
  active: true
40
- excludes: [ "**/test/**","**/androidTest/**","**/*.Test.kt","**/*.Spec.kt","**/*.Spek.kt" ]
39
+ excludes:
40
+ [
41
+ "**/test/**",
42
+ "**/androidTest/**",
43
+ "**/*.Test.kt",
44
+ "**/*.Spec.kt",
45
+ "**/*.Spek.kt",
46
+ ]
41
47
  searchInNestedClass: true
42
48
  searchInInnerClass: true
43
49
  searchInInnerObject: true
44
50
  searchInInnerInterface: true
45
51
  UndocumentedPublicFunction:
46
52
  active: true
47
- excludes: [ "**/test/**","**/androidTest/**","**/*.Test.kt","**/*.Spec.kt","**/*.Spek.kt" ]
53
+ excludes:
54
+ [
55
+ "**/test/**",
56
+ "**/androidTest/**",
57
+ "**/*.Test.kt",
58
+ "**/*.Spec.kt",
59
+ "**/*.Spek.kt",
60
+ ]
48
61
  UndocumentedPublicProperty:
49
62
  active: true
50
- excludes: [ "**/test/**","**/androidTest/**","**/*.Test.kt","**/*.Spec.kt","**/*.Spek.kt" ]
63
+ excludes:
64
+ [
65
+ "**/test/**",
66
+ "**/androidTest/**",
67
+ "**/*.Test.kt",
68
+ "**/*.Spec.kt",
69
+ "**/*.Spek.kt",
70
+ ]
51
71
 
52
72
  complexity:
53
73
  active: true
@@ -58,14 +78,14 @@ complexity:
58
78
  active: true
59
79
  threshold: 10
60
80
  includeStaticDeclarations: false
61
- ComplexMethod:
81
+ CyclomaticComplexMethod:
62
82
  active: true
63
83
  threshold: 10
64
84
  ignoreSingleWhenExpression: true
65
85
  ignoreSimpleWhenEntries: true
66
86
  LabeledExpression:
67
87
  active: true
68
- ignoredLabels: ""
88
+ ignoredLabels: []
69
89
  LargeClass:
70
90
  active: true
71
91
  threshold: 600
@@ -74,7 +94,8 @@ complexity:
74
94
  threshold: 60
75
95
  LongParameterList:
76
96
  active: true
77
- threshold: 6
97
+ functionThreshold: 6
98
+ constructorThreshold: 6
78
99
  ignoreDefaultParameters: true
79
100
  MethodOverloading:
80
101
  active: true
@@ -84,14 +105,24 @@ complexity:
84
105
  threshold: 4
85
106
  StringLiteralDuplication:
86
107
  active: true
87
- excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
108
+ excludes:
109
+ - "**/test/**"
110
+ - "**/androidTest/**"
111
+ - "**/*.Test.kt"
112
+ - "**/*.Spec.kt"
113
+ - "**/*.Spek.kt"
88
114
  threshold: 3
89
115
  ignoreAnnotation: true
90
116
  excludeStringsWithLessThan5Characters: true
91
- ignoreStringsRegex: '$^'
117
+ ignoreStringsRegex: "$^"
92
118
  TooManyFunctions:
93
119
  active: true
94
- excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
120
+ excludes:
121
+ - "**/test/**"
122
+ - "**/androidTest/**"
123
+ - "**/*.Test.kt"
124
+ - "**/*.Spec.kt"
125
+ - "**/*.Spek.kt"
95
126
  thresholdInFiles: 11
96
127
  thresholdInClasses: 11
97
128
  thresholdInInterfaces: 11
@@ -99,7 +130,6 @@ complexity:
99
130
  thresholdInEnums: 11
100
131
  ignoreDeprecated: true
101
132
  ignorePrivate: true
102
- ignoreOverridden: true
103
133
 
104
134
  empty-blocks:
105
135
  active: true
@@ -138,10 +168,19 @@ exceptions:
138
168
  active: true
139
169
  ExceptionRaisedInUnexpectedLocation:
140
170
  active: true
141
- methodNames: 'toString,hashCode,equals,finalize'
171
+ methodNames:
172
+ - toString
173
+ - hashCode
174
+ - equals
175
+ - finalize
142
176
  InstanceOfCheckForException:
143
177
  active: true
144
- excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
178
+ excludes:
179
+ - "**/test/**"
180
+ - "**/androidTest/**"
181
+ - "**/*.Test.kt"
182
+ - "**/*.Spec.kt"
183
+ - "**/*.Spek.kt"
145
184
  NotImplementedDeclaration:
146
185
  active: true
147
186
  PrintStackTrace:
@@ -153,7 +192,11 @@ exceptions:
153
192
  ignoreLabeled: true
154
193
  SwallowedException:
155
194
  active: true
156
- ignoredExceptionTypes: 'InterruptedException,NumberFormatException,ParseException,MalformedURLException'
195
+ ignoredExceptionTypes:
196
+ - InterruptedException
197
+ - NumberFormatException
198
+ - ParseException
199
+ - MalformedURLException
157
200
  allowedExceptionNameRegex: "^(_|(ignore|expected).*)"
158
201
  ThrowingExceptionFromFinally:
159
202
  active: true
@@ -161,12 +204,20 @@ exceptions:
161
204
  active: true
162
205
  ThrowingExceptionsWithoutMessageOrCause:
163
206
  active: true
164
- exceptions: 'IllegalArgumentException,IllegalStateException,IOException'
207
+ exceptions:
208
+ - IllegalArgumentException
209
+ - IllegalStateException
210
+ - IOException
165
211
  ThrowingNewInstanceOfSameException:
166
212
  active: true
167
213
  TooGenericExceptionCaught:
168
214
  active: true
169
- excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
215
+ excludes:
216
+ - "**/test/**"
217
+ - "**/androidTest/**"
218
+ - "**/*.Test.kt"
219
+ - "**/*.Spec.kt"
220
+ - "**/*.Spek.kt"
170
221
  exceptionNames:
171
222
  - ArrayIndexOutOfBoundsException
172
223
  - Error
@@ -210,7 +261,6 @@ formatting:
210
261
  active: true
211
262
  autoCorrect: true
212
263
  indentSize: 4
213
- continuationIndentSize: 4
214
264
  MaximumLineLength:
215
265
  active: true
216
266
  maxLineLength: 120
@@ -292,45 +342,85 @@ naming:
292
342
  active: true
293
343
  ClassNaming:
294
344
  active: true
295
- excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
296
- classPattern: '[A-Z$][a-zA-Z0-9$]*'
345
+ excludes:
346
+ - "**/test/**"
347
+ - "**/androidTest/**"
348
+ - "**/*.Test.kt"
349
+ - "**/*.Spec.kt"
350
+ - "**/*.Spek.kt"
351
+ classPattern: "[A-Z$][a-zA-Z0-9$]*"
297
352
  ConstructorParameterNaming:
298
353
  active: true
299
- excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
300
- parameterPattern: '[a-z][A-Za-z0-9]*'
301
- privateParameterPattern: '[a-z][A-Za-z0-9]*'
302
- excludeClassPattern: '$^'
354
+ excludes:
355
+ - "**/test/**"
356
+ - "**/androidTest/**"
357
+ - "**/*.Test.kt"
358
+ - "**/*.Spec.kt"
359
+ - "**/*.Spek.kt"
360
+ parameterPattern: "[a-z][A-Za-z0-9]*"
361
+ privateParameterPattern: "[a-z][A-Za-z0-9]*"
362
+ excludeClassPattern: "$^"
303
363
  EnumNaming:
304
364
  active: true
305
- excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
306
- enumEntryPattern: '^[A-Z][_a-zA-Z0-9]*'
365
+ excludes:
366
+ - "**/test/**"
367
+ - "**/androidTest/**"
368
+ - "**/*.Test.kt"
369
+ - "**/*.Spec.kt"
370
+ - "**/*.Spek.kt"
371
+ enumEntryPattern: "^[A-Z][_a-zA-Z0-9]*"
307
372
  ForbiddenClassName:
308
373
  active: true
309
- excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
310
- forbiddenName: ''
374
+ excludes:
375
+ - "**/test/**"
376
+ - "**/androidTest/**"
377
+ - "**/*.Test.kt"
378
+ - "**/*.Spec.kt"
379
+ - "**/*.Spek.kt"
380
+ forbiddenName: []
311
381
  FunctionMaxLength:
312
382
  active: true
313
- excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
383
+ excludes:
384
+ - "**/test/**"
385
+ - "**/androidTest/**"
386
+ - "**/*.Test.kt"
387
+ - "**/*.Spec.kt"
388
+ - "**/*.Spek.kt"
314
389
  maximumFunctionNameLength: 30
315
390
  FunctionMinLength:
316
391
  active: true
317
- excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
392
+ excludes:
393
+ - "**/test/**"
394
+ - "**/androidTest/**"
395
+ - "**/*.Test.kt"
396
+ - "**/*.Spec.kt"
397
+ - "**/*.Spek.kt"
318
398
  minimumFunctionNameLength: 3
319
399
  FunctionNaming:
320
400
  active: true
321
- excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
322
- functionPattern: '^([a-z$][a-zA-Z$0-9]*)|(`.*`)$'
323
- excludeClassPattern: '$^'
324
- ignoreOverridden: true
401
+ excludes:
402
+ - "**/test/**"
403
+ - "**/androidTest/**"
404
+ - "**/*.Test.kt"
405
+ - "**/*.Spec.kt"
406
+ - "**/*.Spek.kt"
407
+ functionPattern: "^([a-z$][a-zA-Z$0-9]*)|(`.*`)$"
408
+ excludeClassPattern: "$^"
409
+
325
410
  FunctionParameterNaming:
326
411
  active: true
327
- excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
328
- parameterPattern: '[a-z][A-Za-z0-9]*'
329
- excludeClassPattern: '$^'
412
+ excludes:
413
+ - "**/test/**"
414
+ - "**/androidTest/**"
415
+ - "**/*.Test.kt"
416
+ - "**/*.Spec.kt"
417
+ - "**/*.Spek.kt"
418
+ parameterPattern: "[a-z][A-Za-z0-9]*"
419
+ excludeClassPattern: "$^"
330
420
  ignoreOverridden: true
331
421
  InvalidPackageDeclaration:
332
422
  active: true
333
- rootPackage: ''
423
+ rootPackage: ""
334
424
  MatchingDeclarationName:
335
425
  active: true
336
426
  MemberNameEqualsClassName:
@@ -338,35 +428,64 @@ naming:
338
428
  ignoreOverridden: true
339
429
  ObjectPropertyNaming:
340
430
  active: true
341
- excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
342
- constantPattern: '[A-Za-z][_A-Za-z0-9]*'
343
- propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
344
- privatePropertyPattern: '(_)?[A-Za-z][_A-Za-z0-9]*'
431
+ excludes:
432
+ - "**/test/**"
433
+ - "**/androidTest/**"
434
+ - "**/*.Test.kt"
435
+ - "**/*.Spec.kt"
436
+ - "**/*.Spek.kt"
437
+ constantPattern: "[A-Za-z][_A-Za-z0-9]*"
438
+ propertyPattern: "[A-Za-z][_A-Za-z0-9]*"
439
+ privatePropertyPattern: "(_)?[A-Za-z][_A-Za-z0-9]*"
345
440
  PackageNaming:
346
441
  active: true
347
- excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
442
+ excludes:
443
+ - "**/test/**"
444
+ - "**/androidTest/**"
445
+ - "**/*.Test.kt"
446
+ - "**/*.Spec.kt"
447
+ - "**/*.Spek.kt"
348
448
  packagePattern: '^[a-z]+(\.[a-z][A-Za-z0-9]*)*$'
349
449
  TopLevelPropertyNaming:
350
450
  active: true
351
- excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
352
- constantPattern: '[A-Z][_A-Z0-9]*'
353
- propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
354
- privatePropertyPattern: '_?[A-Za-z][_A-Za-z0-9]*'
451
+ excludes:
452
+ - "**/test/**"
453
+ - "**/androidTest/**"
454
+ - "**/*.Test.kt"
455
+ - "**/*.Spec.kt"
456
+ - "**/*.Spek.kt"
457
+ constantPattern: "[A-Z][_A-Z0-9]*"
458
+ propertyPattern: "[A-Za-z][_A-Za-z0-9]*"
459
+ privatePropertyPattern: "_?[A-Za-z][_A-Za-z0-9]*"
355
460
  VariableMaxLength:
356
461
  active: true
357
- excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
462
+ excludes:
463
+ - "**/test/**"
464
+ - "**/androidTest/**"
465
+ - "**/*.Test.kt"
466
+ - "**/*.Spec.kt"
467
+ - "**/*.Spek.kt"
358
468
  maximumVariableNameLength: 64
359
469
  VariableMinLength:
360
470
  active: true
361
- excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
471
+ excludes:
472
+ - "**/test/**"
473
+ - "**/androidTest/**"
474
+ - "**/*.Test.kt"
475
+ - "**/*.Spec.kt"
476
+ - "**/*.Spek.kt"
362
477
  minimumVariableNameLength: 1
363
478
  VariableNaming:
364
479
  active: true
365
- excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
366
- variablePattern: '[a-z][A-Za-z0-9]*'
367
- privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*'
368
- excludeClassPattern: '$^'
369
- ignoreOverridden: true
480
+ excludes:
481
+ - "**/test/**"
482
+ - "**/androidTest/**"
483
+ - "**/*.Test.kt"
484
+ - "**/*.Spec.kt"
485
+ - "**/*.Spek.kt"
486
+ variablePattern: "[a-z][A-Za-z0-9]*"
487
+ privateVariablePattern: "(_)?[a-z][A-Za-z0-9]*"
488
+ excludeClassPattern: "$^"
370
489
 
371
490
  performance:
372
491
  active: true
@@ -374,10 +493,20 @@ performance:
374
493
  active: true
375
494
  ForEachOnRange:
376
495
  active: true
377
- excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
496
+ excludes:
497
+ - "**/test/**"
498
+ - "**/androidTest/**"
499
+ - "**/*.Test.kt"
500
+ - "**/*.Spec.kt"
501
+ - "**/*.Spek.kt"
378
502
  SpreadOperator:
379
503
  active: true
380
- excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
504
+ excludes:
505
+ - "**/test/**"
506
+ - "**/androidTest/**"
507
+ - "**/*.Test.kt"
508
+ - "**/*.Spec.kt"
509
+ - "**/*.Spek.kt"
381
510
  UnnecessaryTemporaryInstantiation:
382
511
  active: true
383
512
 
@@ -385,8 +514,6 @@ potential-bugs:
385
514
  active: true
386
515
  Deprecation:
387
516
  active: true
388
- DuplicateCaseInWhenExpression:
389
- active: true
390
517
  EqualsAlwaysReturnsTrueOrFalse:
391
518
  active: true
392
519
  EqualsWithHashCodeExist:
@@ -403,13 +530,14 @@ potential-bugs:
403
530
  active: true
404
531
  LateinitUsage:
405
532
  active: false
406
- excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
407
- excludeAnnotatedProperties: ""
533
+ excludes:
534
+ - "**/test/**"
535
+ - "**/androidTest/**"
536
+ - "**/*.Test.kt"
537
+ - "**/*.Spec.kt"
538
+ - "**/*.Spek.kt"
539
+ ignoreAnnotated: []
408
540
  ignoreOnClassesPattern: ""
409
- MissingWhenCase:
410
- active: true
411
- RedundantElseInWhen:
412
- active: true
413
541
  UnconditionalJumpStatementInLoop:
414
542
  active: true
415
543
  UnreachableCode:
@@ -429,7 +557,7 @@ style:
429
557
  active: true
430
558
  DataClassContainsFunctions:
431
559
  active: true
432
- conversionFunctionPrefix: 'to'
560
+ conversionFunctionPrefix: ["to"]
433
561
  DataClassShouldBeImmutable:
434
562
  active: true
435
563
  EqualsNullCall:
@@ -443,11 +571,17 @@ style:
443
571
  includeLineWrapping: false
444
572
  ForbiddenComment:
445
573
  active: true
446
- values: 'TODO:,FIXME:,STOPSHIP:'
574
+ comments:
575
+ - reason: "Forbidden FIXME todo marker in comment, please fix the problem."
576
+ value: "FIXME:"
577
+ - reason: "Forbidden STOPSHIP todo marker in comment, please address the problem before shipping the code."
578
+ value: "STOPSHIP:"
579
+ - reason: "Forbidden TODO todo marker in comment, please do the changes, or add Jira ticket reference and suppress the warning."
580
+ value: "TODO:"
447
581
  allowedPatterns: ""
448
582
  ForbiddenImport:
449
583
  active: true
450
- imports: ''
584
+ imports: []
451
585
  forbiddenPatterns: ""
452
586
  ForbiddenVoid:
453
587
  active: true
@@ -456,17 +590,24 @@ style:
456
590
  FunctionOnlyReturningConstant:
457
591
  active: true
458
592
  ignoreOverridableFunction: true
459
- excludedFunctions: 'describeContents'
460
- excludeAnnotatedFunction: "dagger.Provides"
461
- LibraryCodeMustSpecifyReturnType:
462
- active: true
593
+ excludedFunctions: ["describeContents"]
594
+ ignoreAnnotated: ["dagger.Provides"]
463
595
  LoopWithTooManyJumpStatements:
464
596
  active: true
465
597
  maxJumpCount: 1
466
598
  MagicNumber:
467
599
  active: true
468
- excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
469
- ignoreNumbers: '-1,0,1,2'
600
+ excludes:
601
+ - "**/test/**"
602
+ - "**/androidTest/**"
603
+ - "**/*.Test.kt"
604
+ - "**/*.Spec.kt"
605
+ - "**/*.Spek.kt"
606
+ ignoreNumbers:
607
+ - "-1"
608
+ - "0"
609
+ - "1"
610
+ - "2"
470
611
  ignoreHashCodeFunction: true
471
612
  ignorePropertyDeclaration: false
472
613
  ignoreConstantDeclaration: true
@@ -475,8 +616,9 @@ style:
475
616
  ignoreNamedArgument: true
476
617
  ignoreEnums: false
477
618
  ignoreRanges: false
478
- MandatoryBracesIfStatements:
479
- active: true
619
+ BracesOnIfStatements:
620
+ singleLine: consistent
621
+ multiLine: always
480
622
  MaxLineLength:
481
623
  active: true
482
624
  maxLineLength: 120
@@ -497,7 +639,7 @@ style:
497
639
  active: true
498
640
  OptionalUnit:
499
641
  active: true
500
- OptionalWhenBraces:
642
+ BracesOnWhenStatements:
501
643
  active: true
502
644
  PreferToOverPairSyntax:
503
645
  active: true
@@ -510,7 +652,7 @@ style:
510
652
  ReturnCount:
511
653
  active: true
512
654
  max: 2
513
- excludedFunctions: "equals"
655
+ excludedFunctions: ["equals"]
514
656
  excludeLabeled: false
515
657
  excludeReturnFromLambda: true
516
658
  excludeGuardClauses: true
@@ -527,10 +669,10 @@ style:
527
669
  active: true
528
670
  UnderscoresInNumericLiterals:
529
671
  active: true
530
- acceptableDecimalLength: 5
672
+ acceptableLength: 5
531
673
  UnnecessaryAbstractClass:
532
674
  active: true
533
- excludeAnnotatedClasses: "dagger.Module"
675
+ ignoreAnnotated: ["dagger.Module"]
534
676
  UnnecessaryApply:
535
677
  active: true
536
678
  UnnecessaryInheritance:
@@ -554,7 +696,7 @@ style:
554
696
  active: true
555
697
  UseDataClass:
556
698
  active: true
557
- excludeAnnotatedClasses: ""
699
+ ignoreAnnotated: [""]
558
700
  allowVars: true
559
701
  UseIfInsteadOfWhen:
560
702
  active: true
@@ -568,5 +710,12 @@ style:
568
710
  active: true
569
711
  WildcardImport:
570
712
  active: true
571
- excludes: "**/test/**,**/androidTest/**,**/*.Test.kt,**/*.Spec.kt,**/*.Spek.kt"
572
- excludeImports: 'java.util.*,kotlinx.android.synthetic.*'
713
+ excludes:
714
+ - "**/test/**"
715
+ - "**/androidTest/**"
716
+ - "**/*.Test.kt"
717
+ - "**/*.Spec.kt"
718
+ - "**/*.Spek.kt"
719
+ excludeImports:
720
+ - java.util.*
721
+ - kotlinx.android.synthetic.*
@@ -3,6 +3,7 @@
3
3
  * This product includes software developed at Datadog (https://www.datadoghq.com/).
4
4
  * Copyright 2016-Present Datadog, Inc.
5
5
  */
6
+ @file:Suppress("TooManyFunctions")
6
7
 
7
8
  package com.datadog.reactnative
8
9
 
@@ -226,7 +226,7 @@ class DdLogsImplementation(
226
226
  promise.resolve(null)
227
227
  }
228
228
 
229
- companion object {
229
+ internal companion object {
230
230
  private const val SDK_NOT_INITIALIZED_MESSAGE = "DD_INTERNAL_LOG_SENT_BEFORE_SDK_INIT"
231
231
  internal const val NAME = "DdLogs"
232
232
  }
@@ -356,7 +356,7 @@ class DdRumImplementation(private val datadog: DatadogWrapper = DatadogSDKWrappe
356
356
  }
357
357
 
358
358
  // endregion
359
-
359
+ @Suppress("UndocumentedPublicClass")
360
360
  companion object {
361
361
  private const val MISSING_RESOURCE_SIZE = -1L
362
362
  internal const val NAME = "DdRum"
@@ -72,7 +72,7 @@ internal fun ReadableMap.asCustomEndpoints(): CustomEndpoints {
72
72
  )
73
73
  }
74
74
 
75
- @Suppress("ComplexMethod")
75
+ @Suppress("CyclomaticComplexMethod")
76
76
  internal fun ReadableMap.asProxyConfig(): Pair<Proxy, ProxyAuthenticator?>? {
77
77
  val address: String? = getString("address")
78
78
 
@@ -142,7 +142,7 @@ internal object DefaultConfiguration {
142
142
  const val initialResourceThreshold = 0.1
143
143
  }
144
144
 
145
- @Suppress("ComplexMethod")
145
+ @Suppress("CyclomaticComplexMethod")
146
146
  internal fun JSONDdSdkConfiguration.asDdSdkConfiguration(): DdSdkConfiguration {
147
147
  return DdSdkConfiguration(
148
148
  this.clientToken,
@@ -210,7 +210,7 @@ internal fun List<JSONFirstPartyHost>.asFirstPartyHosts(): Map<String, Set<Traci
210
210
 
211
211
  internal fun List<String>.asTracingHeaderTypes(): Set<TracingHeaderType> {
212
212
  return this.mapNotNull {
213
- when (it.lowercase()) {
213
+ when (it.lowercase(Locale.US)) {
214
214
  "datadog" -> TracingHeaderType.DATADOG
215
215
  "b3" -> TracingHeaderType.B3
216
216
  "b3multi" -> TracingHeaderType.B3MULTI
@@ -220,7 +220,7 @@ internal fun List<String>.asTracingHeaderTypes(): Set<TracingHeaderType> {
220
220
  }.toSet()
221
221
  }
222
222
 
223
- @Suppress("ComplexMethod")
223
+ @Suppress("CyclomaticComplexMethod")
224
224
  internal fun DdSdkConfiguration.toReadableMap(): ReadableMap {
225
225
  val map = WritableNativeMap()
226
226
  map.putString("clientToken", clientToken)
@@ -270,8 +270,7 @@ class DdSdkImplementation(
270
270
  }
271
271
 
272
272
  // endregion
273
-
274
- companion object {
273
+ internal companion object {
275
274
  internal const val DEFAULT_APP_VERSION = "?"
276
275
  internal const val DD_VERSION = "_dd.version"
277
276
  internal const val DD_VERSION_SUFFIX = "_dd.version_suffix"
@@ -108,7 +108,7 @@ class DdSdkNativeInitialization internal constructor(
108
108
  ?: DdSdkImplementation.DEFAULT_APP_VERSION
109
109
  }
110
110
 
111
- @Suppress("ComplexMethod")
111
+ @Suppress("CyclomaticComplexMethod")
112
112
  private fun buildRumConfiguration(configuration: DdSdkConfiguration): RumConfiguration {
113
113
  val configBuilder =
114
114
  RumConfiguration.Builder(
@@ -365,6 +365,7 @@ class DdSdkNativeInitialization internal constructor(
365
365
  }
366
366
  }
367
367
 
368
+ @Suppress("UndocumentedPublicClass")
368
369
  companion object {
369
370
  /**
370
371
  * Initializes the Datadog React Native SDK from your MainApplication.
@@ -93,7 +93,7 @@ class DdTraceImplementation(
93
93
  }
94
94
  }
95
95
 
96
- companion object {
96
+ internal companion object {
97
97
  internal const val NAME = "DdTrace"
98
98
  }
99
99
  }
@@ -7,4 +7,4 @@
7
7
  package com.datadog.reactnative
8
8
 
9
9
  // This is automatically updated by the update-version.sh script
10
- internal const val SDK_VERSION = "2.12.1"
10
+ internal const val SDK_VERSION = "2.12.3"
@@ -1309,7 +1309,7 @@ internal class DdSdkTest {
1309
1309
  mapOf(
1310
1310
  "match" to match,
1311
1311
  "propagatorTypes" to headerTypes.map {
1312
- it.name.lowercase()
1312
+ it.name.lowercase(Locale.US)
1313
1313
  }.toReadableArray()
1314
1314
  ).toReadableMap()
1315
1315
  )
@@ -1367,7 +1367,7 @@ internal class DdSdkTest {
1367
1367
  mapOf(
1368
1368
  "match" to match,
1369
1369
  "propagatorTypes" to listOf(
1370
- TracingHeaderType.DATADOG.name.lowercase(),
1370
+ TracingHeaderType.DATADOG.name.lowercase(Locale.US),
1371
1371
  forge.aString()
1372
1372
  ).toReadableArray()
1373
1373
  ).toReadableMap()
@@ -1427,7 +1427,7 @@ internal class DdSdkTest {
1427
1427
  mapOf(
1428
1428
  "match" to host,
1429
1429
  "propagatorTypes" to listOf(
1430
- TracingHeaderType.DATADOG.name.lowercase()
1430
+ TracingHeaderType.DATADOG.name.lowercase(Locale.US)
1431
1431
  ).toReadableArray()
1432
1432
  ).toReadableMap()
1433
1433
  )
@@ -1435,7 +1435,7 @@ internal class DdSdkTest {
1435
1435
  mapOf(
1436
1436
  "match" to host,
1437
1437
  "propagatorTypes" to listOf(
1438
- TracingHeaderType.B3.name.lowercase()
1438
+ TracingHeaderType.B3.name.lowercase(Locale.US)
1439
1439
  ).toReadableArray()
1440
1440
  ).toReadableMap()
1441
1441
  )
@@ -11,6 +11,7 @@ import com.facebook.react.bridge.JavaOnlyArray
11
11
  import com.facebook.react.bridge.JavaOnlyMap
12
12
  import com.facebook.react.bridge.ReadableArray
13
13
  import com.facebook.react.bridge.ReadableMap
14
+ import java.util.Locale
14
15
 
15
16
  fun Map<*, *>.toReadableMap(): ReadableMap {
16
17
  val keysAndValues = mutableListOf<Any?>()
@@ -33,7 +34,7 @@ fun Map<String, Set<TracingHeaderType>>.toFirstPartyHostsReadableArray(): Readab
33
34
  "match" to it.key,
34
35
  "propagatorTypes" to it.value.map {
35
36
  tracingHeaderType ->
36
- tracingHeaderType.toString().lowercase()
37
+ tracingHeaderType.toString().lowercase(Locale.US)
37
38
  }.toReadableArray()
38
39
  ).toReadableMap()
39
40
  )
@@ -4,14 +4,20 @@
4
4
  * Copyright 2016-Present Datadog, Inc.
5
5
  */
6
6
 
7
- import Foundation
8
7
  import DatadogTrace
8
+ import Foundation
9
9
 
10
10
  @objc
11
11
  public class DdTraceImplementation: NSObject {
12
12
  private lazy var tracer: OTTracer = tracerProvider()
13
13
  private let tracerProvider: () -> OTTracer
14
- private(set) var spanDictionary = [NSString: OTSpan]()
14
+
15
+ private(set) var spansById: [String: OTSpan] = [:]
16
+ private(set) var spanStack: [String] = []
17
+
18
+ private var activeSpan: OTSpan? {
19
+ spanStack.last.flatMap { spansById[$0] }
20
+ }
15
21
 
16
22
  internal init(_ tracerProvider: @escaping () -> OTTracer) {
17
23
  self.tracerProvider = tracerProvider
@@ -23,35 +29,56 @@ public class DdTraceImplementation: NSObject {
23
29
  }
24
30
 
25
31
  @objc
26
- public func startSpan(operation: String, context: NSDictionary, timestampMs: Double, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
27
- let id = UUID().uuidString as NSString
32
+ public func startSpan(
33
+ operation: String, context: NSDictionary, timestampMs: Double,
34
+ resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock
35
+ ) {
36
+ objc_sync_enter(self)
37
+ defer { objc_sync_exit(self) }
38
+
39
+ let id = UUID().uuidString
28
40
  let timeIntervalSince1970: TimeInterval = timestampMs / 1_000
29
41
  let startDate = Date(timeIntervalSince1970: timeIntervalSince1970)
30
42
 
31
- objc_sync_enter(self)
32
43
  let span = tracer.startSpan(
33
44
  operationName: operation,
34
- childOf: nil,
45
+ childOf: activeSpan?.context,
35
46
  tags: castAttributesToSwift(context).mergeWithGlobalAttributes(),
36
47
  startTime: startDate
37
48
  )
49
+
38
50
  span.setActive()
39
- spanDictionary[id] = span
40
- objc_sync_exit(self)
51
+ spansById[id] = span
52
+ spanStack.append(id)
41
53
 
42
54
  resolve(id)
43
55
  }
44
56
 
45
57
  @objc
46
- public func finishSpan(spanId: NSString, context: NSDictionary, timestampMs: Double, resolve:RCTPromiseResolveBlock, reject:RCTPromiseRejectBlock) -> Void {
58
+ public func finishSpan(
59
+ spanId: NSString, context: NSDictionary, timestampMs: Double,
60
+ resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock
61
+ ) {
47
62
  objc_sync_enter(self)
48
- let optionalSpan = spanDictionary.removeValue(forKey: spanId)
49
- if let span = optionalSpan {
50
- set(tags: castAttributesToSwift(context).mergeWithGlobalAttributes(), to: span)
51
- let timeIntervalSince1970: TimeInterval = timestampMs / 1_000
52
- span.finish(at: Date(timeIntervalSince1970: timeIntervalSince1970))
63
+ defer { objc_sync_exit(self) }
64
+
65
+ guard let span = spansById.removeValue(forKey: spanId as String) else {
66
+ resolve(nil)
67
+ return
68
+ }
69
+
70
+ set(tags: castAttributesToSwift(context).mergeWithGlobalAttributes(), to: span)
71
+ let timeIntervalSince1970: TimeInterval = timestampMs / 1_000
72
+ span.finish(at: Date(timeIntervalSince1970: timeIntervalSince1970))
73
+
74
+ if let idx = spanStack.lastIndex(of: spanId as String) {
75
+ let wasTop = (idx == spanStack.count - 1)
76
+ spanStack.remove(at: idx)
77
+
78
+ if wasTop, let prev = activeSpan {
79
+ prev.setActive()
80
+ }
53
81
  }
54
- objc_sync_exit(self)
55
82
 
56
83
  resolve(nil)
57
84
  }
@@ -7,4 +7,4 @@
7
7
  import Foundation
8
8
 
9
9
  // This is automatically updated by the update-version.sh script
10
- let SdkVersion = "2.12.1"
10
+ let SdkVersion = "2.12.3"
@@ -5,5 +5,5 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = void 0;
7
7
  // generated by genversion
8
- const version = exports.version = '2.12.1';
8
+ const version = exports.version = '2.12.3';
9
9
  //# sourceMappingURL=version.js.map
@@ -1,3 +1,3 @@
1
1
  // generated by genversion
2
- export const version = '2.12.1';
2
+ export const version = '2.12.3';
3
3
  //# sourceMappingURL=version.js.map
@@ -1,2 +1,2 @@
1
- export declare const version = "2.12.1";
1
+ export declare const version = "2.12.3";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datadog/mobile-react-native",
3
- "version": "2.12.1",
3
+ "version": "2.12.3",
4
4
  "description": "A client-side React Native module to interact with Datadog",
5
5
  "keywords": [
6
6
  "datadog",
@@ -118,5 +118,5 @@
118
118
  "dependencies": {
119
119
  "big-integer": "^1.6.52"
120
120
  },
121
- "gitHead": "5bc4b0ee2893f83f53aba08337765b4e0d9748e3"
121
+ "gitHead": "842123f32b952c593ae1339b50a328f94c391929"
122
122
  }
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // generated by genversion
2
- export const version = '2.12.1';
2
+ export const version = '2.12.3';