How do I avoid having to set the severity and name for each rule?
See original GitHub issueWhen I have the following, is there any way I can avoid having to set the severity and name for each rule?
RuleFor(envelope => envelope.Body.MOARequest.Header.RequestID.Text)
.NotNull()
.WithSeverity(Severity.Warning)
.WithName(NameOf(envelope => envelope.Body.MOARequest.Header.RequestID))
.NotEmpty()
.WithSeverity(Severity.Warning)
.WithName(NameOf(envelope => envelope.Body.MOARequest.Header.RequestID))
.MaximumLength(20)
.WithSeverity(Severity.Warning)
.WithName(NameOf(envelope => envelope.Body.MOARequest.Header.RequestID))
.When(envelope => envelope?.Body?.MOARequest?.Header?.RequestID != null);
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
All rules have default "error" severity · Issue #23 · stylelint ...
In this case, the syntax for setting the severity for each individual rule makes the configuration really verbose and hard to maintain, so ......
Read more >Defining rule severity - TechDocs - Broadcom Inc.
To define a policy rule severity · Configure a policy rule. · Select a · Click · Select the desired severity level, choose...
Read more >Code analysis rule categories - .NET
NET design guidelines, and security rules help prevent security flaws. You can configure the severity level for an entire category of rules.
Read more >Managing Severity Rules
1. In the Configuration view, select Events > Security Events Log > Security Log. 2. Click the Severity Rules tab. A list of...
Read more >Analyzer configuration - Visual Studio (Windows)
Right-click the rule and select Set severity. In the context menu, choose one of the severity options. Visual Studio adds an entry to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sure, feel free to send a pull request to add this in, otherwise I’ll try and get to it when I have a bit of time
The third parameter of the global display name resolver is the expression, so yes you can get the expression body.
Edit: sorry I misunderstood, I thought you meant the expression for which the rule was defined