Skip to content

refactor!: remove analyzer ignores by fixing the underlying code - #1675

Open
spydon wants to merge 1 commit into
mainfrom
lukasklingsbo/sdk-1448-remove-analyzer-ignore-comments-by-fixing-the-underlying
Open

refactor!: remove analyzer ignores by fixing the underlying code#1675
spydon wants to merge 1 commit into
mainfrom
lukasklingsbo/sdk-1448-remove-analyzer-ignore-comments-by-fixing-the-underlying

Conversation

@spydon

@spydon spydon commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

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.push was declared String? push(Message message) but only ever did return null;, a leftover from the JavaScript port. It is now void push(Message message). No caller used the return value, and realtime-js returns void as well. This removes // ignore: function-always-returns-null.

Callers that stored the result can drop it:

// before
final ref = client.push(message); // always null

// after
client.push(message);

Non-breaking cleanups

  • packages/supabase_flutter/test/widget_test_stubs.dartTestDefaultBinaryMessengerBinding.instance is non-nullable and the package already requires Flutter >=3.35.0, so the three // ignore: invalid_null_aware_operator comments and their ?. operators are gone. The binary messenger is hoisted into a local, and the event channel handler became a named Future<void> local function, which also drops a second function-always-returns-null ignore. Dart function literals cannot carry a return type annotation, hence the named local function.
  • packages/realtime_client/lib/src/realtime_channel.dartsocket.accessToken is 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 _computeResponse so the late final local is no longer needed, removing // ignore: avoid-unnecessary-local-late. A plain final local does not work here because Dart rejects assigning it in both the try and the catch.
  • 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.copyWith now takes required bool enabled, since its only caller (retry()) always passes it. Removes // ignore: avoid-unnecessary-nullable-parameters. _RetryConfig is private, so this is not a public API change.
  • Abbreviated identifiers in the touched code are spelled out: e/s to error/stackTrace, p to sendPort, method to isEncoding.

Ignores intentionally kept

These suppress lints that are correct to silence, so they stay:

Ignore Why it stays
avoid_print Example apps and one test that prints deliberately
invalid_use_of_internal_member Deliberate cross-package @internal access
experimental_member_use Upstream passkeys package API
constant_identifier_names snake_case_test.dart, where snake_case names are the subject under test
avoid-duplicate-constant-values serializer.dart, where two semantically distinct protocol constants happen to share the value 4
avoid-unnecessary-nullable-return-type local_storage_stub.dart must match the signature of the web implementation it is conditionally imported against
avoid-shadowing FunctionsClient.invoke's public headers parameter shadows the headers getter, but is the correct public API name
avoid-unnecessary-nullable-parameters raw_postgrest_builder.dart, where null is the copyWith "unset" sentinel
match-getter-setter-field-names Test fake in lifecycle_test.dart

The file-level public_member_api_docs / sort_constructors_first ignores in realtime_presence.dart and types.dart also stay for now. Those hide genuinely missing dartdoc on public API and deserve their own follow-up rather than being bundled here.

Testing

dart analyze is clean across all packages and flutter analyze is clean for supabase_flutter. Test suites pass for realtime_client (205), supabase_flutter (65), yet_another_json_isolate (27), and postgrest's retry_test.dart (26). The remaining postgrest integration tests need a running PostgREST instance and fail identically on main in this environment.

Summary by CodeRabbit

  • Improvements
    • Improved consistency and reliability across realtime messaging, authentication, and JSON processing.
    • Simplified the realtime message-sending API by clarifying that sending messages does not return a value.
    • Strengthened handling of retry configuration and realtime authentication updates.
  • Testing
    • Updated Flutter platform-channel test utilities for more reliable app-link and event handling.
  • Maintenance
    • Improved type clarity and streamlined internal processing without changing expected runtime behavior.

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.
@spydon
spydon requested a review from a team as a code owner August 7, 2026 15:48
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 11361cce-b15c-433d-b347-dfce9a072e5a

📥 Commits

Reviewing files that changed from the base of the PR and between c6b5b35 and 702f66f.

📒 Files selected for processing (6)
  • packages/postgrest/lib/src/postgrest_builder.dart
  • packages/realtime_client/lib/src/realtime_channel.dart
  • packages/realtime_client/lib/src/realtime_client.dart
  • packages/realtime_client/lib/src/transformers.dart
  • packages/supabase_flutter/test/widget_test_stubs.dart
  • packages/yet_another_json_isolate/lib/src/_isolates_io.dart

📝 Walkthrough

Walkthrough

The 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 RealtimeClient.push return type.

Changes

API and typing cleanup

Layer / File(s) Summary
API contract and type updates
packages/postgrest/lib/src/postgrest_builder.dart, packages/realtime_client/lib/src/realtime_client.dart, packages/realtime_client/lib/src/transformers.dart
_RetryConfig.copyWith requires a non-null enabled value. RealtimeClient.push returns void. Transformer records use an explicit map type.
Realtime join token handling
packages/realtime_client/lib/src/realtime_channel.dart
_handleJoinOk caches the socket access token before calling setAuth. JWT error filtering remains unchanged.

Flutter test channel stub update

Layer / File(s) Summary
App-link channel handling
packages/supabase_flutter/test/widget_test_stubs.dart
mockAppLink uses the default binary messenger directly and forwards encoded link data through a local asynchronous handler.

JSON isolate response handling

Layer / File(s) Summary
Centralized response processing
packages/yet_another_json_isolate/lib/src/_isolates_io.dart
_computeResponse centralizes JSON encoding, decoding, success responses, and error responses. _compute delegates to the helper and sends the response through sendPort.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: v3

Suggested reviewers: tr00d

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the analyzer-ignore cleanup and the underlying code fixes across the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch lukasklingsbo/sdk-1448-remove-analyzer-ignore-comments-by-fixing-the-underlying

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant