From 2404d6fa6a5d38d4aebba09a94aa44d2f97b0479 Mon Sep 17 00:00:00 2001 From: Isaac Obella Date: Wed, 28 Sep 2022 21:15:09 +0300 Subject: [PATCH] fix: Fix code cov script to skip part of files. --- .github/scripts/coverage_gen.sh | 11 +++++++---- lib/presentation/core/routes/app_page.dart | 2 +- lib/presentation/core/routes/app_page.ext.dart | 2 +- lib/presentation/home/home_screen.dart | 2 +- lib/presentation/home/widgets/home_nav.dart | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/scripts/coverage_gen.sh b/.github/scripts/coverage_gen.sh index 53950a1d..9d442dbd 100755 --- a/.github/scripts/coverage_gen.sh +++ b/.github/scripts/coverage_gen.sh @@ -1,7 +1,10 @@ #!/bin/sh file=test/coverage_helper_test.dart touch file -echo "// Helper file to make coverage report for all dart files\n" >> $file -echo "// ignore_for_file: unused_import" >> $file -find lib -type f \( -iname "*.dart" ! -iname "*.g.dart" ! -iname "*.gr.dart" ! -iname "*.freezed.dart" ! -iname "generated_plugin_registrant.dart" ! -iname "*_state.dart" ! -iname "*_event.dart" \) | cut -c 4- | sort | awk -v package="$1" '{printf "import '\''package:collaction_app%s%s'\'';\n", package, $1}' >> $file -echo "void main(){}" >> $file \ No newline at end of file + +{ + printf "// Helper file to make coverage report for all dart files\n" + echo "// ignore_for_file: unused_import" + find lib -type f \( -iname "*.dart" ! -iname "*.g.dart" ! -iname "*.gr.dart" ! -iname "*.freezed.dart" ! -iname "generated_plugin_registrant.dart" ! -iname "*_state.dart" ! -iname "*_event.dart" \) -print0 | xargs -0 grep -L "^part of" | cut -c 4- | sort | awk -v package="$1" '{printf "import '\''package:collaction_app%s%s'\'';\n", package, $1}' + echo "void main(){}" +} >>$file diff --git a/lib/presentation/core/routes/app_page.dart b/lib/presentation/core/routes/app_page.dart index 5ffaac74..a1bceeb4 100644 --- a/lib/presentation/core/routes/app_page.dart +++ b/lib/presentation/core/routes/app_page.dart @@ -1,4 +1,4 @@ -part 'package:collaction_app/presentation/core/routes/app_page.ext.dart'; +part 'app_page.ext.dart'; enum AppPage { mainPage, diff --git a/lib/presentation/core/routes/app_page.ext.dart b/lib/presentation/core/routes/app_page.ext.dart index 71ceda9a..e0c07ab0 100644 --- a/lib/presentation/core/routes/app_page.ext.dart +++ b/lib/presentation/core/routes/app_page.ext.dart @@ -1,4 +1,4 @@ -part of 'package:collaction_app/presentation/core/routes/app_page.dart'; +part of 'app_page.dart'; extension AppPageExt on AppPage { // Route paths diff --git a/lib/presentation/home/home_screen.dart b/lib/presentation/home/home_screen.dart index dcaf2e29..90f757f6 100644 --- a/lib/presentation/home/home_screen.dart +++ b/lib/presentation/home/home_screen.dart @@ -6,7 +6,7 @@ import 'package:go_router/go_router.dart'; import '../core/collaction_icons.dart'; import '../themes/constants.dart'; -part 'package:collaction_app/presentation/home/widgets/home_nav.dart'; +part 'widgets/home_nav.dart'; class HomePage extends StatelessWidget { // Current display page diff --git a/lib/presentation/home/widgets/home_nav.dart b/lib/presentation/home/widgets/home_nav.dart index fea7f013..a9a1b4c0 100644 --- a/lib/presentation/home/widgets/home_nav.dart +++ b/lib/presentation/home/widgets/home_nav.dart @@ -1,4 +1,4 @@ -part of 'package:collaction_app/presentation/home/home_screen.dart'; +part of '../home_screen.dart'; /// Home page navigation bar Widget bottomNavbar(BuildContext context) {