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

[feature] generate a warning or error if an invalid kind or field is used #1059

Closed
HerringtonDarkholme opened this issue Apr 17, 2024 Discussed in #1058 · 0 comments
Closed
Labels
enhancement New feature or request

Comments

@HerringtonDarkholme
Copy link
Member

Discussed in #1058

Originally posted by dotjpg3141 April 17, 2024
How to match specific modifiers of a method? In this example I want to match all public methods.

C#

class Bar {
    public static async void Fii() {
    }

    void Foo() {
    }
}

Rule:

language: csharp
rule:
  kind: method_declaration
  has:
    field: modifier
    regex: ^public$

Playground

The problem here is that users misused kind with field. We can generate an error for it.

@HerringtonDarkholme HerringtonDarkholme added the enhancement New feature or request label Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant