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

[Analyzer Proposal]: Propagate StringSyntaxAttribute #110305

Open
Youssef1313 opened this issue Dec 2, 2024 · 1 comment
Open

[Analyzer Proposal]: Propagate StringSyntaxAttribute #110305

Youssef1313 opened this issue Dec 2, 2024 · 1 comment
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-System.Runtime.CompilerServices code-analyzer Marks an issue that suggests a Roslyn analyzer untriaged New issue has not been triaged by the area owner

Comments

@Youssef1313
Copy link
Member

Background and motivation

StringSyntaxAttribute was introduced to support IDE highlighting scenarios, such as Regex.

Often, users have existing helper methods that may be forwarding a parameter to a method (likely a BCL method, e.g Regex.IsMatch) that has the attribute, but the user doesn't add the attribute.

API Proposal

An analyzer is introduced that will analyze invocations and roughly have the following functionality

  1. Look at the parameters of the invoked method for a parameter with StringSyntaxAttribute
  2. If found, look at the argument corresponding to that parameter.
  3. If the argument is an IParameterReferenceOperation, look into the attributes of that parameter and require a matching attribute.

API Usage

N/A

Alternative Designs

No response

Risks

No response

@Youssef1313 Youssef1313 added the api-suggestion Early API idea and discussion, it is NOT ready for implementation label Dec 2, 2024
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Dec 2, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Dec 2, 2024
@teo-tsirpanis teo-tsirpanis added area-System.Runtime.CompilerServices code-analyzer Marks an issue that suggests a Roslyn analyzer and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Dec 3, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/area-system-runtime-compilerservices
See info in area-owners.md if you want to be subscribed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-suggestion Early API idea and discussion, it is NOT ready for implementation area-System.Runtime.CompilerServices code-analyzer Marks an issue that suggests a Roslyn analyzer untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

2 participants