From 453d4b478a9becaa5ccfcc7fa3be755a58512cae Mon Sep 17 00:00:00 2001 From: Neha Musale Date: Thu, 14 Oct 2021 22:04:46 +0530 Subject: [PATCH 1/7] fix(lints): unnecessary_string_escapes rule --- analysis_options.yaml | 4 ++-- test/setup/test_data/mock_ib_raw_page_data.dart | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 796ecda8..cd9bb9b1 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -29,9 +29,9 @@ linter: join_return_with_assignment: false - prefer_function_declarations_over_variables: false + #prefer_function_declarations_over_variables: false - unnecessary_string_escapes: false + #prefer_const_constructors non_constant_identifier_names: false diff --git a/test/setup/test_data/mock_ib_raw_page_data.dart b/test/setup/test_data/mock_ib_raw_page_data.dart index 37afecbf..cc2e6134 100644 --- a/test/setup/test_data/mock_ib_raw_page_data.dart +++ b/test/setup/test_data/mock_ib_raw_page_data.dart @@ -8,7 +8,7 @@ Map mockIbRawPageData1 = { 'description': '', 'permalink': '/', 'content': - '

Interactive-Book

\n\n

Learn Digital Logic Design easily.

\n\n

The Computer Logical Organization is basically the abstraction which is below the operating system and above the digital logic level.\nNow at this point, the important points are the functional units/subsystems that refer to some hardware which is made up of lower level building blocks.

\n\n

This interactive book gives a complete understanding on Computer Logical Organization starting from basic computer overview till the advanced level.\nThis book is aimed to provide the knowledge to the reader on how to analyze the combinational and sequential circuits and implement them. You can use the combinational circuit/sequential circuit/combination of both the circuits, as per the requirement.\nAfter completing this book, you will be able to implement the type of digital circuit, which is suitable for specific application.

\n\n
\n\n

Audience

\n\n

This book is mainly prepared for the students who are interested in the concepts of digital circuits and Computer Logical Organization. Digital circuits contain a set of Logic gates and these can be operated with binary values, 0 and 1.

\n\n

Prerequisites

\n

Before you start learning from this Book, I hope that you have some basic knowledge about computers and how they work.\nA basic idea regarding the initial concepts of Digital Electronics is enough to understand the topics covered in this tutorial.

\n', + '

Interactive-Book

\n\n

Learn Digital Logic Design easily.

\n\n

The Computer Logical Organization is basically the abstraction which is below the operating system and above the digital logic level.\nNow at this point, the important points are the functional units/subsystems that refer to some hardware which is made up of lower level building blocks.

\n\n

This interactive book gives a complete understanding on Computer Logical Organization starting from basic computer overview till the advanced level.\nThis book is aimed to provide the knowledge to the reader on how to analyze the combinational and sequential circuits and implement them. You can use the combinational circuit/sequential circuit/combination of both the circuits, as per the requirement.\nAfter completing this book, you will be able to implement the type of digital circuit, which is suitable for specific application.

\n\n
\n\n

Audience

\n\n

This book is mainly prepared for the students who are interested in the concepts of digital circuits and Computer Logical Organization. Digital circuits contain a set of Logic gates and these can be operated with binary values, 0 and 1.

\n\n

Prerequisites

\n

Before you start learning from this Book, I hope that you have some basic knowledge about computers and how they work.\nA basic idea regarding the initial concepts of Digital Electronics is enough to understand the topics covered in this tutorial.

\n', 'dir': '/', 'url': '/', 'raw_content': From 94b7e8cda30391ac8962f460b8ba66cdccc4f371 Mon Sep 17 00:00:00 2001 From: Neha Musale Date: Thu, 14 Oct 2021 22:05:32 +0530 Subject: [PATCH 2/7] fix(lints): prefer_function_declarations_over_variables rule --- test/ui_tests/authentication/forgot_password_view_test.dart | 1 + test/ui_tests/authentication/login_view_test.dart | 1 + test/ui_tests/authentication/signup_view_test.dart | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/test/ui_tests/authentication/forgot_password_view_test.dart b/test/ui_tests/authentication/forgot_password_view_test.dart index a31c2d69..7021db4a 100644 --- a/test/ui_tests/authentication/forgot_password_view_test.dart +++ b/test/ui_tests/authentication/forgot_password_view_test.dart @@ -42,6 +42,7 @@ void main() { await _pumpForgotPasswordView(tester); await tester.pumpAndSettle(); + // ignore: prefer_function_declarations_over_variables var _forgotPasswordImagePredicate = (Widget widget) => widget is Image && widget.height == 300; diff --git a/test/ui_tests/authentication/login_view_test.dart b/test/ui_tests/authentication/login_view_test.dart index e2ea46dc..374f1937 100644 --- a/test/ui_tests/authentication/login_view_test.dart +++ b/test/ui_tests/authentication/login_view_test.dart @@ -43,6 +43,7 @@ void main() { await _pumpLoginView(tester); await tester.pumpAndSettle(); + // ignore: prefer_function_declarations_over_variables var _loginImagePredicate = (Widget widget) => widget is Image && widget.height == 300; diff --git a/test/ui_tests/authentication/signup_view_test.dart b/test/ui_tests/authentication/signup_view_test.dart index df0dea5f..df9958e9 100644 --- a/test/ui_tests/authentication/signup_view_test.dart +++ b/test/ui_tests/authentication/signup_view_test.dart @@ -42,6 +42,8 @@ void main() { await _pumpSignupView(tester); await tester.pumpAndSettle(); + + // ignore: prefer_function_declarations_over_variables var _signupImagePredicate = (Widget widget) => widget is Image && widget.height == 300; @@ -63,8 +65,10 @@ void main() { await _pumpSignupView(tester); await tester.pumpAndSettle(); + // ignore: prefer_function_declarations_over_variables var _nameFieldPredicate = (Widget widget) => widget is CVTextField && widget.label == 'Name'; + // ignore: prefer_function_declarations_over_variables var _emailFieldPredicate = (Widget widget) => widget is CVTextField && widget.label == 'Email'; From 72297203991abedabc0d2d6af9b440ff6fc2ce73 Mon Sep 17 00:00:00 2001 From: Neha Musale Date: Thu, 14 Oct 2021 22:06:23 +0530 Subject: [PATCH 3/7] Remove prefer_function_declarations_over_variables rule --- analysis_options.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index cd9bb9b1..b1cd2a6a 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -29,8 +29,6 @@ linter: join_return_with_assignment: false - #prefer_function_declarations_over_variables: false - #prefer_const_constructors non_constant_identifier_names: false From 74a7a298852f0dbbad7a094571ea5408a5010c1b Mon Sep 17 00:00:00 2001 From: Neha Musale Date: Thu, 14 Oct 2021 22:15:05 +0530 Subject: [PATCH 4/7] Formatted the code --- test/ui_tests/authentication/signup_view_test.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/test/ui_tests/authentication/signup_view_test.dart b/test/ui_tests/authentication/signup_view_test.dart index df9958e9..39262768 100644 --- a/test/ui_tests/authentication/signup_view_test.dart +++ b/test/ui_tests/authentication/signup_view_test.dart @@ -42,7 +42,6 @@ void main() { await _pumpSignupView(tester); await tester.pumpAndSettle(); - // ignore: prefer_function_declarations_over_variables var _signupImagePredicate = (Widget widget) => widget is Image && widget.height == 300; From 60b34c90af0adcccc6b6843885ff9be80fb4a9c8 Mon Sep 17 00:00:00 2001 From: Neha Musale Date: Thu, 14 Oct 2021 22:20:34 +0530 Subject: [PATCH 5/7] Remove the #prefer_const_constructors comment --- analysis_options.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index b1cd2a6a..4f32c7ab 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -29,8 +29,6 @@ linter: join_return_with_assignment: false - #prefer_const_constructors - non_constant_identifier_names: false constant_identifier_names: false From e0f919cdb8cc8dba727107a59e4431287e81b3f6 Mon Sep 17 00:00:00 2001 From: Neha Musale Date: Thu, 14 Oct 2021 22:46:40 +0530 Subject: [PATCH 6/7] Formatted the code for prefer_function_declarations_over_variables rule --- .../forgot_password_view_test.dart | 6 +----- .../authentication/login_view_test.dart | 6 ++---- .../authentication/signup_view_test.dart | 18 +++++------------- 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/test/ui_tests/authentication/forgot_password_view_test.dart b/test/ui_tests/authentication/forgot_password_view_test.dart index 7021db4a..85017ef5 100644 --- a/test/ui_tests/authentication/forgot_password_view_test.dart +++ b/test/ui_tests/authentication/forgot_password_view_test.dart @@ -42,11 +42,7 @@ void main() { await _pumpForgotPasswordView(tester); await tester.pumpAndSettle(); - // ignore: prefer_function_declarations_over_variables - var _forgotPasswordImagePredicate = - (Widget widget) => widget is Image && widget.height == 300; - - expect(find.byWidgetPredicate(_forgotPasswordImagePredicate), + expect(find.byWidgetPredicate((Widget widget) => widget is Image && widget.height == 300), findsOneWidget); expect(find.byType(CVTextField), findsOneWidget); expect(find.byType(CVPrimaryButton), findsOneWidget); diff --git a/test/ui_tests/authentication/login_view_test.dart b/test/ui_tests/authentication/login_view_test.dart index 374f1937..b2ad281f 100644 --- a/test/ui_tests/authentication/login_view_test.dart +++ b/test/ui_tests/authentication/login_view_test.dart @@ -43,11 +43,9 @@ void main() { await _pumpLoginView(tester); await tester.pumpAndSettle(); - // ignore: prefer_function_declarations_over_variables - var _loginImagePredicate = - (Widget widget) => widget is Image && widget.height == 300; + expect(find.byWidgetPredicate((Widget widget) => widget is Image && widget.height == 300), + findsOneWidget); - expect(find.byWidgetPredicate(_loginImagePredicate), findsOneWidget); expect(find.byType(CVTextField), findsOneWidget); expect(find.byType(CVPasswordField), findsOneWidget); expect(find.text('Forgot Password?'), findsOneWidget); diff --git a/test/ui_tests/authentication/signup_view_test.dart b/test/ui_tests/authentication/signup_view_test.dart index 39262768..11706614 100644 --- a/test/ui_tests/authentication/signup_view_test.dart +++ b/test/ui_tests/authentication/signup_view_test.dart @@ -42,11 +42,7 @@ void main() { await _pumpSignupView(tester); await tester.pumpAndSettle(); - // ignore: prefer_function_declarations_over_variables - var _signupImagePredicate = - (Widget widget) => widget is Image && widget.height == 300; - - expect(find.byWidgetPredicate(_signupImagePredicate), findsOneWidget); + expect(find.byWidgetPredicate((Widget widget) => widget is Image && widget.height == 300), findsOneWidget); expect(find.byType(CVTextField), findsNWidgets(2)); expect(find.byType(CVPasswordField), findsOneWidget); expect(find.byType(CVPrimaryButton), findsOneWidget); @@ -64,12 +60,8 @@ void main() { await _pumpSignupView(tester); await tester.pumpAndSettle(); - // ignore: prefer_function_declarations_over_variables - var _nameFieldPredicate = - (Widget widget) => widget is CVTextField && widget.label == 'Name'; - // ignore: prefer_function_declarations_over_variables - var _emailFieldPredicate = - (Widget widget) => widget is CVTextField && widget.label == 'Email'; + + expect(find.byWidgetPredicate((Widget widget) => widget is CVTextField && widget.label == 'Name'),findsOneWidget); await tester.tap(find.byType(CVPrimaryButton)); await tester.pumpAndSettle(); @@ -80,7 +72,7 @@ void main() { expect(find.text('Password can\'t be empty'), findsOneWidget); await tester.enterText( - find.byWidgetPredicate(_nameFieldPredicate), 'test'); + find.byWidgetPredicate((Widget widget) => widget is CVTextField && widget.label == 'Name'), 'test'); await tester.tap(find.byType(CVPrimaryButton)); await tester.pumpAndSettle(); @@ -89,7 +81,7 @@ void main() { expect(find.text('Password can\'t be empty'), findsOneWidget); await tester.enterText( - find.byWidgetPredicate(_emailFieldPredicate), 'test@test.com'); + find.byWidgetPredicate((Widget widget) => widget is CVTextField && widget.label == 'Email'), 'test@test.com'); await tester.tap(find.byType(CVPrimaryButton)); await tester.pumpAndSettle(); From 626396a6afffb8ea49aa664568b5328603c498b6 Mon Sep 17 00:00:00 2001 From: Neha Musale Date: Thu, 14 Oct 2021 22:47:54 +0530 Subject: [PATCH 7/7] Formatted the 3 files --- .../forgot_password_view_test.dart | 4 +++- .../authentication/login_view_test.dart | 4 +++- .../authentication/signup_view_test.dart | 19 ++++++++++++++----- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/test/ui_tests/authentication/forgot_password_view_test.dart b/test/ui_tests/authentication/forgot_password_view_test.dart index 85017ef5..644b1a15 100644 --- a/test/ui_tests/authentication/forgot_password_view_test.dart +++ b/test/ui_tests/authentication/forgot_password_view_test.dart @@ -42,7 +42,9 @@ void main() { await _pumpForgotPasswordView(tester); await tester.pumpAndSettle(); - expect(find.byWidgetPredicate((Widget widget) => widget is Image && widget.height == 300), + expect( + find.byWidgetPredicate( + (Widget widget) => widget is Image && widget.height == 300), findsOneWidget); expect(find.byType(CVTextField), findsOneWidget); expect(find.byType(CVPrimaryButton), findsOneWidget); diff --git a/test/ui_tests/authentication/login_view_test.dart b/test/ui_tests/authentication/login_view_test.dart index b2ad281f..a07d46ad 100644 --- a/test/ui_tests/authentication/login_view_test.dart +++ b/test/ui_tests/authentication/login_view_test.dart @@ -43,7 +43,9 @@ void main() { await _pumpLoginView(tester); await tester.pumpAndSettle(); - expect(find.byWidgetPredicate((Widget widget) => widget is Image && widget.height == 300), + expect( + find.byWidgetPredicate( + (Widget widget) => widget is Image && widget.height == 300), findsOneWidget); expect(find.byType(CVTextField), findsOneWidget); diff --git a/test/ui_tests/authentication/signup_view_test.dart b/test/ui_tests/authentication/signup_view_test.dart index 11706614..4ab16607 100644 --- a/test/ui_tests/authentication/signup_view_test.dart +++ b/test/ui_tests/authentication/signup_view_test.dart @@ -42,7 +42,10 @@ void main() { await _pumpSignupView(tester); await tester.pumpAndSettle(); - expect(find.byWidgetPredicate((Widget widget) => widget is Image && widget.height == 300), findsOneWidget); + expect( + find.byWidgetPredicate( + (Widget widget) => widget is Image && widget.height == 300), + findsOneWidget); expect(find.byType(CVTextField), findsNWidgets(2)); expect(find.byType(CVPasswordField), findsOneWidget); expect(find.byType(CVPrimaryButton), findsOneWidget); @@ -60,8 +63,10 @@ void main() { await _pumpSignupView(tester); await tester.pumpAndSettle(); - - expect(find.byWidgetPredicate((Widget widget) => widget is CVTextField && widget.label == 'Name'),findsOneWidget); + expect( + find.byWidgetPredicate((Widget widget) => + widget is CVTextField && widget.label == 'Name'), + findsOneWidget); await tester.tap(find.byType(CVPrimaryButton)); await tester.pumpAndSettle(); @@ -72,7 +77,9 @@ void main() { expect(find.text('Password can\'t be empty'), findsOneWidget); await tester.enterText( - find.byWidgetPredicate((Widget widget) => widget is CVTextField && widget.label == 'Name'), 'test'); + find.byWidgetPredicate((Widget widget) => + widget is CVTextField && widget.label == 'Name'), + 'test'); await tester.tap(find.byType(CVPrimaryButton)); await tester.pumpAndSettle(); @@ -81,7 +88,9 @@ void main() { expect(find.text('Password can\'t be empty'), findsOneWidget); await tester.enterText( - find.byWidgetPredicate((Widget widget) => widget is CVTextField && widget.label == 'Email'), 'test@test.com'); + find.byWidgetPredicate((Widget widget) => + widget is CVTextField && widget.label == 'Email'), + 'test@test.com'); await tester.tap(find.byType(CVPrimaryButton)); await tester.pumpAndSettle();