Skip to content

Deprecate avoid_null_checks_in_equality_operators #59514

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
srawlins opened this issue Aug 14, 2024 · 3 comments
Open

Deprecate avoid_null_checks_in_equality_operators #59514

srawlins opened this issue Aug 14, 2024 · 3 comments
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-linter Issues with the analyzer's support for the linter package linter-set-recommended P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug

Comments

@srawlins
Copy link
Member

We introduced a new Warning called NON_NULLABLE_EQUALS_PARAMETER a few releases ago. It warns when the parameter of an operator == override has a nullable type:

"The parameter type of '==' operators should be non-nullable."

I didn't realize it at the time, but that new warning, plus null safety, basically replace the avoid_null_checks_in_equality_operators lint rule. This rule reports doing any null-check work on a nullable parameter of an operator == override.

As I found out when I migrated the tests from the legacy framework, the rule is a bit non-sensical now because of the redundancy. Every test case either has a WarningCode.NON_NULLABLE_EQUALS_PARAMETER, if it features a nullable parameter, or it features another warning like WarningCode.UNNECESSARY_NULL_COMPARISON_TRUE or StaticWarningCode.INVALID_NULL_AWARE_OPERATOR, if the parameter is non-nullable and is compared to null.

@srawlins srawlins added type-enhancement A request for a change that isn't a bug P3 A lower priority bug or feature request labels Aug 14, 2024
@bwilkerson
Copy link
Member

I agree that this should be deprecated. The first step is probably to get it removed from the 'recommended' set.

@srawlins
Copy link
Member Author

Filed a request at dart-lang/core#829.

@srawlins
Copy link
Member Author

srawlins commented Oct 9, 2024

Removed from the lints package in the 5.0.0 release.

copybara-service bot referenced this issue Oct 14, 2024
Fixes https://github.com/dart-lang/linter/issues/5063

Change-Id: I85a3c9e1a568d55ce1e21d0f1fee4ce1c83292f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389300
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
copybara-service bot referenced this issue Oct 15, 2024
… rule"

This reverts commit 5572900.

Reason for revert: broke the assorted_layout_widgets customer tests.

Original change's description:
> lint rule: Remove the avoid_null_checks_in_equality_operators rule
>
> Fixes https://github.com/dart-lang/linter/issues/5063
>
> Change-Id: I85a3c9e1a568d55ce1e21d0f1fee4ce1c83292f4
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/389300
> Commit-Queue: Samuel Rawlins <srawlins@google.com>
> Reviewed-by: Phil Quitslund <pquitslund@google.com>

Change-Id: I3ff1448088f4d5163dc66f6e181a97302c4d137a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/390300
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
srawlins referenced this issue in srawlins/dart-rfb Oct 29, 2024
Each of these are going to be removed soon.

* avoid_null_checks_in_equality_operators
* unsafe_html

Work towards https://github.com/dart-lang/linter/issues/5063 and https://github.com/dart-lang/linter/issues/5001
srawlins referenced this issue in srawlins/flutter-rfb Oct 29, 2024
Each of these are going to be removed soon.

* avoid_null_checks_in_equality_operators
* unsafe_html

Work towards https://github.com/dart-lang/linter/issues/5063 and https://github.com/dart-lang/linter/issues/5001
srawlins referenced this issue in srawlins/flutter_portal Oct 29, 2024
Each of these are going to be removed soon.

* avoid_null_checks_in_equality_operators
* unsafe_html

Work towards https://github.com/dart-lang/linter/issues/5063 and https://github.com/dart-lang/linter/issues/5001
srawlins referenced this issue in flutter/tests Oct 29, 2024
Work towards https://github.com/dart-lang/linter/issues/5063

This repo refers to the `avoid_null_checks_in_equality_operators` lint rule, which is being removed as per https://github.com/dart-lang/linter/issues/5063.

This repo is also being migrated, as I understand it. I suggest we disable for now, and can remove the `avoid_null_checks_in_equality_operators` enablement after the migration, and re-enable the tests then.
srawlins referenced this issue in srawlins/flutter-packages Oct 30, 2024
Each of these are going to be removed soon.

* avoid_null_checks_in_equality_operators
* unsafe_html

Work towards https://github.com/dart-lang/linter/issues/5063 and https://github.com/dart-lang/linter/issues/5001
auto-submit bot referenced this issue in flutter/tests Oct 30, 2024
Work towards https://github.com/dart-lang/linter/issues/5063

This repo refers to the `avoid_null_checks_in_equality_operators` lint rule, which is being removed as per https://github.com/dart-lang/linter/issues/5063.

This repo is also being migrated, as I understand it. Let's remove it from the customer tests registry.
auto-submit bot referenced this issue in flutter/packages Oct 30, 2024
Each of these are going to be removed soon.

* avoid_null_checks_in_equality_operators
* unsafe_html

Work towards https://github.com/dart-lang/linter/issues/5063 and https://github.com/dart-lang/linter/issues/5001
srawlins referenced this issue in flutter/devtools Oct 31, 2024
Each of these are going to be removed soon.

* avoid_null_checks_in_equality_operators
* unsafe_html

Work towards https://github.com/dart-lang/linter/issues/5063 and https://github.com/dart-lang/linter/issues/5001
mossmana referenced this issue in mossmana/devtools Oct 31, 2024
Each of these are going to be removed soon.

* avoid_null_checks_in_equality_operators
* unsafe_html

Work towards https://github.com/dart-lang/linter/issues/5063 and https://github.com/dart-lang/linter/issues/5001
auto-submit bot referenced this issue in flutter/cocoon Nov 1, 2024
Each of these three are going to be removed soon.

* avoid_null_checks_in_equality_operators
* package_api_docs
* unsafe_html

Work towards https://github.com/dart-lang/linter/issues/5063 and https://github.com/dart-lang/linter/issues/5001
auto-submit bot referenced this issue in flutter/tests Nov 7, 2024
Work towards https://github.com/dart-lang/linter/issues/5063 and https://github.com/dart-lang/linter/issues/5001

There are open PRs for blocked Dart SDK work in these two repos:

* Goddchen/dart-rfb#26
* Goddchen/flutter-rfb#24

@Goddchen has not responded to these in 72 hours. This change disables the tests. The tests can be re-enabled when those PRs have been merged, and the subsequent relevant commits in this repo bumped.
Goddchen referenced this issue in Goddchen/dart-rfb Nov 13, 2024
Each of these are going to be removed soon.

* avoid_null_checks_in_equality_operators
* unsafe_html

Work towards https://github.com/dart-lang/linter/issues/5063 and https://github.com/dart-lang/linter/issues/5001
@devoncarew devoncarew added devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. labels Nov 20, 2024
@devoncarew devoncarew transferred this issue from dart-archive/linter Nov 20, 2024
@bwilkerson bwilkerson added area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. and removed legacy-area-analyzer Use area-devexp instead. labels Feb 21, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-linter Issues with the analyzer's support for the linter package linter-set-recommended P3 A lower priority bug or feature request type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

3 participants