From fed60f499e7d9c0c279f8da8d519420827fd5801 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Fri, 16 Jun 2023 15:11:39 +0200 Subject: [PATCH 1/3] tool: Ignore all generated code in coverage --- tool/coverage.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tool/coverage.sh b/tool/coverage.sh index 77655576..7744e4b4 100755 --- a/tool/coverage.sh +++ b/tool/coverage.sh @@ -9,6 +9,6 @@ mkdir -p /tmp/nextcloud-neon cd packages/nextcloud rm coverage -rf fvm dart run coverage:test_with_coverage --function-coverage --branch-coverage -- --timeout 60s "$@" - lcov --remove coverage/lcov.info "$(pwd)/lib/src/nextcloud.openapi.g.dart" -o coverage/filtered.info + lcov --remove coverage/lcov.info "$(pwd)/lib/src/**.g.dart" -o coverage/filtered.info genhtml coverage/filtered.info -o coverage/html ) From ecdb219a048e39631d02f69b7f6d7d747ccc11c5 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Fri, 16 Jun 2023 15:13:23 +0200 Subject: [PATCH 2/3] dynamite: Add missing coverage ignores --- .../dynamite/lib/src/openapi_builder.dart | 2 +- .../nextcloud/lib/src/nextcloud.openapi.dart | 122 +++++++++--------- 2 files changed, 62 insertions(+), 62 deletions(-) diff --git a/packages/dynamite/dynamite/lib/src/openapi_builder.dart b/packages/dynamite/dynamite/lib/src/openapi_builder.dart index bd3b550d..54604016 100644 --- a/packages/dynamite/dynamite/lib/src/openapi_builder.dart +++ b/packages/dynamite/dynamite/lib/src/openapi_builder.dart @@ -701,7 +701,7 @@ class OpenAPIBuilder implements Builder { if (securityRequirements.isNotEmpty && !isOptionalSecurity) { code.write(''' { - throw Exception('Missing authentication for ${securityRequirements.map((final r) => r.keys.single).join(' or ')}'); + throw Exception('Missing authentication for ${securityRequirements.map((final r) => r.keys.single).join(' or ')}'); // coverage:ignore-line } '''); } diff --git a/packages/nextcloud/lib/src/nextcloud.openapi.dart b/packages/nextcloud/lib/src/nextcloud.openapi.dart index 6635d88a..32691f03 100644 --- a/packages/nextcloud/lib/src/nextcloud.openapi.dart +++ b/packages/nextcloud/lib/src/nextcloud.openapi.dart @@ -204,7 +204,7 @@ class NextcloudCoreClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } final response = await rootClient.doRequest( 'get', @@ -231,7 +231,7 @@ class NextcloudCoreClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } final response = await rootClient.doRequest( 'get', @@ -310,7 +310,7 @@ class NextcloudCoreClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } if (file != '') { queryParameters['file'] = file; @@ -355,7 +355,7 @@ class NextcloudCoreClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId)); path = path.replaceAll('{size}', Uri.encodeQueryComponent(size.toString())); @@ -384,7 +384,7 @@ class NextcloudCoreClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId)); path = path.replaceAll('{size}', Uri.encodeQueryComponent(size.toString())); @@ -417,7 +417,7 @@ class NextcloudCoreClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } queryParameters['search'] = search; queryParameters['itemType'] = itemType; @@ -454,7 +454,7 @@ class NextcloudCoreClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } final response = await rootClient.doRequest( 'delete', @@ -484,7 +484,7 @@ class NextcloudNewsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } final response = await rootClient.doRequest( 'get', @@ -511,7 +511,7 @@ class NextcloudNewsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } final response = await rootClient.doRequest( 'get', @@ -538,7 +538,7 @@ class NextcloudNewsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } queryParameters['name'] = name; final response = await rootClient.doRequest( @@ -567,7 +567,7 @@ class NextcloudNewsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{folderId}', Uri.encodeQueryComponent(folderId.toString())); queryParameters['name'] = name; @@ -591,7 +591,7 @@ class NextcloudNewsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{folderId}', Uri.encodeQueryComponent(folderId.toString())); final response = await rootClient.doRequest( @@ -617,7 +617,7 @@ class NextcloudNewsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{folderId}', Uri.encodeQueryComponent(folderId.toString())); queryParameters['newestItemId'] = newestItemId.toString(); @@ -643,7 +643,7 @@ class NextcloudNewsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } final response = await rootClient.doRequest( 'get', @@ -673,7 +673,7 @@ class NextcloudNewsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } queryParameters['url'] = url; if (folderId != null) { @@ -702,7 +702,7 @@ class NextcloudNewsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{feedId}', Uri.encodeQueryComponent(feedId.toString())); final response = await rootClient.doRequest( @@ -728,7 +728,7 @@ class NextcloudNewsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{feedId}', Uri.encodeQueryComponent(feedId.toString())); if (folderId != null) { @@ -757,7 +757,7 @@ class NextcloudNewsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{feedId}', Uri.encodeQueryComponent(feedId.toString())); queryParameters['feedTitle'] = feedTitle; @@ -784,7 +784,7 @@ class NextcloudNewsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{feedId}', Uri.encodeQueryComponent(feedId.toString())); queryParameters['newestItemId'] = newestItemId.toString(); @@ -817,7 +817,7 @@ class NextcloudNewsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } if (type != 3) { queryParameters['type'] = type.toString(); @@ -866,7 +866,7 @@ class NextcloudNewsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } if (type != 3) { queryParameters['type'] = type.toString(); @@ -900,7 +900,7 @@ class NextcloudNewsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{itemId}', Uri.encodeQueryComponent(itemId.toString())); final response = await rootClient.doRequest( @@ -923,7 +923,7 @@ class NextcloudNewsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{itemId}', Uri.encodeQueryComponent(itemId.toString())); final response = await rootClient.doRequest( @@ -946,7 +946,7 @@ class NextcloudNewsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{itemId}', Uri.encodeQueryComponent(itemId.toString())); final response = await rootClient.doRequest( @@ -969,7 +969,7 @@ class NextcloudNewsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{itemId}', Uri.encodeQueryComponent(itemId.toString())); final response = await rootClient.doRequest( @@ -1007,7 +1007,7 @@ class NextcloudNotesClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } if (category != null) { queryParameters['category'] = category; @@ -1058,7 +1058,7 @@ class NextcloudNotesClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } if (category != '') { queryParameters['category'] = category; @@ -1104,7 +1104,7 @@ class NextcloudNotesClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{id}', Uri.encodeQueryComponent(id.toString())); if (exclude != '') { @@ -1146,7 +1146,7 @@ class NextcloudNotesClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{id}', Uri.encodeQueryComponent(id.toString())); if (content != null) { @@ -1192,7 +1192,7 @@ class NextcloudNotesClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{id}', Uri.encodeQueryComponent(id.toString())); final response = await rootClient.doRequest( @@ -1217,7 +1217,7 @@ class NextcloudNotesClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } final response = await rootClient.doRequest( 'get', @@ -1244,7 +1244,7 @@ class NextcloudNotesClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } headers['Content-Type'] = 'application/json'; body = Uint8List.fromList( @@ -1283,7 +1283,7 @@ class NextcloudNotificationsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } final response = await rootClient.doRequest( 'get', @@ -1310,7 +1310,7 @@ class NextcloudNotificationsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } final response = await rootClient.doRequest( 'delete', @@ -1334,7 +1334,7 @@ class NextcloudNotificationsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{id}', Uri.encodeQueryComponent(id.toString())); final response = await rootClient.doRequest( @@ -1362,7 +1362,7 @@ class NextcloudNotificationsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{id}', Uri.encodeQueryComponent(id.toString())); final response = await rootClient.doRequest( @@ -1394,7 +1394,7 @@ class NextcloudNotificationsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } queryParameters['pushTokenHash'] = pushTokenHash; queryParameters['devicePublicKey'] = devicePublicKey; @@ -1424,7 +1424,7 @@ class NextcloudNotificationsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } final response = await rootClient.doRequest( 'delete', @@ -1452,7 +1452,7 @@ class NextcloudNotificationsClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId)); queryParameters['shortMessage'] = shortMessage; @@ -1490,7 +1490,7 @@ class NextcloudProvisioningApiClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } final response = await rootClient.doRequest( 'get', @@ -1517,7 +1517,7 @@ class NextcloudProvisioningApiClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId)); final response = await rootClient.doRequest( @@ -1552,7 +1552,7 @@ class NextcloudUnifiedPushProviderClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } final response = await rootClient.doRequest( 'get', @@ -1584,7 +1584,7 @@ class NextcloudUnifiedPushProviderClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } queryParameters['keepalive'] = keepalive.toString(); final response = await rootClient.doRequest( @@ -1615,7 +1615,7 @@ class NextcloudUnifiedPushProviderClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } queryParameters['deviceName'] = deviceName; final response = await rootClient.doRequest( @@ -1648,7 +1648,7 @@ class NextcloudUnifiedPushProviderClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{deviceId}', Uri.encodeQueryComponent(deviceId)); final response = await rootClient.doRequest( @@ -1679,7 +1679,7 @@ class NextcloudUnifiedPushProviderClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{deviceId}', Uri.encodeQueryComponent(deviceId)); final response = await rootClient.doRequest( @@ -1711,7 +1711,7 @@ class NextcloudUnifiedPushProviderClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } queryParameters['deviceId'] = deviceId; queryParameters['appName'] = appName; @@ -1743,7 +1743,7 @@ class NextcloudUnifiedPushProviderClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{token}', Uri.encodeQueryComponent(token)); final response = await rootClient.doRequest( @@ -1774,7 +1774,7 @@ class NextcloudUnifiedPushProviderClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{token}', Uri.encodeQueryComponent(token)); final response = await rootClient.doRequest( @@ -1803,7 +1803,7 @@ class NextcloudUnifiedPushProviderClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{token}', Uri.encodeQueryComponent(token)); final response = await rootClient.doRequest( @@ -1832,7 +1832,7 @@ class NextcloudUnifiedPushProviderClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } final response = await rootClient.doRequest( 'get', @@ -1860,7 +1860,7 @@ class NextcloudUnifiedPushProviderClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } final response = await rootClient.doRequest( 'post', @@ -1893,7 +1893,7 @@ class NextcloudUserStatusClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } final response = await rootClient.doRequest( 'get', @@ -1920,7 +1920,7 @@ class NextcloudUserStatusClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } path = path.replaceAll('{userId}', Uri.encodeQueryComponent(userId)); final response = await rootClient.doRequest( @@ -1948,7 +1948,7 @@ class NextcloudUserStatusClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } final response = await rootClient.doRequest( 'get', @@ -1975,7 +1975,7 @@ class NextcloudUserStatusClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } queryParameters['statusType'] = statusType.name; final response = await rootClient.doRequest( @@ -2006,7 +2006,7 @@ class NextcloudUserStatusClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } queryParameters['messageId'] = messageId; if (clearAt != null) { @@ -2041,7 +2041,7 @@ class NextcloudUserStatusClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } if (statusIcon != null) { queryParameters['statusIcon'] = statusIcon; @@ -2075,7 +2075,7 @@ class NextcloudUserStatusClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } final response = await rootClient.doRequest( 'delete', @@ -2099,7 +2099,7 @@ class NextcloudUserStatusClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } final response = await rootClient.doRequest( 'get', @@ -2126,7 +2126,7 @@ class NextcloudUserStatusClient { if (rootClient.authentications.map((final a) => a.id).contains('basic_auth')) { headers.addAll(rootClient.authentications.singleWhere((final a) => a.id == 'basic_auth').headers); } else { - throw Exception('Missing authentication for basic_auth'); + throw Exception('Missing authentication for basic_auth'); // coverage:ignore-line } queryParameters['status'] = status.name; final response = await rootClient.doRequest( From 1ab7c701518317e10600a8fb2e8345328a77cc5f Mon Sep 17 00:00:00 2001 From: jld3103 Date: Fri, 16 Jun 2023 16:46:51 +0200 Subject: [PATCH 3/3] nextcloud: Add missing coverage ignores for WebDAV --- packages/nextcloud/bin/generate_props.dart | 1 + packages/nextcloud/lib/src/webdav/client.dart | 8 +++++--- packages/nextcloud/lib/src/webdav/props.dart | 1 + packages/nextcloud/lib/src/webdav/webdav.dart | 10 ++-------- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/packages/nextcloud/bin/generate_props.dart b/packages/nextcloud/bin/generate_props.dart index 3c577449..cec196e0 100644 --- a/packages/nextcloud/bin/generate_props.dart +++ b/packages/nextcloud/bin/generate_props.dart @@ -22,6 +22,7 @@ void main() { File('lib/src/webdav/props.dart').writeAsStringSync( [ '// ignore_for_file: public_member_api_docs', + '// coverage:ignore-file', "import 'package:nextcloud/src/webdav/webdav.dart';", "import 'package:xml/xml.dart';", "import 'package:xml_annotation/xml_annotation.dart' as annotation;", diff --git a/packages/nextcloud/lib/src/webdav/client.dart b/packages/nextcloud/lib/src/webdav/client.dart index 86e44b4c..1bce6929 100644 --- a/packages/nextcloud/lib/src/webdav/client.dart +++ b/packages/nextcloud/lib/src/webdav/client.dart @@ -65,7 +65,7 @@ class WebDavClient { part = part.substring(1); } while (part.endsWith('/')) { - part = part.substring(0, part.length - 1); + part = part.substring(0, part.length - 1); // coverage:ignore-line } return part; }) @@ -116,7 +116,7 @@ class WebDavClient { return null; } if (remotePath.trim().startsWith('/')) { - dirs[0] = '/${dirs[0]}'; + dirs[0] = '/${dirs[0]}'; // coverage:ignore-line } final prevPath = StringBuffer(); late HttpClientResponse response; @@ -245,11 +245,13 @@ class WebDavClient { }, ); if (response.statusCode == 301) { + // coverage:ignore-start return ls( response.headers['location']!.first, prop: prop, depth: depth, ); + // coverage:ignore-end } return _parseResponse(response); } @@ -272,7 +274,7 @@ class WebDavClient { utf8.encode( WebDavOcFilterFiles( filterRules: filterRules, - prop: prop ?? WebDavPropfindProp(), + prop: prop ?? WebDavPropfindProp(), // coverage:ignore-line ).toXmlElement(namespaces: namespaces).toXmlString(), ), ), diff --git a/packages/nextcloud/lib/src/webdav/props.dart b/packages/nextcloud/lib/src/webdav/props.dart index df63ad55..e35e9506 100644 --- a/packages/nextcloud/lib/src/webdav/props.dart +++ b/packages/nextcloud/lib/src/webdav/props.dart @@ -1,4 +1,5 @@ // ignore_for_file: public_member_api_docs +// coverage:ignore-file import 'package:nextcloud/src/webdav/webdav.dart'; import 'package:xml/xml.dart'; import 'package:xml_annotation/xml_annotation.dart' as annotation; diff --git a/packages/nextcloud/lib/src/webdav/webdav.dart b/packages/nextcloud/lib/src/webdav/webdav.dart index c226cbdf..6a7932a5 100644 --- a/packages/nextcloud/lib/src/webdav/webdav.dart +++ b/packages/nextcloud/lib/src/webdav/webdav.dart @@ -1,4 +1,5 @@ // ignore_for_file: public_member_api_docs +// coverage:ignore-file import 'package:intl/intl.dart'; import 'package:nextcloud/src/webdav/props.dart'; @@ -78,9 +79,6 @@ class WebDavPropertyupdate with _$WebDavPropertyupdateXmlSerializableMixin { required this.set, }); - factory WebDavPropertyupdate.fromXmlElement(final XmlElement element) => - _$WebDavPropertyupdateFromXmlElement(element); - @annotation.XmlElement(name: 'set', namespace: namespaceDav) final WebDavSet set; } @@ -95,7 +93,7 @@ class WebDavSet with _$WebDavSetXmlSerializableMixin { factory WebDavSet.fromXmlElement(final XmlElement element) => _$WebDavSetFromXmlElement(element); @annotation.XmlElement(name: 'prop', namespace: namespaceDav) - final WebDavProp prop; + final WebDavProp prop; // coverage:ignore-line } @annotation.XmlSerializable(createMixin: true) @@ -105,8 +103,6 @@ class WebDavPropfind with _$WebDavPropfindXmlSerializableMixin { required this.prop, }); - factory WebDavPropfind.fromXmlElement(final XmlElement element) => _$WebDavPropfindFromXmlElement(element); - @annotation.XmlElement(name: 'prop', namespace: namespaceDav) final WebDavPropfindProp prop; } @@ -119,8 +115,6 @@ class WebDavOcFilterFiles with _$WebDavOcFilterFilesXmlSerializableMixin { required this.prop, }); - factory WebDavOcFilterFiles.fromXmlElement(final XmlElement element) => _$WebDavOcFilterFilesFromXmlElement(element); - @annotation.XmlElement(name: 'filter-rules', namespace: namespaceOwncloud) final WebDavOcFilterRules filterRules;