Skip to content

Commit 3bcf878

Browse files
committed
format sentry file
1 parent 067b84c commit 3bcf878

6 files changed

+105
-106
lines changed

file/lib/src/sentry_file.dart

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,7 @@ typedef Callback<T> = FutureOr<T> Function();
235235
/// All the copy, create, delete, open, rename, read, and write operations are
236236
/// supported.
237237
class SentryFile implements File {
238-
SentryFile(
239-
this._file, {
240-
@internal Hub? hub,
241-
}) : _hub = hub ?? HubAdapter() {
238+
SentryFile(this._file, {@internal Hub? hub}) : _hub = hub ?? HubAdapter() {
242239
_hub.options.sdk.addIntegration('SentryFileTracing');
243240
_hub.options.sdk.addPackage(packageName, sdkVersion);
244241
}
@@ -319,7 +316,9 @@ class SentryFile implements File {
319316
@override
320317
Future<List<String>> readAsLines({Encoding encoding = utf8}) {
321318
return _wrap(
322-
() async => _file.readAsLines(encoding: encoding), 'file.read');
319+
() async => _file.readAsLines(encoding: encoding),
320+
'file.read',
321+
);
323322
}
324323

325324
@override
@@ -333,7 +332,9 @@ class SentryFile implements File {
333332
@override
334333
Future<String> readAsString({Encoding encoding = utf8}) {
335334
return _wrap(
336-
() async => _file.readAsString(encoding: encoding), 'file.read');
335+
() async => _file.readAsString(encoding: encoding),
336+
'file.read',
337+
);
337338
}
338339

339340
@override
@@ -471,11 +472,7 @@ class SentryFile implements File {
471472
await span?.finish();
472473

473474
await _hub.addBreadcrumb(
474-
Breadcrumb(
475-
message: desc,
476-
data: breadcrumbData,
477-
category: operation,
478-
),
475+
Breadcrumb(message: desc, data: breadcrumbData, category: operation),
479476
);
480477
}
481478
return data;
@@ -535,11 +532,7 @@ class SentryFile implements File {
535532
span?.finish();
536533

537534
_hub.addBreadcrumb(
538-
Breadcrumb(
539-
message: desc,
540-
data: breadcrumbData,
541-
category: operation,
542-
),
535+
Breadcrumb(message: desc, data: breadcrumbData, category: operation),
543536
);
544537
}
545538
return data;
@@ -551,8 +544,7 @@ class SentryFile implements File {
551544
Stream<FileSystemEvent> watch({
552545
int events = FileSystemEvent.all,
553546
bool recursive = false,
554-
}) =>
555-
_file.watch(events: events, recursive: recursive);
547+
}) => _file.watch(events: events, recursive: recursive);
556548

557549
@override
558550
Future<String> resolveSymbolicLinks() => _file.resolveSymbolicLinks();

file/lib/src/sentry_io_overrides.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ class SentryIOOverrides extends IOOverrides {
1313

1414
@override
1515
File createFile(String path) {
16-
return SentryFile(
17-
super.createFile(path),
18-
hub: _hub,
19-
);
16+
return SentryFile(super.createFile(path), hub: _hub);
2017
}
2118
}

file/test/mock_sentry_client.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ class MockSentryClient with NoSuchMethodProvider implements SentryClient {
1919
SentryTraceContextHeader? traceContext,
2020
Hint? hint,
2121
}) async {
22-
captureTransactionCalls
23-
.add(CaptureTransactionCall(transaction, scope, traceContext, hint));
22+
captureTransactionCalls.add(
23+
CaptureTransactionCall(transaction, scope, traceContext, hint),
24+
);
2425
return transaction.eventId;
2526
}
2627
}
@@ -32,5 +33,9 @@ class CaptureTransactionCall {
3233
final Hint? hint;
3334

3435
CaptureTransactionCall(
35-
this.transaction, this.scope, this.traceContext, this.hint);
36+
this.transaction,
37+
this.scope,
38+
this.traceContext,
39+
this.hint,
40+
);
3641
}

file/test/sentry_file_extension_test.dart

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// ignore_for_file: library_annotations
22

33
@TestOn('vm')
4-
54
import 'dart:io';
65

76
import 'package:sentry/sentry.dart';
@@ -20,26 +19,19 @@ void main() {
2019
});
2120

2221
test('io performance enabled wraps file', () async {
23-
final sut = fixture.getSut(
24-
tracesSampleRate: 1.0,
25-
);
22+
final sut = fixture.getSut(tracesSampleRate: 1.0);
2623

2724
expect(sut is SentryFile, true);
2825
});
2926

3027
test('io performance disabled does not wrap file', () async {
31-
final sut = fixture.getSut(
32-
tracesSampleRate: null,
33-
);
28+
final sut = fixture.getSut(tracesSampleRate: null);
3429

3530
expect(sut is SentryFile, false);
3631
});
3732

3833
test('web does not wrap file', () async {
39-
final sut = fixture.getSut(
40-
tracesSampleRate: 1.0,
41-
isWeb: true,
42-
);
34+
final sut = fixture.getSut(tracesSampleRate: 1.0, isWeb: true);
4335

4436
expect(sut is SentryFile, false);
4537
});
@@ -50,10 +42,7 @@ class Fixture {
5042
final options = defaultTestOptions();
5143
late Hub hub;
5244

53-
File getSut({
54-
double? tracesSampleRate,
55-
bool isWeb = false,
56-
}) {
45+
File getSut({double? tracesSampleRate, bool isWeb = false}) {
5746
options.tracesSampleRate = tracesSampleRate;
5847
options.platform = MockPlatform(isWeb: isWeb);
5948

0 commit comments

Comments
 (0)