Skip to content

ci: Add fatal-infos flag to dart and flutter analyze #906

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

Merged
merged 3 commits into from
May 19, 2023

Conversation

Nidal-Bakir
Copy link
Member

@Nidal-Bakir Nidal-Bakir commented May 17, 2023

Pull Request

Issue

Closes: #905

Approach

see fatal-infos docs

@parse-github-assistant
Copy link

parse-github-assistant bot commented May 17, 2023

Thanks for opening this pull request!

@Nidal-Bakir Nidal-Bakir mentioned this pull request May 17, 2023
4 tasks
@Nidal-Bakir
Copy link
Member Author

Nidal-Bakir commented May 17, 2023

Flutter SDK

Run flutter analyze packages/flutter --fatal-infos
Analyzing flutter...

info • Use 'const' with the constructor to improve performance • packages/flutter/example/lib/live_list/main.dart:52:23 • prefer_const_constructors
info • Use 'const' literals as arguments to constructors of '@immutable' classes • packages/flutter/example/lib/live_list/main.dart:54:35 • prefer_const_literals_to_create_immutables
info • Use 'const' with the constructor to improve performance • packages/flutter/example/lib/live_list/main.dart:55:27 • prefer_const_constructors
info • Use 'const' with the constructor to improve performance • packages/flutter/example/lib/live_list/main.dart:56:27 • prefer_const_constructors

4 issues found. (ran in 15.9s)


Dart SDK

Run dart analyze packages/dart --fatal-infos
Analyzing dart...

info - example\main.dart:1:8 - Can't use a relative path to import a library in 'lib'. Try fixing the relative path or changing the import to a 'package:' import. - avoid_relative_lib_imports


No good. We need to fix this. No wonder the publishing is failing

@mtrezza
Copy link
Member

mtrezza commented May 17, 2023

But these don't seem to contain the error that was logged when publishing failed?

@Nidal-Bakir
Copy link
Member Author

Nidal-Bakir commented May 17, 2023

I updated the comment.

If no one opens a pull request to fix this, I'll fix it tomorrow. I have an exam in the morning, so I'm currently studying.

@mtrezza
Copy link
Member

mtrezza commented May 17, 2023

Great that you found that out and analyzed this so far! I think this is one of the last hurdles since we've been revamping our CI, so we're on a good path. Maybe @mbfakourii has time to take a look as well and give a hand.

@mbfakourii
Copy link
Member

mbfakourii commented May 18, 2023

Flutter SDK

Run flutter analyze packages/flutter --fatal-infos
Analyzing flutter...
info • Use 'const' with the constructor to improve performance • packages/flutter/example/lib/live_list/main.dart:52:23 • prefer_const_constructors
info • Use 'const' literals as arguments to constructors of '@immutable' classes • packages/flutter/example/lib/live_list/main.dart:54:35 • prefer_const_literals_to_create_immutables
info • Use 'const' with the constructor to improve performance • packages/flutter/example/lib/live_list/main.dart:55:27 • prefer_const_constructors
info • Use 'const' with the constructor to improve performance • packages/flutter/example/lib/live_list/main.dart:56:27 • prefer_const_constructors
4 issues found. (ran in 15.9s)

Dart SDK

Run dart analyze packages/dart --fatal-infos
Analyzing dart...
info - example\main.dart:1:8 - Can't use a relative path to import a library in 'lib'. Try fixing the relative path or changing the import to a 'package:' import. - avoid_relative_lib_imports

No good. We need to fix this. No wonder the publishing is failing

@Nidal-Bakir Have a good exam ❤️❤️

Regarding the first warnings, I fixed these bugs in the PR, but there was a problem on Flutter 3.3.x and 3.7.x, that's why it was left like this to be supported in this version.

Regarding the second warning, it is better to use it in this way because it is linked to the library in a local form

These are all warnings, I don't think they are the reason for not releasing the version

@mtrezza
Copy link
Member

mtrezza commented May 18, 2023

These are all warnings, I don't think they are the reason for not releasing the version

I've added the missing "Issue" reference to the PR description. As you can see there, publishing is failing because we are running the analzyer as part of the release workflow with dart analyze --fatal-infos. Do you mean we should remove the fatal-info and always publish releases regardless of whether they have errors or warnings on the info level?

@mbfakourii
Copy link
Member

mbfakourii commented May 18, 2023

These are all warnings, I don't think they are the reason for not releasing the version

I've added the missing "Issue" reference to the PR description. As you can see there, publishing is failing because we are running the analzyer as part of the release workflow with dart analyze --fatal-infos. Do you mean we should remove the fatal-info and always publish releases regardless of whether they have errors or warnings on the info level?

No, in my opinion, warnings should be completely resolved

In this PR, I tried to solve the second warning, probably now we don't have any more publishing problems

@mtrezza
Copy link
Member

mtrezza commented May 18, 2023

Should such info level warnings prevent a PR from being merged and/or a release from being published? Or can they be ignored for PRs and releases and be solved over time?

My concern is that if we don't make them fatal in the CI (what this PR intends) we may miss minor issues when reviewing PRs. But if the issues logged on the info level won't cause any trouble and can be ignored, we may as well not add it to the CI and remove it from the publishing workflow. What do you suggest?

@mbfakourii
Copy link
Member

Should such info level warnings prevent a PR from being merged and/or a release from being published? Or can they be ignored for PRs and releases and be solved over time?

My concern is that if we don't make them fatal in the CI (what this PR intends) we may miss minor issues when reviewing PRs. But if the issues logged on the info level won't cause any trouble and can be ignored, we may as well not add it to the CI and remove it from the publishing workflow. What do you suggest?

In my opinion, we should find out and solve these issues in ci, but these warnings do not cause any problems during the release

@mtrezza
Copy link
Member

mtrezza commented May 18, 2023

We can either add the flag or remove it from both, CI and CD. If the flag is removed, anyone is free to look into the CI / CD logs and fix the warnings if they like, but they won't be considered (or even looked at) when merging a PR or publishing a release.

@Nidal-Bakir
Copy link
Member Author

These errors are not critical and will not cause any harm to the app. However, it would be beneficial to fix them since they are relatively easy to address, such as using the const keyword appropriately. Additionally, it is preferable to follow good coding practices. Overall, fixing these issues would be advantageous for the app's long-term performance and stability.

@mtrezza
Copy link
Member

mtrezza commented May 19, 2023

This issue is currently blocking the release pipeline. If there is no contrary opinion I'll remove the flag from all workflows since these are only warnings and merge this PR.

@Nidal-Bakir
Copy link
Member Author

I will fix them all give me 30 min

@Nidal-Bakir
Copy link
Member Author

Nidal-Bakir commented May 19, 2023

#908
Should fix the Dart SDK I just test it. You can merge it and publish the Dart 5.1.1

#909
Should fix the Flutter info errors

Before merging either of those two PRs (#909, #908), please merge this PR first to ensure that the two PRs are actually fixing the errors. This will allow us to run the updated CI against them.

@mtrezza
Copy link
Member

mtrezza commented May 19, 2023

So are we sure that we want these warnings to block the merging of PRs and publishing of releases in the future? That decision is separate from fixing the warnings; they can always be fixed even without blocking PRs and releases.

@Nidal-Bakir
Copy link
Member Author

So are we sure that we want these warnings to block the merging of PRs

Yes

and publishing of releases in the future?

If the PR has no warnings or errors, it should not block the publishing process, and the release process should proceed smoothly. The point is if the PR in the first place does not continue any errors we should not counter any errors in the publishing process.

@mtrezza
Copy link
Member

mtrezza commented May 19, 2023

We don't have a lock file for dependencies, so a PR may show no warnings but the publishing process may indeed, if a dependency has a new release between PR merging and release publishing. See #749.

That may be a low risk we can take. I'm more concerned that these are warnings on the info level. Do we want info level logs to block? Not sure how that is in dart, but in other frameworks it may he too ambiguous to always fix every info warning immediately. I leave this up for you to decide, as you are likely more familiar with what type of warnings these are.

In any case, we may well be ambiguous and merge this PR as is to see how it goes.

@Nidal-Bakir
Copy link
Member Author

Nidal-Bakir commented May 19, 2023

This has nothing to do with the dependencies and the lock file. it's about the actual code in the SDK. Plus we are testing on all Flutter and Dart versions

@mtrezza
Copy link
Member

mtrezza commented May 19, 2023

I assumed the warnings would include any warnings that are caused by dependencies as well. Alright, let's merge this.

Copy link
Member

@mtrezza mtrezza left a comment

Choose a reason for hiding this comment

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

Looks good!

@mtrezza mtrezza merged commit 265c8fc into parse-community:master May 19, 2023
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.

Publishing Dart SDK 5.1.1 failed
3 participants