Repository navigation
Add three rules for connectivity events, memo inputs and reader guards - #5
Merged
Merged
Conversation
connectivity_event_outside_app_epics reports a library under lib/ other than lib/src/epics/app_epics.dart (and the action's own library) that builds OnConnectivityEvent, through ListenForConnectivity.event, the class's own constructor, a redirect to either, or a tear-off. AppEpics maps ConnectivityService's stream to it, and a second writer of isConnected is what once left the offline banner stuck after the first reconnect. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01UESkdYVqQ7NhmMmMfG7ov2
memo_input_is_collection_field reports an element of a Memo call's input list that reads a field off a @freezed object whose generated class computes it in a getter, which freezed does only to wrap a collection in a new unmodifiable view. Such an input is never identical to last time, so the memo never hits. Stored fields (scalars, nested state, collections kept as is) and hand-written getters do not report, and only the app's own Memo counts. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01UESkdYVqQ7NhmMmMfG7ov2
reader_call_after_ignore_no_connection reports, in a yield* of a SyncEngine reader, the operator nearest the last ignoreNoConnection() that follows it, unless it is the sync engine's onNotFound or logBadResponses. The guard cannot see a connection error raised after it, so `local.ignoreNoConnection().asyncMap((_) => api.get(id))` fails offline while reader_without_ignore_no_connection is satisfied. It allows what is known to be safe rather than looking for API calls, since a call can reach the network without naming an API. The reader and sync-engine checks move to shared helpers, unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01UESkdYVqQ7NhmMmMfG7ov2
A subclass builds the event through its super constructor, and creating it passed connectivity_event_outside_app_epics. The rule now also reports a supertype that is OnConnectivityEvent or a subtype of it, in an extends, implements, with or on clause or a class alias, under the same exemptions. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01UESkdYVqQ7NhmMmMfG7ov2
reader_call_after_ignore_no_connection walked past a getter chained after ignoreNoConnection() without judging it; a getter runs code too, and none is allowed, so it now reports. Both reader walkers now follow a chain through `as` casts and extension overrides, so a cast guard is not mistaken for no guard and `Ext(stream).ignoreNoConnection()` counts. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01UESkdYVqQ7NhmMmMfG7ov2
memo_input_is_collection_field saw only a field read written straight into the input list. It now also follows an input through a final local initialized with it, either branch of a conditional, a `!`, a cast, and `.keys`, `.values`, `.entries`, `.toList()` or `.toSet()` on such a field, and an inputs list held in a final local. A non-final local is not followed, as it could hold another value by the call. The report sits on the input as written in the list. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01UESkdYVqQ7NhmMmMfG7ov2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds three warning rules for rules
cb-mobile's CLAUDE.md states but nothing enforced.connectivity_event_outside_app_epics: buildingOnConnectivityEvent(orListenForConnectivity.event, a tear-off, or a subclass) outsideapp_epics.dart. A second writer ofisConnectedbroke the offline banner before.memo_input_is_collection_field: aMemoinput that is a collection field of freezed state, which freezed wraps anew on every read so the memo never hits. Follows final locals, conditionals,!,as, and.keys/.values/.entries/.toList()/.toSet().reader_call_after_ignore_no_connection: an operator or getter after a reader's.ignoreNoConnection(), which the guard does not cover. OnlyonNotFoundandlogBadResponsesfrom the sync engine are allowed there.Shared helpers move out of
reader_without_ignore_no_connection, whose behaviour is unchanged. Both reader walkers now followascasts and extension overrides.Testing
./check.shpasses: 122 tests incb_lints, 62 incb_checks, and the fixture draws every rule.dart analyzewith the plugin by path: 0 reports from each rule, and every case fires on a probe.Not included
memo_distinct_needs_identity_equalityis onfeat/memo-distinct-rule, held back: it reports three view models in cb-mobile that break CLAUDE.md's@Freezed(equal: false)rule (appointment_items.dart:37,invoice_payments_container.dart:36,selected_invoice_container.dart:48). It can follow once those are fixed.ignoreNoConnectionitself is still matched by name, as before.🤖 Generated with Claude Code
https://claude.ai/code/session_01UESkdYVqQ7NhmMmMfG7ov2