Skip to content

Commit

Permalink
Update version to 4.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
josefpihrt committed Mar 29, 2022
1 parent ab1fd3a commit 2e882b7
Show file tree
Hide file tree
Showing 36 changed files with 322 additions and 84 deletions.
21 changes: 13 additions & 8 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
### Unreleased

* Add analyzer NormalizeFormatOfEnumFlagValue (RCS1254)
* Add analyzer FormatDocumentationCommentSummary (RCS1253)
* Add analyzer NormalizeUsageOfInfiniteLoop (RCS1252)
* Add analyzer RemoveUnnecessaryBraces (RCS1251)
* Call AddRange instead of Add (RCS1235)
### 4.1.0 (2022-03-29)

* Add analyzer [RCS1254](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1254.md) (Normalize format of enum flag value)
* Add analyzer [RCS1253](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1253.md) (Format documentation comment summary)
* Add analyzer [RCS1252](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1252.md) (Normalize usage of infinite loop)
* Add analyzer [RCS1251](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1251.md) (Remove unnecessary braces from record declaration)
* Add refactoring [Deconstruct foreach variable (RR0217)](https://github.com/JosefPihrt/Roslynator/blob/master/docs/refactoring/RR0217.md)
* Add code fix for CS8602, CS8604
* Fix code fix for CS0225
* Put back refactoring SplitLocalDeclarationAndAssignment (RR0194) ([issue](https://github.com/JosefPihrt/Roslynator/issues/881))
* Add suggestion to call AddRange instead of Add (RCS1235)
* Put back refactoring "Split local declaration and assignment" (RR0194) ([issue](https://github.com/JosefPihrt/Roslynator/issues/881))
* Adopt activation events in VS Code extension ([issue](https://github.com/JosefPihrt/Roslynator/issues/883)) (thanks to [ProphetLamb](https://github.com/ProphetLamb))
* Fix: Get config value from global AnalyzerConfig if available ([issue](https://github.com/JosefPihrt/Roslynator/issues/884))
* Add refactoring [Deconstruct foreach variable (RR0217)](https://github.com/JosefPihrt/Roslynator/blob/master/docs/refactoring/RR0217.md)
* Fix: Do not suggest using null-forgiving operator for parameter default value (CS8625)
* Fix: Check if equality operator is overloaded (RCS1171)
* Fix: Do not remove field initialization in struct with constructor(s) (RCS1129)

### 4.0.3 (2022-01-29)

Expand Down
12 changes: 6 additions & 6 deletions docs/analyzers/RCS0059.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
```csharp
items
.Select(selector)
.FirstOrDefault()
?.ToString()
.FirstOrDefault()
?.ToString()
```

### Code with Fix

```csharp
items
.Select(selector)
.FirstOrDefault()?
.ToString()
.FirstOrDefault()?
.ToString()
```

## Options
Expand Down
2 changes: 1 addition & 1 deletion docs/analyzers/RCS1031.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RCS1031: Remove unnecessary braces
# RCS1031: Remove unnecessary braces in switch section

| Property | Value |
| -------- | ------- |
Expand Down
2 changes: 1 addition & 1 deletion docs/analyzers/RCS1063.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RCS1063: Avoid usage of do statement to create an infinite loop
# RCS1063: \(\[deprecated\] use RCS1252 instead\) Avoid usage of do statement to create an infinite loop

| Property | Value |
| -------- | ------- |
Expand Down
2 changes: 1 addition & 1 deletion docs/analyzers/RCS1064.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RCS1064: Avoid usage of for statement to create an infinite loop
# RCS1064: \(\[deprecated\] use RCS1252 instead\) Avoid usage of for statement to create an infinite loop

| Property | Value |
| -------- | ------- |
Expand Down
2 changes: 1 addition & 1 deletion docs/analyzers/RCS1065.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RCS1065: Avoid usage of while statement to create an infinite loop
# RCS1065: \(\[deprecated\] use RCS1252 instead\) Avoid usage of while statement to create an infinite loop

| Property | Value |
| -------- | ------- |
Expand Down
2 changes: 1 addition & 1 deletion docs/analyzers/RCS1100.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RCS1100: Format documentation summary on a single line
# RCS1100: \(\[deprecated\] use RCS1253 instead\) Format documentation summary on a single line

| Property | Value |
| -------- | ------- |
Expand Down
2 changes: 1 addition & 1 deletion docs/analyzers/RCS1101.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RCS1101: Format documentation summary on multiple lines
# RCS1101: \(\[deprecated\] use RCS1253 instead\) Format documentation summary on multiple lines

| Property | Value |
| -------- | ------- |
Expand Down
2 changes: 1 addition & 1 deletion docs/analyzers/RCS1237.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# RCS1237: Use bit shift operator
# RCS1237: \(\[deprecated\] use RCS1254 instead\) Use bit shift operator

| Property | Value |
| -------- | ------- |
Expand Down
25 changes: 25 additions & 0 deletions docs/analyzers/RCS1251.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# RCS1251: Remove unnecessary braces from record declaration

| Property | Value |
| -------- | ------- |
| Id | RCS1251 |
| Severity | Info |

## Example

### Code with Diagnostic

```csharp
public record Foo(string Value1, string Value2)
{
}
```

### Code with Fix

```csharp
public record Foo(string Value1, string Value2);
```


*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)*
18 changes: 18 additions & 0 deletions docs/analyzers/RCS1252.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# RCS1252: Normalize usage of infinite loop

| Property | Value |
| --------------- | -------------------------------- |
| Id | RCS1252 |
| Severity | None |
| Required option | `roslynator_infinite_loop_style` |

## Options

### Use 'for'/'while' statement as an infinite loop

```editorconfig
roslynator_infinite_loop_style = for|while
```


*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)*
22 changes: 22 additions & 0 deletions docs/analyzers/RCS1253.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# RCS1253: Format documentation comment summary

| Property | Value |
| --------------- | -------------------------------------- |
| Id | RCS1253 |
| Severity | None |
| Required option | `roslynator_doc_comment_summary_style` |

## Summary

This analyzer replaces RCS1100 and RCS1101.

## Options

### Format documentation comment summary on single line or multiple lines

```editorconfig
roslynator_doc_comment_summary_style = multi_line|single_line
```


*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)*
18 changes: 18 additions & 0 deletions docs/analyzers/RCS1254.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# RCS1254: Normalize format of enum flag value

| Property | Value |
| --------------- | ---------------------------------- |
| Id | RCS1254 |
| Severity | Info |
| Required option | `roslynator_enum_flag_value_style` |

## Options

### Format enum flag value as decimal number or as a shift operator

```editorconfig
roslynator_enum_flag_value_style = decimal_number|shift_operator
```


*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)*
15 changes: 8 additions & 7 deletions docs/api.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
assembly Roslynator.Core, Version=2.2.0.1, Culture=neutral, PublicKeyToken=926ea54d246a765e
assembly Roslynator.CSharp, Version=2.2.0.1, Culture=neutral, PublicKeyToken=926ea54d246a765e
assembly Roslynator.CSharp.Workspaces, Version=2.2.0.1, Culture=neutral, PublicKeyToken=926ea54d246a765e
assembly Roslynator.Testing.Common, Version=1.0.0.1, Culture=neutral, PublicKeyToken=926ea54d246a765e
assembly Roslynator.Testing.CSharp, Version=1.0.0.1, Culture=neutral, PublicKeyToken=926ea54d246a765e
assembly Roslynator.Testing.CSharp.Xunit, Version=1.0.0.1, Culture=neutral, PublicKeyToken=926ea54d246a765e
assembly Roslynator.Workspaces.Core, Version=2.2.0.1, Culture=neutral, PublicKeyToken=926ea54d246a765e
assembly Roslynator.Core, Version=4.1.0.0, Culture=neutral, PublicKeyToken=926ea54d246a765e
assembly Roslynator.CSharp, Version=4.1.0.0, Culture=neutral, PublicKeyToken=926ea54d246a765e
assembly Roslynator.CSharp.Workspaces, Version=4.1.0.0, Culture=neutral, PublicKeyToken=926ea54d246a765e
assembly Roslynator.Testing.Common, Version=4.1.0.0, Culture=neutral, PublicKeyToken=926ea54d246a765e
assembly Roslynator.Testing.CSharp, Version=4.1.0.0, Culture=neutral, PublicKeyToken=926ea54d246a765e
assembly Roslynator.Testing.CSharp.Xunit, Version=4.1.0.0, Culture=neutral, PublicKeyToken=926ea54d246a765e
assembly Roslynator.Workspaces.Core, Version=4.1.0.0, Culture=neutral, PublicKeyToken=926ea54d246a765e

namespace Roslynator

Expand Down Expand Up @@ -971,6 +971,7 @@ namespace Roslynator.CSharp
public static LocalDeclarationStatementInfo LocalDeclarationStatementInfo(ExpressionSyntax value, bool allowMissing = false);
public static MemberDeclarationListInfo MemberDeclarationListInfo(CompilationUnitSyntax compilationUnit);
public static MemberDeclarationListInfo MemberDeclarationListInfo(NamespaceDeclarationSyntax declaration);
public static MemberDeclarationListInfo MemberDeclarationListInfo(BaseNamespaceDeclarationSyntax declaration);
public static MemberDeclarationListInfo MemberDeclarationListInfo(TypeDeclarationSyntax declaration);
public static MemberDeclarationListInfo MemberDeclarationListInfo(ClassDeclarationSyntax declaration);
public static MemberDeclarationListInfo MemberDeclarationListInfo(StructDeclarationSyntax declaration);
Expand Down
2 changes: 1 addition & 1 deletion docs/api/Roslynator/CSharp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
| [SyntaxAccessibility](SyntaxAccessibility/README.md) | A set of static methods that are related to C\# accessibility\. |
| [SyntaxExtensions](SyntaxExtensions/README.md) | A set of extension methods for syntax \(types derived from [CSharpSyntaxNode](https://docs.microsoft.com/en-us/dotnet/api/microsoft.codeanalysis.csharp.csharpsyntaxnode)\)\. |
| [SyntaxInfo](SyntaxInfo/README.md) | Serves as a factory for types in Roslynator\.CSharp\.Syntax namespace\. |
| [SyntaxInverter](SyntaxInverter/README.md) | \[deprecated\] |
| [SyntaxInverter](SyntaxInverter/README.md) | \[deprecated\] Provides static methods for syntax inversion\. |
| [SyntaxLogicalInverter](SyntaxLogicalInverter/README.md) | Provides static methods for syntax inversion\. |
| [SyntaxLogicalInverterOptions](SyntaxLogicalInverterOptions/README.md) | |
| [WorkspaceExtensions](WorkspaceExtensions/README.md) | A set of extension methods for the workspace layer\. |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

| Method | Summary |
| ------ | ------- |
| [MemberDeclarationListInfo(BaseNamespaceDeclarationSyntax)](#Roslynator_CSharp_SyntaxInfo_MemberDeclarationListInfo_Microsoft_CodeAnalysis_CSharp_Syntax_BaseNamespaceDeclarationSyntax_) | Creates a new [MemberDeclarationListInfo](../../Syntax/MemberDeclarationListInfo/README.md) from the specified declaration\. |
| [MemberDeclarationListInfo(ClassDeclarationSyntax)](#Roslynator_CSharp_SyntaxInfo_MemberDeclarationListInfo_Microsoft_CodeAnalysis_CSharp_Syntax_ClassDeclarationSyntax_) | Creates a new [MemberDeclarationListInfo](../../Syntax/MemberDeclarationListInfo/README.md) from the specified declaration\. |
| [MemberDeclarationListInfo(CompilationUnitSyntax)](#Roslynator_CSharp_SyntaxInfo_MemberDeclarationListInfo_Microsoft_CodeAnalysis_CSharp_Syntax_CompilationUnitSyntax_) | Creates a new [MemberDeclarationListInfo](../../Syntax/MemberDeclarationListInfo/README.md) from the specified compilation unit\. |
| [MemberDeclarationListInfo(InterfaceDeclarationSyntax)](#Roslynator_CSharp_SyntaxInfo_MemberDeclarationListInfo_Microsoft_CodeAnalysis_CSharp_Syntax_InterfaceDeclarationSyntax_) | Creates a new [MemberDeclarationListInfo](../../Syntax/MemberDeclarationListInfo/README.md) from the specified declaration\. |
Expand All @@ -18,6 +19,23 @@
| [MemberDeclarationListInfo(SyntaxNode)](#Roslynator_CSharp_SyntaxInfo_MemberDeclarationListInfo_Microsoft_CodeAnalysis_SyntaxNode_) | Creates a new [MemberDeclarationListInfo](../../Syntax/MemberDeclarationListInfo/README.md) from the specified node\. |
| [MemberDeclarationListInfo(TypeDeclarationSyntax)](#Roslynator_CSharp_SyntaxInfo_MemberDeclarationListInfo_Microsoft_CodeAnalysis_CSharp_Syntax_TypeDeclarationSyntax_) | Creates a new [MemberDeclarationListInfo](../../Syntax/MemberDeclarationListInfo/README.md) from the specified declaration\. |

## MemberDeclarationListInfo\(BaseNamespaceDeclarationSyntax\) <a id="Roslynator_CSharp_SyntaxInfo_MemberDeclarationListInfo_Microsoft_CodeAnalysis_CSharp_Syntax_BaseNamespaceDeclarationSyntax_"></a>

\
Creates a new [MemberDeclarationListInfo](../../Syntax/MemberDeclarationListInfo/README.md) from the specified declaration\.

```csharp
public static Roslynator.CSharp.Syntax.MemberDeclarationListInfo MemberDeclarationListInfo(Microsoft.CodeAnalysis.CSharp.Syntax.BaseNamespaceDeclarationSyntax declaration)
```

### Parameters

**declaration** &ensp; [BaseNamespaceDeclarationSyntax](https://docs.microsoft.com/en-us/dotnet/api/microsoft.codeanalysis.csharp.syntax.basenamespacedeclarationsyntax)

### Returns

[MemberDeclarationListInfo](../../Syntax/MemberDeclarationListInfo/README.md)

## MemberDeclarationListInfo\(ClassDeclarationSyntax\) <a id="Roslynator_CSharp_SyntaxInfo_MemberDeclarationListInfo_Microsoft_CodeAnalysis_CSharp_Syntax_ClassDeclarationSyntax_"></a>

\
Expand Down
1 change: 1 addition & 0 deletions docs/api/Roslynator/CSharp/SyntaxInfo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public static class SyntaxInfo
| [IsExpressionInfo(SyntaxNode, Boolean, Boolean)](IsExpressionInfo/README.md#Roslynator_CSharp_SyntaxInfo_IsExpressionInfo_Microsoft_CodeAnalysis_SyntaxNode_System_Boolean_System_Boolean_) | Creates a new [IsExpressionInfo](../Syntax/IsExpressionInfo/README.md) from the specified node\. |
| [LocalDeclarationStatementInfo(ExpressionSyntax, Boolean)](LocalDeclarationStatementInfo/README.md#Roslynator_CSharp_SyntaxInfo_LocalDeclarationStatementInfo_Microsoft_CodeAnalysis_CSharp_Syntax_ExpressionSyntax_System_Boolean_) | Creates a new [LocalDeclarationStatementInfo](../Syntax/LocalDeclarationStatementInfo/README.md) from the specified expression\. |
| [LocalDeclarationStatementInfo(LocalDeclarationStatementSyntax, Boolean)](LocalDeclarationStatementInfo/README.md#Roslynator_CSharp_SyntaxInfo_LocalDeclarationStatementInfo_Microsoft_CodeAnalysis_CSharp_Syntax_LocalDeclarationStatementSyntax_System_Boolean_) | Creates a new [LocalDeclarationStatementInfo](../Syntax/LocalDeclarationStatementInfo/README.md) from the specified local declaration statement\. |
| [MemberDeclarationListInfo(BaseNamespaceDeclarationSyntax)](MemberDeclarationListInfo/README.md#Roslynator_CSharp_SyntaxInfo_MemberDeclarationListInfo_Microsoft_CodeAnalysis_CSharp_Syntax_BaseNamespaceDeclarationSyntax_) | Creates a new [MemberDeclarationListInfo](../Syntax/MemberDeclarationListInfo/README.md) from the specified declaration\. |
| [MemberDeclarationListInfo(ClassDeclarationSyntax)](MemberDeclarationListInfo/README.md#Roslynator_CSharp_SyntaxInfo_MemberDeclarationListInfo_Microsoft_CodeAnalysis_CSharp_Syntax_ClassDeclarationSyntax_) | Creates a new [MemberDeclarationListInfo](../Syntax/MemberDeclarationListInfo/README.md) from the specified declaration\. |
| [MemberDeclarationListInfo(CompilationUnitSyntax)](MemberDeclarationListInfo/README.md#Roslynator_CSharp_SyntaxInfo_MemberDeclarationListInfo_Microsoft_CodeAnalysis_CSharp_Syntax_CompilationUnitSyntax_) | Creates a new [MemberDeclarationListInfo](../Syntax/MemberDeclarationListInfo/README.md) from the specified compilation unit\. |
| [MemberDeclarationListInfo(InterfaceDeclarationSyntax)](MemberDeclarationListInfo/README.md#Roslynator_CSharp_SyntaxInfo_MemberDeclarationListInfo_Microsoft_CodeAnalysis_CSharp_Syntax_InterfaceDeclarationSyntax_) | Creates a new [MemberDeclarationListInfo](../Syntax/MemberDeclarationListInfo/README.md) from the specified declaration\. |
Expand Down
3 changes: 3 additions & 0 deletions docs/api/Roslynator/CSharp/SyntaxInverter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

SyntaxInverter is obsolete, use SyntaxLogicalInverter instead\.

\
Provides static methods for syntax inversion\.

```csharp
[Obsolete("SyntaxInverter is obsolete, use SyntaxLogicalInverter instead.")]
public static class SyntaxInverter
Expand Down
13 changes: 13 additions & 0 deletions docs/cs/CS8602.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# CS8602

| Property | Value |
| -------- | ------------------------------------------ |
| Id | CS8602 |
| Title | Dereference of a possibly null reference\. |
| Severity | Warning |

## Code Fixes

* Use null propagation operator

*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)*
13 changes: 13 additions & 0 deletions docs/cs/CS8604.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# CS8604

| Property | Value |
| -------- | ------------------------------------------------ |
| Id | CS8604 |
| Title | Possible null reference argument for parameter\. |
| Severity | Warning |

## Code Fixes

* Use null\-forgiving operator

*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)*
18 changes: 9 additions & 9 deletions docs/refactorings/RR0194.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
## Split declaration and initialization

| Property | Value |
| ------------------ | ------------------------------------ |
| Id | RR0194 |
| Title | Split declaration and initialization |
| Syntax | local variable declaration |
| Span | equals token |
| Enabled by Default | &#x2713; |
## Split local declaration and assignment

| Property | Value |
| ------------------ | -------------------------------------- |
| Id | RR0194 |
| Title | Split local declaration and assignment |
| Syntax | local variable declaration |
| Span | equals token |
| Enabled by Default | &#x2713; |

### Usage

Expand Down
45 changes: 45 additions & 0 deletions docs/refactorings/RR0217.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
## Deconstruct foreach variable

| Property | Value |
| ------------------ | ---------------------------- |
| Id | RR0217 |
| Title | Deconstruct foreach variable |
| Syntax | foreach statement |
| Enabled by Default | &#x2713; |

## Summary

type or identifier

### Usage

#### Before

```csharp
var dic = new Dictionary<string, object>();

foreach (var kvp in dic)
{
var k = kvp.Key;
var v = kvp.Value.ToString();
}
```

#### After

```csharp
var dic = new Dictionary<string, object>();

foreach (var (key, value) in dic)
{
var k = key;
var v = value.ToString();
}
```

## See Also

* [Full list of refactorings](Refactorings.md)


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

0 comments on commit 2e882b7

Please sign in to comment.