fix(supabase_lints): enable lines_longer_than_80_chars and fix all violations - #1655
Conversation
|
Warning Review limit reached
Next review available in: 9 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (10)
📝 WalkthroughWalkthroughThis PR reformats Dart documentation, comments, strings, examples, and test fixtures across examples and packages. It enables the ChangesDocumentation and formatting alignment
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 10
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@examples/passkeys/integration_test/passkeys_test.dart`:
- Around line 16-20: Update the explanatory comment in the passkey integration
test to describe the ceremony as a WebAuthn/authenticator prompt rather than a
“platform authenticator” prompt, while retaining the existing examples and
headless-testing explanation.
In `@packages/gotrue/lib/src/gotrue_client.dart`:
- Around line 1122-1124: Update the comment near the authentication error
handling so the explanations for ignored 401, 403, and 404 status codes remain
separate, with each status code’s rationale clearly delimited and readable.
In `@packages/gotrue/lib/src/types/session.dart`:
- Around line 87-88: Update the isExpired documentation comment to use matching
backtick delimiters around true, ensuring the inline code renders correctly in
generated API documentation.
In `@packages/realtime_client/lib/src/realtime_channel.dart`:
- Around line 888-892: Update the unsubscribe documentation comment near the
channel termination API by changing “use the a `receive` hook” to “use a
`receive` hook,” removing the extra article.
In `@packages/realtime_client/lib/src/realtime_client.dart`:
- Around line 162-163: Complete the [endPoint] documentation comment by closing
the parenthetical phrase after “inherited host & protocol” and clearly
describing the supported relative endpoint form, preserving the existing
examples and wording.
- Around line 196-197: Update the constructor documentation for reconnectAfterMs
to state that the default is the stepped backoff function returned by
RetryTimer.createRetryFunction(), replacing the ambiguous “stepped backoff off”
wording.
In `@packages/realtime_client/lib/src/types.dart`:
- Around line 62-63: Correct the duplicated wording in both error messages near
the visible fromString() validation messages: replace “can be can be passed”
with “can be passed” and add “the” before the backticked fromString() method,
preserving the rest of each message.
In `@packages/storage_client/lib/src/storage_file_api.dart`:
- Around line 208-209: Correct the documentation grammar in the comments near
the signed upload URL description and the transform API description: update the
wording to “can be used to upload files” and “[transform] downloads a
transformed variant,” respectively.
In `@packages/supabase_flutter/lib/src/supabase_auth.dart`:
- Around line 341-342: Update the documentation reference in the OAuth sign-in
comment to use the existing auth state stream member `onAuthStateChange` instead
of `onAuthStateChanged`, matching the subscription used by the implementation.
In `@packages/supabase/lib/src/supabase_stream_builder.dart`:
- Around line 215-216: Update the reconnect comment near _getPostgrestData() to
correct the sentence separation and describe the actual asynchronous behavior:
PostgREST data loading is started after realtime subscribe without awaiting
completion, so do not claim it finishes before the realtime connection.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: c2cfe49e-5f4c-4eda-98a7-727c5fe36d1e
📒 Files selected for processing (110)
examples/authentication/integration_test/authentication_test.dartexamples/authentication/lib/auth_repository.dartexamples/authentication/lib/main.dartexamples/authentication/lib/models.dartexamples/database_crud/integration_test/tasks_test.dartexamples/database_crud/lib/main.dartexamples/database_crud/lib/models.dartexamples/database_crud/lib/tasks_repository.dartexamples/edge_functions/integration_test/functions_test.dartexamples/edge_functions/integration_test/invoke_test.dartexamples/edge_functions/lib/functions_repository.dartexamples/edge_functions/lib/models.dartexamples/launcher/lib/launcher.dartexamples/passkeys/integration_test/passkeys_test.dartexamples/realtime_room/integration_test/room_test.dartexamples/realtime_room/lib/main.dartexamples/realtime_room/lib/models.dartexamples/realtime_room/lib/room_channel.dartexamples/realtime_room/lib/room_repository.dartexamples/storage_transforms/integration_test/storage_test.dartexamples/storage_transforms/lib/main.dartexamples/storage_transforms/lib/storage_repository.dartpackages/functions_client/lib/src/functions_client.dartpackages/functions_client/lib/src/types.dartpackages/functions_client/test/functions_dart_test.dartpackages/gotrue/lib/src/broadcast_stub.dartpackages/gotrue/lib/src/constants.dartpackages/gotrue/lib/src/fetch.dartpackages/gotrue/lib/src/gotrue_admin_api.dartpackages/gotrue/lib/src/gotrue_admin_oauth_api.dartpackages/gotrue/lib/src/gotrue_client.dartpackages/gotrue/lib/src/gotrue_mfa_api.dartpackages/gotrue/lib/src/gotrue_oauth_api.dartpackages/gotrue/lib/src/helper.dartpackages/gotrue/lib/src/types/auth_exception.dartpackages/gotrue/lib/src/types/auth_response.dartpackages/gotrue/lib/src/types/auth_state.dartpackages/gotrue/lib/src/types/jwt.dartpackages/gotrue/lib/src/types/mfa.dartpackages/gotrue/lib/src/types/session.dartpackages/gotrue/lib/src/types/types.dartpackages/gotrue/lib/src/types/user.dartpackages/gotrue/lib/src/types/user_attributes.dartpackages/gotrue/test/client_test.dartpackages/gotrue/test/custom_http_client.dartpackages/gotrue/test/custom_oauth_provider_test.dartpackages/gotrue/test/get_claims_test.dartpackages/gotrue/test/jwk_test.dartpackages/gotrue/test/otp_mock_test.dartpackages/gotrue/test/refresh_token_race_test.dartpackages/gotrue/test/src/set_session_test.dartpackages/gotrue/test/utils.dartpackages/postgrest/lib/src/postgrest.dartpackages/postgrest/lib/src/postgrest_builder.dartpackages/postgrest/lib/src/postgrest_filter_builder.dartpackages/postgrest/lib/src/postgrest_query_builder.dartpackages/postgrest/lib/src/postgrest_transform_builder.dartpackages/postgrest/lib/src/raw_postgrest_builder.dartpackages/postgrest/lib/src/response_postgrest_builder.dartpackages/postgrest/lib/src/types.dartpackages/postgrest/test/reset_helper.dartpackages/postgrest/test/retry_test.dartpackages/postgrest/test/stack_trace_test.dartpackages/postgrest/test/transforms_test.dartpackages/postgrest/test/upsert_test.dartpackages/realtime_client/lib/realtime_client.dartpackages/realtime_client/lib/src/realtime_channel.dartpackages/realtime_client/lib/src/realtime_client.dartpackages/realtime_client/lib/src/realtime_presence.dartpackages/realtime_client/lib/src/retry_timer.dartpackages/realtime_client/lib/src/transformers.dartpackages/realtime_client/lib/src/types.dartpackages/realtime_client/test/channel_test.dartpackages/realtime_client/test/mock_test.dartpackages/realtime_client/test/realtime_integration_test.dartpackages/realtime_client/test/serializer_test.dartpackages/realtime_client/test/socket_test.dartpackages/realtime_client/test/utils/realtime_test_utils.dartpackages/realtime_client/test/websocket_io_test.dartpackages/storage_client/lib/src/fetch.dartpackages/storage_client/lib/src/storage_client.dartpackages/storage_client/lib/src/storage_file_api.dartpackages/storage_client/lib/src/types.dartpackages/storage_client/lib/src/vector_client.dartpackages/storage_client/test/basic_test.dartpackages/storage_client/test/client_test.dartpackages/supabase/lib/src/remove_subscription_result.dartpackages/supabase/lib/src/supabase_client.dartpackages/supabase/lib/src/supabase_client_options.dartpackages/supabase/lib/src/supabase_query_schema.dartpackages/supabase/lib/src/supabase_stream_builder.dartpackages/supabase/test/client_test.dartpackages/supabase/test/mock_test.dartpackages/supabase/test/stream_integration_test.dartpackages/supabase/test/utilities_test.dartpackages/supabase/test/utils.dartpackages/supabase_common/lib/src/client_info.dartpackages/supabase_common/lib/src/testing/local_stack.dartpackages/supabase_common/test/base64url_test.dartpackages/supabase_flutter/lib/src/hot_restart_cleanup_web.dartpackages/supabase_flutter/lib/src/local_storage.dartpackages/supabase_flutter/lib/src/supabase.dartpackages/supabase_flutter/lib/src/supabase_auth.dartpackages/supabase_flutter/test/auth_test.dartpackages/supabase_flutter/test/debug_default_test.dartpackages/supabase_flutter/test/deep_link_test.dartpackages/supabase_flutter/test/storage_test.dartpackages/supabase_flutter/test/utils.dartpackages/supabase_lints/lib/analysis_options.yamlpackages/yet_another_json_isolate/lib/yet_another_json_isolate.dart
…violations
`dart format` never reflows comments or splits string literals, so nothing
enforced the 80-column limit outside of code the formatter could break itself.
That let 440 over-long lines accumulate across 109 files, and CodeRabbit ended
up doing the enforcement by hand in review.
Enabling the lint continues the ratcheting pattern the shared config already
documents: turn a rule on once its violations are gone.
How the violations were fixed:
- Prose in `///` and `//` blocks is rewrapped at 80 columns with the wording
unchanged. Fenced code, markdown lists and tables, and `{@template}` macros
are left structurally intact.
- Over-long string literals are split into adjacent literals, so the value is
unchanged. This was verified mechanically: every string literal value in
every touched file was parsed with `package:analyzer` before and after and
compared, and the only difference is the one deliberate change below.
- Doc samples that ran long were reformatted the way `dart format` would break
the same code. Three of them were JavaScript left over from the ports
(`new RetryTimer(...)`, `console.log`, `let`), and are now Dart.
- Comments that started with `///`/`//` immediately followed by text now have
the conventional space, and one `///` comment on a local variable became a
regular `//` comment.
- `buildClientInfoHeader` computes the encoded platform version into a local
instead of interpolating a call chain too long to fit. Same output.
- Two `test(...)` headers with a trailing closure moved their arguments onto
separate lines.
Note that the lint tolerates a line whose overflow is a single unbreakable URI,
so URLs in comments and in strings stay as they are.
a37d87a to
8f9b82d
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
DCM's `avoid-commented-out-code` fired on the JWT payload comment in `get_claims_test.dart`: wrapping the JSON across two comment lines made the fragment parse as code. It is prose now, and the Header/Payload/Signature structure that the rewrap had flattened into one paragraph is back. The rest are wording problems the rewrap surfaced, all of them pre-existing: - `gotrue_client.dart`: the 401/403/404 explanations are three sentences again instead of one run-on line. - `session.dart`: `'true`` had mismatched delimiters, so it did not render as inline code. - `realtime_channel.dart`: "use the a `receive` hook" -> "use a `receive` hook". - `realtime_client.dart`: the `[endPoint]` sentence had an unclosed parenthesis, and `reconnectAfterMs` claimed "Defaults to stepped backoff off" where the constructor actually defaults to `RetryTimer.createRetryFunction()`. - `types.dart`: both `fromString` messages said "can be can be passed to `fromString()` method". - `storage_file_api.dart`: "can be used upload files" -> "can be used to upload files", and "[transform] download a transformed variant" -> "downloads", in both places it appears. - `supabase_auth.dart`: the doc pointed at `auth.onAuthStateChanged`, which does not exist; the member is `onAuthStateChange`. - `supabase_stream_builder.dart`: the reconnect comment claimed the initial PostgREST load completes before the realtime connect, which the `unawaited` call after `subscribe()` does not establish. It now describes what the code does, including why the first subscribe is skipped. - `passkeys_test.dart`: a security key is a roaming authenticator, so the prompt is no longer described as a platform authenticator prompt. The two `types.dart` messages are the only runtime strings that change.
Why
dart formatnever reflows comments and never splits string literals, so nothing enforced the 80-column limit outside of the code the formatter can break by itself. 440 over-long lines had accumulated across 109 files, and CodeRabbit was doing the enforcement by hand in review (it flagged two such lines on #1654).Enabling the rule continues the ratcheting pattern
packages/supabase_lints/lib/analysis_options.yamlalready documents: turn a rule on once its violations are gone.What
lines_longer_than_80_chars: truein the shared lint config (the Flutter variant includes it, so both are covered), plus the 440 fixes.//////blocksdart formatwould break the same code//////The four one-offs:
buildClientInfoHeadercomputes the encoded platform version into a local instead of interpolating a call chain that cannot fit on one line. Same output.test(...)headers with a trailing closure moved their arguments onto separate lines.// commenton a map entry moved above the entry.Three doc samples were JavaScript left over from the ports (
new RetryTimer(...),console.log(...),let) inside```dartfences. They are Dart now.Fenced code, markdown lists and tables, and
{@template}macros were kept structurally intact rather than reflowed as prose.String values are provably unchanged
Splitting a literal into adjacent literals is value-preserving only if the split points are the sole change, so that was checked mechanically rather than by eye: every string literal value in every touched file was parsed with
package:analyzerbefore and after (adjacent literals collapsed the way the language does) and compared in order. The only file that reports a difference isclient_info.dart, which is the deliberate refactor above.A note on the rule
It tolerates a line whose overflow is a single unbreakable URI, verified with a probe file: a long
'http://…'literal is accepted, while an equally long literal without a URI is not. So URLs in comments and strings stay as they are, and no// ignore:comments were needed anywhere.Testing
dart analyze packages examples: clean, zero violationsdart format --set-exit-if-changed packages examples: clean, so the wrapping is stable under the formattersupabase_common,functions_client,realtime_client,storage_client,supabase,supabase_flutter, and the hermeticgotruesuites (includingget_claims_testandjwk_test, whose JWT fixtures were split most aggressively, and the two restructured tests)postgrestfails against my local stack both on this branch and on its base, and two identical runs of the same code disagree on which tests fail, so that suite is state-dependent locally. CI, which starts a fresh stack, is the arbiter there.Summary by CodeRabbit