Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
dart pub get
dart test -p chrome --test-randomize-ordering-seed=random --chain-stack-traces
dart test -p vm --coverage=coverage --test-randomize-ordering-seed=random --chain-stack-traces
dart pub run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.packages --report-on=lib
dart pub run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=lib

- name: Install webdev
run: dart pub global activate webdev
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
dart pub get
dart test -p chrome --test-randomize-ordering-seed=random --chain-stack-traces
dart test -p vm --coverage=coverage --test-randomize-ordering-seed=random --chain-stack-traces
dart pub run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.packages --report-on=lib
dart pub run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=lib

- uses: codecov/codecov-action@v2
if: runner.os == 'Linux'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/flutter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
flutter pub get

- name: Test chrome
if: runner.os != 'macOS'
if: runner.os == 'Linux'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

#500
Right now it only happens on Windows, let's see if that helps.

run: |
cd flutter
flutter test --platform chrome --test-randomize-ordering-seed=random
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/logging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
dart pub get
dart test -p chrome --test-randomize-ordering-seed=random --chain-stack-traces
dart test -p vm --coverage=coverage --test-randomize-ordering-seed=random --chain-stack-traces
dart pub run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.packages --report-on=lib
dart pub run coverage:format_coverage --lcov --in=coverage --out=coverage/lcov.info --packages=.dart_tool/package_config.json --report-on=lib

- uses: codecov/codecov-action@v2
if: runner.os == 'Linux'
Expand Down
5 changes: 4 additions & 1 deletion dart/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include: package:pedantic/analysis_options.yaml
include: package:lints/recommended.yaml

analyzer:
exclude:
Expand All @@ -18,3 +18,6 @@ linter:
rules:
prefer_relative_imports: true
unnecessary_brace_in_string_interps: true
prefer_function_declarations_over_variables: false
no_leading_underscores_for_local_identifiers: false
avoid_renaming_method_parameters: false
3 changes: 1 addition & 2 deletions dart/lib/src/protocol/sentry_span.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ class SentrySpan extends ISentrySpan {
this._context,
this._hub, {
DateTime? startTimestamp,
bool? sampled,
this.sampled,
Function({DateTime? endTimestamp})? finishedCallback,
}) {
_startTimestamp = startTimestamp?.toUtc() ?? getUtcDateTime();
this.sampled = sampled;
_finishedCallback = finishedCallback;
}

Expand Down
4 changes: 2 additions & 2 deletions dart/lib/src/protocol/sentry_trace_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class SentryTraceHeader {
SentryTraceHeader(
this.traceId,
this.spanId, {
bool? sampled,
}) : sampled = sampled;
this.sampled,
});

factory SentryTraceHeader.fromTraceHeader(String header) {
final parts = header.split('-');
Expand Down
12 changes: 9 additions & 3 deletions dart/lib/src/scope.dart
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ class Scope {

_contexts.clone().forEach((key, value) {
// add the contexts runtime list to the event.contexts.runtimes
if (key == SentryRuntime.listType && value is List && value.isNotEmpty) {
if (key == SentryRuntime.listType &&
value is List<SentryRuntime> &&
value.isNotEmpty) {
_mergeEventContextsRuntimes(value, event);
} else if (key != SentryRuntime.listType &&
(!event.contexts.containsKey(key) || event.contexts[key] == null) &&
Expand Down Expand Up @@ -265,8 +267,12 @@ class Scope {
}

/// Merge the scope contexts runtimes and the event contexts runtimes.
void _mergeEventContextsRuntimes(List value, SentryEvent event) =>
value.forEach((runtime) => event.contexts.addRuntime(runtime));
void _mergeEventContextsRuntimes(
List<SentryRuntime> values, SentryEvent event) {
for (final runtime in values) {
event.contexts.addRuntime(runtime);
}
}

/// If the scope and the event have tag entries with the same key,
/// the event tags will be kept.
Expand Down
4 changes: 2 additions & 2 deletions dart/lib/src/sentry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ class Sentry {
// execute integrations after hub being enabled
if (appRunner != null) {
var runIntegrationsAndAppRunner = () async {
final integrations = options.integrations
.where((i) => !(i is RunZonedGuardedIntegration));
final integrations =
options.integrations.where((i) => i is! RunZonedGuardedIntegration);
await _callIntegrations(integrations, options);
await appRunner();
};
Expand Down
4 changes: 1 addition & 3 deletions dart/lib/src/sentry_tracer_finish_status.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ class SentryTracerFinishStatus {
final bool finishing;
final SpanStatus? status;

SentryTracerFinishStatus.finishing(SpanStatus? status)
: finishing = true,
status = status;
SentryTracerFinishStatus.finishing(this.status) : finishing = true;

SentryTracerFinishStatus.notFinishing()
: finishing = false,
Expand Down
6 changes: 3 additions & 3 deletions dart/lib/src/transport/data_category.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// Different category types of data sent to Sentry. Used for rate limiting and client reports.
enum DataCategory {
all,
data_category_default, // default
dataCategoryDefault, // default
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@denrase I hope this is fine, since camelCase is recommended by the new linter.

error,
session,
transaction,
Expand All @@ -16,7 +16,7 @@ extension DataCategoryExtension on DataCategory {
case '__all__':
return DataCategory.all;
case 'default':
return DataCategory.data_category_default;
return DataCategory.dataCategoryDefault;
case 'error':
return DataCategory.error;
case 'session':
Expand All @@ -35,7 +35,7 @@ extension DataCategoryExtension on DataCategory {
switch (this) {
case DataCategory.all:
return '__all__';
case DataCategory.data_category_default:
case DataCategory.dataCategoryDefault:
return 'default';
case DataCategory.error:
return 'error';
Expand Down
6 changes: 3 additions & 3 deletions dart/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ dependencies:

dev_dependencies:
mockito: ^5.1.0
pedantic: ^1.11.1 # discontinued replaced by lints
test: ^1.20.2
lints: ^2.0.0
test: ^1.21.1
yaml: ^3.1.0 # needed for version match (code and pubspec)
collection: ^1.16.0
coverage: ^1.2.0
coverage: ^1.3.0
4 changes: 2 additions & 2 deletions dart/test/contexts_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ void main() {
clone.operatingSystem!.toJson(), contexts.operatingSystem!.toJson());
expect(clone.gpu!.toJson(), contexts.gpu!.toJson());

contexts.runtimes.forEach((element) {
for (final element in contexts.runtimes) {
expect(
clone.runtimes.where(
(clone) => MapEquality().equals(element.toJson(), clone.toJson()),
),
isNotEmpty,
);
});
}

expect(clone['theme'], {'value': 'material'});
expect(clone['version'], {'value': 9});
Expand Down
2 changes: 1 addition & 1 deletion dart/test/http_client/tracing_client_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ void main() {
final span = tracer.children.first;

expect(response.request!.headers['sentry-trace'],
'${span.toSentryTrace().value}');
span.toSentryTrace().value);
});

test('do not throw if no span bound to the scope', () async {
Expand Down
2 changes: 1 addition & 1 deletion dart/test/protocol/sentry_trace_header_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void main() {
});

test('invalid header throws $InvalidSentryTraceHeaderException', () {
var exception;
Object? exception;
try {
SentryTraceHeader.fromTraceHeader('invalidHeader');
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion dart/test/sentry_event_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ void main() {
});

test('serializes to JSON with sentryException', () {
var sentryException;
SentryException? sentryException;
try {
throw StateError('an error');
} catch (err) {
Expand Down
6 changes: 3 additions & 3 deletions dart/test/test_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ void testHeaders(

if (withSecret) {
expectedHeaders['X-Sentry-Auth'] =
expectedHeaders['X-Sentry-Auth']! + 'sentry_secret=secret, ';
'${expectedHeaders['X-Sentry-Auth']!}sentry_secret=secret, ';
}

expectedHeaders['X-Sentry-Auth'] = expectedHeaders['X-Sentry-Auth']! +
'sentry_timestamp=${fakeClockProvider().millisecondsSinceEpoch}';
expectedHeaders['X-Sentry-Auth'] =
'${expectedHeaders['X-Sentry-Auth']!}sentry_timestamp=${fakeClockProvider().millisecondsSinceEpoch}';

if (withUserAgent) {
expectedHeaders['User-Agent'] = '$sdkName/$sdkVersion';
Expand Down
6 changes: 3 additions & 3 deletions dio/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ dependencies:
meta: ^1.3.0

dev_dependencies:
lints: ^1.0.1
test: ^1.20.2
lints: ^2.0.0
test: ^1.21.1
yaml: ^3.1.0 # needed for version match (code and pubspec)
coverage: ^1.2.0
coverage: ^1.3.0
mockito: ^5.1.0
http: ^0.13.4

Expand Down
7 changes: 6 additions & 1 deletion flutter/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include: package:pedantic/analysis_options.yaml
include: package:flutter_lints/flutter.yaml

analyzer:
errors:
Expand All @@ -19,3 +19,8 @@ linter:
prefer_relative_imports: true
unnecessary_brace_in_string_interps: true
implementation_imports: true
prefer_const_literals_to_create_immutables: false
prefer_const_constructors: false
library_private_types_in_public_api: false
no_leading_underscores_for_local_identifiers: false
prefer_function_declarations_over_variables: false
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class AndroidPlatformExceptionEventProcessor implements EventProcessor {
@override
FutureOr<SentryEvent?> apply(SentryEvent event, {dynamic hint}) async {
final plaformException = event.throwable;
if (!(plaformException is PlatformException)) {
if (plaformException is! PlatformException) {
return event;
}

Expand Down
1 change: 0 additions & 1 deletion flutter/lib/src/sentry_native_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class SentryNativeChannel {
exception: error,
stackTrace: stackTrace,
);
return null;
}
}

Expand Down
2 changes: 1 addition & 1 deletion flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dev_dependencies:
sdk: flutter
mockito: ^5.1.0
yaml: ^3.1.0 # needed for version match (code and pubspec)
pedantic: ^1.11.1
flutter_lints: ^2.0.0

dependency_overrides:
sentry:
Expand Down
2 changes: 2 additions & 0 deletions flutter/test/file_system_transport_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@TestOn('vm')

import 'dart:convert';
import 'dart:typed_data';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@TestOn('vm')

import 'package:flutter_test/flutter_test.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:sentry_flutter/src/integrations/native_app_start_integration.dart';
Expand Down
2 changes: 2 additions & 0 deletions flutter/test/load_android_image_list_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@TestOn('vm')

import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
Expand Down
2 changes: 2 additions & 0 deletions flutter/test/load_contexts_integrations_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@TestOn('vm')

import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
Expand Down
1 change: 0 additions & 1 deletion flutter/test/mocks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ class MockNativeChannel implements SentryNativeChannel {
@override
Future<void> beginNativeFrames() async {
numberOfBeginNativeFramesCalls += 1;
return null;
}

@override
Expand Down
4 changes: 3 additions & 1 deletion flutter/test/native_sdk_integration_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@TestOn('vm')

import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
Expand Down Expand Up @@ -156,7 +158,7 @@ void main() {
MethodChannel createChannelWithCallback(
Future<dynamic>? Function(MethodCall call)? handler,
) {
final channel = const MethodChannel('initNativeSdk');
final channel = MethodChannel('initNativeSdk');
channel.setMockMethodCallHandler(handler);
return channel;
}
Expand Down
2 changes: 2 additions & 0 deletions flutter/test/sentry_native_channel_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@TestOn('vm')

import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/mockito.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
Expand Down
2 changes: 2 additions & 0 deletions flutter/test/sentry_native_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@TestOn('vm')

import 'package:flutter_test/flutter_test.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:sentry_flutter/src/sentry_native.dart';
Expand Down
6 changes: 3 additions & 3 deletions logging/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ dependencies:
sentry: ^6.6.0-alpha.2

dev_dependencies:
lints: ^1.0.1
test: ^1.20.2
lints: ^2.0.0
test: ^1.21.1
yaml: ^3.1.0 # needed for version match (code and pubspec)
coverage: ^1.2.0
coverage: ^1.3.0
meta: ^1.3.0

dependency_overrides:
Expand Down