refactor!: remove analyzer ignores by fixing the underlying code - #1675
refactor!: remove analyzer ignores by fixing the underlying code#1675spydon wants to merge 1 commit into
Conversation
Several `// ignore:` comments were suppressing lints that point at real code smells rather than false positives. Now that v3 allows breaking changes, fix the underlying signatures and code instead of silencing them. `RealtimeClient.push` was declared `String? push(Message message)` but only ever did `return null;`, a leftover from the JavaScript port. No caller used the return value, and realtime-js returns void as well. The remaining changes are non-breaking: the null-aware operators in the Flutter test stubs are unnecessary since `TestDefaultBinaryMessengerBinding.instance` is non-nullable, `socket.accessToken` is hoisted into a local so the null check promotes it, the isolate's try/catch is extracted into a function so its `late final` local is unnecessary, `getPayloadRecords` moves its type arguments onto the variable declaration, and `_RetryConfig.copyWith` takes a required non-nullable `enabled` since its only caller always passes it. Abbreviated identifiers in the touched code are spelled out. BREAKING CHANGE: `RealtimeClient.push` now returns `void` instead of `String?`. It always returned `null`, so callers that stored the result can drop it.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe PR applies typing and lint cleanup across PostgREST and Realtime, updates Flutter app-link test stubs, and centralizes JSON isolate response handling. Existing runtime behavior remains unchanged except for the ChangesAPI and typing cleanup
Flutter test channel stub update
JSON isolate response handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Several
// ignore:comments across the packages were suppressing lints that point at real code smells rather than false positives. Now that v3 allows breaking changes, the underlying signatures and code are fixed instead of silenced.Closes SDK-1448
Breaking
RealtimeClient.pushwas declaredString? push(Message message)but only ever didreturn null;, a leftover from the JavaScript port. It is nowvoid push(Message message). No caller used the return value, andrealtime-jsreturns void as well. This removes// ignore: function-always-returns-null.Callers that stored the result can drop it:
Non-breaking cleanups
packages/supabase_flutter/test/widget_test_stubs.dart—TestDefaultBinaryMessengerBinding.instanceis non-nullable and the package already requires Flutter>=3.35.0, so the three// ignore: invalid_null_aware_operatorcomments and their?.operators are gone. The binary messenger is hoisted into a local, and the event channel handler became a namedFuture<void>local function, which also drops a secondfunction-always-returns-nullignore. Dart function literals cannot carry a return type annotation, hence the named local function.packages/realtime_client/lib/src/realtime_channel.dart—socket.accessTokenis hoisted into a local so the null check promotes it, removing// ignore: avoid-passing-self-as-argument.packages/yet_another_json_isolate/lib/src/_isolates_io.dart— the try/catch is extracted into_computeResponseso thelate finallocal is no longer needed, removing// ignore: avoid-unnecessary-local-late. A plainfinallocal does not work here because Dart rejects assigning it in both thetryand thecatch.packages/realtime_client/lib/src/transformers.dart— type arguments moved onto the variable declaration, removing// ignore: avoid-inferrable-type-arguments.packages/postgrest/lib/src/postgrest_builder.dart—_RetryConfig.copyWithnow takesrequired bool enabled, since its only caller (retry()) always passes it. Removes// ignore: avoid-unnecessary-nullable-parameters._RetryConfigis private, so this is not a public API change.e/stoerror/stackTrace,ptosendPort,methodtoisEncoding.Ignores intentionally kept
These suppress lints that are correct to silence, so they stay:
avoid_printinvalid_use_of_internal_member@internalaccessexperimental_member_usepasskeyspackage APIconstant_identifier_namessnake_case_test.dart, where snake_case names are the subject under testavoid-duplicate-constant-valuesserializer.dart, where two semantically distinct protocol constants happen to share the value4avoid-unnecessary-nullable-return-typelocal_storage_stub.dartmust match the signature of the web implementation it is conditionally imported againstavoid-shadowingFunctionsClient.invoke's publicheadersparameter shadows theheadersgetter, but is the correct public API nameavoid-unnecessary-nullable-parametersraw_postgrest_builder.dart, where null is the copyWith "unset" sentinelmatch-getter-setter-field-nameslifecycle_test.dartThe file-level
public_member_api_docs/sort_constructors_firstignores inrealtime_presence.dartandtypes.dartalso stay for now. Those hide genuinely missing dartdoc on public API and deserve their own follow-up rather than being bundled here.Testing
dart analyzeis clean across all packages andflutter analyzeis clean forsupabase_flutter. Test suites pass forrealtime_client(205),supabase_flutter(65),yet_another_json_isolate(27), andpostgrest'sretry_test.dart(26). The remainingpostgrestintegration tests need a running PostgREST instance and fail identically onmainin this environment.Summary by CodeRabbit