diff --git a/ChangeLog.md b/ChangeLog.md index ca1e34008f..32bfad2543 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,30 @@ +### 3.0.1 (2020-10-19) + +* Add analyzer [RCS0055](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS0055.md) (Fix formatting of a binary expression chain) +* Add analyzer [RCS0054](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS0054.md) (Fix formatting of a call chain) +* Add analyzer [RCS0053](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS0053.md) (Fix formatting of a list) +* Add analyzer [RCS0052](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS0052.md) (Add newline before equals sign instead of after it (or vice versa)) +* Add analyzer [RCS1248](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1248.md) (Use 'is null' pattern instead of comparison (or vice versa)) ([issue](https://github.com/JosefPihrt/Roslynator/issues/458)) +* Add analyzer [RCS1247](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1247.md) (Fix documentation comment tag) +* Add analyzer option [RCS1207i](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1207i.md) (Convert method group to anonymous function) +* Add analyzer option [RCS1090i](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1090i.md) (Remove call to 'ConfigureAwait') +* Add analyzer option [RCS1018i](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1018i.md) (Remove accessibility modifiers) ([issue](https://github.com/JosefPihrt/Roslynator/issues/260)) +* Add analyzer option [RCS1014i](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1014i.md) (Use implicitly typed array) +* Add analyzer option [RCS1014a](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1014a.md) (Use implicitly typed array (when type is obvious)) +* Add analyzer option [RCS1078i](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1078i.md) (Use string.Empty instead of "") +* Add analyzer option [RCS1016a](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1016a.md) (Convert expression-body to block body when expression is multi-line) +* Add analyzer option [RCS1016b](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1016b.md) (Convert expression-body to block body when declaration is multi-line) +* Disable by default analyzer [RCS1207i](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1207i.md) (Convert method group to anonymous function) +* Remove analyzer [RCS1219](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1219.md) (Call 'Enumerable.Skip' and 'Enumerable.Any' instead of 'Enumerable.Count') +* Rename analyzer "Avoid 'null' on left side of binary expression" to "Constant values should be placed on right side of comparisons" [RCS1098](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1098.md) +* Rename analyzer "Simplify boolean expression" to "Unncessary null check" [RCS1199](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1199.md) ([issue](https://github.com/JosefPihrt/Roslynator/issues/373)) + +* More syntax is considered as having obvious type: + * string literal + * character literal + * boolean literal + * implicit array creation that contains only expressions whose type is obvious + ### 3.0.0 (2020-06-16) * Update references to Roslyn API to 3.5.0 diff --git a/docs/analyzers/RCS0047.md b/docs/analyzers/RCS0047.md index d36c2df3d4..f186213c74 100644 --- a/docs/analyzers/RCS0047.md +++ b/docs/analyzers/RCS0047.md @@ -1,4 +1,4 @@ -# RCS0047: Wrap and indent each node in list +# RCS0047: \[deprecated\] Wrap and indent each node in list | Property | Value | | -------- | ---------- | @@ -6,6 +6,10 @@ | Category | Formatting | | Severity | None | +## Summary + +This analyzer has been deprecated. Use analyzer [RCS0053](RCS0053.md) instead. + ## Examples ### Code with Diagnostic diff --git a/docs/analyzers/RCS0052.md b/docs/analyzers/RCS0052.md new file mode 100644 index 0000000000..0474ec6989 --- /dev/null +++ b/docs/analyzers/RCS0052.md @@ -0,0 +1,39 @@ +# RCS0052: Add newline before equals sign instead of after it \(or vice versa\) + +| Property | Value | +| -------- | ---------- | +| Id | RCS0052 | +| Category | Formatting | +| Severity | None | + +## Example + +### Code with Diagnostic + +```csharp +string s = // RCS0052 + new string(' ', 4); +``` + +### Code with Fix + +```csharp +string s + = new string(' ', 4); +``` + +## Options + +* [RCS0052i](RCS0052i.md) \- Add newline after equals sign instead of before it\. + +## Applies to + +* [Roslynator.Formatting.Analyzers](https://www.nuget.org/packages/Roslynator.Formatting.Analyzers) + +## See Also + +* [Analyzer Options](../AnalyzerOptions.md) +* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) + + +*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/docs/analyzers/RCS0052i.md b/docs/analyzers/RCS0052i.md new file mode 100644 index 0000000000..bc864cd64f --- /dev/null +++ b/docs/analyzers/RCS0052i.md @@ -0,0 +1,37 @@ +# RCS0052i: Add newline after equals sign instead of before it + +| Property | Value | +| -------- | -------------- | +| Id | RCS0052i | +| Category | AnalyzerOption | +| Severity | None | + +This option modifies behavior of analyzer [RCS0052](RCS0052.md)\. It requires [RCS0052](RCS0052.md) to be enabled\. + +## Example + +### Code with Diagnostic + +```csharp +string s // [|Id|] + = new string(' ', 4); +``` + +### Code with Fix + +```csharp +string s = + new string(' ', 4); +``` + +## Applies to + +* [Roslynator.Formatting.Analyzers](https://www.nuget.org/packages/Roslynator.Formatting.Analyzers) + +## See Also + +* [Analyzer Options](../AnalyzerOptions.md) +* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) + + +*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/docs/analyzers/RCS0053.md b/docs/analyzers/RCS0053.md new file mode 100644 index 0000000000..39338279ee --- /dev/null +++ b/docs/analyzers/RCS0053.md @@ -0,0 +1,133 @@ +# RCS0053: Fix formatting of a list + +| Property | Value | +| -------- | ---------- | +| Id | RCS0053 | +| Category | Formatting | +| Severity | None | + +## Summary + + + This analyzer: +* fixes indentation of argument/parameter list and similar lists +* formats each item in a multi-line list on a separate line + +Following formats are considered as valid (for a parameter list): +```cs +void M(object x, object y) +{ +} +``` +```cs +void M( + object x, object y) +{ +} +``` +```cs +void M( + object x, + object y) +{ +} +``` + + +## Examples + +### Code with Diagnostic + +```csharp +void M( + object x, + object y) +{ +} +``` + +### Code with Fix + +```csharp +void M( + object x, + object y) +{ +} +``` + +- - - + +### Code with Diagnostic + +```csharp +void M(object x, + object y) +{ +} +``` + +### Code with Fix + +```csharp +void M( + object x, + object y) +{ +} +``` + +- - - + +### Code with Diagnostic + +```csharp +void M(object x, + object y) +{ +} +``` + +### Code with Fix + +```csharp +void M( + object x, + object y) +{ +} +``` + +- - - + +### Code with Diagnostic + +```csharp +void M( + object x, + object y, object z) +{ +} +``` + +### Code with Fix + +```csharp +void M( + object x, + object y, + object z) +{ +} +``` + +## Applies to + +* [Roslynator.Formatting.Analyzers](https://www.nuget.org/packages/Roslynator.Formatting.Analyzers) + +## See Also + +* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) + + +*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/docs/analyzers/RCS0054.md b/docs/analyzers/RCS0054.md new file mode 100644 index 0000000000..73195adc23 --- /dev/null +++ b/docs/analyzers/RCS0054.md @@ -0,0 +1,60 @@ +# RCS0054: Fix formatting of a call chain + +| Property | Value | +| -------- | ---------- | +| Id | RCS0054 | +| Category | Formatting | +| Severity | None | + +## Summary + +This analyzer: +* fixes indentation of multi-line call chain +* formats each call on a separate line + + +## Examples + +### Code with Diagnostic + +```csharp +return [|x.M1() // RCS0054 + .M2().M3()|]; +``` + +### Code with Fix + +```csharp +return [|x.M1() + .M2() + .M3()|]; +``` + +- - - + +### Code with Diagnostic + +```csharp +return [|x.M1() // RCS0054 +.M2() +.M3()|]; +``` + +### Code with Fix + +```csharp +return [|x.M1() + .M2() + .M3()|]; +``` + +## Applies to + +* [Roslynator.Formatting.Analyzers](https://www.nuget.org/packages/Roslynator.Formatting.Analyzers) + +## See Also + +* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) + + +*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/docs/analyzers/RCS0055.md b/docs/analyzers/RCS0055.md new file mode 100644 index 0000000000..1d5336d4c1 --- /dev/null +++ b/docs/analyzers/RCS0055.md @@ -0,0 +1,68 @@ +# RCS0055: Fix formatting of a binary expression chain + +| Property | Value | +| -------- | ---------- | +| Id | RCS0055 | +| Category | Formatting | +| Severity | None | + +## Summary + +This analyzer: + * fixes indentation of multi-line binary expression chain + * formats each expression on a separate line + + +## Examples + +### Code with Diagnostic + +```csharp +if (x && y // RCS0055 + && z) +{ +} +``` + +### Code with Fix + +```csharp +if (x + && y + && z) +{ +} +``` + +- - - + +### Code with Diagnostic + +```csharp +if (x // RCS0055 +&& y +&& z) +{ +} +``` + +### Code with Fix + +```csharp +if (x + && y + && z) +{ +} +``` + +## Applies to + +* [Roslynator.Formatting.Analyzers](https://www.nuget.org/packages/Roslynator.Formatting.Analyzers) + +## See Also + +* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) + + +*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/docs/analyzers/RCS1014.md b/docs/analyzers/RCS1014.md index 1ca4a85954..ca5410f21d 100644 --- a/docs/analyzers/RCS1014.md +++ b/docs/analyzers/RCS1014.md @@ -1,4 +1,4 @@ -# RCS1014: Avoid implicitly\-typed array +# RCS1014: Use explicitly typed array \(or vice versa\) | Property | Value | | -------- | ----------- | @@ -11,17 +11,23 @@ ### Code with Diagnostic ```csharp -var items = new[] { "" }; +var items = new[] { "a", B }; ``` ### Code with Fix ```csharp -var items = new string[] { "" }; +var items = new string[] { "a", B }; ``` +## Options + +* [RCS1014a](RCS1014a.md) \- Use implicitly typed array \(when type is obvious\)\. +* [RCS1014i](RCS1014i.md) \- Use implicitly typed array\. + ## See Also +* [Analyzer Options](../AnalyzerOptions.md) * [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) diff --git a/docs/analyzers/RCS1014a.md b/docs/analyzers/RCS1014a.md new file mode 100644 index 0000000000..e089ffc435 --- /dev/null +++ b/docs/analyzers/RCS1014a.md @@ -0,0 +1,31 @@ +# RCS1014a: Use implicitly typed array \(when type is obvious\) + +| Property | Value | +| -------- | -------------- | +| Id | RCS1014a | +| Category | AnalyzerOption | +| Severity | None | + +This option modifies behavior of analyzer [RCS1014](RCS1014.md)\. It requires [RCS1014](RCS1014.md) to be enabled\. + +## Example + +### Code with Diagnostic + +```csharp +var items = new string[] { "a", "b" }; +``` + +### Code with Fix + +```csharp +var items = new[] { "a", "b" }; +``` + +## See Also + +* [Analyzer Options](../AnalyzerOptions.md) +* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) + + +*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/docs/analyzers/RCS1014i.md b/docs/analyzers/RCS1014i.md new file mode 100644 index 0000000000..b55c531b08 --- /dev/null +++ b/docs/analyzers/RCS1014i.md @@ -0,0 +1,31 @@ +# RCS1014i: Use implicitly typed array + +| Property | Value | +| -------- | -------------- | +| Id | RCS1014i | +| Category | AnalyzerOption | +| Severity | None | + +This option modifies behavior of analyzer [RCS1014](RCS1014.md)\. It requires [RCS1014](RCS1014.md) to be enabled\. + +## Example + +### Code with Diagnostic + +```csharp +var items = new string[] { A, B }; +``` + +### Code with Fix + +```csharp +var items = new[] { A, B }; +``` + +## See Also + +* [Analyzer Options](../AnalyzerOptions.md) +* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) + + +*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/docs/analyzers/RCS1016.md b/docs/analyzers/RCS1016.md index 6be2ab18eb..41d69d4b05 100644 --- a/docs/analyzers/RCS1016.md +++ b/docs/analyzers/RCS1016.md @@ -1,4 +1,4 @@ -# RCS1016: Use expression\-bodied member +# RCS1016: Convert block body to expression\-body \(or vice versa\) | Property | Value | | ------------------------ | ------- | @@ -12,20 +12,26 @@ ### Code with Diagnostic ```csharp -public object Foo() +public string Foo() { // RCS1016 - return null; + return ""; } ``` ### Code with Fix ```csharp -public object Foo() => null; +public string Foo() => ""; ``` +## Options + +* [RCS1016a](RCS1016a.md) \- Convert expression\-body to block body when expression is multi\-line\. +* [RCS1016b](RCS1016b.md) \- Convert expression\-body to block body when declaration is multi\-line\. + ## See Also +* [Analyzer Options](../AnalyzerOptions.md) * [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) diff --git a/docs/analyzers/RCS1016a.md b/docs/analyzers/RCS1016a.md new file mode 100644 index 0000000000..d164d63f8c --- /dev/null +++ b/docs/analyzers/RCS1016a.md @@ -0,0 +1,45 @@ +# RCS1016a: Convert expression\-body to block body when expression is multi\-line + +| Property | Value | +| ------------------------ | -------------- | +| Id | RCS1016a | +| Category | AnalyzerOption | +| Severity | None | +| Minimal Language Version | 6\.0 | + +This option modifies behavior of analyzer [RCS1016](RCS1016.md)\. It requires [RCS1016](RCS1016.md) to be enabled\. + +## Example + +### Code with Diagnostic + +```csharp +public string[] Foo() => new string[] // [|Id|] +{ + "a", + "b", + "c" +}; +``` + +### Code with Fix + +```csharp +public string[] Foo() +{ + return new string[] + { + "a", + "b", + "c" + }; +} +``` + +## See Also + +* [Analyzer Options](../AnalyzerOptions.md) +* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) + + +*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/docs/analyzers/RCS1016b.md b/docs/analyzers/RCS1016b.md new file mode 100644 index 0000000000..363b52e299 --- /dev/null +++ b/docs/analyzers/RCS1016b.md @@ -0,0 +1,41 @@ +# RCS1016b: Convert expression\-body to block body when declaration is multi\-line + +| Property | Value | +| ------------------------ | -------------- | +| Id | RCS1016b | +| Category | AnalyzerOption | +| Severity | None | +| Minimal Language Version | 6\.0 | + +This option modifies behavior of analyzer [RCS1016](RCS1016.md)\. It requires [RCS1016](RCS1016.md) to be enabled\. + +## Example + +### Code with Diagnostic + +```csharp +public string[] Foo( + string a, + string b, + string c) => new string[] { a, b, c }; // [|Id|] +``` + +### Code with Fix + +```csharp +public string[] Foo( + string a, + string b, + string c) +{ + return new string[] { a, b, c }; +} +``` + +## See Also + +* [Analyzer Options](../AnalyzerOptions.md) +* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) + + +*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/docs/analyzers/RCS1017.md b/docs/analyzers/RCS1017.md index 76dd24a6e0..c7c91819d9 100644 --- a/docs/analyzers/RCS1017.md +++ b/docs/analyzers/RCS1017.md @@ -1,4 +1,4 @@ -# RCS1017: Avoid multiline expression body +# RCS1017: \[deprecated\] Avoid multiline expression body | Property | Value | | -------- | ------- | @@ -6,6 +6,10 @@ | Category | Style | | Severity | None | +## Summary + +This analyzer has been deprecated. Use analyzer [RCS1016a](RCS1016a.md) instead. + ## Example ### Code with Diagnostic diff --git a/docs/analyzers/RCS1018.md b/docs/analyzers/RCS1018.md index 834fdf8132..d5e0290384 100644 --- a/docs/analyzers/RCS1018.md +++ b/docs/analyzers/RCS1018.md @@ -1,4 +1,4 @@ -# RCS1018: Add accessibility modifiers +# RCS1018: Add accessibility modifiers \(or vice versa\) | Property | Value | | -------- | ----------- | @@ -30,8 +30,13 @@ internal class Foo } ``` +## Options + +* [RCS1018i](RCS1018i.md) \- Remove accessibility modifiers\. + ## See Also +* [Analyzer Options](../AnalyzerOptions.md) * [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) diff --git a/docs/analyzers/RCS1018i.md b/docs/analyzers/RCS1018i.md new file mode 100644 index 0000000000..285e724833 --- /dev/null +++ b/docs/analyzers/RCS1018i.md @@ -0,0 +1,41 @@ +# RCS1018i: Remove accessibility modifiers + +| Property | Value | +| -------- | -------------- | +| Id | RCS1018i | +| Category | AnalyzerOption | +| Severity | None | + +This option modifies behavior of analyzer [RCS1018](RCS1018.md)\. It requires [RCS1018](RCS1018.md) to be enabled\. + +## Example + +### Code with Diagnostic + +```csharp +internal class Foo // [|Id|] +{ + private void Bar() // [|Id|] + { + } +} +``` + +### Code with Fix + +```csharp +class Foo +{ + void Bar() + { + } +} +``` + +## See Also + +* [Analyzer Options](../AnalyzerOptions.md) +* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) + + +*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/docs/analyzers/RCS1021.md b/docs/analyzers/RCS1021.md index 6cf7d4fc57..e227a97887 100644 --- a/docs/analyzers/RCS1021.md +++ b/docs/analyzers/RCS1021.md @@ -1,4 +1,4 @@ -# RCS1021: Simplify lambda expression +# RCS1021: Convert lambda expression body to expression\-body | Property | Value | | -------- | -------------- | diff --git a/docs/analyzers/RCS1058.md b/docs/analyzers/RCS1058.md index f65e7907eb..7da0e34ef5 100644 --- a/docs/analyzers/RCS1058.md +++ b/docs/analyzers/RCS1058.md @@ -1,27 +1,44 @@ # RCS1058: Use compound assignment -| Property | Value | -| -------- | -------------- | -| Id | RCS1058 | -| Category | Simplification | -| Severity | Info | +| Property | Value | +| ------------------------ | --------------------- | +| Id | RCS1058 | +| Category | Simplification | +| Severity | Info | +| Minimal Language Version | 8\.0 \(??= operator\) | -## Example +## Examples ### Code with Diagnostic ```csharp -i = i + 2; +x = x + 2; ``` ### Code with Fix ```csharp -i += 2; +x += 2; +``` + +- - - + +### Code with Diagnostic + +```csharp +x ?? (x = M()) +``` + +### Code with Fix + +```csharp +x ??= M() ``` ## See Also +* [Compound assignment](https://docs.microsoft.com/cs-cz/dotnet/csharp/language-reference/operators/arithmetic-operators#compound-assignment) +* [?? and ??= operators](https://docs.microsoft.com/dotnet/csharp/language-reference/operators/null-coalescing-operator) * [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) diff --git a/docs/analyzers/RCS1077.md b/docs/analyzers/RCS1077.md index ac0e0e84fc..9c6b406011 100644 --- a/docs/analyzers/RCS1077.md +++ b/docs/analyzers/RCS1077.md @@ -218,6 +218,20 @@ enumerable.SelectMany(f => f.Items).Count() enumerable.Sum(f => f.Items.Count) ``` +- - - + +### Code with Diagnostic + +```csharp +listOfT.Select(f => M(f)).ToList() +``` + +### Code with Fix + +```csharp +listOfT.ConvertAll(f => M(f)) +``` + ## See Also * [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) diff --git a/docs/analyzers/RCS1078.md b/docs/analyzers/RCS1078.md index a086a1dc43..5dea86b0de 100644 --- a/docs/analyzers/RCS1078.md +++ b/docs/analyzers/RCS1078.md @@ -1,4 +1,4 @@ -# RCS1078: Use "" instead of string\.Empty +# RCS1078: Use "" instead of string\.Empty \(or vice versa\) | Property | Value | | -------- | ------- | @@ -20,8 +20,13 @@ string s = string.Empty; string s = ""; ``` +## Options + +* [RCS1078i](RCS1078i.md) \- Use string\.Empty instead of ""\. + ## See Also +* [Analyzer Options](../AnalyzerOptions.md) * [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) diff --git a/docs/analyzers/RCS1078i.md b/docs/analyzers/RCS1078i.md new file mode 100644 index 0000000000..fb6657c7c8 --- /dev/null +++ b/docs/analyzers/RCS1078i.md @@ -0,0 +1,31 @@ +# RCS1078i: Use string\.Empty instead of "" + +| Property | Value | +| -------- | -------------- | +| Id | RCS1078i | +| Category | AnalyzerOption | +| Severity | None | + +This option modifies behavior of analyzer [RCS1078](RCS1078.md)\. It requires [RCS1078](RCS1078.md) to be enabled\. + +## Example + +### Code with Diagnostic + +```csharp +string s = ""; +``` + +### Code with Fix + +```csharp +string s = string.Empty; +``` + +## See Also + +* [Analyzer Options](../AnalyzerOptions.md) +* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) + + +*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/docs/analyzers/RCS1090.md b/docs/analyzers/RCS1090.md index 5c6f51d8e2..9e4458519f 100644 --- a/docs/analyzers/RCS1090.md +++ b/docs/analyzers/RCS1090.md @@ -1,4 +1,4 @@ -# RCS1090: Call 'ConfigureAwait\(false\)' +# RCS1090: Add call to 'ConfigureAwait' \(or vice versa\) | Property | Value | | -------- | ------- | @@ -26,8 +26,13 @@ public async Task FooAsync() } ``` +## Options + +* [RCS1090i](RCS1090i.md) \- Remove call to 'ConfigureAwait'\. + ## See Also +* [Analyzer Options](../AnalyzerOptions.md) * [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) diff --git a/docs/analyzers/RCS1090i.md b/docs/analyzers/RCS1090i.md new file mode 100644 index 0000000000..70bad99512 --- /dev/null +++ b/docs/analyzers/RCS1090i.md @@ -0,0 +1,37 @@ +# RCS1090i: Remove call to 'ConfigureAwait' + +| Property | Value | +| -------- | -------------- | +| Id | RCS1090i | +| Category | AnalyzerOption | +| Severity | None | + +This option modifies behavior of analyzer [RCS1090](RCS1090.md)\. It requires [RCS1090](RCS1090.md) to be enabled\. + +## Example + +### Code with Diagnostic + +```csharp +public async Task FooAsync() +{ + await GetValueAsync().ConfigureAwait(false); // [|Id|] +} +``` + +### Code with Fix + +```csharp +public async Task FooAsync() +{ + await GetValueAsync(); +} +``` + +## See Also + +* [Analyzer Options](../AnalyzerOptions.md) +* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) + + +*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/docs/analyzers/RCS1098.md b/docs/analyzers/RCS1098.md index 9a350d04c1..f5dfa9664d 100644 --- a/docs/analyzers/RCS1098.md +++ b/docs/analyzers/RCS1098.md @@ -1,4 +1,4 @@ -# RCS1098: Avoid 'null' on the left side of a binary expression +# RCS1098: Constant values should be placed on right side of comparisons | Property | Value | | -------- | ----------- | @@ -12,7 +12,7 @@ ```csharp if (null == x) // RCS1098 -{ +{ } ``` diff --git a/docs/analyzers/RCS1179.md b/docs/analyzers/RCS1179.md index 59622abf79..4f77dfb273 100644 --- a/docs/analyzers/RCS1179.md +++ b/docs/analyzers/RCS1179.md @@ -1,4 +1,4 @@ -# RCS1179: Use 'return' instead of assignment +# RCS1179: Unnecessary assignment | Property | Value | | -------- | -------------- | diff --git a/docs/analyzers/RCS1199.md b/docs/analyzers/RCS1199.md index 8eb52416ba..15a332a21e 100644 --- a/docs/analyzers/RCS1199.md +++ b/docs/analyzers/RCS1199.md @@ -1,12 +1,12 @@ -# RCS1199: Simplify boolean expression +# RCS1199: Unncessary null check -| Property | Value | -| -------- | -------------- | -| Id | RCS1199 | -| Category | Simplification | -| Severity | Info | +| Property | Value | +| -------- | ---------- | +| Id | RCS1199 | +| Category | Redundancy | +| Severity | Info | -## Example +## Examples ### Code with Diagnostic @@ -28,6 +28,29 @@ if (x == true) } ``` +- - - + +### Code with Diagnostic + +```csharp +bool? x = null; +bool y = false; + +// ... + +if (x != null && x.Value == y) // RCS1199 +{ +} +``` + +### Code with Fix + +```csharp +if (x == y) +{ +} +``` + ## See Also * [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) diff --git a/docs/analyzers/RCS1207.md b/docs/analyzers/RCS1207.md index d453dcf171..4ea34725fe 100644 --- a/docs/analyzers/RCS1207.md +++ b/docs/analyzers/RCS1207.md @@ -1,10 +1,10 @@ -# RCS1207: Convert anonymous function to method group +# RCS1207: Convert anonymous function to method group \(or vice versa\) | Property | Value | | -------- | -------------- | | Id | RCS1207 | | Category | Simplification | -| Severity | Hidden | +| Severity | None | ## Example @@ -20,8 +20,13 @@ var x = items.Select(f => Foo(f)); var x = items.Select(Foo); ``` +## Options + +* [RCS1207i](RCS1207i.md) \- Convert method group to anonymous function\. + ## See Also +* [Analyzer Options](../AnalyzerOptions.md) * [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) diff --git a/docs/analyzers/RCS1207i.md b/docs/analyzers/RCS1207i.md new file mode 100644 index 0000000000..2ddb7f35f0 --- /dev/null +++ b/docs/analyzers/RCS1207i.md @@ -0,0 +1,31 @@ +# RCS1207i: Convert method group to anonymous function + +| Property | Value | +| -------- | -------------- | +| Id | RCS1207i | +| Category | AnalyzerOption | +| Severity | None | + +This option modifies behavior of analyzer [RCS1207](RCS1207.md)\. It requires [RCS1207](RCS1207.md) to be enabled\. + +## Example + +### Code with Diagnostic + +```csharp +var x = items.Select(Foo); +``` + +### Code with Fix + +```csharp +var x = items.Select(f => Foo(f)); +``` + +## See Also + +* [Analyzer Options](../AnalyzerOptions.md) +* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) + + +*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/docs/analyzers/RCS1210.md b/docs/analyzers/RCS1210.md index 2fd01a8069..281fa131b9 100644 --- a/docs/analyzers/RCS1210.md +++ b/docs/analyzers/RCS1210.md @@ -1,4 +1,4 @@ -# RCS1210: Return Task\.FromResult instead of returning null +# RCS1210: Return completed task instead of returning null | Property | Value | | -------- | ------- | diff --git a/docs/analyzers/RCS1219.md b/docs/analyzers/RCS1219.md index c5cfc1411a..8bc9e372ae 100644 --- a/docs/analyzers/RCS1219.md +++ b/docs/analyzers/RCS1219.md @@ -1,4 +1,4 @@ -# RCS1219: Call 'Enumerable\.Skip' and 'Enumerable\.Any' instead of 'Enumerable\.Count' +# \[deprecated\] RCS1219: Call 'Enumerable\.Skip' and 'Enumerable\.Any' instead of 'Enumerable\.Count' | Property | Value | | -------- | ----------- | diff --git a/docs/analyzers/RCS1232.md b/docs/analyzers/RCS1232.md index f8c57cb672..f4ab0b5f00 100644 --- a/docs/analyzers/RCS1232.md +++ b/docs/analyzers/RCS1232.md @@ -14,7 +14,7 @@ class C { /// - /// RCS1232 + /// // RCS1232 /// /// void M(object p1, object p2, object p3) diff --git a/docs/analyzers/RCS1233.md b/docs/analyzers/RCS1233.md index 592310f3fc..4c934517ee 100644 --- a/docs/analyzers/RCS1233.md +++ b/docs/analyzers/RCS1233.md @@ -11,7 +11,7 @@ ### Code with Diagnostic ```csharp -boolExpr1 & boolExpr2 RCS1233 +boolExpr1 & boolExpr2 ``` ### Code with Fix @@ -25,7 +25,7 @@ boolExpr1 && boolExpr2 ### Code with Diagnostic ```csharp -boolExpr1 | boolExpr2 RCS1233 +boolExpr1 | boolExpr2 ``` ### Code with Fix diff --git a/docs/analyzers/RCS1234.md b/docs/analyzers/RCS1234.md index 06ab4ee70e..50a5560eef 100644 --- a/docs/analyzers/RCS1234.md +++ b/docs/analyzers/RCS1234.md @@ -15,7 +15,7 @@ enum E { A = 1, B = 2, - C = 2, RCS1234 + C = 2, // RCS1234 } ``` diff --git a/docs/analyzers/RCS1236.md b/docs/analyzers/RCS1236.md index 30cfecabb9..7ac4da58e2 100644 --- a/docs/analyzers/RCS1236.md +++ b/docs/analyzers/RCS1236.md @@ -38,9 +38,22 @@ catch (Exception ex) when (ex is InvalidOperationException) } ``` +## Remarks + +The accepted [answer](https://stackoverflow.com/a/28879616) from Stack Overflow states: +>"If there is an exception thrown within the filter, then that exception will be silently swallowed and the filter simply fails." + +It is impossible to definitely detect if an exception can be thrown within an expression. + +So the expression is considered as the one that can throw an exception if it contains method call that meets one of the following requirements: + +* Its name starts with `ThrowIf`. +* Its XML comment contains `` element. + ## See Also * [What's New in C# 6.0 - Exception Filters](https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-6#exception-filters) +* [Exception filters in C# 6: their biggest advantage is not what you think](https://thomaslevesque.com/2015/06/21/exception-filters-in-c-6/) * [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) diff --git a/docs/analyzers/RCS1240.md b/docs/analyzers/RCS1240.md index 9d8f113c06..4c4d1df086 100644 --- a/docs/analyzers/RCS1240.md +++ b/docs/analyzers/RCS1240.md @@ -11,7 +11,7 @@ ### Code with Diagnostic ```csharp -array.Length <= 0 RCS1240 +array.Length <= 0 ``` ### Code with Fix diff --git a/docs/analyzers/RCS1241.md b/docs/analyzers/RCS1241.md index 77433df5f0..6cad24912b 100644 --- a/docs/analyzers/RCS1241.md +++ b/docs/analyzers/RCS1241.md @@ -22,7 +22,7 @@ public class C { } -public abstract class Comparable : IComparable RCS1241 +public abstract class Comparable : IComparable // RCS1241 { public abstract int CompareTo(C other); } @@ -72,7 +72,7 @@ public class C { } -public abstract class Comparer : IComparer RCS1241 +public abstract class Comparer : IComparer // RCS1241 { public abstract int Compare(C x, C y); } @@ -139,7 +139,7 @@ public class C { } -public abstract class EqualityComparer : IEqualityComparer RCS1241 +public abstract class EqualityComparer : IEqualityComparer // RCS1241 { public abstract bool Equals(C x, C y); diff --git a/docs/analyzers/RCS1244.md b/docs/analyzers/RCS1244.md index 05e333ffeb..7bf1e376c5 100644 --- a/docs/analyzers/RCS1244.md +++ b/docs/analyzers/RCS1244.md @@ -16,9 +16,9 @@ This analyzer is similar to [IDE0034](https://docs.microsoft.com/visualstudio/id ### Code with Diagnostic ```csharp -Foo M(Foo foo = default(Foo)) RCS1244 +Foo M(Foo foo = default(Foo)) // RCS1244 { - return default(Foo); RCS1244 + return default(Foo); // RCS1244 } ``` diff --git a/docs/analyzers/RCS1247.md b/docs/analyzers/RCS1247.md new file mode 100644 index 0000000000..629f2bad21 --- /dev/null +++ b/docs/analyzers/RCS1247.md @@ -0,0 +1,69 @@ +# RCS1247: Fix documentation comment tag + +| Property | Value | +| -------- | ----------- | +| Id | RCS1247 | +| Category | Readability | +| Severity | Info | + +## Examples + +### Code with Diagnostic + +```csharp +/// +/// null // RCS1247 +/// +void M() +{ +} +``` + +### Code with Fix + +```csharp +/// +/// null +/// +void M() +{ +} +``` + +- - - + +### Code with Diagnostic + +```csharp +/// +/// // RCS1247 +/// if (x == null) +/// x = new object(); +/// +/// +void M() +{ +} +``` + +### Code with Fix + +```csharp +/// +/// +/// if (x == null) +/// x = new object(); +/// +/// +void M() +{ +} +``` + +## See Also + +* [Recommended tags for documentation comments (C# programming guide)](https://docs.microsoft.com/dotnet/csharp/programming-guide/xmldoc/recommended-tags-for-documentation-comments) +* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) + + +*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/docs/analyzers/RCS1248.md b/docs/analyzers/RCS1248.md new file mode 100644 index 0000000000..bf40934a54 --- /dev/null +++ b/docs/analyzers/RCS1248.md @@ -0,0 +1,35 @@ +# RCS1248: Use 'is null' pattern instead of comparison \(or vice versa\) + +| Property | Value | +| ------------------------ | ------- | +| Id | RCS1248 | +| Category | Style | +| Severity | None | +| Minimal Language Version | 7\.0 | + +## Example + +### Code with Diagnostic + +```csharp +x == null +``` + +### Code with Fix + +```csharp +x is null +``` + +## Options + +* [RCS1248a](RCS1248a.md) \- Use 'is null' pattern instead of '\!=' operator\. +* [RCS1248i](RCS1248i.md) \- Use comparison instead of 'is null' pattern\. + +## See Also + +* [Analyzer Options](../AnalyzerOptions.md) +* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) + + +*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/docs/analyzers/RCS1248a.md b/docs/analyzers/RCS1248a.md new file mode 100644 index 0000000000..171883d4d2 --- /dev/null +++ b/docs/analyzers/RCS1248a.md @@ -0,0 +1,32 @@ +# RCS1248a: Use 'is null' pattern instead of '\!=' operator + +| Property | Value | +| ------------------------ | -------------- | +| Id | RCS1248a | +| Category | AnalyzerOption | +| Severity | None | +| Minimal Language Version | 7\.0 | + +This option modifies behavior of analyzer [RCS1248](RCS1248.md)\. It requires [RCS1248](RCS1248.md) to be enabled\. + +## Example + +### Code with Diagnostic + +```csharp +x != null +``` + +### Code with Fix + +```csharp +!(x is null) +``` + +## See Also + +* [Analyzer Options](../AnalyzerOptions.md) +* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) + + +*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/docs/analyzers/RCS1248i.md b/docs/analyzers/RCS1248i.md new file mode 100644 index 0000000000..c5966b454f --- /dev/null +++ b/docs/analyzers/RCS1248i.md @@ -0,0 +1,46 @@ +# RCS1248i: Use comparison instead of 'is null' pattern + +| Property | Value | +| ------------------------ | -------------- | +| Id | RCS1248i | +| Category | AnalyzerOption | +| Severity | None | +| Minimal Language Version | 7\.0 | + +This option modifies behavior of analyzer [RCS1248](RCS1248.md)\. It requires [RCS1248](RCS1248.md) to be enabled\. + +## Examples + +### Code with Diagnostic + +```csharp +x is null +``` + +### Code with Fix + +```csharp +x == null +``` + +- - - + +### Code with Diagnostic + +```csharp +!(x is null) +``` + +### Code with Fix + +```csharp +x != null +``` + +## See Also + +* [Analyzer Options](../AnalyzerOptions.md) +* [How to Suppress a Diagnostic](../HowToConfigureAnalyzers.md#how-to-suppress-a-diagnostic) + + +*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/docs/refactorings/RR0037.md b/docs/refactorings/RR0037.md index 743714ed13..0329665482 100644 --- a/docs/refactorings/RR0037.md +++ b/docs/refactorings/RR0037.md @@ -1,15 +1,15 @@ -## Expand expression body +## Convert expression\-body to block body -| Property | Value | -| ------------------ | ---------------------- | -| Id | RR0037 | -| Title | Expand expression body | -| Syntax | expression body | -| Enabled by Default | ✓ | +| Property | Value | +| ------------------ | -------------------------------------- | +| Id | RR0037 | +| Title | Convert expression\-body to block body | +| Syntax | expression body | +| Enabled by Default | ✓ | ### Usage -![Expand expression body](../../images/refactorings/ExpandExpressionBody.png) +![Convert expression-body to block body](../../images/refactorings/ConvertExpressionBodyToBlockBody.png) ## See Also diff --git a/docs/refactorings/RR0039.md b/docs/refactorings/RR0039.md index a513458540..3efac87d47 100644 --- a/docs/refactorings/RR0039.md +++ b/docs/refactorings/RR0039.md @@ -1,16 +1,16 @@ -## Expand lambda expression body +## Convert lambda expression body to block body -| Property | Value | -| ------------------ | ----------------------------- | -| Id | RR0039 | -| Title | Expand lambda expression body | -| Syntax | lambda expression | -| Span | body | -| Enabled by Default | ✓ | +| Property | Value | +| ------------------ | -------------------------------------------- | +| Id | RR0039 | +| Title | Convert lambda expression body to block body | +| Syntax | lambda expression's expression body | +| Span | body | +| Enabled by Default | ✓ | ### Usage -![Expand lambda expression body](../../images/refactorings/ExpandLambdaExpressionBody.png) +![Convert lambda expression body to block body](../../images/refactorings/ConvertLambdaExpressionBodyToBlockBody.png) ## See Also diff --git a/docs/refactorings/RR0048.md b/docs/refactorings/RR0048.md index dba2e8e15b..a11f48863b 100644 --- a/docs/refactorings/RR0048.md +++ b/docs/refactorings/RR0048.md @@ -1,17 +1,45 @@ -## Format argument list +## Wrap arguments -| Property | Value | -| ------------------ | -------------------- | -| Id | RR0048 | -| Title | Format argument list | -| Syntax | argument list | -| Enabled by Default | ✓ | +| Property | Value | +| ------------------ | -------------- | +| Id | RR0048 | +| Title | Wrap arguments | +| Syntax | argument list | +| Enabled by Default | ✓ | ### Usage -![Format argument list](../../images/refactorings/FormatEachArgumentOnSeparateLine.png) +#### Before -![Format argument list](../../images/refactorings/FormatAllArgumentsOnSingleLine.png) +```csharp +M(x, y, z); +``` + +#### After + +```csharp +M( + x, + y, + z); +``` + +- - - + +#### Before + +```csharp +void M( + x, + y, + z); +``` + +#### After + +```csharp +void M(x, y, z); +``` ## See Also diff --git a/docs/refactorings/RR0049.md b/docs/refactorings/RR0049.md index 86d1c8388b..5b24c4f9ae 100644 --- a/docs/refactorings/RR0049.md +++ b/docs/refactorings/RR0049.md @@ -1,15 +1,51 @@ -## Format binary expression +## Wrap binary expression | Property | Value | | ------------------ | ---------------------------------------------------- | | Id | RR0049 | -| Title | Format binary expression | +| Title | Wrap binary expression | | Syntax | logical and/or expression, bitwise and/or expression | | Enabled by Default | ✓ | ### Usage -![Format binary expression](../../images/refactorings/FormatBinaryExpression.png) +#### Before + +```csharp +if (x && y && z) +{ +} +``` + +#### After + +```csharp +if (x + && y + && z) +{ +} +``` + +- - - + +#### Before + +```csharp +if (x + && y + && z) +{ +} +``` + +#### After + +```csharp +if (x && y && z) +{ +} +``` ## See Also diff --git a/docs/refactorings/RR0050.md b/docs/refactorings/RR0050.md index 4f2e661a9d..a680048ecd 100644 --- a/docs/refactorings/RR0050.md +++ b/docs/refactorings/RR0050.md @@ -1,17 +1,27 @@ -## Format conditional expression +## Wrap conditional expression -| Property | Value | -| ------------------ | ----------------------------- | -| Id | RR0050 | -| Title | Format conditional expression | -| Syntax | conditional expression | -| Enabled by Default | ✓ | +| Property | Value | +| ------------------ | --------------------------- | +| Id | RR0050 | +| Title | Wrap conditional expression | +| Syntax | conditional expression | +| Enabled by Default | ✓ | ### Usage -![Format conditional expression](../../images/refactorings/FormatConditionalExpressionOnMultipleLines.png) +#### Before -![Format conditional expression](../../images/refactorings/FormatConditionalExpressionOnSingleLine.png) +```csharp +x ? y : z +``` + +#### After + +```csharp +x + ? y + : z +``` ## See Also diff --git a/docs/refactorings/RR0051.md b/docs/refactorings/RR0051.md index 3d1e9e7b09..413b30d52b 100644 --- a/docs/refactorings/RR0051.md +++ b/docs/refactorings/RR0051.md @@ -1,17 +1,45 @@ -## Format expression chain +## Wrap call chain -| Property | Value | -| ------------------ | ----------------------- | -| Id | RR0051 | -| Title | Format expression chain | -| Syntax | expression chain | -| Enabled by Default | ✓ | +| Property | Value | +| ------------------ | --------------- | +| Id | RR0051 | +| Title | Wrap call chain | +| Syntax | call chain | +| Enabled by Default | ✓ | ### Usage -![Format expression chain](../../images/refactorings/FormatExpressionChainOnMultipleLines.png) +#### Before -![Format expression chain](../../images/refactorings/FormatExpressionChainOnSingleLine.png) +```csharp +x.M().N().O() +``` + +#### After + +```csharp +x + .M() + .N() + .O() +``` + +- - - + +#### Before + +```csharp +x + .M() + .N() + .O() +``` + +#### After + +```csharp +x.M().N().O() +``` ## See Also diff --git a/docs/refactorings/RR0052.md b/docs/refactorings/RR0052.md index 9964eaa6d5..6e6b0779e3 100644 --- a/docs/refactorings/RR0052.md +++ b/docs/refactorings/RR0052.md @@ -1,17 +1,49 @@ -## Format initializer +## Wrap initializer expressions -| Property | Value | -| ------------------ | ------------------ | -| Id | RR0052 | -| Title | Format initializer | -| Syntax | initializer | -| Enabled by Default | ✓ | +| Property | Value | +| ------------------ | ---------------------------- | +| Id | RR0052 | +| Title | Wrap initializer expressions | +| Syntax | initializer | +| Enabled by Default | ✓ | ### Usage -![Format initializer](../../images/refactorings/FormatInitializerOnMultipleLines.png) +#### Before -![Format initializer](../../images/refactorings/FormatInitializerOnSingleLine.png) +```csharp +var x = new string[] { "a", "b", "c" } +``` + +#### After + +```csharp +var x = new string[] +{ + "a", + "b", + "c" +} +``` + +- - - + +#### Before + +```csharp +var x = new string[] +{ + "a", + "b", + "c" +} +``` + +#### After + +```csharp +var x = new string[] { "a", "b", "c" } +``` ## See Also diff --git a/docs/refactorings/RR0053.md b/docs/refactorings/RR0053.md index c4c6eca785..37ad27ed8e 100644 --- a/docs/refactorings/RR0053.md +++ b/docs/refactorings/RR0053.md @@ -1,17 +1,53 @@ -## Format parameter list +## Wrap parameters -| Property | Value | -| ------------------ | --------------------- | -| Id | RR0053 | -| Title | Format parameter list | -| Syntax | parameter list | -| Enabled by Default | ✓ | +| Property | Value | +| ------------------ | --------------- | +| Id | RR0053 | +| Title | Wrap parameters | +| Syntax | parameter list | +| Enabled by Default | ✓ | ### Usage -![Format parameter list](../../images/refactorings/FormatEachParameterOnSeparateLine.png) - -![Format parameter list](../../images/refactorings/FormatAllParametersOnSingleLine.png) +#### Before + +```csharp +void M(object x, object y, object z) +{ +} +``` + +#### After + +```csharp +void M( + object x, + object y, + object z) +{ +} +``` + +- - - + +#### Before + +```csharp +void M( + object x, + object y, + object z) +{ +} +``` + +#### After + +```csharp +void M(object x, object y, object z) +{ +} +``` ## See Also diff --git a/docs/refactorings/RR0137.md b/docs/refactorings/RR0137.md index 52f94ef1d6..a7c25d9c26 100644 --- a/docs/refactorings/RR0137.md +++ b/docs/refactorings/RR0137.md @@ -1,11 +1,11 @@ -## Replace method group with lambda - -| Property | Value | -| ------------------ | -------------------------------- | -| Id | RR0137 | -| Title | Replace method group with lambda | -| Syntax | method group | -| Enabled by Default | ✓ | +## Convert method group to lambda + +| Property | Value | +| ------------------ | ------------------------------ | +| Id | RR0137 | +| Title | Convert method group to lambda | +| Syntax | method group | +| Enabled by Default | ✓ | ### Usage diff --git a/docs/refactorings/RR0152.md b/docs/refactorings/RR0152.md index 6b8e03634e..6c3a8a9aa0 100644 --- a/docs/refactorings/RR0152.md +++ b/docs/refactorings/RR0152.md @@ -1,15 +1,15 @@ -## Reverse 'for' loop +## Reverse 'for' statement -| Property | Value | -| ------------------ | ------------------ | -| Id | RR0152 | -| Title | Reverse 'for' loop | -| Syntax | for statement | -| Enabled by Default | ✓ | +| Property | Value | +| ------------------ | ----------------------- | +| Id | RR0152 | +| Title | Reverse 'for' statement | +| Syntax | for statement | +| Enabled by Default | ✓ | ### Usage -![Reverse 'for' loop](../../images/refactorings/ReverseForLoop.png) +![Reverse 'for' statement](../../images/refactorings/ReverseForStatement.png) ## See Also diff --git a/docs/refactorings/RR0154.md b/docs/refactorings/RR0154.md index 209cfd6904..779bfab745 100644 --- a/docs/refactorings/RR0154.md +++ b/docs/refactorings/RR0154.md @@ -1,16 +1,16 @@ -## Simplify lambda expression +## Convert lambda expression body to expression\-body -| Property | Value | -| ------------------ | --------------------------------------------------------------- | -| Id | RR0154 | -| Title | Simplify lambda expression | -| Syntax | lambda expression with block with single single\-line statement | -| Span | body | -| Enabled by Default | ✓ | +| Property | Value | +| ------------------ | -------------------------------------------------------------------- | +| Id | RR0154 | +| Title | Convert lambda expression body to expression\-body | +| Syntax | lambda expression with block body with single single\-line statement | +| Span | body | +| Enabled by Default | ✓ | ### Usage -![Simplify lambda expression](../../images/refactorings/SimplifyLambdaExpression.png) +![Convert lambda expression body to expression-body](../../images/refactorings/ConvertLambdaExpressionBodyToExpressionBody.png) ## See Also diff --git a/docs/refactorings/RR0169.md b/docs/refactorings/RR0169.md index 235b3fad16..a1dd2253e9 100644 --- a/docs/refactorings/RR0169.md +++ b/docs/refactorings/RR0169.md @@ -1,16 +1,16 @@ -## Use expression\-bodied member +## Convert block body to expression\-body -| Property | Value | -| ------------------ | ----------------------------------- | -| Id | RR0169 | -| Title | Use expression\-bodied member | -| Syntax | method, property, indexer, operator | -| Span | body or accessor list | -| Enabled by Default | ✓ | +| Property | Value | +| ------------------ | -------------------------------------- | +| Id | RR0169 | +| Title | Convert block body to expression\-body | +| Syntax | method, property, indexer, operator | +| Span | body or accessor list | +| Enabled by Default | ✓ | ### Usage -![Use expression-bodied member](../../images/refactorings/UseExpressionBodiedMember.png) +![Convert block body to expression-body](../../images/refactorings/ConvertBlockBodyToExpressionBody.png) ## See Also diff --git a/docs/refactorings/RR0187.md b/docs/refactorings/RR0187.md index 21fc88981b..9e7365d356 100644 --- a/docs/refactorings/RR0187.md +++ b/docs/refactorings/RR0187.md @@ -1,9 +1,9 @@ -## Format constraint clauses +## Wrap constraint clauses | Property | Value | | ------------------ | -------------------------------- | | Id | RR0187 | -| Title | Format constraint clauses | +| Title | Wrap constraint clauses | | Syntax | type parameter constraint clause | | Enabled by Default | ✓ | diff --git a/docs/refactorings/Refactorings.md b/docs/refactorings/Refactorings.md index b3ad837155..906d79bb82 100644 --- a/docs/refactorings/Refactorings.md +++ b/docs/refactorings/Refactorings.md @@ -424,6 +424,12 @@ else } ``` +#### Convert block body to expression\-body \(RR0169\) + +* **Syntax**: method, property, indexer, operator +* **Span**: body or accessor list +![Convert block body to expression-body](../../images/refactorings/ConvertBlockBodyToExpressionBody.png) + #### Convert comment to documentation comment \(RR0192\) * **Syntax**: single\-line comment @@ -469,6 +475,11 @@ while (condition) } ``` +#### Convert expression\-body to block body \(RR0037\) + +* **Syntax**: expression body +![Convert expression-body to block body](../../images/refactorings/ConvertExpressionBodyToBlockBody.png) + #### Convert 'for' to 'foreach' \(RR0130\) * **Syntax**: for statement @@ -601,6 +612,34 @@ $"name: {name,0:f}, value: {value}" string.Format("name: {0,0:f} value: {1}", name, value) ``` +#### Convert lambda expression body to block body \(RR0039\) + +* **Syntax**: lambda expression's expression body +* **Span**: body +![Convert lambda expression body to block body](../../images/refactorings/ConvertLambdaExpressionBodyToBlockBody.png) + +#### Convert lambda expression body to expression\-body \(RR0154\) + +* **Syntax**: lambda expression with block body with single single\-line statement +* **Span**: body +![Convert lambda expression body to expression-body](../../images/refactorings/ConvertLambdaExpressionBodyToExpressionBody.png) + +#### Convert method group to lambda \(RR0137\) + +* **Syntax**: method group + +#### Before + +```csharp +Func func = Foo; +``` + +#### After + +```csharp +Func func = (f, g) => Foo(f, g) +``` + #### Convert null literal to default expression \(RR0139\) * **Syntax**: argument @@ -837,22 +876,11 @@ switch (s) * **Syntax**: event field declaration ![Expand event](../../images/refactorings/ExpandEvent.png) -#### Expand expression body \(RR0037\) - -* **Syntax**: expression body -![Expand expression body](../../images/refactorings/ExpandExpressionBody.png) - #### Expand initializer \(RR0038\) * **Syntax**: initializer ![Expand initializer](../../images/refactorings/ExpandInitializer.png) -#### Expand lambda expression body \(RR0039\) - -* **Syntax**: lambda expression -* **Span**: body -![Expand lambda expression body](../../images/refactorings/ExpandLambdaExpressionBody.png) - #### Expand property \(RR0040\) * **Syntax**: auto\-property @@ -961,69 +989,6 @@ if (y) ![Format accessor braces](../../images/refactorings/FormatAccessorBracesOnSingleLine.png) -#### Format argument list \(RR0048\) - -* **Syntax**: argument list -![Format argument list](../../images/refactorings/FormatEachArgumentOnSeparateLine.png) - -![Format argument list](../../images/refactorings/FormatAllArgumentsOnSingleLine.png) - -#### Format binary expression \(RR0049\) - -* **Syntax**: logical and/or expression, bitwise and/or expression -![Format binary expression](../../images/refactorings/FormatBinaryExpression.png) - -#### Format conditional expression \(RR0050\) - -* **Syntax**: conditional expression -![Format conditional expression](../../images/refactorings/FormatConditionalExpressionOnMultipleLines.png) - -![Format conditional expression](../../images/refactorings/FormatConditionalExpressionOnSingleLine.png) - -#### Format constraint clauses \(RR0187\) - -* **Syntax**: type parameter constraint clause - -#### Before - -```csharp -private void Foo() where T1 : class where T2 : class where T3 : class -{ -} -``` - -#### After - -```csharp -private void Foo() - where T1 : class - where T2 : class - where T3 : class -{ -} -``` - -#### Format expression chain \(RR0051\) - -* **Syntax**: expression chain -![Format expression chain](../../images/refactorings/FormatExpressionChainOnMultipleLines.png) - -![Format expression chain](../../images/refactorings/FormatExpressionChainOnSingleLine.png) - -#### Format initializer \(RR0052\) - -* **Syntax**: initializer -![Format initializer](../../images/refactorings/FormatInitializerOnMultipleLines.png) - -![Format initializer](../../images/refactorings/FormatInitializerOnSingleLine.png) - -#### Format parameter list \(RR0053\) - -* **Syntax**: parameter list -![Format parameter list](../../images/refactorings/FormatEachParameterOnSeparateLine.png) - -![Format parameter list](../../images/refactorings/FormatAllParametersOnSingleLine.png) - #### Generate base constructors \(RR0054\) * **Syntax**: class declaration @@ -1950,22 +1915,6 @@ public enum Foo * **Span**: interpolation ![Replace interpolated string with interpolation expression](../../images/refactorings/ReplaceInterpolatedStringWithInterpolationExpression.png) -#### Replace method group with lambda \(RR0137\) - -* **Syntax**: method group - -#### Before - -```csharp -Func func = Foo; -``` - -#### After - -```csharp -Func func = (f, g) => Foo(f, g) -``` - #### Replace method with property \(RR0138\) * **Syntax**: method @@ -2013,10 +1962,10 @@ object[] arr = null; * **Span**: property header ![Replace property with method](../../images/refactorings/ReplacePropertyWithMethod.png) -#### Reverse 'for' loop \(RR0152\) +#### Reverse 'for' statement \(RR0152\) * **Syntax**: for statement -![Reverse 'for' loop](../../images/refactorings/ReverseForLoop.png) +![Reverse 'for' statement](../../images/refactorings/ReverseForStatement.png) #### Simplify if \(RR0153\) @@ -2024,12 +1973,6 @@ object[] arr = null; * **Span**: top if keyword or selected if statement ![Simplify if](../../images/refactorings/SimplifyIf.png) -#### Simplify lambda expression \(RR0154\) - -* **Syntax**: lambda expression with block with single single\-line statement -* **Span**: body -![Simplify lambda expression](../../images/refactorings/SimplifyLambdaExpression.png) - #### Sort case labels \(RR0207\) * **Syntax**: selected case labels with string literal or enum field @@ -2270,12 +2213,6 @@ using (var en = items.GetEnumerator()) } ``` -#### Use expression\-bodied member \(RR0169\) - -* **Syntax**: method, property, indexer, operator -* **Span**: body or accessor list -![Use expression-bodied member](../../images/refactorings/UseExpressionBodiedMember.png) - #### Use lambda expression instead of anonymous method \(RR0170\) * **Syntax**: anonymous method @@ -2292,6 +2229,161 @@ using (var en = items.GetEnumerator()) * **Syntax**: string concatenation ![Use StringBuilder instead of concatenation](../../images/refactorings/UseStringBuilderInsteadOfConcatenation.png) +#### Wrap arguments \(RR0048\) + +* **Syntax**: argument list + +#### Before + +```csharp +M(x, y, z); +``` + +#### After + +```csharp +M( + x, + y, + z); +``` + +- - - + +#### Before + +```csharp +void M( + x, + y, + z); +``` + +#### After + +```csharp +void M(x, y, z); +``` + +#### Wrap binary expression \(RR0049\) + +* **Syntax**: logical and/or expression, bitwise and/or expression + +#### Before + +```csharp +if (x && y && z) +{ +} +``` + +#### After + +```csharp +if (x + && y + && z) +{ +} +``` + +- - - + +#### Before + +```csharp +if (x + && y + && z) +{ +} +``` + +#### After + +```csharp +if (x && y && z) +{ +} +``` + +#### Wrap call chain \(RR0051\) + +* **Syntax**: call chain + +#### Before + +```csharp +x.M().N().O() +``` + +#### After + +```csharp +x + .M() + .N() + .O() +``` + +- - - + +#### Before + +```csharp +x + .M() + .N() + .O() +``` + +#### After + +```csharp +x.M().N().O() +``` + +#### Wrap conditional expression \(RR0050\) + +* **Syntax**: conditional expression + +#### Before + +```csharp +x ? y : z +``` + +#### After + +```csharp +x + ? y + : z +``` + +#### Wrap constraint clauses \(RR0187\) + +* **Syntax**: type parameter constraint clause + +#### Before + +```csharp +private void Foo() where T1 : class where T2 : class where T3 : class +{ +} +``` + +#### After + +```csharp +private void Foo() + where T1 : class + where T2 : class + where T3 : class +{ +} +``` + #### Wrap in \#if directive \(RR0174\) * **Syntax**: selected lines @@ -2322,5 +2414,89 @@ using (var en = items.GetEnumerator()) * **Syntax**: local declaration of type that implements IDisposable ![Wrap in using statement](../../images/refactorings/WrapInUsingStatement.png) +#### Wrap initializer expressions \(RR0052\) + +* **Syntax**: initializer + +#### Before + +```csharp +var x = new string[] { "a", "b", "c" } +``` + +#### After + +```csharp +var x = new string[] +{ + "a", + "b", + "c" +} +``` + +- - - + +#### Before + +```csharp +var x = new string[] +{ + "a", + "b", + "c" +} +``` + +#### After + +```csharp +var x = new string[] { "a", "b", "c" } +``` + +#### Wrap parameters \(RR0053\) + +* **Syntax**: parameter list + +#### Before + +```csharp +void M(object x, object y, object z) +{ +} +``` + +#### After + +```csharp +void M( + object x, + object y, + object z) +{ +} +``` + +- - - + +#### Before + +```csharp +void M( + object x, + object y, + object z) +{ +} +``` + +#### After + +```csharp +void M(object x, object y, object z) +{ +} +``` + *\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/src/Analyzers.CodeFixes/Analyzers.CodeFixes.csproj b/src/Analyzers.CodeFixes/Analyzers.CodeFixes.csproj index 3789a79108..931e706f1a 100644 --- a/src/Analyzers.CodeFixes/Analyzers.CodeFixes.csproj +++ b/src/Analyzers.CodeFixes/Analyzers.CodeFixes.csproj @@ -5,7 +5,7 @@ - 3.0.0.3 + 3.0.1.0 Roslynator.CSharp.Analyzers.CodeFixes Roslynator.CSharp Roslynator.Analyzers.nuspec diff --git a/src/Analyzers/Analyzers.csproj b/src/Analyzers/Analyzers.csproj index a4752333cf..de944e1a84 100644 --- a/src/Analyzers/Analyzers.csproj +++ b/src/Analyzers/Analyzers.csproj @@ -5,7 +5,7 @@ - 3.0.0.3 + 3.0.1.0 Roslynator.CSharp.Analyzers Roslynator.CSharp false diff --git a/src/Analyzers/README.md b/src/Analyzers/README.md index 81728a73bc..5588e5c50c 100644 --- a/src/Analyzers/README.md +++ b/src/Analyzers/README.md @@ -16,14 +16,14 @@ | RCS1010 | [Use 'var' instead of explicit type (when the type is obvious)](../../docs/analyzers/RCS1010.md) | Simplification | None | | RCS1012 | [Use explicit type instead of 'var' (when the type is obvious)](../../docs/analyzers/RCS1012.md) | Readability | None | | RCS1013 | [Use predefined type](../../docs/analyzers/RCS1013.md) | Usage | None | -| RCS1014 | [Avoid implicitly-typed array](../../docs/analyzers/RCS1014.md) | Readability | None | +| RCS1014 | [Use explicitly typed array (or vice versa)](../../docs/analyzers/RCS1014.md) | Readability | None | | RCS1015 | [Use nameof operator](../../docs/analyzers/RCS1015.md) | Maintainability | Info | -| RCS1016 | [Use expression-bodied member](../../docs/analyzers/RCS1016.md) | Usage | None | -| RCS1017 | [Avoid multiline expression body](../../docs/analyzers/RCS1017.md) | Style | None | -| RCS1018 | [Add accessibility modifiers](../../docs/analyzers/RCS1018.md) | Readability | Info | +| RCS1016 | [Convert block body to expression-body (or vice versa)](../../docs/analyzers/RCS1016.md) | Usage | None | +| RCS1017 | [\[deprecated\] Avoid multiline expression body](../../docs/analyzers/RCS1017.md) | Style | None | +| RCS1018 | [Add accessibility modifiers (or vice versa)](../../docs/analyzers/RCS1018.md) | Readability | Info | | RCS1019 | [Order modifiers](../../docs/analyzers/RCS1019.md) | Readability | None | | RCS1020 | [Simplify Nullable\ to T?](../../docs/analyzers/RCS1020.md) | Simplification | Info | -| RCS1021 | [Simplify lambda expression](../../docs/analyzers/RCS1021.md) | Simplification | Info | +| RCS1021 | [Convert lambda expression body to expression-body](../../docs/analyzers/RCS1021.md) | Simplification | Info | | RCS1031 | [Remove unnecessary braces](../../docs/analyzers/RCS1031.md) | Redundancy | Hidden | | RCS1032 | [Remove redundant parentheses](../../docs/analyzers/RCS1032.md) | Redundancy | Info | | RCS1033 | [Remove redundant boolean literal](../../docs/analyzers/RCS1033.md) | Redundancy | Info | @@ -65,20 +65,20 @@ | RCS1074 | [Remove redundant constructor](../../docs/analyzers/RCS1074.md) | Redundancy | Hidden | | RCS1075 | [Avoid empty catch clause that catches System.Exception](../../docs/analyzers/RCS1075.md) | Design | Warning | | RCS1077 | [Optimize LINQ method call](../../docs/analyzers/RCS1077.md) | Performance | Info | -| RCS1078 | [Use "" instead of string.Empty](../../docs/analyzers/RCS1078.md) | General | None | +| RCS1078 | [Use "" instead of string.Empty (or vice versa)](../../docs/analyzers/RCS1078.md) | General | None | | RCS1079 | [Throwing of new NotImplementedException](../../docs/analyzers/RCS1079.md) | General | Info | | RCS1080 | [Use 'Count/Length' property instead of 'Any' method](../../docs/analyzers/RCS1080.md) | Performance | Info | | RCS1081 | [Split variable declaration](../../docs/analyzers/RCS1081.md) | Readability | None | | RCS1084 | [Use coalesce expression instead of conditional expression](../../docs/analyzers/RCS1084.md) | Simplification | Info | | RCS1085 | [Use auto-implemented property](../../docs/analyzers/RCS1085.md) | Simplification | Info | | RCS1089 | [Use --/++ operator instead of assignment](../../docs/analyzers/RCS1089.md) | Simplification | Info | -| RCS1090 | [Call 'ConfigureAwait(false)'](../../docs/analyzers/RCS1090.md) | Design | Info | +| RCS1090 | [Add call to 'ConfigureAwait' (or vice versa)](../../docs/analyzers/RCS1090.md) | Design | Info | | RCS1091 | [Remove empty region](../../docs/analyzers/RCS1091.md) | Redundancy | Hidden | | RCS1093 | [Remove file with no code](../../docs/analyzers/RCS1093.md) | Redundancy | Info | | RCS1094 | [Declare using directive on top level](../../docs/analyzers/RCS1094.md) | Readability | None | | RCS1096 | [Convert 'HasFlag' call to bitwise operation (or vice versa)](../../docs/analyzers/RCS1096.md) | Performance | Info | | RCS1097 | [Remove redundant 'ToString' call](../../docs/analyzers/RCS1097.md) | Redundancy | Info | -| RCS1098 | [Avoid 'null' on the left side of a binary expression](../../docs/analyzers/RCS1098.md) | Readability | Info | +| RCS1098 | [Constant values should be placed on right side of comparisons](../../docs/analyzers/RCS1098.md) | Readability | Info | | RCS1099 | [Default label should be the last label in a switch section](../../docs/analyzers/RCS1099.md) | Readability | Info | | RCS1100 | [Format documentation summary on a single line](../../docs/analyzers/RCS1100.md) | Formatting | None | | RCS1101 | [Format documentation summary on multiple lines](../../docs/analyzers/RCS1101.md) | Formatting | None | @@ -138,7 +138,7 @@ | RCS1175 | [Unused this parameter](../../docs/analyzers/RCS1175.md) | Redundancy | Info | | RCS1176 | [Use 'var' instead of explicit type (when the type is not obvious)](../../docs/analyzers/RCS1176.md) | Simplification | None | | RCS1177 | [Use 'var' instead of explicit type (in foreach)](../../docs/analyzers/RCS1177.md) | Simplification | None | -| RCS1179 | [Use 'return' instead of assignment](../../docs/analyzers/RCS1179.md) | Simplification | Info | +| RCS1179 | [Unnecessary assignment](../../docs/analyzers/RCS1179.md) | Simplification | Info | | RCS1180 | [Inline lazy initialization](../../docs/analyzers/RCS1180.md) | Simplification | Info | | RCS1181 | [Convert comment to documentation comment](../../docs/analyzers/RCS1181.md) | General | Hidden | | RCS1182 | [Remove redundant base interface](../../docs/analyzers/RCS1182.md) | Redundancy | Hidden | @@ -155,7 +155,7 @@ | RCS1196 | [Call extension method as instance method](../../docs/analyzers/RCS1196.md) | Style | Info | | RCS1197 | [Optimize StringBuilder.Append/AppendLine call](../../docs/analyzers/RCS1197.md) | Performance | Info | | RCS1198 | [Avoid unnecessary boxing of value type](../../docs/analyzers/RCS1198.md) | Performance | None | -| RCS1199 | [Simplify boolean expression](../../docs/analyzers/RCS1199.md) | Simplification | Info | +| RCS1199 | [Unncessary null check](../../docs/analyzers/RCS1199.md) | Redundancy | Info | | RCS1200 | [Call 'Enumerable.ThenBy' instead of 'Enumerable.OrderBy'](../../docs/analyzers/RCS1200.md) | Usage | Info | | RCS1201 | [Use method chaining](../../docs/analyzers/RCS1201.md) | Simplification | Hidden | | RCS1202 | [Avoid NullReferenceException](../../docs/analyzers/RCS1202.md) | Usage | Info | @@ -163,10 +163,10 @@ | RCS1204 | [Use EventArgs.Empty](../../docs/analyzers/RCS1204.md) | Usage | Info | | RCS1205 | [Order named arguments according to the order of parameters](../../docs/analyzers/RCS1205.md) | Readability | Info | | RCS1206 | [Use conditional access instead of conditional expression](../../docs/analyzers/RCS1206.md) | Usage | Info | -| RCS1207 | [Convert anonymous function to method group](../../docs/analyzers/RCS1207.md) | Simplification | Hidden | +| RCS1207 | [Convert anonymous function to method group (or vice versa)](../../docs/analyzers/RCS1207.md) | Simplification | None | | RCS1208 | [Reduce 'if' nesting](../../docs/analyzers/RCS1208.md) | Style | None | | RCS1209 | [Order type parameter constraints](../../docs/analyzers/RCS1209.md) | Readability | Info | -| RCS1210 | [Return Task.FromResult instead of returning null](../../docs/analyzers/RCS1210.md) | Usage | Warning | +| RCS1210 | [Return completed task instead of returning null](../../docs/analyzers/RCS1210.md) | Usage | Warning | | RCS1211 | [Remove unnecessary 'else'](../../docs/analyzers/RCS1211.md) | Redundancy | Hidden | | RCS1212 | [Remove redundant assignment](../../docs/analyzers/RCS1212.md) | Redundancy | Info | | RCS1213 | [Remove unused member declaration](../../docs/analyzers/RCS1213.md) | Redundancy | Info | @@ -175,7 +175,6 @@ | RCS1216 | [Unnecessary unsafe context](../../docs/analyzers/RCS1216.md) | Redundancy | Info | | RCS1217 | [Convert interpolated string to concatenation](../../docs/analyzers/RCS1217.md) | Readability | Hidden | | RCS1218 | [Simplify code branching](../../docs/analyzers/RCS1218.md) | Readability | Info | -| RCS1219 | [Call 'Enumerable.Skip' and 'Enumerable.Any' instead of 'Enumerable.Count'](../../docs/analyzers/RCS1219.md) | Performance | None | | RCS1220 | [Use pattern matching instead of combination of 'is' operator and cast operator](../../docs/analyzers/RCS1220.md) | Usage | Info | | RCS1221 | [Use pattern matching instead of combination of 'as' operator and null check](../../docs/analyzers/RCS1221.md) | Usage | Info | | RCS1222 | [Merge preprocessor directives](../../docs/analyzers/RCS1222.md) | Readability | Info | @@ -202,6 +201,8 @@ | RCS1243 | [Duplicate word in a comment](../../docs/analyzers/RCS1243.md) | General | Info | | RCS1244 | [Simplify 'default' expression](../../docs/analyzers/RCS1244.md) | Simplification | Hidden | | RCS1246 | [Use element access](../../docs/analyzers/RCS1246.md) | Usage | Info | +| RCS1247 | [Fix documentation comment tag](../../docs/analyzers/RCS1247.md) | Readability | Info | +| RCS1248 | [Use 'is null' pattern instead of comparison (or vice versa)](../../docs/analyzers/RCS1248.md) | Style | None | *\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/src/CSharp.Workspaces/CSharp.Workspaces.csproj b/src/CSharp.Workspaces/CSharp.Workspaces.csproj index dc83f8580f..212841cb1d 100644 --- a/src/CSharp.Workspaces/CSharp.Workspaces.csproj +++ b/src/CSharp.Workspaces/CSharp.Workspaces.csproj @@ -5,7 +5,7 @@ - 1.0.0.27 + 1.0.0.28 Roslynator.CSharp.Workspaces Roslynator ..\api.ruleset diff --git a/src/CSharp/CSharp.csproj b/src/CSharp/CSharp.csproj index fcd6292520..034618ce7d 100644 --- a/src/CSharp/CSharp.csproj +++ b/src/CSharp/CSharp.csproj @@ -5,7 +5,7 @@ - 1.0.0.27 + 1.0.0.28 Roslynator.CSharp Roslynator ..\api.ruleset diff --git a/src/CodeFixes/CodeFixes.csproj b/src/CodeFixes/CodeFixes.csproj index 3b223d8051..796e1b614e 100644 --- a/src/CodeFixes/CodeFixes.csproj +++ b/src/CodeFixes/CodeFixes.csproj @@ -5,7 +5,7 @@ - 3.0.0.3 + 3.0.1.0 Roslynator.CSharp.CodeFixes Roslynator.CSharp.CodeFixes Roslynator.CodeFixes.nuspec diff --git a/src/Common/Common.csproj b/src/Common/Common.csproj index 6fb417b256..d65fc17fc5 100644 --- a/src/Common/Common.csproj +++ b/src/Common/Common.csproj @@ -5,7 +5,7 @@ - 3.0.0.3 + 3.0.1.0 Roslynator.Common Roslynator diff --git a/src/Core/Core.csproj b/src/Core/Core.csproj index cb4d660f2c..a5852a1937 100644 --- a/src/Core/Core.csproj +++ b/src/Core/Core.csproj @@ -5,7 +5,7 @@ - 1.0.0.27 + 1.0.0.28 Roslynator.Core Roslynator ..\api.ruleset diff --git a/src/Formatting.Analyzers.CodeFixes/Formatting.Analyzers.CodeFixes.csproj b/src/Formatting.Analyzers.CodeFixes/Formatting.Analyzers.CodeFixes.csproj index be56c4889c..989ebe64ce 100644 --- a/src/Formatting.Analyzers.CodeFixes/Formatting.Analyzers.CodeFixes.csproj +++ b/src/Formatting.Analyzers.CodeFixes/Formatting.Analyzers.CodeFixes.csproj @@ -5,7 +5,7 @@ - 1.0.0.2 + 1.0.0.3 Roslynator.Formatting.Analyzers.CodeFixes Roslynator.Formatting Roslynator.Formatting.Analyzers.nuspec diff --git a/src/Formatting.Analyzers/Formatting.Analyzers.csproj b/src/Formatting.Analyzers/Formatting.Analyzers.csproj index bcc8e306e9..3a89be7b9f 100644 --- a/src/Formatting.Analyzers/Formatting.Analyzers.csproj +++ b/src/Formatting.Analyzers/Formatting.Analyzers.csproj @@ -5,7 +5,7 @@ - 1.0.0.2 + 1.0.0.3 Roslynator.Formatting.Analyzers Roslynator.Formatting false diff --git a/src/Formatting.Analyzers/README.md b/src/Formatting.Analyzers/README.md index d8f9e4e31f..82484fbf71 100644 --- a/src/Formatting.Analyzers/README.md +++ b/src/Formatting.Analyzers/README.md @@ -43,11 +43,15 @@ | RCS0044 | [Use carriage return + linefeed as newline](../../docs/analyzers/RCS0044.md) | Formatting | None | | RCS0045 | [Use linefeed as newline](../../docs/analyzers/RCS0045.md) | Formatting | None | | RCS0046 | [Use spaces instead of tab](../../docs/analyzers/RCS0046.md) | Formatting | None | -| RCS0047 | [Wrap and indent each node in list](../../docs/analyzers/RCS0047.md) | Formatting | None | +| RCS0047 | [\[deprecated\] Wrap and indent each node in list](../../docs/analyzers/RCS0047.md) | Formatting | None | | RCS0048 | [Remove newlines from initializer with single-line expression](../../docs/analyzers/RCS0048.md) | Formatting | None | | RCS0049 | [Add empty line after top comment](../../docs/analyzers/RCS0049.md) | Formatting | None | | RCS0050 | [Add empty line before top declaration](../../docs/analyzers/RCS0050.md) | Formatting | None | | RCS0051 | [Add newline between closing brace and 'while' keyword (or vice versa)](../../docs/analyzers/RCS0051.md) | Formatting | None | +| RCS0052 | [Add newline before equals sign instead of after it (or vice versa)](../../docs/analyzers/RCS0052.md) | Formatting | None | +| RCS0053 | [Fix formatting of a list](../../docs/analyzers/RCS0053.md) | Formatting | None | +| RCS0054 | [Fix formatting of a call chain](../../docs/analyzers/RCS0054.md) | Formatting | None | +| RCS0055 | [Fix formatting of a binary expression chain](../../docs/analyzers/RCS0055.md) | Formatting | None | *\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/src/Refactorings/README.md b/src/Refactorings/README.md index 5da5b1ebdc..51a5af3887 100644 --- a/src/Refactorings/README.md +++ b/src/Refactorings/README.md @@ -22,7 +22,6 @@ | RR0178 | [Add type parameter](../../docs/refactorings/RR0178.md) | ✓ | | RR0013 | [Add using directive](../../docs/refactorings/RR0013.md) | ✓ | | RR0014 | [Add using static directive](../../docs/refactorings/RR0014.md) | ✓ | -| RR0015 | [Call 'ConfigureAwait(false)'](../../docs/refactorings/RR0015.md) | ✓ | | RR0016 | [Call extension method as instance method](../../docs/refactorings/RR0016.md) | ✓ | | RR0144 | [Call string.IndexOf instead of string.Contains](../../docs/refactorings/RR0144.md) | ✓ | | RR0017 | [Call 'To...' method (ToString, ToArray, ToList)](../../docs/refactorings/RR0017.md) | ✓ | @@ -39,8 +38,10 @@ | RR0171 | [Convert "" to string.Empty](../../docs/refactorings/RR0171.md) | \- | | RR0143 | [Convert '(yield) return' to 'if'](../../docs/refactorings/RR0143.md) | ✓ | | RR0120 | [Convert ?: to if-else](../../docs/refactorings/RR0120.md) | ✓ | +| RR0169 | [Convert block body to expression-body](../../docs/refactorings/RR0169.md) | ✓ | | RR0192 | [Convert comment to documentation comment](../../docs/refactorings/RR0192.md) | ✓ | | RR0123 | [Convert 'do' to 'while'](../../docs/refactorings/RR0123.md) | ✓ | +| RR0037 | [Convert expression-body to block body](../../docs/refactorings/RR0037.md) | ✓ | | RR0130 | [Convert 'for' to 'foreach'](../../docs/refactorings/RR0130.md) | ✓ | | RR0131 | [Convert 'for' to 'while'](../../docs/refactorings/RR0131.md) | ✓ | | RR0129 | [Convert 'foreach' to 'for'](../../docs/refactorings/RR0129.md) | ✓ | @@ -52,6 +53,9 @@ | RR0193 | [Convert interpolated string to concatenation](../../docs/refactorings/RR0193.md) | ✓ | | RR0136 | [Convert interpolated string to string literal](../../docs/refactorings/RR0136.md) | ✓ | | RR0201 | [Convert interpolated string to 'string.Format'](../../docs/refactorings/RR0201.md) | ✓ | +| RR0039 | [Convert lambda expression body to block body](../../docs/refactorings/RR0039.md) | ✓ | +| RR0154 | [Convert lambda expression body to expression-body](../../docs/refactorings/RR0154.md) | ✓ | +| RR0137 | [Convert method group to lambda](../../docs/refactorings/RR0137.md) | ✓ | | RR0139 | [Convert null literal to default expression](../../docs/refactorings/RR0139.md) | ✓ | | RR0142 | [Convert regular string literal to verbatim string literal](../../docs/refactorings/RR0142.md) | ✓ | | RR0211 | [Convert statements to if-else](../../docs/refactorings/RR0211.md) | ✓ | @@ -71,9 +75,7 @@ | RR0035 | [Expand coalesce expression](../../docs/refactorings/RR0035.md) | ✓ | | RR0034 | [Expand compound assignment operator](../../docs/refactorings/RR0034.md) | ✓ | | RR0036 | [Expand event](../../docs/refactorings/RR0036.md) | ✓ | -| RR0037 | [Expand expression body](../../docs/refactorings/RR0037.md) | ✓ | | RR0038 | [Expand initializer](../../docs/refactorings/RR0038.md) | ✓ | -| RR0039 | [Expand lambda expression body](../../docs/refactorings/RR0039.md) | ✓ | | RR0040 | [Expand property](../../docs/refactorings/RR0040.md) | ✓ | | RR0041 | [Expand property and add backing field](../../docs/refactorings/RR0041.md) | ✓ | | RR0203 | [Extract event handler method](../../docs/refactorings/RR0203.md) | ✓ | @@ -81,13 +83,6 @@ | RR0044 | [Extract generic type](../../docs/refactorings/RR0044.md) | ✓ | | RR0045 | [Extract statement(s)](../../docs/refactorings/RR0045.md) | ✓ | | RR0046 | [Extract type declaration to a new file](../../docs/refactorings/RR0046.md) | ✓ | -| RR0048 | [Format argument list](../../docs/refactorings/RR0048.md) | ✓ | -| RR0049 | [Format binary expression](../../docs/refactorings/RR0049.md) | ✓ | -| RR0050 | [Format conditional expression](../../docs/refactorings/RR0050.md) | ✓ | -| RR0187 | [Format constraint clauses](../../docs/refactorings/RR0187.md) | ✓ | -| RR0051 | [Format expression chain](../../docs/refactorings/RR0051.md) | ✓ | -| RR0052 | [Format initializer](../../docs/refactorings/RR0052.md) | ✓ | -| RR0053 | [Format parameter list](../../docs/refactorings/RR0053.md) | ✓ | | RR0054 | [Generate base constructors](../../docs/refactorings/RR0054.md) | ✓ | | RR0055 | [Generate combined enum member](../../docs/refactorings/RR0055.md) | ✓ | | RR0056 | [Generate enum member](../../docs/refactorings/RR0056.md) | ✓ | @@ -171,14 +166,12 @@ | RR0125 | [Replace equals expression with string.IsNullOrEmpty](../../docs/refactorings/RR0125.md) | ✓ | | RR0126 | [Replace equals expression with string.IsNullOrWhiteSpace](../../docs/refactorings/RR0126.md) | ✓ | | RR0135 | [Replace interpolated string with interpolation expression](../../docs/refactorings/RR0135.md) | ✓ | -| RR0137 | [Replace method group with lambda](../../docs/refactorings/RR0137.md) | ✓ | | RR0138 | [Replace method with property](../../docs/refactorings/RR0138.md) | \- | | RR0185 | [Replace object creation with default value](../../docs/refactorings/RR0185.md) | ✓ | | RR0140 | [Replace prefix operator to postfix operator](../../docs/refactorings/RR0140.md) | ✓ | | RR0141 | [Replace property with method](../../docs/refactorings/RR0141.md) | ✓ | -| RR0152 | [Reverse 'for' loop](../../docs/refactorings/RR0152.md) | ✓ | +| RR0152 | [Reverse 'for' statement](../../docs/refactorings/RR0152.md) | ✓ | | RR0153 | [Simplify if](../../docs/refactorings/RR0153.md) | ✓ | -| RR0154 | [Simplify lambda expression](../../docs/refactorings/RR0154.md) | ✓ | | RR0207 | [Sort case labels](../../docs/refactorings/RR0207.md) | ✓ | | RR0155 | [Sort member declarations](../../docs/refactorings/RR0155.md) | ✓ | | RR0156 | [Split attributes](../../docs/refactorings/RR0156.md) | ✓ | @@ -191,21 +184,26 @@ | RR0161 | [Swap member declarations](../../docs/refactorings/RR0161.md) | ✓ | | RR0200 | [Uncomment multi-line comment](../../docs/refactorings/RR0200.md) | ✓ | | RR0163 | [Uncomment single-line comment](../../docs/refactorings/RR0163.md) | ✓ | -| RR0168 | [Use "" instead of string.Empty](../../docs/refactorings/RR0168.md) | ✓ | | RR0191 | [Use C# 6.0 dictionary initializer](../../docs/refactorings/RR0191.md) | ✓ | | RR0165 | [Use coalesce expression instead of if](../../docs/refactorings/RR0165.md) | ✓ | | RR0128 | [Use constant instead of field](../../docs/refactorings/RR0128.md) | ✓ | | RR0167 | [Use element access instead of 'First/Last'ElementAt' method](../../docs/refactorings/RR0167.md) | ✓ | | RR0206 | [Use enumerator explicitly](../../docs/refactorings/RR0206.md) | ✓ | -| RR0169 | [Use expression-bodied member](../../docs/refactorings/RR0169.md) | ✓ | | RR0170 | [Use lambda expression instead of anonymous method](../../docs/refactorings/RR0170.md) | ✓ | | RR0183 | [Use List\ instead of yield](../../docs/refactorings/RR0183.md) | ✓ | | RR0182 | [Use StringBuilder instead of concatenation](../../docs/refactorings/RR0182.md) | ✓ | +| RR0048 | [Wrap arguments](../../docs/refactorings/RR0048.md) | ✓ | +| RR0049 | [Wrap binary expression](../../docs/refactorings/RR0049.md) | ✓ | +| RR0051 | [Wrap call chain](../../docs/refactorings/RR0051.md) | ✓ | +| RR0050 | [Wrap conditional expression](../../docs/refactorings/RR0050.md) | ✓ | +| RR0187 | [Wrap constraint clauses](../../docs/refactorings/RR0187.md) | ✓ | | RR0174 | [Wrap in #if directive](../../docs/refactorings/RR0174.md) | ✓ | | RR0172 | [Wrap in condition](../../docs/refactorings/RR0172.md) | ✓ | | RR0175 | [Wrap in region](../../docs/refactorings/RR0175.md) | ✓ | | RR0176 | [Wrap in try-catch](../../docs/refactorings/RR0176.md) | ✓ | | RR0177 | [Wrap in using statement](../../docs/refactorings/RR0177.md) | ✓ | +| RR0052 | [Wrap initializer expressions](../../docs/refactorings/RR0052.md) | ✓ | +| RR0053 | [Wrap parameters](../../docs/refactorings/RR0053.md) | ✓ | *\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/src/Refactorings/Refactorings.csproj b/src/Refactorings/Refactorings.csproj index d8acc4bc91..86b0ecd81f 100644 --- a/src/Refactorings/Refactorings.csproj +++ b/src/Refactorings/Refactorings.csproj @@ -5,7 +5,7 @@ - 3.0.0.3 + 3.0.1.0 Roslynator.CSharp.Refactorings Roslynator.CSharp.Refactorings diff --git a/src/Tools/MetadataGenerator/Program.cs b/src/Tools/MetadataGenerator/Program.cs index d17efacd02..cfc86dfa02 100644 --- a/src/Tools/MetadataGenerator/Program.cs +++ b/src/Tools/MetadataGenerator/Program.cs @@ -7,6 +7,7 @@ using System.IO; using System.Linq; using System.Text; +using System.Text.RegularExpressions; using System.Threading.Tasks; using Microsoft.Build.Locator; using Microsoft.CodeAnalysis; @@ -144,6 +145,8 @@ private static async Task Main(string[] args) } } + UpdateChangeLog(); + void WriteAnalyzerMarkdowns(IEnumerable analyzers, IEnumerable<(string title, string url)> appliesTo = null) { foreach (AnalyzerMetadata analyzer in analyzers) @@ -208,6 +211,41 @@ void WriteAnalyzersReadMe(string path, ImmutableArray descript MarkdownGenerator.CreateAnalyzersReadMe(descriptors.Where(f => !f.IsObsolete), title, comparer)); } + void UpdateChangeLog() + { + var issueRegex = new Regex(@"\(\#(?\d+)\)"); + var analyzerRegex = new Regex(@"(\p{Lu}\p{Ll}+){2,}\ +\((?RCS\d{4}[a-z]?)\)"); + + string path = GetPath(@"..\ChangeLog.md"); + string s = File.ReadAllText(path, _utf8NoBom); + + List allAnalyzers = analyzers + .Concat(formattingAnalyzers) + .Concat(codeAnalysisAnalyzers) + .ToList(); + + ImmutableDictionary dic = allAnalyzers + .Concat(allAnalyzers.SelectMany(f => f.OptionAnalyzers)) + .ToImmutableDictionary(f => f.Id, f => f); + + s = issueRegex.Replace(s, "([issue](https://github.com/JosefPihrt/Roslynator/issues/${issue}))"); + + s = analyzerRegex.Replace( + s, + m => + { + string id = m.Groups["id"].Value; + + Debug.Assert(dic.ContainsKey(id), id); + + AnalyzerMetadata analyzer = dic[id]; + + return $"[{id}](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/{id}.md) ({analyzer.Title.TrimEnd('.')})"; + }); + + File.WriteAllText(path, s, _utf8NoBom); + } + void WriteAllText(string relativePath, string content, bool onlyIfChanges = true, bool fileMustExists = true) { string path = GetPath(relativePath); diff --git a/src/Tools/RuleSetGenerator/Program.cs b/src/Tools/RuleSetGenerator/Program.cs index 0a0fbcc742..1f09243fd9 100644 --- a/src/Tools/RuleSetGenerator/Program.cs +++ b/src/Tools/RuleSetGenerator/Program.cs @@ -14,9 +14,9 @@ internal static class Program { private static void Main(string[] args) { + string action = null; #if DEBUG string rootPath = @"..\..\..\..\.."; - string action = null; #else string rootPath = System.Environment.CurrentDirectory; #endif diff --git a/src/VisualBasic.Workspaces/VisualBasic.Workspaces.csproj b/src/VisualBasic.Workspaces/VisualBasic.Workspaces.csproj index 63ea7a9dc8..41ebb2fe49 100644 --- a/src/VisualBasic.Workspaces/VisualBasic.Workspaces.csproj +++ b/src/VisualBasic.Workspaces/VisualBasic.Workspaces.csproj @@ -5,7 +5,7 @@ - 1.0.0.27 + 1.0.0.28 Roslynator.VisualBasic.Workspaces Roslynator ..\api.ruleset diff --git a/src/VisualBasic/VisualBasic.csproj b/src/VisualBasic/VisualBasic.csproj index 58f19bd91a..e50b4dfa74 100644 --- a/src/VisualBasic/VisualBasic.csproj +++ b/src/VisualBasic/VisualBasic.csproj @@ -5,7 +5,7 @@ - 1.0.0.27 + 1.0.0.28 Roslynator.VisualBasic Roslynator ..\api.ruleset diff --git a/src/VisualStudio.Common/Properties/AssemblyInfo.cs b/src/VisualStudio.Common/Properties/AssemblyInfo.cs index ed314a9aaf..57373d0247 100644 --- a/src/VisualStudio.Common/Properties/AssemblyInfo.cs +++ b/src/VisualStudio.Common/Properties/AssemblyInfo.cs @@ -36,5 +36,5 @@ // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("3.0.0.0")] +[assembly: AssemblyVersion("3.0.1.0")] //[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/VisualStudio.Refactorings/Properties/AssemblyInfo.cs b/src/VisualStudio.Refactorings/Properties/AssemblyInfo.cs index 125851495e..3f2ba6eea1 100644 --- a/src/VisualStudio.Refactorings/Properties/AssemblyInfo.cs +++ b/src/VisualStudio.Refactorings/Properties/AssemblyInfo.cs @@ -31,6 +31,6 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.0.0.0")] +[assembly: AssemblyVersion("3.0.1.0")] //[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: NeutralResourcesLanguage("en-US")] diff --git a/src/VisualStudio.Refactorings/source.extension.vsixmanifest b/src/VisualStudio.Refactorings/source.extension.vsixmanifest index 46705e76e9..14759b31a1 100644 --- a/src/VisualStudio.Refactorings/source.extension.vsixmanifest +++ b/src/VisualStudio.Refactorings/source.extension.vsixmanifest @@ -1,7 +1,7 @@  - + Roslynator Refactorings 2019 A collection of 300+ refactorings and fixes for C#, powered by Roslyn. http://github.com/JosefPihrt/Roslynator diff --git a/src/VisualStudio/Properties/AssemblyInfo.cs b/src/VisualStudio/Properties/AssemblyInfo.cs index 6e5ff849dd..524f143ad1 100644 --- a/src/VisualStudio/Properties/AssemblyInfo.cs +++ b/src/VisualStudio/Properties/AssemblyInfo.cs @@ -31,6 +31,6 @@ // Build Number // Revision // -[assembly: AssemblyVersion("3.0.0.0")] +[assembly: AssemblyVersion("3.0.1.0")] //[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: NeutralResourcesLanguage("en-US")] diff --git a/src/VisualStudio/source.extension.vsixmanifest b/src/VisualStudio/source.extension.vsixmanifest index e00302c5ee..490c86f5fe 100644 --- a/src/VisualStudio/source.extension.vsixmanifest +++ b/src/VisualStudio/source.extension.vsixmanifest @@ -1,7 +1,7 @@  - + Roslynator 2019 A collection of 500+ analyzers, refactorings and fixes for C#, powered by Roslyn. http://github.com/JosefPihrt/Roslynator diff --git a/src/VisualStudioCode/VisualStudioCode.csproj b/src/VisualStudioCode/VisualStudioCode.csproj index 113b868450..a9b43e4767 100644 --- a/src/VisualStudioCode/VisualStudioCode.csproj +++ b/src/VisualStudioCode/VisualStudioCode.csproj @@ -5,7 +5,7 @@ - 3.0.0.0 + 3.0.1.0 Roslynator.VisualStudioCode Roslynator false diff --git a/src/VisualStudioCode/package/CHANGELOG.md b/src/VisualStudioCode/package/CHANGELOG.md index 38eac1f210..bb9f29cb54 100644 --- a/src/VisualStudioCode/package/CHANGELOG.md +++ b/src/VisualStudioCode/package/CHANGELOG.md @@ -1,3 +1,30 @@ +## 3.0.1 (2020-10-19) + +* Add analyzer [RCS0055](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS0055.md) (Fix formatting of a binary expression chain) +* Add analyzer [RCS0054](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS0054.md) (Fix formatting of a call chain) +* Add analyzer [RCS0053](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS0053.md) (Fix formatting of a list) +* Add analyzer [RCS0052](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS0052.md) (Add newline before equals sign instead of after it (or vice versa)) +* Add analyzer [RCS1248](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1248.md) (Use 'is null' pattern instead of comparison (or vice versa)) ([issue](https://github.com/JosefPihrt/Roslynator/issues/458)) +* Add analyzer [RCS1247](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1247.md) (Fix documentation comment tag) +* Add analyzer option [RCS1207i](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1207i.md) (Convert method group to anonymous function) +* Add analyzer option [RCS1090i](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1090i.md) (Remove call to 'ConfigureAwait') +* Add analyzer option [RCS1018i](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1018i.md) (Remove accessibility modifiers) ([issue](https://github.com/JosefPihrt/Roslynator/issues/260)) +* Add analyzer option [RCS1014i](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1014i.md) (Use implicitly typed array) +* Add analyzer option [RCS1014a](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1014a.md) (Use implicitly typed array (when type is obvious)) +* Add analyzer option [RCS1078i](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1078i.md) (Use string.Empty instead of "") +* Add analyzer option [RCS1016a](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1016a.md) (Convert expression-body to block body when expression is multi-line) +* Add analyzer option [RCS1016b](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1016b.md) (Convert expression-body to block body when declaration is multi-line) +* Disable by default analyzer [RCS1207i](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1207i.md) (Convert method group to anonymous function) +* Remove analyzer [RCS1219](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1219.md) (Call 'Enumerable.Skip' and 'Enumerable.Any' instead of 'Enumerable.Count') +* Rename analyzer "Avoid 'null' on left side of binary expression" to "Constant values should be placed on right side of comparisons" [RCS1098](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1098.md) +* Rename analyzer "Simplify boolean expression" to "Unncessary null check" [RCS1199](https://github.com/JosefPihrt/Roslynator/blob/master/docs/analyzers/RCS1199.md) ([issue](https://github.com/JosefPihrt/Roslynator/issues/373)) + +* More syntax is considered as having obvious type: + * string literal + * character literal + * boolean literal + * implicit array creation that contains only expressions whose type is obvious + ## 3.0.0 (2020-06-16) * Update references to Roslyn API to 3.5.0 diff --git a/src/VisualStudioCode/package/package-lock.json b/src/VisualStudioCode/package/package-lock.json index 67b1041cb5..582a1b561b 100644 --- a/src/VisualStudioCode/package/package-lock.json +++ b/src/VisualStudioCode/package/package-lock.json @@ -1,6 +1,6 @@ { "name": "roslynator", - "version": "3.0.0", + "version": "3.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/src/VisualStudioCode/package/package.json b/src/VisualStudioCode/package/package.json index 5e79b5fa9d..f1ae71caf6 100644 --- a/src/VisualStudioCode/package/package.json +++ b/src/VisualStudioCode/package/package.json @@ -4,7 +4,7 @@ "displayName": "Roslynator", "description": "A collection of 500+ analyzers, refactorings and fixes for C#, powered by Roslyn.", "icon": "images/icon.png", - "version": "3.0.0", + "version": "3.0.1", "author": "Josef Pihrt", "license": "SEE LICENSE IN LICENSE.TXT", "homepage": "https://github.com/josefpihrt/roslynator", diff --git a/src/Workspaces.Common/Workspaces.Common.csproj b/src/Workspaces.Common/Workspaces.Common.csproj index 8d8bf41d48..a612288496 100644 --- a/src/Workspaces.Common/Workspaces.Common.csproj +++ b/src/Workspaces.Common/Workspaces.Common.csproj @@ -5,7 +5,7 @@ - 3.0.0.3 + 3.0.1.0 Roslynator.Workspaces.Common Roslynator diff --git a/src/Workspaces.Core/Workspaces.Core.csproj b/src/Workspaces.Core/Workspaces.Core.csproj index 32d404081e..92acb083ec 100644 --- a/src/Workspaces.Core/Workspaces.Core.csproj +++ b/src/Workspaces.Core/Workspaces.Core.csproj @@ -5,7 +5,7 @@ - 1.0.0.27 + 1.0.0.28 Roslynator.Workspaces.Core Roslynator ..\api.ruleset diff --git a/tools/build.cmd b/tools/build.cmd index 53866a06a0..d898f80cf3 100644 --- a/tools/build.cmd +++ b/tools/build.cmd @@ -3,7 +3,7 @@ set _msbuildPath="C:\Program Files\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild" set _properties=Configuration=Release,Deterministic=true,TreatWarningsAsErrors=true,WarningsNotAsErrors=1591 set _outDir=..\out\Release -set _version=3.0.0 +set _version=3.0.1 orang delete "..\src" -a d -n "bin,obj" l li e -i "packages,node_modules" l li e ne -t n --content-only -y su s diff --git a/tools/update_version.cmd b/tools/update_version.cmd index 504a99f0f8..e57c17b629 100644 --- a/tools/update_version.cmd +++ b/tools/update_version.cmd @@ -2,9 +2,10 @@ rem dotnet install tool -g orang.dotnet.cli -set _apiVersion=1.0.0.27 -set _version=3.0.0.3 -set _version3=3.0.0 +set _apiVersion=1.0.0.28 +set _formattingVersion=1.0.0.3 +set _version=3.0.1.0 +set _version3=3.0.1 set _root=..\src set _options=from-file -t m r -y trim-line -v n -o "orang.log" v=di @@ -37,6 +38,15 @@ orang replace ^ echo. +orang replace ^ + "%_root%\Formatting.Analyzers\Formatting.Analyzers.csproj" ^ + "%_root%\Formatting.Analyzers.CodeFixes\Formatting.Analyzers.CodeFixes.csproj" ^ + -c "patterns\csproj_version.txt" ^ + %_options% ^ + -r %_formattingVersion% + +echo. + orang replace ^ "%_root%\VisualStudio\source.extension.vsixmanifest" ^ "%_root%\VisualStudio.Refactorings\source.extension.vsixmanifest" ^