Skip to content

Commit

Permalink
Change version to 2.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
josefpihrt committed Mar 13, 2020
1 parent 0db67f4 commit 4516b18
Show file tree
Hide file tree
Showing 39 changed files with 411 additions and 90 deletions.
46 changes: 46 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,67 @@
### 2.9.0 (2020-03-13)

* Switch to Roslyn 3.x libraries
* Add `Directory.Build.props` file
* Add open configuration commands to Command Palette (VS Code) ([PR](https://github.com/JosefPihrt/Roslynator/pull/648))

#### Bug Fixes

* Fix key duplication/handle camel case names in `omnisharp.json` ([PR](https://github.com/JosefPihrt/Roslynator/pull/645))
* Use prefix unary operator instead of postfix unary operator ([RCS1089](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1089.md)) ([issue](https://github.com/JosefPihrt/Roslynator/issues/639))
* Cast of `this` to its interface cannot be null ([RCS1202](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1202.md)) ([issue](https://github.com/JosefPihrt/Roslynator/issues/640))
* Do not remove braces in switch section if it contains 'using variable' ([RCS1031](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1031.md)) ([issue](https://github.com/JosefPihrt/Roslynator/issues/632))

#### New Analyzers

* [RCS1242](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1242.md) (DoNotPassNonReadOnlyStructByReadOnlyReference).
* [RCS1243](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1243.md) (DuplicateWordInComment).
* [RCS1244](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1244.md) (SimplifyDefaultExpression).
* [RCS1245](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1245.md) (SimplifyConditionalExpression2) ([issue](https://github.com/JosefPihrt/Roslynator/issues/612)).

#### Analyzers

* Disable analyzer [RCS1057](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1057.md) by default ([issue](https://github.com/JosefPihrt/Roslynator/issues/590)).
* Merge analyzer [RCS1156](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1156.md) with [RCS1113](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1113.md) ([issue](https://github.com/JosefPihrt/Roslynator/issues/650)).
* `x == ""` should be replaced with `string.IsNullOrEmpty(x)`
* Improve analyzer [RCS1215](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1215.md) ([commit](https://github.com/JosefPihrt/Roslynator/commit/0fdd97f9a62463f8b004abeb17a8b8509374c35a)).
* `x == double.NaN` should be replaced with `double.IsNaN(x)`
* Enable [RCS1169](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1169.md) and [RCS1170](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1170.md) if the type is read-only struct ([commit](https://github.com/JosefPihrt/Roslynator/commit/f34e105433dbc65686369adf712b0b99d93eaef7)).
* Improve analyzer [RCS1077](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1077.md) ([commit](https://github.com/JosefPihrt/Roslynator/commit/3ee275442cb16f6a9104b42d582ba7d76d6df88c)).
* `x.OrderBy(y => y).Reverse()` can be simplified to `x.OrderByDescending(y => y)`
* `x.SelectMany(y => y).Count()` can be simplified to `x.Sum(y => y.Count)` if `x` has `Count` or `Length` property
* Improve analyzer [RCS1161](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1161.md) - Declare explicit enum value using `<<` operator ([commit](https://github.com/JosefPihrt/Roslynator/commit/6b78496efe1a2f2678f2ef2a71986e2bee006863)).
* Improve analyzer [RCS1036](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1036.md) - remove empty line between documentation comment and declaration ([commit](https://github.com/JosefPihrt/Roslynator/commit/de0f1205671281679866e92edd9337a7416409e6)).
* Improve analyzer [RCS1037](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1037.md) - remove trailing white-space from documentation comment ([commit](https://github.com/JosefPihrt/Roslynator/commit/c3f7d193ee37d04de7e2c698aab7f3e1e6350e80)).
* Improve analyzer [RCS1143](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1143.md) ([commit](https://github.com/JosefPihrt/Roslynator/commit/4c4281ebdf8eb0aa1a77d5e5bfda71bc66cce1df))
* `x?.M() ?? default(int?)` can be simplified to `x?.M()` if `x` is a nullable struct.
* Improve analyzer [RCS1206](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1206.md) ([commit](https://github.com/JosefPihrt/Roslynator/commit/88dd4cea4df07f036a8296511410ccff70f8fefe))
* `(x != null) ? x.M() : default(int?)` can be simplified to `x?.M()` if `x` is a nullable struct.

### 2.3.1 (2020-01-20)

* Last release of package Roslynator.Analyzers (2.3.0) that references Roslyn 2.x (VS 2017)

### 2.3.0 (2019-12-28)

* Last release of Roslynator for VS 2017
* Automatically update configuration in omnisharp.json (VS Code) ([PR](https://github.com/JosefPihrt/Roslynator/pull/623)).

### 2.2.1 (2019-10-26)

* Add set of formatting analyzers (RCS0...).

### 2.2.0 (2019-09-28)

* Enable configuration for non-Windows systems (VS Code).

#### Analyzers

* Disable analyzer [RCS1029](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1029.md) (FormatBinaryOperatorOnNextLine) by default.

## 2.1.4 (2019-08-13)

* Initial release of Roslynator for VS Code.

### 2.1.3 (2019-08-06)

#### Analyzers
Expand Down
2 changes: 1 addition & 1 deletion docs/analyzers/RCS1057.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
| -------- | ---------- |
| Id | RCS1057 |
| Category | Formatting |
| Severity | Info |
| Severity | None |

## Example

Expand Down
28 changes: 28 additions & 0 deletions docs/analyzers/RCS1077.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,34 @@ enumerable.Any() ? enumerable.First() : default // RCS1077
enumerable.FirstOrDefault()
```

- - -

### Code with Diagnostic

```csharp
enumerable.OrderBy(f => f).Reverse() // RCS1077
```

### Code with Fix

```csharp
enumerable.OrderByDescending()
```

- - -

### Code with Diagnostic

```csharp
enumerable.SelectMany(f => f.Items).Count() // RCS1077
```

### Code with Fix

```csharp
enumerable.Sum(f => f.Items.Count)
```

## See Also

* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic)
Expand Down
16 changes: 15 additions & 1 deletion docs/analyzers/RCS1089.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
| Category | Simplification |
| Severity | Info |

## Example
## Examples

### Code with Diagnostic

Expand All @@ -20,6 +20,20 @@ i = i + 1; // RCS1089
i++;
```

- - -

### Code with Diagnostic

```csharp
M(i + 1); // RCS1089
```

### Code with Fix

```csharp
M(++i);
```

## See Also

* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic)
Expand Down
14 changes: 14 additions & 0 deletions docs/analyzers/RCS1104.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,20 @@ bool x = y;

### Code with Diagnostic

```csharp
bool x = y ? false : true; // RCS1104
```

### Code with Fix

```csharp
bool x = !y;
```

- - -

### Code with Diagnostic

```csharp
bool x = y ? z : false; // RCS1104
```
Expand Down
21 changes: 20 additions & 1 deletion docs/analyzers/RCS1113.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
| Category | Usage |
| Severity | Info |

## Example
## Examples

### Code with Diagnostic

Expand All @@ -24,8 +24,27 @@ if (string.IsNullOrEmpty(s))
}
```

- - -

### Code with Diagnostic

```csharp
if (s == "") // RCS1113
{
}
```

### Code with Fix

```csharp
if (string.IsNullOrEmpty(s))
{
}
```

## See Also

* [CA1820: Test for empty strings using string length](https://docs.microsoft.com/en-us/visualstudio/code-quality/ca1820)
* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic)


Expand Down
2 changes: 1 addition & 1 deletion docs/analyzers/RCS1156.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RCS1156: Use string\.Length instead of comparison with empty string
# \[deprecated\] RCS1156: Use string\.Length instead of comparison with empty string

| Property | Value |
| -------- | ------- |
Expand Down
14 changes: 14 additions & 0 deletions docs/analyzers/RCS1215.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,20 @@ if (items.Count < 0) // RCS1215
}
```

- - -

### Code with Diagnostic

```csharp
x == double.NaN
```

### Code with Fix

```csharp
double.IsNaN(x)
```

## See Also

* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic)
Expand Down
41 changes: 41 additions & 0 deletions docs/analyzers/RCS1242.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# RCS1242: Do not pass non\-read\-only struct by read\-only reference

| Property | Value |
| ------------------------ | ----------- |
| Id | RCS1242 |
| Category | Performance |
| Severity | Warning |
| Minimal Language Version | 7\.2 |

## Example

### Code with Diagnostic

```csharp
struct C
{
void M(in C c) // RCS1242
{
}
}
```

### Code with Fix

```csharp
struct C
{
void M(C c)
{
}
}
```

## See Also

* [in parameter modifier (C# Reference)](https://docs.microsoft.com/dotnet/csharp/language-reference/keywords/in-parameter-modifier)
* [The 'in'-modifier and the readonly structs in C#](https://devblogs.microsoft.com/premier-developer/the-in-modifier-and-the-readonly-structs-in-c/)
* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic)


*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)*
38 changes: 38 additions & 0 deletions docs/analyzers/RCS1243.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# RCS1243: Duplicate word in a comment

| Property | Value |
| -------- | ------- |
| Id | RCS1243 |
| Category | General |
| Severity | Info |

## Example

### Code with Diagnostic

```csharp
/// <summary>
/// This is the the comment.
/// </summary>
public class C
{
}
```

### Code with Fix

```csharp
/// <summary>
/// This is the comment.
/// </summary>
public class C
{
}
```

## See Also

* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic)


*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)*
39 changes: 39 additions & 0 deletions docs/analyzers/RCS1244.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# RCS1244: Simplify 'default' expression

| Property | Value |
| ------------------------ | -------------- |
| Id | RCS1244 |
| Category | Simplification |
| Severity | Hidden |
| Minimal Language Version | 7\.1 |

## Summary

This analyzer is similar to [IDE0034](https://docs.microsoft.com/visualstudio/ide/common-quick-actions#remove-type-from-default-value-expression) but there are some differences. For example this analyzer does not simplify 'default' expression passed as an argument expression.

## Example

### Code with Diagnostic

```csharp
Foo M(Foo foo = default(Foo)) RCS1244
{
return default(Foo); RCS1244
}
```

### Code with Fix

```csharp
Foo M(Foo foo = default)
{
return default;
}
```

## See Also

* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic)


*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)*
42 changes: 42 additions & 0 deletions docs/analyzers/RCS1245.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# RCS1245: Simplify conditional expression

| Property | Value |
| -------- | -------------- |
| Id | RCS1245 |
| Category | Simplification |
| Severity | Hidden |

## Examples

### Code with Diagnostic

```csharp
bool x = y ? false : z; // RCS1245
```

### Code with Fix

```csharp
bool x = !y && z;
```

- - -

### Code with Diagnostic

```csharp
bool x = y ? z : true; // RCS1245
```

### Code with Fix

```csharp
bool x = !y || z;
```

## See Also

* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic)


*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)*
Loading

0 comments on commit 4516b18

Please sign in to comment.