Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix analyzer issues #7222

Merged
merged 4 commits into from
Nov 16, 2023
Merged

Fix analyzer issues #7222

merged 4 commits into from
Nov 16, 2023

Conversation

pshao25
Copy link
Member

@pshao25 pshao25 commented Nov 1, 2023

Fix Azure/autorest.csharp#3710
Root cause: Azure/autorest.csharp#3710 (comment)
Quote here:

The get sub client method returns the sub client called Operation, which is a criterion of a service method in analyzer

public virtual Operation GetOperationClient(string apiVersion = "1.0.0")
{
    Argument.AssertNotNull(apiVersion, nameof(apiVersion));

    return new Operation(ClientDiagnostics, _pipeline, _endpoint, apiVersion);
}

Solution: When checking whether a method is a service method, not just checking the type name, but also checking the namespace name.

Fix Azure/autorest.csharp#3708
Root cause: Azure/autorest.csharp#3708 (comment)
Quote here:

We generate static properties in clients, so there will be a static constructor without any parameters implicitly added, which should not be in the searching scope of a constructor equivalent.

Solution: exclude static constructor when looking for a equivalent constructor method, because we only care about the constructors explicitly written by generator or customization.

Preview in azure-sdk-for-net: Azure/azure-sdk-for-net#39672

jsquire
jsquire previously requested changes Nov 1, 2023
Copy link
Member

@jsquire jsquire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please add details to the description. What are the intended changes to the current ruleset? The code itself has few comments as to the intent of the rule and what pattern its intending to validate.

@pshao25
Copy link
Member Author

pshao25 commented Nov 2, 2023

Can we please add details to the description. What are the intended changes to the current ruleset? The code itself has few comments as to the intent of the rule and what pattern its intending to validate.

Updated.

@jsquire jsquire dismissed their stale review November 2, 2023 13:57

Remediated

@pshao25
Copy link
Member Author

pshao25 commented Nov 6, 2023

@m-nash could you help review? This blocks we change constructors behaviors as we discussed in Azure/autorest.csharp#3706 (comment)

@pshao25 pshao25 merged commit c4395d1 into main Nov 16, 2023
7 checks passed
@pshao25 pshao25 deleted the fix3708and3710 branch November 16, 2023 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants