Disable dart-code-metrics for now

Even though I'm not using v4.2, the return-value rule is still being
applied with `flutter analyze` though not consistently.

For now, lets disable this, as there are 300+ warnings to fix.
This commit is contained in:
Vishesh Handa
2021-08-25 11:17:21 +02:00
parent 3d80c494c9
commit 7ff61d2f41
11 changed files with 18 additions and 14 deletions

View File

@ -17,8 +17,8 @@ analyzer:
- "lib/generated_plugin_registrant.dart"
enable-experiment:
- nonfunction-type-aliases
plugins:
- dart_code_metrics
# plugins:
# - dart_code_metrics
linter:
rules:
@ -149,4 +149,3 @@ dart_code_metrics:
# - no-magic-number
# - no-object-declaration
# - prefer-conditional-expressions

View File

@ -49,7 +49,7 @@ class Analytics {
var pseudoId = pref.getString("pseudoId");
if (pseudoId == null) {
pseudoId = const Uuid().v4();
pref.setString("pseudoId", pseudoId);
var _ = pref.setString("pseudoId", pseudoId);
}
var config = AnalyticsConfig("", pref);

View File

@ -26,6 +26,6 @@ class AnalyticsConfig extends ChangeNotifier with SettingsSharedPref {
var def = AnalyticsConfig(id, pref);
await setBool("collectUsageStatistics", enabled, def.enabled);
await pref.setString("appVersion", appVersion);
var _ = await pref.setString("appVersion", appVersion);
}
}

View File

@ -28,7 +28,7 @@ Future<Result<void>> sendAnalytics(pb.AnalyticsMessage msg) async {
msg,
options: CallOptions(timeout: _timeout),
);
await call;
var _ = await call;
} on Exception catch (e, st) {
await channel.shutdown();
return Result.fail(e, st);

View File

@ -46,7 +46,10 @@ class AnalyticsStorage {
builder.add(intData.buffer.asUint8List());
builder.add(eventData);
await File(filePath).writeAsBytes(builder.toBytes(), mode: FileMode.append);
var _ = await File(filePath).writeAsBytes(
builder.toBytes(),
mode: FileMode.append,
);
numEventsThisSession++;
}

View File

@ -70,7 +70,7 @@ void _isolateMain(SendPort toMainSender) {
ReceivePort fromMainRec = ReceivePort();
toMainSender.send(fromMainRec.sendPort);
fromMainRec.listen((data) async {
var _ = fromMainRec.listen((data) async {
assert(data is _LoadingMessage);
var msg = data as _LoadingMessage;

View File

@ -47,7 +47,7 @@ class EditorBottomBar extends StatelessWidget {
var addIcon = IconButton(
icon: const Icon(Icons.attach_file),
onPressed: () {
showModalBottomSheet(
var _ = showModalBottomSheet(
context: context,
builder: (c) => AddBottomSheet(editor, editorState),
elevation: 0,
@ -58,7 +58,7 @@ class EditorBottomBar extends StatelessWidget {
var menuIcon = IconButton(
icon: const Icon(Icons.more_vert),
onPressed: () {
showModalBottomSheet(
var _ = showModalBottomSheet(
context: context,
builder: (c) => BottomMenuSheet(
editor: editor,

View File

@ -145,7 +145,8 @@ Future<void> captureSentryException(
level: level,
);
await Sentry.captureEvent(event, stackTrace: Trace.from(stackTrace).terse);
var _ = await Sentry.captureEvent(event,
stackTrace: Trace.from(stackTrace).terse);
return;
} catch (e) {
print("Failed to report with Sentry: $e");

View File

@ -123,6 +123,7 @@ bool openNewNoteEditor(BuildContext context, String term) {
),
settings: const RouteSettings(name: '/newNote/'),
);
Navigator.of(context).push(route);
var _ = Navigator.of(context).push(route);
return true;
}

View File

@ -239,7 +239,7 @@ class _FolderViewState extends State<FolderView> {
),
settings: RouteSettings(name: '/newNote/$routeType'),
);
await Navigator.of(context).push(route);
var _ = await Navigator.of(context).push(route);
ScaffoldMessenger.of(context).removeCurrentSnackBar();
}

View File

@ -86,7 +86,7 @@ class PurchaseManager {
Log.i("Pending Complete Purchase - ${purchaseDetails.productID}");
try {
await InAppPurchaseConnection.instance
var _ = await InAppPurchaseConnection.instance
.completePurchase(purchaseDetails);
} catch (e, stackTrace) {
logException(e, stackTrace);