Skip to content

Clean up code #1878

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
merged 9 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@ EnricherEventProcessor enricherEventProcessor(SentryOptions options) {
return IoEnricherEventProcessor(options);
}

/// Enriches [SentryEvents] with various kinds of information.
/// Enriches [SentryEvent]s with various kinds of information.
/// Uses Darts [Platform](https://api.dart.dev/stable/dart-io/Platform-class.html)
/// class to read information.
class IoEnricherEventProcessor implements EnricherEventProcessor {
IoEnricherEventProcessor(
this._options,
);
IoEnricherEventProcessor(this._options);

final SentryOptions _options;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ class WebEnricherEventProcessor implements EnricherEventProcessor {

final url = request?.url ?? _window.location.toString();
return (request ?? SentryRequest(url: url))
.copyWith(
headers: header,
)
.copyWith(headers: header)
.sanitized();
}

Expand Down
1 change: 1 addition & 0 deletions dart/lib/src/hint.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'sentry_attachment/sentry_attachment.dart';
import 'sentry_options.dart';

/// Hints are used in [BeforeSendCallback], [BeforeBreadcrumbCallback] and
/// event processors.
Expand Down
2 changes: 1 addition & 1 deletion dart/lib/src/sentry_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import 'client_reports/client_report_recorder.dart';
import 'client_reports/discard_reason.dart';
import 'transport/data_category.dart';

/// Default value for [User.ipAddress]. It gets set when an event does not have
/// Default value for [SentryUser.ipAddress]. It gets set when an event does not have
/// a user and IP address. Only applies if [SentryOptions.sendDefaultPii] is set
/// to true.
const _defaultIpAddress = '{{auto}}';
Expand Down
18 changes: 12 additions & 6 deletions dart/lib/src/sentry_stack_trace_factory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'noop_origin.dart' if (dart.library.html) 'origin.dart';
import 'protocol.dart';
import 'sentry_options.dart';

/// converts [StackTrace] to [SentryStackFrames]
/// converts [StackTrace] to [SentryStackFrame]s
class SentryStackTraceFactory {
final SentryOptions _options;

Expand All @@ -21,6 +21,10 @@ class SentryStackTraceFactory {
'sentry_logging',
'sentry_dio',
'sentry_file',
'sentry_hive',
'sentry_isar',
'sentry_sqflite',
'sentry_drift',
];

SentryStackTraceFactory(this._options);
Expand Down Expand Up @@ -123,16 +127,18 @@ class SentryStackTraceFactory {
absPath: abs,
function: member,
// https://docs.sentry.io/development/sdk-dev/features/#in-app-frames
inApp: isInApp(frame),
inApp: _isInApp(frame),
fileName: fileName,
package: frame.package,
);

if (frame.line != null && frame.line! >= 0) {
final line = frame.line;
if (line != null && line >= 0) {
sentryStackFrame = sentryStackFrame.copyWith(lineNo: frame.line);
}

if (frame.column != null && frame.column! >= 0) {
final column = frame.column;
if (column != null && column >= 0) {
sentryStackFrame = sentryStackFrame.copyWith(colNo: frame.column);
}
return sentryStackFrame;
Expand All @@ -153,11 +159,11 @@ class SentryStackTraceFactory {
return frame.uri.pathSegments.last;
}

return '${frame.uri}';
return frame.uri.toString();
}

/// whether this frame comes from the app and not from Dart core or 3rd party librairies
bool isInApp(Frame frame) {
bool _isInApp(Frame frame) {
final scheme = frame.uri.scheme;

if (scheme.isEmpty) {
Expand Down
6 changes: 3 additions & 3 deletions dart/lib/src/sentry_tracer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ class SentryTracer extends ISentrySpan {
/// highest timestamp of child spans, trimming the duration of the
/// transaction. This is useful to discard extra time in the transaction that
/// is not accounted for in child spans, like what happens in the
/// [SentryNavigatorObserver] idle transactions, where we finish the
/// transaction after a given "idle time" and we don't want this "idle time"
/// to be part of the transaction.
/// [SentryNavigatorObserver](https://pub.dev/documentation/sentry_flutter/latest/sentry_flutter/SentryNavigatorObserver-class.html)
/// idle transactions, where we finish the transaction after a given
/// "idle time" and we don't want this "idle time" to be part of the transaction.
SentryTracer(
SentryTransactionContext transactionContext,
this._hub, {
Expand Down
6 changes: 3 additions & 3 deletions flutter/example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -631,7 +631,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -681,7 +681,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
Loading