feat: add static code diagnostic check-for-equals-in-render-object-setters #1003
feat: add static code diagnostic check-for-equals-in-render-object-setters #1003
Conversation
@fzyzcjy if you have some time to take a look and test the rule - that'd be very much appreciated! |
Dart Code Metrics unused files report of dart_code_metrics. ✅Summary
|
Dart Code Metrics analyze report of dart_code_metrics. ✅Summary
|
Sure, let me have a look :) As for testing, may not have time now, but you can run it on the |
...nt_analyzer/rules/rules_list/check_for_equals_in_render_object_setters/examples/example.dart
Show resolved
Hide resolved
Good job! LGTM especially on the demo in the tests. But not sure how many false positives will happen in the real codebase - may need to run it actually :) |
Codecov Report
@@ Coverage Diff @@
## master #1003 +/- ##
==========================================
+ Coverage 87.36% 87.46% +0.09%
==========================================
Files 311 313 +2
Lines 6571 6628 +57
==========================================
+ Hits 5741 5797 +56
- Misses 830 831 +1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
No problem since it "return" when "idential" No problem. Inside the inner setter, it is ok https://github.com/flutter/flutter/blob/8b3aabd61dfd7b7b525ae4be04093ba507d1455a/packages/flutter/lib/src/rendering/editable.dart#L2775 Seems no problem, the settings is a naive field without fancy heavy things |
I strongly suspect this is a bug. That is what I have said in the issue title - "maybe even apply this linter to check potential bugs in Flutter source code" :) What about giving a PR to flutter repo fixing this 🎉 More details: Where is the controller from? Where is _UiKitPlatformView used? Thus, seems like this is really a bug. |
Do you want to do it? It's mostly your effort finding this 🙂 |
Sure 🙂 |
@incendial Not very sure. The only interesting call is: However it is named "insertRenderObjectChild", where by saying "insert" I suspect it will not happen unconditionally on every update. So I guess it is normal. |
Kudos, SonarCloud Quality Gate passed! |
What is the purpose of this pull request? (put an "X" next to an item)
#997