-
-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f6008b
commit 4331884
Showing
49 changed files
with
822 additions
and
57 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
# RCS1218: Simplify code branching | ||
|
||
| Property | Value | | ||
| --------------------------- | ----------- | | ||
| Id | RCS1218 | | ||
| Category | Readability | | ||
| Default Severity | Info | | ||
| Enabled by Default | ✓ | | ||
| Supports Fade\-Out | \- | | ||
| Supports Fade\-Out Analyzer | \- | | ||
|
||
## Examples | ||
|
||
### Code with Diagnostic | ||
|
||
```csharp | ||
if (x) // RCS1218 | ||
{ | ||
} | ||
else | ||
{ | ||
Foo(); | ||
} | ||
``` | ||
|
||
### Code with Fix | ||
|
||
```csharp | ||
if (!x) | ||
{ | ||
Foo(); | ||
} | ||
``` | ||
|
||
- - - | ||
|
||
### Code with Diagnostic | ||
|
||
```csharp | ||
while (true) | ||
{ | ||
if (x) // RCS1218 | ||
{ | ||
Foo(); | ||
} | ||
else | ||
{ | ||
break; | ||
} | ||
} | ||
``` | ||
|
||
### Code with Fix | ||
|
||
```csharp | ||
while (x) | ||
{ | ||
Foo(); | ||
} | ||
``` | ||
|
||
- - - | ||
|
||
### Code with Diagnostic | ||
|
||
```csharp | ||
while (true) | ||
{ | ||
if (x) // RCS1218 | ||
{ | ||
break; | ||
} | ||
|
||
Foo(); | ||
} | ||
``` | ||
|
||
### Code with Fix | ||
|
||
```csharp | ||
while (!x) | ||
{ | ||
Foo(); | ||
|
||
} | ||
``` | ||
|
||
- - - | ||
|
||
### Code with Diagnostic | ||
|
||
```csharp | ||
do | ||
{ | ||
Foo(); | ||
|
||
if (x) // RCS1218 | ||
{ | ||
break; | ||
} | ||
|
||
} while (true) | ||
``` | ||
|
||
### Code with Fix | ||
|
||
```csharp | ||
do | ||
{ | ||
Foo(); | ||
|
||
} while (!x) | ||
``` | ||
|
||
## How to Suppress | ||
|
||
### SuppressMessageAttribute | ||
|
||
```csharp | ||
[assembly: SuppressMessage("Readability", "RCS1218:Simplify code branching.", Justification = "<Pending>")] | ||
``` | ||
|
||
### \#pragma | ||
|
||
```csharp | ||
#pragma warning disable RCS1218 // Simplify code branching. | ||
#pragma warning restore RCS1218 // Simplify code branching. | ||
``` | ||
|
||
### Ruleset | ||
|
||
* [How to configure rule set](../HowToConfigureAnalyzers.md) | ||
|
||
*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* |
Oops, something went wrong.