Conversation
…itializeWithHttpClientHandler Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tom Http Client Handler Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he global pre-filter A call that fails to bind may pair the root with the wrong parameter, so following it could track a symbol that never appears in the callee; the root is now silenced instead. The body text used by the global pre-filter is computed once per method rather than once per global and method pair. The rule doc records the deliberate DescendKinds duplication. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Member
Author
|
CI note: the red "Test results" check is a flake, not a regression. On attempt 1 the timing assertion in |
…nt-initialize-with-http-client-handler
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.
Summary
New ApplicationCop rule AC0035
RestClientInitializeWithHttpClientHandler, implementing Rule 2 of discussion #405 (the per-variable check). AC0033 (#568) reports once per object when the app implements no"Http Client Handler"at all; AC0035 reports eachCodeunit "Rest Client"variable that does not receive one. Both fire independently.RestClientInitializeWithHttpClientHandlerCodeunit "Rest Client"(2350) is initialized withInitialize(),Initialize(HttpAuthentication),Create(),Create(HttpAuthentication)or with the System Application's defaultcodeunit 2360 "Http Client Handler", or is used without any initialization.Rest Client Impl.auto-initializes with the default handler on first use, so all of these send the request as the System Application (permission scope, outgoing web-service telemetry, no test mocking).Design
var RestClientparameter is silent on its own.Initialize/Createwhose handler-typed argument (bound to anInterface "Http Client Handler"parameter) has a static type other than codeunit 2360 (matched on id and name). Interface-typed variables, factory return values, parameters and handler codeunits from any app all pass, so the library pattern (main app passes its handler into a shared library that calls the Rest Client) is not reported.varand by-value, since codeunit variables are reference types), unlimited depth, cycle-safe.Clear, assigned from anything but its ownCreate, assigned to another variable, returned viaexit, or an invocation on it fails to bind.Initialize/Createcounts as use, so future Rest Client members need no uptake.Initialize/Createcall found directly on the root (own body for a local, any body of the object for a global); otherwise the variable name. A default call is reported even when a good call exists elsewhere (Initialize()re-initializes with the default handler).RegisterSymbolActionon the same nine kinds as AC0033; root discovery on symbols only (LocalVariables,GetMembers()), oneGetSemanticModelper object with a root, binding only the bodies that own a local root or spell a global root's name. Self-contained per object, so partial-analysis passes are safe.Deliberate non-reports
Parameters and return values,
Clear(RestClient), anything passed out of the object,Codeunit::"Rest Client"object references, arrays/lists/interface-typed variables, declared-but-unused variables, test and test-runner codeunits, obsolete objects and obsolete procedures.Verification
Failed: 18, Passed: 27(all 18 HasDiagnostic cases failing, all 27 NoDiagnostic passing); after the implementation commitPassed: 45on net10.0 and on the net8.0 leg (GITHUB_ACTIONS=true … -p:NavTargetFramework=net8.0).dotnet build ALCops.slnclean; ApplicationCop and Common Release builds withContinuousIntegrationBuild=true(netstandard2.1 / net8.0 / net10.0) clean;dotnet format ALCops.sln --verify-no-changesclean; fulldotnet test ALCops.slngreen;Validate-Rules.ps1OK.NoExceptionpass over all 45 fixtures (markers stripped) showed no swallowed analyzer exceptions, and every fixture reports exactly the expected AC0035 count on the expected span.DescendKindsduplication with AC0033 is recorded in the rule doc.Docs: companion page in ALCops/alcops.dev#194.
🤖 Generated with Claude Code