-
-
Notifications
You must be signed in to change notification settings - Fork 257
fix: Linter issues #52
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,12 +121,12 @@ abstract class SentryClient { | |
|
||
@visibleForTesting | ||
String get postUri { | ||
String port = dsnUri.hasPort && | ||
var port = dsnUri.hasPort && | ||
((dsnUri.scheme == 'http' && dsnUri.port != 80) || | ||
(dsnUri.scheme == 'https' && dsnUri.port != 443)) | ||
? ':${dsnUri.port}' | ||
: ''; | ||
int pathLength = dsnUri.pathSegments.length; | ||
var pathLength = dsnUri.pathSegments.length; | ||
String apiPath; | ||
if (pathLength > 1) { | ||
// some paths would present before the projectID in the dsnUri | ||
|
@@ -143,16 +143,16 @@ abstract class SentryClient { | |
@required Event event, | ||
StackFrameFilter stackFrameFilter, | ||
}) async { | ||
final DateTime now = _clock(); | ||
String authHeader = 'Sentry sentry_version=6, sentry_client=$sentryClient, ' | ||
final now = _clock(); | ||
var authHeader = 'Sentry sentry_version=6, sentry_client=$sentryClient, ' | ||
'sentry_timestamp=${now.millisecondsSinceEpoch}, sentry_key=$publicKey'; | ||
if (secretKey != null) { | ||
authHeader += ', sentry_secret=$secretKey'; | ||
} | ||
|
||
final Map<String, String> headers = buildHeaders(authHeader); | ||
final headers = buildHeaders(authHeader); | ||
|
||
final Map<String, dynamic> data = <String, dynamic>{ | ||
final data = <String, dynamic>{ | ||
'project': projectId, | ||
'event_id': _uuidGenerator(), | ||
'timestamp': formatDateAsIso8601WithSecondPrecision(now), | ||
|
@@ -179,15 +179,14 @@ abstract class SentryClient { | |
|
||
final body = bodyEncoder(data, headers); | ||
|
||
final Response response = await httpClient.post( | ||
final response = await httpClient.post( | ||
postUri, | ||
headers: headers, | ||
body: body, | ||
); | ||
|
||
if (response.statusCode != 200) { | ||
String errorMessage = | ||
'Sentry.io responded with HTTP ${response.statusCode}'; | ||
var errorMessage = 'Sentry.io responded with HTTP ${response.statusCode}'; | ||
if (response.headers['x-sentry-error'] != null) { | ||
errorMessage += ': ${response.headers['x-sentry-error']}'; | ||
} | ||
|
@@ -203,7 +202,7 @@ abstract class SentryClient { | |
@required dynamic exception, | ||
dynamic stackTrace, | ||
}) { | ||
final Event event = Event( | ||
final event = Event( | ||
exception: exception, | ||
stackTrace: stackTrace, | ||
); | ||
|
@@ -430,7 +429,7 @@ class Event { | |
/// Serializes this event to JSON. | ||
Map<String, dynamic> toJson( | ||
{StackFrameFilter stackFrameFilter, String origin}) { | ||
final Map<String, dynamic> json = <String, dynamic>{ | ||
final json = <String, dynamic>{ | ||
'platform': sdkPlatform, | ||
'sdk': { | ||
'version': sdkVersion, | ||
|
@@ -568,6 +567,7 @@ class Contexts { | |
|
||
/// Produces a [Map] that can be serialized to JSON. | ||
Map<String, dynamic> toJson() { | ||
// ignore: omit_local_variable_types | ||
final Map<String, dynamic> json = {}; | ||
|
||
Map<String, dynamic> deviceMap; | ||
|
@@ -593,25 +593,25 @@ class Contexts { | |
|
||
if (runtimes != null) { | ||
if (runtimes.length == 1) { | ||
final Runtime runtime = runtimes[0]; | ||
final runtime = runtimes[0]; | ||
if (runtime != null) { | ||
final String key = runtime.key ?? 'runtime'; | ||
final key = runtime.key ?? 'runtime'; | ||
json[key] = runtime.toJson(); | ||
} | ||
} else if (runtimes.length > 1) { | ||
for (final runtime in runtimes) { | ||
if (runtime != null) { | ||
String key = runtime.key ?? runtime.name.toLowerCase(); | ||
var key = runtime.key ?? runtime.name.toLowerCase(); | ||
|
||
if (json.containsKey(key)) { | ||
int k = 0; | ||
var k = 0; | ||
while (json.containsKey(key)) { | ||
key = '$key$k'; | ||
k++; | ||
} | ||
} | ||
|
||
json[key] = runtime.toJson()..addAll({"type": "runtime"}); | ||
json[key] = runtime.toJson()..addAll({'type': 'runtime'}); | ||
} | ||
} | ||
} | ||
|
@@ -736,16 +736,17 @@ class Device { | |
|
||
/// Produces a [Map] that can be serialized to JSON. | ||
Map<String, dynamic> toJson() { | ||
// ignore: omit_local_variable_types | ||
final Map<String, dynamic> json = {}; | ||
|
||
String orientation; | ||
|
||
switch (this.orientation) { | ||
case Orientation.portrait: | ||
orientation = "portait"; | ||
orientation = 'portait'; | ||
break; | ||
case Orientation.landscape: | ||
orientation = "landscape"; | ||
orientation = 'landscape'; | ||
break; | ||
} | ||
|
||
|
@@ -848,6 +849,7 @@ class OperatingSystem { | |
|
||
/// Produces a [Map] that can be serialized to JSON. | ||
Map<String, dynamic> toJson() { | ||
// ignore: omit_local_variable_types | ||
final Map<String, dynamic> json = {}; | ||
|
||
if (name != null) json['name'] = name; | ||
|
@@ -891,10 +893,12 @@ class Runtime { | |
final String rawDescription; | ||
|
||
const Runtime({this.key, this.name, this.version, this.rawDescription}) | ||
// ignore: prefer_is_empty | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds like a gap in the language. /cc @lrhn @leafpetersen @eernstg There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, then it's a linter issue. The linter should not be in a conflict with the language. Which quickly led me to https://github.com/dart-lang/linter/issues/1719 |
||
: assert(key == null || key.length >= 1); | ||
|
||
/// Produces a [Map] that can be serialized to JSON. | ||
Map<String, dynamic> toJson() { | ||
// ignore: omit_local_variable_types | ||
final Map<String, dynamic> json = {}; | ||
|
||
if (name != null) json['name'] = name; | ||
|
@@ -945,6 +949,7 @@ class App { | |
|
||
/// Produces a [Map] that can be serialized to JSON. | ||
Map<String, dynamic> toJson() { | ||
// ignore: omit_local_variable_types | ||
final Map<String, dynamic> json = {}; | ||
|
||
if (name != null) json['app_name'] = name; | ||
|
@@ -980,6 +985,7 @@ class Browser { | |
|
||
/// Produces a [Map] that can be serialized to JSON. | ||
Map<String, dynamic> toJson() { | ||
// ignore: omit_local_variable_types | ||
final Map<String, dynamic> json = {}; | ||
bruno-garcia marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if (name != null) json['name'] = name; | ||
|
@@ -1039,11 +1045,11 @@ class User { | |
/// Produces a [Map] that can be serialized to JSON. | ||
Map<String, dynamic> toJson() { | ||
return { | ||
"id": id, | ||
"username": username, | ||
"email": email, | ||
"ip_address": ipAddress, | ||
"extras": extras, | ||
'id': id, | ||
'username': username, | ||
'email': email, | ||
'ip_address': ipAddress, | ||
'extras': extras, | ||
}; | ||
} | ||
} | ||
|
@@ -1169,8 +1175,8 @@ class Dsn { | |
}); | ||
|
||
static Dsn parse(String dsn) { | ||
final Uri uri = Uri.parse(dsn); | ||
final List<String> userInfo = uri.userInfo.split(':'); | ||
final uri = Uri.parse(dsn); | ||
final userInfo = uri.userInfo.split(':'); | ||
|
||
assert(() { | ||
if (uri.pathSegments.isEmpty) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,10 +10,10 @@ void main() { | |
test('$Breadcrumb serializes', () { | ||
expect( | ||
Breadcrumb( | ||
"example log", | ||
'example log', | ||
DateTime.utc(2019), | ||
level: SeverityLevel.debug, | ||
category: "test", | ||
category: 'test', | ||
).toJson(), | ||
<String, dynamic>{ | ||
'timestamp': '2019-01-01T00:00:00', | ||
|
@@ -25,15 +25,15 @@ void main() { | |
}); | ||
test('serializes to JSON', () { | ||
final user = User( | ||
id: "user_id", | ||
username: "username", | ||
email: "[email protected]", | ||
ipAddress: "127.0.0.1", | ||
extras: {"foo": "bar"}); | ||
id: 'user_id', | ||
username: 'username', | ||
email: '[email protected]', | ||
ipAddress: '127.0.0.1', | ||
extras: {'foo': 'bar'}); | ||
|
||
final breadcrumbs = [ | ||
Breadcrumb("test log", DateTime.utc(2019), | ||
level: SeverityLevel.debug, category: "test"), | ||
Breadcrumb('test log', DateTime.utc(2019), | ||
level: SeverityLevel.debug, category: 'test'), | ||
]; | ||
|
||
expect( | ||
|
Uh oh!
There was an error while loading. Please reload this page.