Skip to content

Commit

Permalink
Change version to 1.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
josefpihrt committed Apr 17, 2018
1 parent 9f6008b commit 4331884
Show file tree
Hide file tree
Showing 49 changed files with 822 additions and 57 deletions.
18 changes: 18 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
### 1.8.1 (2018-04-17)

#### Analyzers

* Add analyzer [SimplifyCodeBranching](http://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1218.md) (RCS1218)
* Add analyzer [CallSkipAndAnyInsteadOfCount](http://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1219.md) (RCS1219) (split from RCS1083)

#### Refactorings

* Add refactoring [MoveUnsafeContextToContainingDeclaration](http://github.com/JosefPihrt/Roslynator/blob/master/docs/refactorings/RR0202.md) (RR0202)
* Add refactoring [ExtractEventHandlerMethod](http://github.com/JosefPihrt/Roslynator/blob/master/docs/refactorings/RR0203.md) (RR0203)
* Add refactoring [GeneratePropertyForDebuggerDisplayAttribute](http://github.com/JosefPihrt/Roslynator/blob/master/docs/refactorings/RR0204.md) (RR0204)
* Add refactoring [AddEmptyLineBetweenDeclarations](http://github.com/JosefPihrt/Roslynator/blob/master/docs/refactorings/RR0205.md) (RR0205)

#### Code Fixes

* Add code fixes for CS0152, CS0238, CS0524, CS0525, CS0549, CS0567, CS0568, CS0574, CS0575, CS0714, CS1737, CS1743, CS8340.

### 1.8.0 (2018-03-20)

#### Analyzers
Expand Down
58 changes: 54 additions & 4 deletions docs/analyzers/RCS1057.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,73 @@
### Code with Diagnostic

```csharp
public void Foo()
public class Foo
{
public void M1()
{
} // RCS1057
public void M2()
{
} // RCS1057
/// <summary>
/// ...
/// </summary>
public void M3()
{
} // RCS1057
public string P1 { get; set; } // RCS1057
[Obsolete]
public string P2 { get; set; }
} // RCS1057
public void Bar()
public enum FooEnum
{
A = 0, // RCS1057
/// <summary>
/// ...
/// </summary>
B = 1, // RCS1057
[Obsolete]
C = 2,
}
```

### Code with Fix

```csharp
public void Foo()
public class Foo
{
public void M1()
{
}

public void M2()
{
}

/// <summary>
/// ...
/// </summary>
public void M3()
{
}

public string P1 { get; set; }

[Obsolete]
public string P2 { get; set; }
}

public void Bar()
public enum FooEnum
{
A = 0,

/// <summary>
/// ...
/// </summary>
B = 1,

[Obsolete]
C = 2,
}
```

Expand Down
8 changes: 4 additions & 4 deletions docs/analyzers/RCS1099.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RCS1099: Default label should be last label in switch section
# RCS1099: Default label should be the last label in a switch section

| Property | Value |
| --------------------------- | ----------- |
Expand Down Expand Up @@ -40,14 +40,14 @@ switch (s)
### SuppressMessageAttribute

```csharp
[assembly: SuppressMessage("Readability", "RCS1099:Default label should be last label in switch section.", Justification = "<Pending>")]
[assembly: SuppressMessage("Readability", "RCS1099:Default label should be the last label in a switch section.", Justification = "<Pending>")]
```

### \#pragma

```csharp
#pragma warning disable RCS1099 // Default label should be last label in switch section.
#pragma warning restore RCS1099 // Default label should be last label in switch section.
#pragma warning disable RCS1099 // Default label should be the last label in a switch section.
#pragma warning restore RCS1099 // Default label should be the last label in a switch section.
```

### Ruleset
Expand Down
8 changes: 4 additions & 4 deletions docs/analyzers/RCS1172.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RCS1172: Use is operator instead of as operator
# RCS1172: Use 'is' operator instead of 'as' operator

| Property | Value |
| --------------------------- | -------------- |
Expand Down Expand Up @@ -32,14 +32,14 @@ if (x is string)
### SuppressMessageAttribute

```csharp
[assembly: SuppressMessage("Simplification", "RCS1172:Use is operator instead of as operator.", Justification = "<Pending>")]
[assembly: SuppressMessage("Simplification", "RCS1172:Use 'is' operator instead of 'as' operator.", Justification = "<Pending>")]
```

### \#pragma

```csharp
#pragma warning disable RCS1172 // Use is operator instead of as operator.
#pragma warning restore RCS1172 // Use is operator instead of as operator.
#pragma warning disable RCS1172 // Use 'is' operator instead of 'as' operator.
#pragma warning restore RCS1172 // Use 'is' operator instead of 'as' operator.
```

### Ruleset
Expand Down
34 changes: 31 additions & 3 deletions docs/analyzers/RCS1210.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
| Supports Fade\-Out | \- |
| Supports Fade\-Out Analyzer | \- |

## Example
## Examples

### Code with Diagnostic

```csharp
Task<object> FooAsync()
Task<object> GetAsync()
{
return null; // RCS1210
}
Expand All @@ -23,12 +23,40 @@ Task<object> FooAsync()
### Code with Fix

```csharp
Task<object> FooAsync()
Task<object> GetAsync()
{
return Task.FromResult<object>(null);
}
```

- - -

### Code with Diagnostic

```csharp
Task<object> GetAsync()
{
return _foo?.GetAsync(); // RCS1210
}
```

### Code with Fix

```csharp
Task<object> GetAsync()
{
Foo x = _foo;
if (x != null)
{
return _foo.GetAsync();
}
else
{
return Task.FromResult<object>(null);
}
}
```

## How to Suppress

### SuppressMessageAttribute
Expand Down
2 changes: 1 addition & 1 deletion docs/analyzers/RCS1217.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
string x = null;
// ...
string y = $"{x}{x}{x}";
string y = $"{x}{x}{x}"; // RCS1217
```

### Code with Fix
Expand Down
134 changes: 134 additions & 0 deletions docs/analyzers/RCS1218.md
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 | &#x2713; |
| 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)\)*
Loading

0 comments on commit 4331884

Please sign in to comment.