Skip to content
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

fix(lints): avoid_unnecessary_containers #151

Closed
wants to merge 6 commits into from
Closed

fix(lints): avoid_unnecessary_containers #151

wants to merge 6 commits into from

Conversation

Neha62-lit
Copy link
Contributor

@Neha62-lit Neha62-lit commented Oct 7, 2021

Fixes #149

Fix lints for these rule:

  • avoid_unnecessary_containers
  • avoid_print

@Neha62-lit Neha62-lit closed this Oct 7, 2021
@Neha62-lit Neha62-lit deleted the fix-lints-2 branch October 7, 2021 06:53
@coveralls
Copy link

coveralls commented Oct 7, 2021

Pull Request Test Coverage Report for Build 1315008201

  • 2 of 7 (28.57%) changed or added relevant lines in 6 files are covered.
  • 9 unchanged lines in 2 files lost coverage.
  • Overall coverage remained the same at 74.202%

Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/services/local_storage_service.dart 1 2 50.0%
lib/ui/views/groups/add_assignment_view.dart 0 1 0.0%
lib/ui/views/groups/components/assignment_card.dart 0 1 0.0%
lib/ui/views/groups/update_assignment_view.dart 0 1 0.0%
lib/ui/views/ib/ib_page_view.dart 0 1 0.0%
Files with Coverage Reduction New Missed Lines %
lib/ui/views/groups/update_assignment_view.dart 3 59.43%
lib/ui/views/groups/add_assignment_view.dart 6 59.83%
Totals Coverage Status
Change from base Build 1312382936: 0.0%
Covered Lines: 4024
Relevant Lines: 5423

💛 - Coveralls

@@ -33,9 +33,9 @@ linter:
directives_ordering: false

# In case of production should be set to true
avoid_print: false
avoid_print: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better remove these rules instead of making them true since they are true by default

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I will remove this rule from analysis_options.yaml file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here if I remove this rule from that file then after running flutter analyze, I am getting 7 warnings of avoid_prints.
So Can I use the debugPrint overthere instead of removing that rule or commenting in that specific file wherever we used print()?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@@ -55,6 +55,7 @@ class AboutPrivacyPolicyView extends StatelessWidget {
? Theme.of(context).textTheme.headline5
: Theme.of(context).textTheme.headline6;

// ignore: avoid_unnecessary_containers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot remove the unnecessary container here and other places ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to run the app, but I got some error that's why I ignored that warning.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What should I do here now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, So can I remove that unnecessary containers from that UI?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@@ -34,7 +34,7 @@ class DatabaseServiceImpl implements DatabaseService {
try {
await Hive.initFlutter();
} catch (e) {
print('Hive Initialization Failed');
// print('Hive Initialization Failed');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the options if we want to debug the log but exclude them from production as Dart rule says ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use "debugPrint()" instead of "print".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@manjotsidhu
Copy link
Member

The multiple commits that are being pushed doesn't matter since we can Squash and Merge them as a single commit.

@Neha62-lit
Copy link
Contributor Author

Yes, I will be creating a new PR of these changes in one commit right now. Is it okay?

@manjotsidhu
Copy link
Member

Yes, I will be creating a new PR of these changes in one commit right now. Is it okay?

Yes It's fine. Even though multiple commits come, we can squash and merge.

@Neha62-lit
Copy link
Contributor Author

Yes, I will be creating a new PR of these changes in one commit right now. Is it okay?

Yes It's fine. Even though multiple commits come, we can squash and merge.

Okay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix and enable linter rules
3 participants