From 56128e43a83749379e54e854a74451d5e6609422 Mon Sep 17 00:00:00 2001 From: Josef Pihrt Date: Mon, 24 Apr 2023 15:11:32 +0200 Subject: [PATCH] Release 4.3.0 (CLI 0.6.0) (#1080) --- ChangeLog.md | 20 +- README.md | 2 +- docs/AnalyzersVsRefactorings.md | 2 +- docs/HowToUpdateDocumentation.md | 4 +- docs/README.md | 6 +- docs/analyzers/RCSXXXX.md | 4 +- docs/analyzers/README.md | 285 ++ docs/cs/CS0127.md | 2 +- docs/cs/CS1997.md | 2 +- docs/cs/README.md | 176 ++ docs/refactorings/README.md | 205 ++ docs/refactorings/RRXXXX.md | 4 +- docs/refactorings/Refactorings.md | 2592 ----------------- .../Roslynator.Analyzers.nuspec | 2 +- src/Analyzers.CodeFixes/docs/NuGetReadme.md | 2 +- src/Analyzers/README.md | 213 +- src/CSharp/CSharp/CSharpFacts.cs | 2 +- .../Roslynator.CodeAnalysis.Analyzers.nuspec | 2 +- .../docs/NuGetReadme.md | 2 +- src/CodeAnalysis.Analyzers/README.md | 19 +- src/CodeFixes/README.md | 175 +- src/CodeFixes/Roslynator.CodeFixes.nuspec | 4 +- ...ExceptionToDocumentationCommentAnalysis.cs | 2 +- src/Directory.Build.props | 26 +- src/Documentation/Documentation.csproj | 4 +- .../Roslynator.Formatting.Analyzers.nuspec | 2 +- .../docs/NuGetReadme.md | 2 +- src/Formatting.Analyzers/README.md | 60 +- src/Refactorings/README.md | 206 +- .../CSharp/CodeFixesOptionsPageGenerator.cs | 7 +- .../RefactoringsOptionsPageGenerator.cs | 7 +- .../CodeGeneration/Html/HtmlGenerator.cs | 2 +- .../Markdown/MarkdownGenerator.cs | 33 +- src/Tools/CodeGenerator/Program.cs | 4 +- .../MetadataGenerator.csproj | 4 +- src/Tools/MetadataGenerator/Program.cs | 30 +- src/VisualStudio.Refactorings/Overview.md | 14 +- .../Properties/AssemblyInfo.cs | 2 +- .../source.extension.vsixmanifest | 4 +- .../CodeFixesOptionsPage.Generated.cs | 1 - src/VisualStudio/Overview.md | 16 +- src/VisualStudio/Properties/AssemblyInfo.cs | 4 +- .../RefactoringsOptionsPage.Generated.cs | 3 +- .../source.extension.vsixmanifest | 6 +- src/VisualStudioCode/package/CHANGELOG.md | 34 + src/VisualStudioCode/package/README.md | 2 +- .../package/package-lock.json | 4 +- src/VisualStudioCode/package/package.json | 2 +- ...lementToDocumentationCommentRefactoring.cs | 2 +- tools/build.cmd | 14 +- tools/build_cli.cmd | 8 +- tools/build_cli.ps1 | 4 +- tools/build_vscode.cmd | 10 +- 53 files changed, 839 insertions(+), 3405 deletions(-) create mode 100644 docs/analyzers/README.md create mode 100644 docs/cs/README.md create mode 100644 docs/refactorings/README.md delete mode 100644 docs/refactorings/Refactorings.md diff --git a/ChangeLog.md b/ChangeLog.md index bd11cc86d4..66f4b98e3f 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -7,9 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [4.3.0] - 2023-04-24 + ### Changed - [CLI] Bump Roslyn to 4.5.0 ([#1043](https://github.com/josefpihrt/roslynator/pull/1043)). +- [CLI] Downgrade version of Microsoft.Build.Locator from 1.5.5 to 1.4.1 ([#1079](https://github.com/JosefPihrt/Roslynator/pull/1079)) - [CLI] Add more information about the found diagnostics to the XML output file ([#1078](https://github.com/josefpihrt/roslynator/pull/1078) by @PeterKaszab). ### Fixed @@ -22,23 +25,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Do not remove parameterless empty constructor in a struct with field initializers ([RCS1074](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1074.md)) ([#1021](https://github.com/josefpihrt/roslynator/pull/1021)). - Do not suggest to use generic event handler ([RCS1159](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1159.md)) ([#1022](https://github.com/josefpihrt/roslynator/pull/1022)). - Fix ([RCS1077](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1077.md)) ([#1023](https://github.com/josefpihrt/roslynator/pull/1023)). -- Fix ([RCS1097](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1097.md)) ([#1037](https://github.com/JosefPihrt/Roslynator/pull/1037)). +- Fix ([RCS1097](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1097.md)) ([#1037](https://github.com/JosefPihrt/Roslynator/pull/1037) by @jamesHargreaves12). - Do not report ([RCS1170](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1170.md)) when `Microsoft.AspNetCore.Components.InjectAttribute` is used ([#1046](https://github.com/JosefPihrt/Roslynator/pull/1046)). - Fix ([RCS1235](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1235.md)) ([#1047](https://github.com/JosefPihrt/Roslynator/pull/1047)). - Fix ([RCS1206](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1206.md)) ([#1049](https://github.com/JosefPihrt/Roslynator/pull/1049)). - Prevent possible recursion in ([RCS1235](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1235.md)) ([#1054](https://github.com/JosefPihrt/Roslynator/pull/1054)). -- Fix ([RCS1223](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1223.md)) ([#1051](https://github.com/JosefPihrt/Roslynator/pull/1051)). -- Do not remove braces in the cases where there are overlapping local variables. ([RCS1031](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1031.md), [RCS1211](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1211.md), [RCS1208](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1208.md), [RCS1061](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1061.md)) ([#1039](https://github.com/JosefPihrt/Roslynator/pull/1039),[#1062](https://github.com/JosefPihrt/Roslynator/pull/1062)). +- Fix ([RCS1223](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1223.md)) ([#1051](https://github.com/JosefPihrt/Roslynator/pull/1051) by @jamesHargreaves12). +- Do not remove braces in the cases where there are overlapping local variables. ([RCS1031](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1031.md), [RCS1211](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1211.md), [RCS1208](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1208.md), [RCS1061](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1061.md)) ([#1039](https://github.com/JosefPihrt/Roslynator/pull/1039), [#1062](https://github.com/JosefPihrt/Roslynator/pull/1062) by @jamesHargreaves12). - [CLI] Analyze command does not create the XML output file and returns incorrect exit code when only compiler diagnostics are reported ([#1056](https://github.com/JosefPihrt/Roslynator/pull/1056) by @PeterKaszab). - [CLI] Fix exit code when multiple projects are processed ([#1061](https://github.com/JosefPihrt/Roslynator/pull/1061) by @PeterKaszab). -- Fix code fix for CS0164 ([#1031](https://github.com/JosefPihrt/Roslynator/pull/1031)). +- Fix code fix for CS0164 ([#1031](https://github.com/JosefPihrt/Roslynator/pull/1031) by @jamesHargreaves12). - Do not report `System.Windows.DependencyPropertyChangedEventArgs` as unused parameter ([RCS1163](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1163.md)) ([#1068](https://github.com/JosefPihrt/Roslynator/pull/1068)). -- Fix ([RCS1032](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1032.md)) ([#1064](https://github.com/JosefPihrt/Roslynator/pull/1064)). -- Update processing of .globalconfig file to prioritize file-specific diagnostic severities over global diagnostic severities. [#1066](https://github.com/JosefPihrt/Roslynator/pull/1066/files) -- Fix RCS1009 to handles discard designations ([#1063](https://github.com/JosefPihrt/Roslynator/pull/1063/files)). +- Fix ([RCS1032](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1032.md)) ([#1064](https://github.com/JosefPihrt/Roslynator/pull/1064) by @jamesHargreaves12). +- Update processing of .globalconfig file to prioritize file-specific diagnostic severities over global diagnostic severities ([#1066](https://github.com/JosefPihrt/Roslynator/pull/1066/files) by @jamesHargreaves12). +- Fix RCS1009 to handles discard designations ([#1063](https://github.com/JosefPihrt/Roslynator/pull/1063/files) by @jamesHargreaves12). - [CLI] Fix number of formatted documents, file banners added ([#1072](https://github.com/JosefPihrt/Roslynator/pull/1072)). -- Improve support for coalesce expressions in code fixes that require computing the logical inversion of an expression, such as [RCS1208](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1208.md) ([#1069](https://github.com/JosefPihrt/Roslynator/pull/1069)). -- [CLI] Downgrade version of Microsoft.Build.Locator from 1.5.5 to 1.4.1 ([#1079](https://github.com/JosefPihrt/Roslynator/pull/1079)) +- Improve support for coalesce expressions in code fixes that require computing the logical inversion of an expression, such as [RCS1208](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1208.md) ([#1069](https://github.com/JosefPihrt/Roslynator/pull/1069) by @jamesHargreaves12). ## [4.2.0] - 2022-11-27 diff --git a/README.md b/README.md index e546568dd1..d0faa47413 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Roslynator -A collection of 500+ [analyzers](src/Analyzers/README.md), [refactorings](src/Refactorings/README.md) and [fixes](src/CodeFixes/README.md) for C#, powered by [Roslyn](http://github.com/dotnet/roslyn). +A collection of 500+ [analyzers](docs/analyzers/README.md), [refactorings](docs/refactorings/README.md) and [fixes](docs/cs/README.md) for C#, powered by [Roslyn](https://github.com/dotnet/roslyn). ### Features diff --git a/docs/AnalyzersVsRefactorings.md b/docs/AnalyzersVsRefactorings.md index d186f958ef..7c4b27f17b 100644 --- a/docs/AnalyzersVsRefactorings.md +++ b/docs/AnalyzersVsRefactorings.md @@ -32,7 +32,7 @@ Hotkey `Ctrl` + `.` will display available code fixes. Code fixes have precedenc ### Configuration -Analyzers can be configured by using **rule set** file (see [How to Configure Analyzers](http://github.com/JosefPihrt/Roslynator/blob/main/docs/HowToConfigureAnalyzers.md)). +Analyzers can be configured by using **rule set** file (see [How to Configure Analyzers](https://github.com/JosefPihrt/Roslynator/blob/main/docs/HowToConfigureAnalyzers.md)). ## Refactorings diff --git a/docs/HowToUpdateDocumentation.md b/docs/HowToUpdateDocumentation.md index 481d5355bf..f072f54d51 100644 --- a/docs/HowToUpdateDocumentation.md +++ b/docs/HowToUpdateDocumentation.md @@ -43,7 +43,7 @@ To update documentation it is necessary to edit [Analyzers.xml](../src/Analyzers Remarks - http://github.com/JosefPihrt/Roslynator + https://github.com/JosefPihrt/Roslynator A sample link @@ -73,7 +73,7 @@ Metadata sample above will produce [RCSXXXX.md](analyzers/RCSXXXX.md). Remarks - http://github.com/JosefPihrt/Roslynator + https://github.com/JosefPihrt/Roslynator A sample link diff --git a/docs/README.md b/docs/README.md index cbf5354ac9..8608e6eef1 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,9 +1,9 @@ # Roslynator Docs -* [List of Analyzers](../src/Analyzers/README.md) -* [List of Refactorings](../src/Refactorings/README.md) -* [List of Fixable Compiler Diagnostics](../src/CodeFixes/README.md) +* [List of Analyzers](analyzers/README.md) +* [List of Refactorings](refactorings/README.md) +* [List of Fixable Compiler Diagnostics](cs/README.md) * [Roslynator Configuration](Configuration.md) ## How to diff --git a/docs/analyzers/RCSXXXX.md b/docs/analyzers/RCSXXXX.md index 8d38860f5c..aa7a9e2912 100644 --- a/docs/analyzers/RCSXXXX.md +++ b/docs/analyzers/RCSXXXX.md @@ -30,8 +30,8 @@ Remarks ## See Also -* [A sample link](http://github.com/JosefPihrt/Roslynator) +* [A sample link](https://github.com/JosefPihrt/Roslynator) * [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 +*\(Generated with [DotMarkdown](https://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/docs/analyzers/README.md b/docs/analyzers/README.md new file mode 100644 index 0000000000..b856857330 --- /dev/null +++ b/docs/analyzers/README.md @@ -0,0 +1,285 @@ +## Roslynator Analyzers + +### Overview + +| Package | Prefix | Comment | +| ------- | ------ | ------- | +| [Roslynator.Analyzers](https://www.nuget.org/packages/Roslynator.Analyzers) | `RCS1` | common analyzers | +| [Roslynator.Formatting.Analyzers](https://www.nuget.org/packages/Roslynator.Formatting.Analyzers) | `RCS0` | \- | +| [Roslynator.CodeAnalysis.Analyzers](https://www.nuget.org/packages/Roslynator.CodeAnalysis.Analyzers) | `RCS9` | suitable for projects that reference Roslyn packages \(`Microsoft.CodeAnalysis*`\) | + +### List of Analyzers + +| Id | Title | Severity | +| --- | ----- | -------- | +| RCS0001 | [Add blank line after embedded statement](RCS0001.md) | None | +| RCS0002 | [Add blank line after #region](RCS0002.md) | None | +| RCS0003 | [Add blank line after using directive list](RCS0003.md) | None | +| RCS0005 | [Add blank line before #endregion](RCS0005.md) | None | +| RCS0006 | [Add blank line before using directive list](RCS0006.md) | None | +| RCS0007 | [Add blank line between accessors](RCS0007.md) | None | +| RCS0008 | [Add blank line between closing brace and next statement](RCS0008.md) | None | +| RCS0009 | [Add blank line between declaration and documentation comment](RCS0009.md) | None | +| RCS0010 | [Add blank line between declarations](RCS0010.md) | None | +| RCS0011 | [Add/remove blank line between single-line accessors](RCS0011.md) | None | +| RCS0012 | [Add blank line between single-line declarations](RCS0012.md) | None | +| RCS0013 | [Add blank line between single-line declarations of different kind](RCS0013.md) | None | +| RCS0014 | [Add blank line between switch sections](RCS0014.md) | None | +| RCS0015 | [Add/remove blank line between using directives](RCS0015.md) | None | +| RCS0016 | [Put attribute list on its own line](RCS0016.md) | None | +| RCS0020 | [Format accessor's braces on a single line or multiple lines](RCS0020.md) | None | +| RCS0021 | [Format block's braces on a single line or multiple lines](RCS0021.md) | None | +| RCS0022 | [Add new line after opening brace of empty block](RCS0022.md) | None | +| RCS0023 | [Format type declaration's braces](RCS0023.md) | None | +| RCS0024 | [Add new line after switch label](RCS0024.md) | None | +| RCS0025 | [Put full accessor on its own line](RCS0025.md) | None | +| RCS0027 | [Place new line after/before binary operator](RCS0027.md) | None | +| RCS0028 | [Place new line after/before '?:' operator](RCS0028.md) | None | +| RCS0029 | [Put constructor initializer on its own line](RCS0029.md) | None | +| RCS0030 | [Add new line before embedded statement](RCS0030.md) | None | +| RCS0031 | [Put enum member on its own line](RCS0031.md) | None | +| RCS0032 | [Place new line after/before arrow token](RCS0032.md) | None | +| RCS0033 | [Add new line before statement](RCS0033.md) | None | +| RCS0034 | [Put type parameter constraint on its own line](RCS0034.md) | None | +| RCS0036 | [Remove blank line between single-line declarations of same kind](RCS0036.md) | None | +| RCS0038 | [Remove blank line between using directives with same root namespace](RCS0038.md) | None | +| RCS0039 | [Remove new line before base list](RCS0039.md) | None | +| RCS0041 | [Remove new line between 'if' keyword and 'else' keyword](RCS0041.md) | None | +| RCS0042 | [Put auto-accessors on a single line](RCS0042.md) | None | +| RCS0043 | [Format accessor's braces on a single line when expression is on single line](RCS0043.md) | None | +| RCS0044 | [Use carriage return + linefeed as new line](RCS0044.md) | None | +| RCS0045 | [Use linefeed as new line](RCS0045.md) | None | +| RCS0046 | [Use spaces instead of tab](RCS0046.md) | None | +| RCS0047 | [\[deprecated\] Wrap and indent each node in list](RCS0047.md) | None | +| RCS0048 | [Put initializer on a single line](RCS0048.md) | None | +| RCS0049 | [Add blank line after top comment](RCS0049.md) | None | +| RCS0050 | [Add blank line before top declaration](RCS0050.md) | None | +| RCS0051 | [Add/remove new line before 'while' in 'do' statement](RCS0051.md) | None | +| RCS0052 | [Place new line after/before equals token](RCS0052.md) | None | +| RCS0053 | [Fix formatting of a list](RCS0053.md) | None | +| RCS0054 | [Fix formatting of a call chain](RCS0054.md) | None | +| RCS0055 | [Fix formatting of a binary expression chain](RCS0055.md) | None | +| RCS0056 | [A line is too long](RCS0056.md) | None | +| RCS0057 | [Normalize whitespace at the beginning of a file](RCS0057.md) | None | +| RCS0058 | [Normalize whitespace at the end of a file](RCS0058.md) | None | +| RCS0059 | [Place new line after/before null-conditional operator](RCS0059.md) | None | +| RCS0060 | [Add/remove line after file scoped namespace declaration](RCS0060.md) | None | +| RCS1001 | [Add braces (when expression spans over multiple lines)](RCS1001.md) | Info | +| RCS1002 | [Remove braces](RCS1002.md) | None | +| RCS1003 | [Add braces to if-else (when expression spans over multiple lines)](RCS1003.md) | Info | +| RCS1004 | [Remove braces from if-else](RCS1004.md) | None | +| RCS1005 | [Simplify nested using statement](RCS1005.md) | Hidden | +| RCS1006 | [Merge 'else' with nested 'if'](RCS1006.md) | Hidden | +| RCS1007 | [Add braces](RCS1007.md) | None | +| RCS1008 | [Use explicit type instead of 'var' (when the type is not obvious)](RCS1008.md) | None | +| RCS1009 | [Use explicit type instead of 'var' (foreach variable)](RCS1009.md) | None | +| RCS1010 | [Use 'var' instead of explicit type (when the type is obvious)](RCS1010.md) | None | +| RCS1012 | [Use explicit type instead of 'var' (when the type is obvious)](RCS1012.md) | None | +| RCS1013 | [Use predefined type](RCS1013.md) | None | +| RCS1014 | [Use explicitly/implicitly typed array](RCS1014.md) | None | +| RCS1015 | [Use nameof operator](RCS1015.md) | Info | +| RCS1016 | [Use block body or expression body](RCS1016.md) | None | +| RCS1018 | [Add/remove accessibility modifiers](RCS1018.md) | None | +| RCS1019 | [Order modifiers](RCS1019.md) | None | +| RCS1020 | [Simplify Nullable\ to T?](RCS1020.md) | Info | +| RCS1021 | [Convert lambda expression body to expression body](RCS1021.md) | Info | +| RCS1031 | [Remove unnecessary braces in switch section](RCS1031.md) | Hidden | +| RCS1032 | [Remove redundant parentheses](RCS1032.md) | Info | +| RCS1033 | [Remove redundant boolean literal](RCS1033.md) | Info | +| RCS1034 | [Remove redundant 'sealed' modifier](RCS1034.md) | Hidden | +| RCS1035 | [Remove redundant comma in initializer](RCS1035.md) | None | +| RCS1036 | [Remove unnecessary blank line](RCS1036.md) | Info | +| RCS1037 | [Remove trailing white-space](RCS1037.md) | Info | +| RCS1038 | [Remove empty statement](RCS1038.md) | Info | +| RCS1039 | [Remove argument list from attribute](RCS1039.md) | Hidden | +| RCS1040 | [Remove empty 'else' clause](RCS1040.md) | Hidden | +| RCS1041 | [Remove empty initializer](RCS1041.md) | Info | +| RCS1042 | [Remove enum default underlying type](RCS1042.md) | Hidden | +| RCS1043 | [Remove 'partial' modifier from type with a single part](RCS1043.md) | Hidden | +| RCS1044 | [Remove original exception from throw statement](RCS1044.md) | Warning | +| RCS1046 | [Asynchronous method name should end with 'Async'](RCS1046.md) | None | +| RCS1047 | [Non-asynchronous method name should not end with 'Async'](RCS1047.md) | Info | +| RCS1048 | [Use lambda expression instead of anonymous method](RCS1048.md) | Info | +| RCS1049 | [Simplify boolean comparison](RCS1049.md) | Info | +| RCS1050 | [Include/omit parentheses when creating new object](RCS1050.md) | None | +| RCS1051 | [Add/remove parentheses from condition in conditional operator](RCS1051.md) | None | +| RCS1052 | [Declare each attribute separately](RCS1052.md) | None | +| RCS1055 | [Avoid semicolon at the end of declaration](RCS1055.md) | Hidden | +| RCS1056 | [Avoid usage of using alias directive](RCS1056.md) | None | +| RCS1058 | [Use compound assignment](RCS1058.md) | Info | +| RCS1059 | [Avoid locking on publicly accessible instance](RCS1059.md) | Warning | +| RCS1060 | [Declare each type in separate file](RCS1060.md) | None | +| RCS1061 | [Merge 'if' with nested 'if'](RCS1061.md) | Hidden | +| RCS1063 | [(\[deprecated\] use RCS1252 instead) Avoid usage of do statement to create an infinite loop](RCS1063.md) | Info | +| RCS1064 | [(\[deprecated\] use RCS1252 instead) Avoid usage of for statement to create an infinite loop](RCS1064.md) | None | +| RCS1065 | [(\[deprecated\] use RCS1252 instead) Avoid usage of while statement to create an infinite loop](RCS1065.md) | None | +| RCS1066 | [Remove empty 'finally' clause](RCS1066.md) | Hidden | +| RCS1068 | [Simplify logical negation](RCS1068.md) | Info | +| RCS1069 | [Remove unnecessary case label](RCS1069.md) | Hidden | +| RCS1070 | [Remove redundant default switch section](RCS1070.md) | Hidden | +| RCS1071 | [Remove redundant base constructor call](RCS1071.md) | Hidden | +| RCS1072 | [Remove empty namespace declaration](RCS1072.md) | Info | +| RCS1073 | [Convert 'if' to 'return' statement](RCS1073.md) | Info | +| RCS1074 | [Remove redundant constructor](RCS1074.md) | Hidden | +| RCS1075 | [Avoid empty catch clause that catches System.Exception](RCS1075.md) | Warning | +| RCS1077 | [Optimize LINQ method call](RCS1077.md) | Info | +| RCS1078 | [Use "" or 'string.Empty'](RCS1078.md) | None | +| RCS1079 | [Throwing of new NotImplementedException](RCS1079.md) | None | +| RCS1080 | [Use 'Count/Length' property instead of 'Any' method](RCS1080.md) | None | +| RCS1081 | [Split variable declaration](RCS1081.md) | None | +| RCS1084 | [Use coalesce expression instead of conditional expression](RCS1084.md) | Info | +| RCS1085 | [Use auto-implemented property](RCS1085.md) | Info | +| RCS1089 | [Use --/++ operator instead of assignment](RCS1089.md) | Info | +| RCS1090 | [Add/remove 'ConfigureAwait(false)' call](RCS1090.md) | None | +| RCS1091 | [Remove empty region](RCS1091.md) | Hidden | +| RCS1093 | [Remove file with no code](RCS1093.md) | Info | +| RCS1094 | [Declare using directive on top level](RCS1094.md) | None | +| RCS1096 | [Use 'HasFlag' method or bitwise operator](RCS1096.md) | None | +| RCS1097 | [Remove redundant 'ToString' call](RCS1097.md) | Info | +| RCS1098 | [Constant values should be placed on right side of comparisons](RCS1098.md) | Info | +| RCS1099 | [Default label should be the last label in a switch section](RCS1099.md) | Info | +| RCS1100 | [(\[deprecated\] use RCS1253 instead) Format documentation summary on a single line](RCS1100.md) | None | +| RCS1101 | [(\[deprecated\] use RCS1253 instead) Format documentation summary on multiple lines](RCS1101.md) | None | +| RCS1102 | [Make class static](RCS1102.md) | Warning | +| RCS1103 | [Convert 'if' to assignment](RCS1103.md) | Info | +| RCS1104 | [Simplify conditional expression](RCS1104.md) | Info | +| RCS1105 | [Unnecessary interpolation](RCS1105.md) | Info | +| RCS1106 | [Remove empty destructor](RCS1106.md) | Info | +| RCS1107 | [Remove redundant 'ToCharArray' call](RCS1107.md) | Info | +| RCS1108 | [Add 'static' modifier to all partial class declarations](RCS1108.md) | Info | +| RCS1110 | [Declare type inside namespace](RCS1110.md) | Info | +| RCS1111 | [Add braces to switch section with multiple statements](RCS1111.md) | None | +| RCS1112 | [Combine 'Enumerable.Where' method chain](RCS1112.md) | Info | +| RCS1113 | [Use 'string.IsNullOrEmpty' method](RCS1113.md) | Info | +| RCS1114 | [Remove redundant delegate creation](RCS1114.md) | Info | +| RCS1118 | [Mark local variable as const](RCS1118.md) | Info | +| RCS1123 | [Add parentheses when necessary](RCS1123.md) | Info | +| RCS1124 | [Inline local variable](RCS1124.md) | Hidden | +| RCS1126 | [Add braces to if-else](RCS1126.md) | None | +| RCS1128 | [Use coalesce expression](RCS1128.md) | Info | +| RCS1129 | [Remove redundant field initialization](RCS1129.md) | Hidden | +| RCS1130 | [Bitwise operation on enum without Flags attribute](RCS1130.md) | Info | +| RCS1132 | [Remove redundant overriding member](RCS1132.md) | Info | +| RCS1133 | [Remove redundant Dispose/Close call](RCS1133.md) | Hidden | +| RCS1134 | [Remove redundant statement](RCS1134.md) | Hidden | +| RCS1135 | [Declare enum member with zero value (when enum has FlagsAttribute)](RCS1135.md) | Info | +| RCS1136 | [Merge switch sections with equivalent content](RCS1136.md) | Hidden | +| RCS1138 | [Add summary to documentation comment](RCS1138.md) | Warning | +| RCS1139 | [Add summary element to documentation comment](RCS1139.md) | Warning | +| RCS1140 | [Add exception to documentation comment](RCS1140.md) | Hidden | +| RCS1141 | [Add 'param' element to documentation comment](RCS1141.md) | Hidden | +| RCS1142 | [Add 'typeparam' element to documentation comment](RCS1142.md) | Hidden | +| RCS1143 | [Simplify coalesce expression](RCS1143.md) | Hidden | +| RCS1145 | [Remove redundant 'as' operator](RCS1145.md) | Hidden | +| RCS1146 | [Use conditional access](RCS1146.md) | Info | +| RCS1151 | [Remove redundant cast](RCS1151.md) | Hidden | +| RCS1154 | [Sort enum members](RCS1154.md) | Info | +| RCS1155 | [Use StringComparison when comparing strings](RCS1155.md) | Warning | +| RCS1156 | [Use string.Length instead of comparison with empty string](RCS1156.md) | Info | +| RCS1157 | [Composite enum value contains undefined flag](RCS1157.md) | Info | +| RCS1158 | [Static member in generic type should use a type parameter](RCS1158.md) | Info | +| RCS1159 | [Use EventHandler\](RCS1159.md) | Info | +| RCS1160 | [Abstract type should not have public constructors](RCS1160.md) | Info | +| RCS1161 | [Enum should declare explicit values](RCS1161.md) | Hidden | +| RCS1162 | [Avoid chain of assignments](RCS1162.md) | None | +| RCS1163 | [Unused parameter](RCS1163.md) | Info | +| RCS1164 | [Unused type parameter](RCS1164.md) | Info | +| RCS1165 | [Unconstrained type parameter checked for null](RCS1165.md) | Hidden | +| RCS1166 | [Value type object is never equal to null](RCS1166.md) | Info | +| RCS1168 | [Parameter name differs from base name](RCS1168.md) | Hidden | +| RCS1169 | [Make field read-only](RCS1169.md) | Info | +| RCS1170 | [Use read-only auto-implemented property](RCS1170.md) | Info | +| RCS1171 | [Simplify lazy initialization](RCS1171.md) | Info | +| RCS1172 | [Use 'is' operator instead of 'as' operator](RCS1172.md) | Warning | +| RCS1173 | [Use coalesce expression instead of 'if'](RCS1173.md) | Info | +| RCS1174 | [Remove redundant async/await](RCS1174.md) | None | +| RCS1175 | [Unused 'this' parameter](RCS1175.md) | Info | +| RCS1176 | [Use 'var' instead of explicit type (when the type is not obvious)](RCS1176.md) | None | +| RCS1177 | [Use 'var' instead of explicit type (in foreach)](RCS1177.md) | None | +| RCS1179 | [Unnecessary assignment](RCS1179.md) | Info | +| RCS1180 | [Inline lazy initialization](RCS1180.md) | Info | +| RCS1181 | [Convert comment to documentation comment](RCS1181.md) | Hidden | +| RCS1182 | [Remove redundant base interface](RCS1182.md) | Hidden | +| RCS1186 | [Use Regex instance instead of static method](RCS1186.md) | Hidden | +| RCS1187 | [Use constant instead of field](RCS1187.md) | Info | +| RCS1188 | [Remove redundant auto-property initialization](RCS1188.md) | Hidden | +| RCS1189 | [Add or remove region name](RCS1189.md) | Hidden | +| RCS1190 | [Join string expressions](RCS1190.md) | Info | +| RCS1191 | [Declare enum value as combination of names](RCS1191.md) | Info | +| RCS1192 | [Unnecessary usage of verbatim string literal](RCS1192.md) | Info | +| RCS1193 | [Overriding member should not change 'params' modifier](RCS1193.md) | Warning | +| RCS1194 | [Implement exception constructors](RCS1194.md) | Warning | +| RCS1195 | [Use ^ operator](RCS1195.md) | Info | +| RCS1196 | [Call extension method as instance method](RCS1196.md) | Info | +| RCS1197 | [Optimize StringBuilder.Append/AppendLine call](RCS1197.md) | Info | +| RCS1198 | [Avoid unnecessary boxing of value type](RCS1198.md) | None | +| RCS1199 | [Unnecessary null check](RCS1199.md) | Info | +| RCS1200 | [Call 'Enumerable.ThenBy' instead of 'Enumerable.OrderBy'](RCS1200.md) | Info | +| RCS1201 | [Use method chaining](RCS1201.md) | Hidden | +| RCS1202 | [Avoid NullReferenceException](RCS1202.md) | Info | +| RCS1203 | [Use AttributeUsageAttribute](RCS1203.md) | Warning | +| RCS1204 | [Use EventArgs.Empty](RCS1204.md) | Info | +| RCS1205 | [Order named arguments according to the order of parameters](RCS1205.md) | Info | +| RCS1206 | [Use conditional access instead of conditional expression](RCS1206.md) | Info | +| RCS1207 | [Use anonymous function or method group](RCS1207.md) | None | +| RCS1208 | [Reduce 'if' nesting](RCS1208.md) | None | +| RCS1209 | [Order type parameter constraints](RCS1209.md) | Info | +| RCS1210 | [Return completed task instead of returning null](RCS1210.md) | Warning | +| RCS1211 | [Remove unnecessary 'else'](RCS1211.md) | Hidden | +| RCS1212 | [Remove redundant assignment](RCS1212.md) | Info | +| RCS1213 | [Remove unused member declaration](RCS1213.md) | Info | +| RCS1214 | [Unnecessary interpolated string](RCS1214.md) | Info | +| RCS1215 | [Expression is always equal to true/false](RCS1215.md) | Warning | +| RCS1216 | [Unnecessary unsafe context](RCS1216.md) | Info | +| RCS1217 | [Convert interpolated string to concatenation](RCS1217.md) | Hidden | +| RCS1218 | [Simplify code branching](RCS1218.md) | Info | +| RCS1220 | [Use pattern matching instead of combination of 'is' operator and cast operator](RCS1220.md) | Info | +| RCS1221 | [Use pattern matching instead of combination of 'as' operator and null check](RCS1221.md) | Info | +| RCS1222 | [Merge preprocessor directives](RCS1222.md) | Info | +| RCS1223 | [Mark publicly visible type with DebuggerDisplay attribute](RCS1223.md) | None | +| RCS1224 | [Make method an extension method](RCS1224.md) | Info | +| RCS1225 | [Make class sealed](RCS1225.md) | Info | +| RCS1226 | [Add paragraph to documentation comment](RCS1226.md) | Info | +| RCS1227 | [Validate arguments correctly](RCS1227.md) | Info | +| RCS1228 | [Unused element in documentation comment](RCS1228.md) | Hidden | +| RCS1229 | [Use async/await when necessary](RCS1229.md) | Info | +| RCS1230 | [Unnecessary explicit use of enumerator](RCS1230.md) | Info | +| RCS1231 | [Make parameter ref read-only](RCS1231.md) | None | +| RCS1232 | [Order elements in documentation comment](RCS1232.md) | Info | +| RCS1233 | [Use short-circuiting operator](RCS1233.md) | Info | +| RCS1234 | [Duplicate enum value](RCS1234.md) | Info | +| RCS1235 | [Optimize method call](RCS1235.md) | Info | +| RCS1236 | [Use exception filter](RCS1236.md) | Info | +| RCS1237 | [(\[deprecated\] use RCS1254 instead) Use bit shift operator](RCS1237.md) | Hidden | +| RCS1238 | [Avoid nested ?: operators](RCS1238.md) | Hidden | +| RCS1239 | [Use 'for' statement instead of 'while' statement](RCS1239.md) | Info | +| RCS1240 | [Operator is unnecessary](RCS1240.md) | Info | +| RCS1241 | [Implement non-generic counterpart](RCS1241.md) | Hidden | +| RCS1242 | [Do not pass non-read-only struct by read-only reference](RCS1242.md) | Warning | +| RCS1243 | [Duplicate word in a comment](RCS1243.md) | Info | +| RCS1244 | [Simplify 'default' expression](RCS1244.md) | Hidden | +| RCS1246 | [Use element access](RCS1246.md) | Info | +| RCS1247 | [Fix documentation comment tag](RCS1247.md) | Info | +| RCS1248 | [Normalize null check](RCS1248.md) | None | +| RCS1249 | [Unnecessary null-forgiving operator](RCS1249.md) | Info | +| RCS1250 | [Use implicit/explicit object creation](RCS1250.md) | None | +| RCS1251 | [Remove unnecessary braces from record declaration](RCS1251.md) | Info | +| RCS1252 | [Normalize usage of infinite loop](RCS1252.md) | None | +| RCS1253 | [Format documentation comment summary](RCS1253.md) | None | +| RCS1254 | [Normalize format of enum flag value](RCS1254.md) | Info | +| RCS1255 | [Simplify argument null check](RCS1255.md) | None | +| RCS1256 | [Invalid argument null check](RCS1256.md) | Info | +| RCS9001 | [Use pattern matching](RCS9001.md) | Hidden | +| RCS9002 | [Use property SyntaxNode.SpanStart](RCS9002.md) | Info | +| RCS9003 | [Unnecessary conditional access](RCS9003.md) | Info | +| RCS9004 | [Call 'Any' instead of accessing 'Count'](RCS9004.md) | Info | +| RCS9005 | [Unnecessary null check](RCS9005.md) | Info | +| RCS9006 | [Use element access](RCS9006.md) | Info | +| RCS9007 | [Use return value](RCS9007.md) | Warning | +| RCS9008 | [Call 'Last' instead of using \[\]](RCS9008.md) | Info | +| RCS9009 | [Unknown language name](RCS9009.md) | Warning | +| RCS9010 | [Specify ExportCodeRefactoringProviderAttribute.Name](RCS9010.md) | Hidden | +| RCS9011 | [Specify ExportCodeFixProviderAttribute.Name](RCS9011.md) | Hidden | + + +*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/docs/cs/CS0127.md b/docs/cs/CS0127.md index d2f0fcf810..b2d3c78995 100644 --- a/docs/cs/CS0127.md +++ b/docs/cs/CS0127.md @@ -10,8 +10,8 @@ ## Code Fixes * Change member type according to return expression -* Remove return expression * Remove 'return' keyword +* Remove return expression *\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/docs/cs/CS1997.md b/docs/cs/CS1997.md index e66e2824a1..fab4b884fa 100644 --- a/docs/cs/CS1997.md +++ b/docs/cs/CS1997.md @@ -9,8 +9,8 @@ ## Code Fixes * Change member type according to return expression -* Remove return expression * Remove 'return' keyword +* Remove return expression *\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/docs/cs/README.md b/docs/cs/README.md new file mode 100644 index 0000000000..8ae1e0a1f9 --- /dev/null +++ b/docs/cs/README.md @@ -0,0 +1,176 @@ +## Compiler Diagnostics Fixable with Roslynator + +| Id | Title | +| --- | ----- | +| [CS0019](CS0019.md) | Operator 'operator' cannot be applied to operands of type 'type' and 'type'\. | +| [CS0021](CS0021.md) | Cannot apply indexing with \[\] to an expression of type 'type'\. | +| [CS0023](CS0023.md) | Operator 'operator' cannot be applied to operand of type 'type'\. | +| [CS0029](CS0029.md) | Cannot implicitly convert type 'type' to 'type'\. | +| [CS0030](CS0030.md) | Cannot convert type 'type' to 'type'\. | +| [CS0037](CS0037.md) | Cannot convert null to 'type' because it is a non\-nullable value type\. | +| [CS0069](CS0069.md) | An event in an interface cannot have add or remove accessors\. | +| [CS0077](CS0077.md) | The as operator must be used with a reference type or nullable type \('type' is a non\-nullable value type\)\. | +| [CS0080](CS0080.md) | Constraints are not allowed on non\-generic declarations\. | +| [CS0101](CS0101.md) | The namespace 'namespace' already contains a definition for 'type'\. | +| [CS0102](CS0102.md) | The type 'type name' already contains a definition for 'identifier'\. | +| [CS0103](CS0103.md) | The name 'identifier' does not exist in the current context\. | +| [CS0107](CS0107.md) | More than one protection modifier\. | +| [CS0109](CS0109.md) | The member 'member' does not hide an inherited member\. The new keyword is not required\. | +| [CS0112](CS0112.md) | A static member 'function' cannot be marked as override, virtual or abstract\. | +| [CS0114](CS0114.md) | 'function1' hides inherited member 'function2'\. To make the current method override that implementation, add the override keyword\. Otherwise add the new keyword\. | +| [CS0115](CS0115.md) | 'function': no suitable method found to override\. | +| [CS0119](CS0119.md) | 'identifier' is a 'construct', which is not valid in the given context\. | +| [CS0120](CS0120.md) | An object reference is required for the nonstatic field, method, or property 'member'\. | +| [CS0123](CS0123.md) | No overload for 'method' matches delegate 'delegate'\. | +| [CS0126](CS0126.md) | An object of a type convertible to 'type' is required\. | +| [CS0127](CS0127.md) | Since 'function' returns void, a return keyword must not be followed by an object expression\. | +| [CS0128](CS0128.md) | A local variable named 'variable' is already defined in this scope\. | +| [CS0131](CS0131.md) | The left\-hand side of an assignment must be a variable, property or indexer\. | +| [CS0132](CS0132.md) | 'constructor': a static constructor must be parameterless\. | +| [CS0133](CS0133.md) | The expression being assigned to 'variable' must be constant\. | +| [CS0136](CS0136.md) | A local variable named 'var' cannot be declared in this scope because it would give a different meaning to 'var', which is already used in a 'parent or current/child' scope to denote something else\. | +| [CS0139](CS0139.md) | No enclosing loop out of which to break or continue\. | +| [CS0152](CS0152.md) | The switch statement contains multiple cases with same label value\. | +| [CS0161](CS0161.md) | 'method': not all code paths return a value\. | +| [CS0162](CS0162.md) | Unreachable code detected\. | +| [CS0163](CS0163.md) | Control cannot fall through from one case label \('label'\) to another\. | +| [CS0164](CS0164.md) | This label has not been referenced\. | +| [CS0165](CS0165.md) | Use of unassigned local variable 'name'\. | +| [CS0168](CS0168.md) | The variable 'var' is declared but never used\. | +| [CS0173](CS0173.md) | Type of conditional expression cannot be determined because there is no implicit conversion between 'class1' and 'class2'\. | +| [CS0177](CS0177.md) | The out parameter 'parameter' must be assigned to before control leaves the current method\. | +| [CS0191](CS0191.md) | A readonly field cannot be assigned to \(except in a constructor or a variable initializer\)\. | +| [CS0192](CS0192.md) | Readonly field 'name' cannot be used as ref or out value \(except in a constructor\)\. | +| [CS0201](CS0201.md) | Only assignment, call, increment, decrement, and new object expressions can be used as a statement\. | +| [CS0214](CS0214.md) | Pointers and fixed size buffers may only be used in an unsafe context\. | +| [CS0216](CS0216.md) | The operator 'operator' requires a matching operator 'missing\_operator' to also be defined\. | +| [CS0219](CS0219.md) | The variable 'variable' is assigned but its value is never used\. | +| [CS0221](CS0221.md) | Constant value 'value' cannot be converted to a 'type' \(use 'unchecked' syntax to override\)\. | +| [CS0225](CS0225.md) | The params parameter must be a single dimensional array\. | +| [CS0238](CS0238.md) | 'identifier' cannot be sealed because it is not an override\. | +| [CS0246](CS0246.md) | The type or namespace name 'type/namespace' could not be found \(are you missing a using directive or an assembly reference?\)\. | +| [CS0260](CS0260.md) | Missing partial modifier on declaration of type 'type'; another partial declaration of this type exists\. | +| [CS0262](CS0262.md) | Partial declarations of 'type' have conflicting accessibility modifiers\. | +| [CS0266](CS0266.md) | Cannot implicitly convert type 'type1' to 'type2'\. An explicit conversion exists \(are you missing a cast?\)\. | +| [CS0267](CS0267.md) | The partial modifier can only appear immediately before 'class', 'struct', or 'interface'\. | +| [CS0275](CS0275.md) | 'accessor': accessibility modifiers may not be used on accessors in an interface\. | +| [CS0305](CS0305.md) | Using the generic type 'generic type' requires 'number' type arguments\. | +| [CS0401](CS0401.md) | The new\(\) constraint must be the last constraint specified\. | +| [CS0403](CS0403.md) | Cannot convert null to type parameter 'name' because it could be a non\-nullable value type\. Consider using default\('T'\) instead\. | +| [CS0405](CS0405.md) | Duplicate constraint 'constraint' for type parameter 'type parameter'\. | +| [CS0407](CS0407.md) | 'return\-type method' has the wrong return type\. | +| [CS0409](CS0409.md) | A constraint clause has already been specified for type parameter 'type parameter'\. All of the constraints for a type parameter must be specified in a single where clause\. | +| [CS0428](CS0428.md) | Cannot convert method group 'identifier' to non\-delegate type 'type'\. Did you intend to invoke the method? | +| [CS0441](CS0441.md) | 'class': a class cannot be both static and sealed\. | +| [CS0442](CS0442.md) | 'property': abstract properties cannot have private accessors\. | +| [CS0449](CS0449.md) | The 'class' or 'struct' constraint must come before any other constraints\. | +| [CS0450](CS0450.md) | 'type parameter name': cannot specify both a constraint class and the 'class' or 'struct' constraint\. | +| [CS0451](CS0451.md) | The 'new\(\)' constraint cannot be used with the 'struct' constraint\. | +| [CS0472](CS0472.md) | The result of the expression is always 'value1' since a value of type 'value2' is never equal to 'null' of type 'value3'\. | +| [CS0500](CS0500.md) | 'class member' cannot declare a body because it is marked abstract\. | +| [CS0501](CS0501.md) | 'member function' must declare a body because it is not marked abstract, extern, or partial\. | +| [CS0507](CS0507.md) | 'function1': cannot change access modifiers when overriding 'access' inherited member 'function2'\. | +| [CS0508](CS0508.md) | 'type1': return type must be 'type2' to match overridden member 'member name'\. | +| [CS0513](CS0513.md) | 'function' is abstract but it is contained in nonabstract class 'class'\. | +| [CS0515](CS0515.md) | 'function': access modifiers are not allowed on static constructors\. | +| [CS0525](CS0525.md) | Interfaces cannot contain fields\. | +| [CS0527](CS0527.md) | Type 'type' in interface list is not an interface\. | +| [CS0531](CS0531.md) | 'member': interface members cannot have a definition\. | +| [CS0539](CS0539.md) | 'member' in explicit interface declaration is not a member of interface | +| [CS0541](CS0541.md) | 'declaration': explicit interface declaration can only be declared in a class or struct\. | +| [CS0549](CS0549.md) | New virtual member in sealed class\. | +| [CS0558](CS0558.md) | User\-defined operator 'operator' must be declared static and public\. | +| [CS0567](CS0567.md) | Interfaces cannot contain operators\. | +| [CS0568](CS0568.md) | Structs cannot contain explicit parameterless constructors\. | +| [CS0573](CS0573.md) | 'field declaration': cannot have instance field initializers in structs\. | +| [CS0574](CS0574.md) | Name of destructor must match name of class\. | +| [CS0575](CS0575.md) | Only class types can contain destructors\. | +| [CS0579](CS0579.md) | Duplicate 'attribute' attribute\. | +| [CS0592](CS0592.md) | Attribute 'attribute' is not valid on this declaration type\. It is valid on 'type' declarations only\. | +| [CS0621](CS0621.md) | 'member': virtual or abstract members cannot be private\. | +| [CS0628](CS0628.md) | member' : new protected member declared in sealed class\. | +| [CS0659](CS0659.md) | 'class' overrides Object\.Equals\(object o\) but does not override Object\.GetHashCode\(\)\. | +| [CS0660](CS0660.md) | 'class' defines operator == or operator \!= but does not override Object\.Equals\(object o\)\. | +| [CS0661](CS0661.md) | 'class' defines operator == or operator \!= but does not override Object\.GetHashCode\(\)\. | +| [CS0678](CS0678.md) | 'variable': a field can not be both volatile and readonly\. | +| [CS0693](CS0693.md) | Type parameter 'type parameter' has the same name as the type parameter from outer type 'type'\. | +| [CS0708](CS0708.md) | 'field': cannot declare instance members in a static class\. | +| [CS0710](CS0710.md) | Static classes cannot have instance constructors | +| [CS0713](CS0713.md) | Static class 'static type' cannot derive from type 'type'\. Static classes must derive from object\. | +| [CS0714](CS0714.md) | Static class cannot implement interfaces\. | +| [CS0718](CS0718.md) | 'type': static types cannot be used as type arguments\. | +| [CS0750](CS0750.md) | A partial method cannot have access modifiers or the virtual, abstract, override, new, sealed, or extern modifiers\. | +| [CS0751](CS0751.md) | A partial method must be declared in a partial class or partial struct\. | +| [CS0753](CS0753.md) | Only methods, classes, structs, or interfaces may be partial\. | +| [CS0756](CS0756.md) | A partial method may not have multiple defining declarations\. | +| [CS0759](CS0759.md) | No defining declaration found for implementing declaration of partial method 'method'\. | +| [CS0766](CS0766.md) | Partial methods must have a void return type\. | +| [CS0815](CS0815.md) | Cannot assign 'expression' to an implicitly typed local\. | +| [CS0819](CS0819.md) | Implicitly typed locals cannot have multiple declarators\. | +| [CS0822](CS0822.md) | Implicitly typed locals cannot be const\. | +| [CS1003](CS1003.md) | Syntax error, 'char' expected\. | +| [CS1004](CS1004.md) | Duplicate 'modifier' modifier\. | +| [CS1012](CS1012.md) | Too many characters in character literal\. | +| [CS1023](CS1023.md) | Embedded statement cannot be a declaration or labeled statement\. | +| [CS1031](CS1031.md) | Type expected\. | +| [CS1057](CS1057.md) | 'member': static classes cannot contain protected members\. | +| [CS1061](CS1061.md) | 'type' does not contain a definition for 'member' and no extension method 'name' accepting a first argument of type 'type' could be found \(are you missing a using directive or an assembly reference?\)\. | +| [CS1100](CS1100.md) | Method 'name' has a parameter modifier 'this' which is not on the first parameter\. | +| [CS1105](CS1105.md) | Extension methods must be static\. | +| [CS1106](CS1106.md) | Extension methods must be defined in a non\-generic static class\. | +| [CS1503](CS1503.md) | Argument 'number' cannot convert from 'type1' to 'type2'\. | +| [CS1522](CS1522.md) | Empty switch block\. | +| [CS1526](CS1526.md) | A new expression requires \(\), \[\], or \{\} after type\. | +| [CS1527](CS1527.md) | Elements defined in a namespace cannot be explicitly declared as private, protected, protected internal or private protected\. | +| [CS1591](CS1591.md) | Missing XML comment for publicly visible type or member 'name'\. | +| [CS1597](CS1597.md) | Semicolon after method or accessor block is not valid\. | +| [CS1609](CS1609.md) | Modifiers cannot be placed on event accessor declarations\. | +| [CS1615](CS1615.md) | Argument 'number' should not be passed with the 'keyword' keyword\. | +| [CS1620](CS1620.md) | Argument 'number' must be passed with the 'keyword' keyword\. | +| [CS1621](CS1621.md) | The yield statement cannot be used inside an anonymous method or lambda expression\. | +| [CS1622](CS1622.md) | Cannot return a value from an iterator\. Use the yield return statement to return a value, or yield break to end the iteration\. | +| [CS1623](CS1623.md) | Iterators cannot have ref or out parameters\. | +| [CS1624](CS1624.md) | The body of 'identifier' cannot be an iterator block because 'type' is not an iterator interface type\. | +| [CS1643](CS1643.md) | Not all code paths return a value in method of type 'type'\. | +| [CS1674](CS1674.md) | 'T': type used in a using statement must be implicitly convertible to 'System\.IDisposable'\. | +| [CS1689](CS1689.md) | Attribute 'attribute' is only valid on methods or attribute classes\. | +| [CS1715](CS1715.md) | 'type1': type must be 'type2' to match overridden member 'member'\. | +| [CS1717](CS1717.md) | Assignment made to same variable; did you mean to assign something else? | +| [CS1722](CS1722.md) | Base class 'class' must come before any interfaces\. | +| [CS1737](CS1737.md) | Optional parameters must appear after all required parameters\. | +| [CS1741](CS1741.md) | A ref or out parameter cannot have a default value\. | +| [CS1743](CS1743.md) | Cannot specify a default value for the 'this' parameter\. | +| [CS1750](CS1750.md) | A value of type 'type1' cannot be used as a default parameter because there are no standard conversions to type 'type2\. | +| [CS1751](CS1751.md) | Cannot specify a default value for a parameter array\. | +| [CS1955](CS1955.md) | Non\-invocable member 'name' cannot be used like a method\. | +| [CS1983](CS1983.md) | The return type of an async method must be void, Task or Task\\. | +| [CS1988](CS1988.md) | Async methods cannot have ref or out parameters\. | +| [CS1994](CS1994.md) | The 'async' modifier can only be used in methods that have a body\. | +| [CS1997](CS1997.md) | Since 'RemoveReturnKeywordOrReturnExpression\.FooAsync\(\)' is an async method that returns 'Task', a return keyword must not be followed by an object expression\. Did you intend to return 'Task\>'? | +| [CS3000](CS3000.md) | Methods with variable arguments are not CLS\-compliant\. | +| [CS3001](CS3001.md) | Argument type 'type' is not CLS\-compliant\. | +| [CS3002](CS3002.md) | Return type of 'method' is not CLS\-compliant\. | +| [CS3003](CS3003.md) | Type of 'variable' is not CLS\-compliant\. | +| [CS3005](CS3005.md) | Identifier 'identifier' differing only in case is not CLS\-compliant\. | +| [CS3006](CS3006.md) | Overloaded method 'method' differing only in ref or out, or in array rank, is not CLS\-compliant\. | +| [CS3007](CS3007.md) | Overloaded method 'method' differing only by unnamed array types is not CLS\-compliant\. | +| [CS3008](CS3008.md) | Identifier 'identifier' is not CLS\-compliant\. | +| [CS3009](CS3009.md) | Base type 'type' is not CLS\-compliant\. | +| [CS3016](CS3016.md) | Arrays as attribute arguments is not CLS\-compliant\. | +| [CS3024](CS3024.md) | Constraint type 'type' is not CLS\-compliant\. | +| [CS3027](CS3027.md) | 'type\_1' is not CLS\-compliant because base interface 'type\_2' is not CLS\-compliant\. | +| [CS7036](CS7036.md) | There is no argument given that corresponds to the required formal parameter 'parameter' of 'member'\. | +| [CS8050](CS8050.md) | Only auto\-implemented properties can have initializers\. | +| [CS8070](CS8070.md) | Control cannot fall out of switch from final case label \('default'\)\. | +| [CS8112](CS8112.md) | 'function' is a local function and must therefore always have a body\. | +| [CS8139](CS8139.md) | Cannot change tuple element names when overriding inherited member\. | +| [CS8340](CS8340.md) | Instance fields of read\-only structs must be read\-only\. | +| [CS8403](CS8403.md) | Method with an iterator block must be 'async' to return 'IAsyncEnumerable\](RR0179.md) | ✓ | +| RR0180 | [Inline using static directive](RR0180.md) | ✓ | +| RR0181 | [Inline constant declaration](RR0181.md) | ✓ | +| RR0182 | [Use StringBuilder instead of concatenation](RR0182.md) | ✓ | +| RR0183 | [Use List\ instead of yield](RR0183.md) | ✓ | +| RR0184 | [Split if](RR0184.md) | ✓ | +| RR0185 | [Remove instantiation of a local variable](RR0185.md) | ✓ | +| RR0186 | [Change accessibility](RR0186.md) | ✓ | +| RR0187 | [Wrap constraint clauses](RR0187.md) | ✓ | +| RR0188 | [Convert 'foreach' to 'for' and reverse loop](RR0188.md) | \- | +| RR0189 | [Invert if](RR0189.md) | ✓ | +| RR0190 | [Split if-else](RR0190.md) | ✓ | +| RR0191 | [Use index initializer](RR0191.md) | ✓ | +| RR0192 | [Convert comment to documentation comment](RR0192.md) | ✓ | +| RR0193 | [Convert interpolated string to concatenation](RR0193.md) | ✓ | +| RR0194 | [Split local declaration and assignment](RR0194.md) | ✓ | +| RR0195 | [Add member to interface](RR0195.md) | ✓ | +| RR0196 | [Merge if with parent if](RR0196.md) | ✓ | +| RR0197 | [Initialize field from constructor](RR0197.md) | ✓ | +| RR0198 | [Inline property](RR0198.md) | ✓ | +| RR0199 | [Remove enum member value(s)](RR0199.md) | ✓ | +| RR0200 | [Uncomment multi-line comment](RR0200.md) | ✓ | +| RR0201 | [Convert interpolated string to 'string.Format'](RR0201.md) | ✓ | +| RR0202 | [Move unsafe context to containing declaration](RR0202.md) | ✓ | +| RR0203 | [Extract event handler method](RR0203.md) | ✓ | +| RR0204 | [Generate property for DebuggerDisplay attribute](RR0204.md) | ✓ | +| RR0205 | [Add empty line between declarations](RR0205.md) | ✓ | +| RR0206 | [Use enumerator explicitly](RR0206.md) | ✓ | +| RR0207 | [Sort case labels](RR0207.md) | ✓ | +| RR0208 | [Add tag to documentation comment](RR0208.md) | ✓ | +| RR0209 | [Remove async/await](RR0209.md) | ✓ | +| RR0210 | [Implement custom enumerator](RR0210.md) | ✓ | +| RR0211 | [Convert statements to if-else](RR0211.md) | ✓ | +| RR0212 | [Copy switch section](RR0212.md) | ✓ | +| RR0213 | [Add parameter to interface member](RR0213.md) | ✓ | +| RR0214 | [Convert 'switch' expression to 'switch' statement](RR0214.md) | ✓ | +| RR0215 | [Expand positional constructor](RR0215.md) | ✓ | +| RR0216 | [Add all properties to initializer](RR0216.md) | ✓ | +| RR0217 | [Deconstruct foreach variable](RR0217.md) | ✓ | + + +*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/docs/refactorings/RRXXXX.md b/docs/refactorings/RRXXXX.md index 35517152a6..9b282d1e6e 100644 --- a/docs/refactorings/RRXXXX.md +++ b/docs/refactorings/RRXXXX.md @@ -32,8 +32,8 @@ Remarks ## See Also -* [A sample link](http://github.com/JosefPihrt/Roslynator) +* [A sample link](https://github.com/JosefPihrt/Roslynator) * [Full list of refactorings](Refactorings.md) -*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file +*\(Generated with [DotMarkdown](https://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/docs/refactorings/Refactorings.md b/docs/refactorings/Refactorings.md deleted file mode 100644 index e2af5d8257..0000000000 --- a/docs/refactorings/Refactorings.md +++ /dev/null @@ -1,2592 +0,0 @@ -## Roslynator Refactorings - -#### Add all properties to initializer \(RR0216\) - -* **Syntax**: object/record initializer - -#### Before - -```csharp -class C -{ - public string P1 { get; set; } - public string P2 { get; set; } - - void M() - { - var x = new C() { }; - } -} -``` - -#### After - -```csharp -class C -{ - public string P1 { get; set; } - public string P2 { get; set; } - - void M() - { - var x = new C() { P1 = , P2 = }; - } -} -``` - -#### Add argument name \(RR0011\) - -* **Syntax**: argument list -![Add argument name](../../images/refactorings/AddArgumentName.png) - -#### Add braces \(RR0002\) - -* **Syntax**: do statement, else clause, fixed statement, for statement, foreach statement, if statement, lock statement, using statement, while statement -* **Span**: embedded statement -![Add braces](../../images/refactorings/AddBraces.png) - -#### Add braces to if\-else \(RR0003\) - -* **Syntax**: if\-else chain -* **Span**: embedded statement -![Add braces to if-else](../../images/refactorings/AddBracesToIfElse.png) - -#### Add braces to switch section \(RR0004\) - -* **Syntax**: switch section -* **Span**: case or default keyword -![Add braces to switch section](../../images/refactorings/AddBracesToSwitchSection.png) - -#### Add braces to switch sections \(RR0005\) - -* **Syntax**: switch statement -* **Span**: case or default keyword -![Add braces to switch sections](../../images/refactorings/AddBracesToSwitchSections.png) - -#### Add default value to parameter \(RR0007\) - -* **Syntax**: parameter without default value -* **Span**: identifier -![Add default value to parameter](../../images/refactorings/AddDefaultValueToParameter.png) - -#### Add default value to return statement \(RR0008\) - -* **Syntax**: return statement without expression -![Add default value to return statement](../../images/refactorings/AddDefaultValueToReturnStatement.png) - -#### Add empty line between declarations \(RR0205\) - -* **Syntax**: selected declarations - -#### Before - -```csharp -private object x; -private object y; -private object z; -``` - -#### After - -```csharp -private object x; - -private object y; - -private object z; -``` - -#### Add 'exception' element to documentation comment \(RR0009\) - -* **Syntax**: throw statement -![Add 'exception' element to documentation comment](../../images/refactorings/AddExceptionElementToDocumentationComment.png) - -#### Add explicit cast \(RR0006\) - -* **Syntax**: argument, assignment expression, return statement, variable declaration -![Add explicit cast](../../images/refactorings/AddCastExpressionToArgument.png) - -![Add explicit cast](../../images/refactorings/AddCastExpressionToAssignmentExpression.png) - -![Add explicit cast](../../images/refactorings/AddCastExpressionToReturnStatement.png) - -![Add explicit cast](../../images/refactorings/AddCastExpressionToVariableDeclaration.png) - -#### Add generic parameter to a declaration \(RR0178\) - -* **Syntax**: class declaration, struct declaration, interface declaration, delegate declaration, method declaration, local function -![Add generic parameter to a declaration](../../images/refactorings/AddGenericParameterToDeclaration.png) - -#### Add identifier to parameter \(RR0012\) - -* **Syntax**: parameter -* **Span**: missing identifier -![Add identifier to parameter](../../images/refactorings/AddIdentifierToParameter.png) - -#### Add identifier to variable declaration \(RR0010\) - -* **Syntax**: variable declaration -![Add identifier to variable declaration](../../images/refactorings/AddIdentifierToVariableDeclaration.png) - -#### Add member to interface \(RR0195\) - -* **Syntax**: method, property, indexer, event -* **Span**: identifier - -#### Before - -```csharp -public class Foo : IFoo -{ - public void Bar() - { - } -} - -public interface IFoo -{ -} -``` - -#### After - -```csharp -public class Foo : IFoo -{ - public void Bar() - { - } -} - -public interface IFoo -{ - void Bar(); -} -``` - -#### Add missing cases to switch statement \(RR0059\) - -* **Syntax**: switch statement - -#### Before - -```csharp -switch (dayOfWeek) -{ - case DayOfWeek.Sunday: - break; - case DayOfWeek.Monday: - break; - case DayOfWeek.Tuesday: - break; - case DayOfWeek.Wednesday: - break; - case DayOfWeek.Thursday: - break; -} -``` - -#### After - -```csharp -switch (dayOfWeek) -{ - case DayOfWeek.Sunday: - break; - case DayOfWeek.Monday: - break; - case DayOfWeek.Tuesday: - break; - case DayOfWeek.Wednesday: - break; - case DayOfWeek.Thursday: - break; - case DayOfWeek.Friday: - break; - case DayOfWeek.Saturday: - break; -} -``` - -#### Add parameter to interface member \(RR0213\) - -* **Syntax**: method declaration, indexer declaration -* **Span**: method name or 'this' keyword - -#### Before - -```csharp -interface IFoo -{ - void Bar(object p); -} - -class Foo : IFoo -{ - public void Bar(object p, object p2) - { - } -} -``` - -#### After - -```csharp -interface IFoo -{ - void Bar(object p, object p2); -} - -class Foo : IFoo -{ - public void Bar(object p, object p2) - { - } -} -``` - -#### Add tag to documentation comment \(RR0208\) - -* **Syntax**: selected word\(s\) in documentation comment - -#### Before - -```csharp -/// -/// null -/// -public class Foo -{ -} -``` - -#### After - -```csharp -/// -/// null -/// -public class Foo -{ -} -``` - -#### Add using directive \(RR0013\) - -* **Syntax**: qualified name -* **Span**: selected namespace -![Add using directive](../../images/refactorings/AddUsingDirective.png) - -#### Add using static directive \(RR0014\) - -* **Syntax**: member access expression \(public or internal static class\) -* **Span**: selected class name -![Add using static directive](../../images/refactorings/AddUsingStaticDirective.png) - -#### Call 'ConfigureAwait\(false\)' \(RR0015\) - -* **Syntax**: awaitable method invocation -* **Span**: method name -![Call 'ConfigureAwait(false)'](../../images/refactorings/CallConfigureAwait.png) - -#### Call extension method as instance method \(RR0016\) - -* **Syntax**: method invocation -![Call extension method as instance method](../../images/refactorings/CallExtensionMethodAsInstanceMethod.png) - -#### Call string\.IndexOf instead of string\.Contains \(RR0144\) - -* **Syntax**: method invocation -* **Span**: method name - -#### Before - -```csharp -if (s.Contains("a")) -{ -{ -``` - -#### After - -```csharp -if (s.IndexOf("a", StringComparison.OrdinalIgnoreCase) != -1) -{ -{ -``` - -#### Call 'To\.\.\.' method \(ToString, ToArray, ToList\) \(RR0017\) - -* **Syntax**: argument, assignment expression, return statement, variable declaration -![Call 'To...' method (ToString, ToArray, ToList)](../../images/refactorings/CallToMethod.png) - -#### Change accessibility \(RR0186\) - -* **Syntax**: access modifier -![Change accessibility](../../images/refactorings/ChangeAccessibility.png) - -#### Change method return type to 'void' \(RR0021\) - -* **Syntax**: method, local function -![Change method return type to 'void'](../../images/refactorings/ChangeMethodReturnTypeToVoid.png) - -#### Change method/property/indexer type according to return expression \(RR0019\) - -* **Syntax**: return statement in method/property/indexer -![Change method/property/indexer type according to return expression](../../images/refactorings/ChangeMemberTypeAccordingToReturnExpression.png) - -#### Change method/property/indexer type according to yield return expression \(RR0020\) - -* **Syntax**: yield return statement in method/property/indexer -![Change method/property/indexer type according to yield return expression](../../images/refactorings/ChangeMemberTypeAccordingToYieldReturnExpression.png) - -#### Change type according to expression \(RR0022\) - -* **Syntax**: variable declaration, foreach statement -* **Span**: type - -#### Before - -```csharp -IEnumerable items = new List(); -``` - -#### After - -```csharp -List items = new List(); -``` - -#### Check expression for null \(RR0024\) - -* **Syntax**: local declaration \(identifier\), assignment expression \(left\) -![Check expression for null](../../images/refactorings/CheckExpressionForNull.png) - -#### Check parameter for null \(RR0025\) - -* **Syntax**: parameter -* **Span**: parameter identifier -![Check parameter for null](../../images/refactorings/CheckParameterForNull.png) - -#### Comment out member declaration \(RR0027\) - -* **Syntax**: method, constructor, property, indexer, operator, event, namespace, class, struct, interface -* **Span**: opening or closing brace -![Comment out member declaration](../../images/refactorings/CommentOutMemberDeclaration.png) - -#### Comment out statement \(RR0028\) - -* **Syntax**: do statement, fixed statement, for statement, foreach statement, checked statement, if statement, lock statement, switch statement, try statement, unchecked statement, unsafe statement, using statement, while statement -* **Span**: opening or closing brace -![Comment out statement](../../images/refactorings/CommentOutStatement.png) - -#### Convert "" to string\.Empty \(RR0171\) - -* **Syntax**: empty string literal -![Convert "" to string.Empty](../../images/refactorings/UseStringEmptyInsteadOfEmptyStringLiteral.png) - -#### Convert ?: to if\-else \(RR0120\) - -* **Syntax**: ?: operator that is part of local declaration, assignment or \(yield\) return statement - -#### Before - -```csharp -string s = (x) ? "a" : "b"; -``` - -#### After - -```csharp -string s; -if (x) -{ - s = "a"; -} -else -{ - s = "b"; -} -``` - -- - - - -#### Before - -```csharp -string s = (x) ? "a" : (y) ? "b" : "c"; -``` - -#### After - -```csharp -string s; -if (x) -{ - s = "a"; -} -else if (y) -{ - s = "b"; -} -else -{ - s = "c"; -} -``` - -#### Convert auto\-property to full property \(RR0041\) - -* **Syntax**: auto\-property -![Convert auto-property to full property](../../images/refactorings/ConvertAutoPropertyToFullProperty.png) - -#### Convert auto\-property to full property \(without backing field\) \(RR0040\) - -* **Syntax**: auto\-property -![Convert auto-property to full property (without backing field)](../../images/refactorings/ConvertAutoPropertyToFullPropertyWithoutBackingField.png) - -#### 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 - -#### Before - -```csharp -// comment -public class Foo -{ -} -``` - -#### After - -```csharp -/// -/// comment -/// -public class Foo -{ -} -``` - -#### Convert 'do' to 'while' \(RR0123\) - -* **Syntax**: do statement -* **Span**: do keyword - -#### Before - -```csharp -do -{ -} while (condition); -``` - -#### After - -```csharp -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 -![Convert 'for' to 'foreach'](../../images/refactorings/ConvertForToForEach.png) - -#### Convert 'for' to 'while' \(RR0131\) - -* **Syntax**: for statement -* **Span**: for keyword or selected for statement -![Convert 'for' to 'while'](../../images/refactorings/ConvertForToWhile.png) - -#### Convert 'foreach' to 'for' \(RR0129\) - -* **Syntax**: foreach statement -![Convert 'foreach' to 'for'](../../images/refactorings/ConvertForEachToFor.png) - -#### Convert 'foreach' to 'for' and reverse loop \(RR0188\) - -* **Syntax**: foreach statement - -#### Before - -```csharp -foreach (object item in items) -{ - yield return item; -} -``` - -#### After - -```csharp -for (int i = items.Count - 1; i >= 0; i--) -{ - yield return items[i]; -} -``` - -#### Convert 'HasFlag' call to bitwise operation \(RR0164\) - -* **Syntax**: Enum\.HasFlag method invocation -![Convert 'HasFlag' call to bitwise operation](../../images/refactorings/ConvertHasFlagCallToBitwiseOperation.png) - -#### Convert hexadecimal literal to decimal literal \(RR0132\) - -* **Syntax**: hexadecimal literal -![Convert hexadecimal literal to decimal literal](../../images/refactorings/ConvertHexadecimalLiteralToDecimalLiteral.png) - -#### Convert 'if' to ?: \(RR0166\) - -* **Syntax**: if statement -* **Span**: top if keyword or selected if statement -![Convert 'if' to ?:](../../images/refactorings/ConvertIfToConditionalExpression.png) - -#### Convert 'if' to 'switch' \(RR0133\) - -* **Syntax**: if statement -* **Span**: top if keyword or selected if statement - -#### Before - -```csharp -var ch = stringReader.Read(); - -if (ch == 10 || ch == 13) -{ - return; -} -else -{ - stringBuilder.Append(ch); -} -``` - -#### After - -```csharp -var ch = stringReader.Read(); - -switch (ch) -{ - case 10: - case 13: - { - return; - } - - default: - { - stringBuilder.Append(ch); - break; - } -} -``` - -#### Convert interpolated string to concatenation \(RR0193\) - -* **Syntax**: interpolated string - -#### Before - -```csharp -string s = $"a{b}c"; -``` - -#### After - -```csharp -string s = "a" + b + "c"; -``` - -#### Convert interpolated string to string literal \(RR0136\) - -* **Syntax**: Interpolated string without any interpolation -![Convert interpolated string to string literal](../../images/refactorings/ConvertInterpolatedStringToStringLiteral.png) - -#### Convert interpolated string to 'string\.Format' \(RR0201\) - -* **Syntax**: interpolated string - -#### Before - -```csharp -$"name: {name,0:f}, value: {value}" -``` - -#### After - -```csharp -string.Format("name: {0,0:f} value: {1}", name, value) -``` - -#### Convert lambda block body to expression body \(RR0154\) - -* **Syntax**: lambda expression with block body with single single\-line statement -* **Span**: body -![Convert lambda block body to expression body](../../images/refactorings/ConvertLambdaBlockBodyToExpressionBody.png) - -#### 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 method group to lambda \(RR0137\) - -* **Syntax**: method group - -#### Before - -```csharp -Func func = Foo; -``` - -#### After - -```csharp -Func func = (f, g) => Foo(f, g) -``` - -#### Convert regular string literal to verbatim string literal \(RR0142\) - -* **Syntax**: regular string literal -![Convert regular string literal to verbatim string literal](../../images/refactorings/ConvertRegularStringLiteralToVerbatimStringLiteral.png) - -#### Convert 'return' statement to 'if' \(RR0143\) - -* **Syntax**: return statement, yield return statement -* **Span**: selected statement, yield keyword or return keyword -![Convert 'return' statement to 'if'](../../images/refactorings/ReplaceReturnStatementWithIfElse.png) - -#### Convert statements to if\-else \(RR0211\) - -* **Syntax**: selected statements \(first statement must be 'if' statement\) - -#### Before - -```csharp -if (x) - return 1; - -if (y) -{ - return 2; -} -else if (z) -{ - return 3; -} - -return 0; -``` - -#### After - -```csharp -if (x) -{ - return 1; -} -else if (y) -{ - return 2; -} -else if (z) -{ - return 3; -} -else -{ - return 0; -} -``` - -#### Convert 'string\.Format' to interpolated string \(RR0145\) - -* **Syntax**: string\.Format method -![Convert 'string.Format' to interpolated string](../../images/refactorings/ConvertStringFormatToInterpolatedString.png) - -#### Convert 'switch' expression to 'switch' statement \(RR0214\) - -* **Syntax**: switch expression -* **Span**: switch keyword - -#### Before - -```csharp -return dayOfWeek switch -{ - DayOfWeek.Monday => 1, - DayOfWeek.Tuesday => 2, - DayOfWeek.Wednesday => 3, - DayOfWeek.Thursday => 4, - DayOfWeek.Friday => 5, - _ => throw new Exception(), -}; -``` - -#### After - -```csharp -switch (dayOfWeek) -{ - case DayOfWeek.Monday: - return 1; - case DayOfWeek.Tuesday: - return 2; - case DayOfWeek.Wednesday: - return 3; - case DayOfWeek.Thursday: - return 4; - case DayOfWeek.Friday: - return 5; - default: - throw new Exception(); -} -``` - -#### Convert 'switch' to 'if' \(RR0147\) - -* **Syntax**: switch statement -* **Span**: switch keyword -![Convert 'switch' to 'if'](../../images/refactorings/ConvertSwitchToIf.png) - -#### Convert verbatim string literal to regular string literal \(RR0148\) - -* **Syntax**: verbatim string literal -![Convert verbatim string literal to regular string literal](../../images/refactorings/ConvertVerbatimStringLiteralToRegularStringLiteral.png) - -#### Convert verbatim string literal to regular string literals \(RR0149\) - -* **Syntax**: multiline verbatim string literal -![Convert verbatim string literal to regular string literals](../../images/refactorings/ConvertVerbatimStringLiteralToRegularStringLiterals.png) - -#### Convert 'while' statement to 'do' statement \(RR0150\) - -* **Syntax**: while statement -* **Span**: while keyword - -#### Before - -```csharp -while (condition) -{ -} -``` - -#### After - -```csharp -if (condition) -{ - do - { - } while (condition); -} -``` - -#### Convert 'while' statement to 'for' statement \(RR0151\) - -* **Syntax**: while statement -* **Span**: while keyword or selected statement\(s\) -![Convert 'while' statement to 'for' statement](../../images/refactorings/ConvertWhileToFor.png) - -#### Copy argument \(RR0030\) - -* **Syntax**: missing argument -![Copy argument](../../images/refactorings/CopyArgument.png) - -#### Copy documentation comment from base member \(RR0029\) - -* **Syntax**: constructor, method, property, indexer, event -![Copy documentation comment from base member](../../images/refactorings/CopyDocumentationCommentFromBaseMember.png) - -![Copy documentation comment from base member](../../images/refactorings/CopyDocumentationCommentFromImplementedMember.png) - -#### Copy member declaration \(RR0031\) - -* **Syntax**: method, constructor, property, indexer, operator, event, namespace, class, struct, interface -* **Span**: opening or closing brace -![Copy member declaration](../../images/refactorings/CopyMemberDeclaration.png) - -#### Copy parameter \(RR0032\) - -* **Syntax**: missing parameter -![Copy parameter](../../images/refactorings/CopyParameter.png) - -#### Copy statement \(RR0033\) - -* **Syntax**: do statement, fixed statement, for statement, foreach statement, checked statement, if statement, lock statement, switch statement, try statement, unchecked statement, unsafe statement, using statement, while statement -* **Span**: opening or closing brace -![Copy statement](../../images/refactorings/CopyStatement.png) - -#### Copy switch section \(RR0212\) - -* **Syntax**: switch section -* **Span**: close brace or empty line after switch section - -#### Before - -```csharp -switch (s) -{ - case "a": - { - // ... - - break; - } - default: - { - break; - } -} -``` - -#### After - -```csharp -switch (s) -{ - case "a": - { - // ... - - break; - } - case "a": - { - // ... - - break; - } - default: - { - break; - } -} -``` - -#### Deconstruct foreach variable \(RR0217\) - -* **Syntax**: foreach statement - -#### Before - -```csharp -var dic = new Dictionary(); - -foreach (var kvp in dic) -{ - var k = kvp.Key; - var v = kvp.Value.ToString(); -} -``` - -#### After - -```csharp -var dic = new Dictionary(); - -foreach (var (key, value) in dic) -{ - var k = key; - var v = value.ToString(); -} -``` - -#### Expand coalesce expression \(RR0035\) - -* **Syntax**: coalesce expression -* **Span**: ?? operator -![Expand coalesce expression](../../images/refactorings/ExpandCoalesceExpression.png) - -#### Expand compound assignment \(RR0034\) - -* **Syntax**: compound assignment expression -* **Span**: operator -![Expand compound assignment](../../images/refactorings/ExpandCompoundAssignment.png) - -#### Expand event declaration \(RR0036\) - -* **Syntax**: event field declaration -![Expand event declaration](../../images/refactorings/ExpandEventDeclaration.png) - -#### Expand initializer \(RR0038\) - -* **Syntax**: initializer -![Expand initializer](../../images/refactorings/ExpandInitializer.png) - -#### Expand positional constructor \(RR0215\) - -* **Syntax**: positional record -* **Span**: parameter list - -#### Before - -```csharp -public record Foo([property: Obsolete] string Value1, string Value2); -``` - -#### After - -```csharp -public record Foo -{ - public Foo(string value1, string value2) - { - Value1 = value1; - Value2 = value2; - } - - [Obsolete] - public string Value1 { get; init; } - public string Value2 { get; init; } -} -``` - -#### Extract event handler method \(RR0203\) - -* **Syntax**: lambda expression - -#### Before - -```csharp -void Foo() -{ - x.Changed += (s, e) => Bar(); -} -``` - -#### After - -```csharp -void Foo() -{ - x.Changed += Changed; -} - -void OnChanged(object sender, EventArgs e) -{ - Bar(); -} -``` - -#### Extract expression from condition \(RR0043\) - -* **Syntax**: if statement, while statement -* **Span**: condition - -#### Before - -```csharp -if (x && y) // Select 'y' -{ -} -``` - -#### After - -```csharp -if(x) -{ - if (y) - { - } -} -``` - -- - - - -#### Before - -```csharp -if (x || y) // Select 'y' -{ -} -``` - -#### After - -```csharp -if(x) -{ -} - -if (y) -{ -} -``` - -#### Extract generic type \(RR0044\) - -* **Syntax**: generic name with single type argument -* **Span**: type argument -![Extract generic type](../../images/refactorings/ExtractGenericType.png) - -#### Extract type declaration to a new file \(RR0046\) - -* **Syntax**: class declaration, struct declaration, interface declaration, enum declaration, delegate declaration -* **Span**: identifier -![Extract type declaration to a new file](../../images/refactorings/ExtractTypeDeclarationToNewFile.png) - -#### Format accessor braces \(RR0047\) - -* **Syntax**: get accessor, set accessor, add accessor, remove accessor -* **Span**: block -![Format accessor braces](../../images/refactorings/FormatAccessorBracesOnMultipleLines.png) - -![Format accessor braces](../../images/refactorings/FormatAccessorBracesOnSingleLine.png) - -#### Generate base constructors \(RR0054\) - -* **Syntax**: class declaration -* **Span**: identifier -![Generate base constructors](../../images/refactorings/GenerateBaseConstructors.png) - -#### Generate combined enum member \(RR0055\) - -* **Syntax**: enum declaration \(with FlagsAttribute\) -![Generate combined enum member](../../images/refactorings/GenerateCombinedEnumMember.png) - -#### Generate enum member \(RR0056\) - -* **Syntax**: enum declaration \(with FlagsAttribute\) -![Generate enum member](../../images/refactorings/GenerateEnumMember.png) - -#### Generate enum values \(RR0057\) - -* **Syntax**: enum declaration \(with FlagsAttribute\) -![Generate enum values](../../images/refactorings/GenerateEnumValues.png) - -#### Generate event invoking method \(RR0058\) - -* **Syntax**: event -* **Span**: identifier -![Generate event invoking method](../../images/refactorings/GenerateEventInvokingMethod.png) - -#### Generate property for DebuggerDisplay attribute \(RR0204\) - -* **Syntax**: DebuggerDisplay attribute - -#### Before - -```csharp -[DebuggerDisplay("A: {A} B: {B}")] -public class Foo -{ - public string A { get; } - public string B { get; } -} -``` - -#### After - -```csharp -DebuggerDisplay("{DebuggerDisplay,nq}")] -public class Foo -{ - public string A { get; } - public string B { get; } - - [DebuggerBrowsable(DebuggerBrowsableState.Never)] - private string DebuggerDisplay - { - get { return $"A: {A} B: {B}"; } - } -} -``` - -#### Implement custom enumerator \(RR0210\) - -* **Syntax**: class that implements IEnumerable\ -* **Span**: identifier - -#### Before - -```csharp -using System; -using System.Collections; -using System.Collections.Generic; - -class C : IEnumerable -{ - IEnumerator IEnumerable.GetEnumerator() - { - throw new NotImplementedException(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - throw new NotImplementedException(); - } -} -``` - -#### After - -```csharp -using System; -using System.Collections; -using System.Collections.Generic; - -class C : IEnumerable -{ - IEnumerator IEnumerable.GetEnumerator() - { - throw new NotImplementedException(); - } - - IEnumerator IEnumerable.GetEnumerator() - { - throw new NotImplementedException(); - } - - public Enumerator GetEnumerator() - { - return new Enumerator(this); - } - - public struct Enumerator - { - private readonly C _c; - private int _index; - - internal Enumerator(C c) - { - _c = c; - _index = -1; - } - - public T Current - { - get - { - throw new NotImplementedException(); - } - } - - public bool MoveNext() - { - throw new NotImplementedException(); - } - - public void Reset() - { - _index = -1; - throw new NotImplementedException(); - } - - public override bool Equals(object obj) - { - throw new NotSupportedException(); - } - - public override int GetHashCode() - { - throw new NotSupportedException(); - } - } - - //TODO: IEnumerable.GetEnumerator() and IEnumerable.GetEnumerator() should return instance of EnumeratorImpl. - private class EnumeratorImpl : IEnumerator - { - private Enumerator _e; - - internal EnumeratorImpl(C c) - { - _e = new Enumerator(c); - } - - public T Current - { - get - { - return _e.Current; - } - } - - object IEnumerator.Current - { - get - { - return _e.Current; - } - } - - public bool MoveNext() - { - return _e.MoveNext(); - } - - void IEnumerator.Reset() - { - _e.Reset(); - } - - void IDisposable.Dispose() - { - } - } -} -``` - -#### Implement IEquatable\ \(RR0179\) - -* **Syntax**: class declaration, struct declaration, interface declaration -* **Span**: base list -![Implement IEquatable\](../../images/refactorings/ImplementIEquatableOfT.png) - -#### Initialize field from constructor \(RR0197\) - -* **Syntax**: field declaration -* **Span**: identifier - -#### Before - -```csharp -public class Foo -{ - private string _bar; - - public Foo() - { - } - - public Foo(object parameter) - { - } - - public Foo(object parameter1, object parameter2) - : this(parameter1) - { - } -} -``` - -#### After - -```csharp -public class Foo -{ - private string _bar; - - public Foo(string bar) - { - _bar = bar; - } - - public Foo(object parameter, string bar) - { - _bar = bar; - } - - public Foo(object parameter1, object parameter2, string bar) - : this(parameter1, bar) - { - _bar = bar; - } -} -``` - -#### Initialize local variable with default value \(RR0060\) - -* **Syntax**: local declaration without initializer -* **Span**: identifier -![Initialize local variable with default value](../../images/refactorings/InitializeLocalVariableWithDefaultValue.png) - -#### Inline alias expression \(RR0061\) - -* **Syntax**: using alias directive -* **Span**: identifier -![Inline alias expression](../../images/refactorings/InlineAliasExpression.png) - -#### Inline constant declaration \(RR0181\) - -* **Syntax**: constant declaration -![Inline constant declaration](../../images/refactorings/InlineConstantDeclaration.png) - -#### Inline constant value \(RR0127\) - -* **Syntax**: expression that has constant value - -#### Before - -```csharp -public const string Value = "x"; - -void Foo() -{ - string x = Value; -} -``` - -#### After - -```csharp -public const string Value = "x"; - -void Foo() -{ - string x = "x"; -} -``` - -#### Inline method \(RR0062\) - -* **Syntax**: method invocation -![Inline method](../../images/refactorings/InlineMethod.png) - -#### Inline property \(RR0198\) - -* **Syntax**: property access -![Inline property](../../images/refactorings/InlineProperty.png) - -#### Inline using static directive \(RR0180\) - -* **Syntax**: using static directive -![Inline using static directive](../../images/refactorings/InlineUsingStaticDirective.png) - -#### Insert string interpolation \(RR0063\) - -* **Syntax**: string literal, interpolated string -![Insert string interpolation](../../images/refactorings/InsertInterpolationIntoStringLiteral.png) - -![Insert string interpolation](../../images/refactorings/InsertInterpolationIntoInterpolatedString.png) - -#### Introduce and initialize field \(RR0064\) - -* **Syntax**: constructor parameter -![Introduce and initialize field](../../images/refactorings/IntroduceAndInitializeField.png) - -#### Introduce and initialize property \(RR0065\) - -* **Syntax**: constructor parameter -![Introduce and initialize property](../../images/refactorings/IntroduceAndInitializeProperty.png) - -#### Introduce constructor \(RR0066\) - -* **Syntax**: field, property -![Introduce constructor](../../images/refactorings/IntroduceConstructor.png) - -#### Introduce field to lock on \(RR0067\) - -* **Syntax**: lock statement -* **Span**: missing expression -![Introduce field to lock on](../../images/refactorings/IntroduceFieldToLockOn.png) - -#### Introduce local variable \(RR0068\) - -* **Syntax**: expression statement, expression in using statement -![Introduce local variable](../../images/refactorings/IntroduceLocalVariable.png) - -#### Invert binary expression \(RR0079\) - -* **Syntax**: logical and/or expression -![Invert binary expression](../../images/refactorings/InvertBinaryExpression.png) - -#### Invert boolean literal \(RR0080\) - -* **Syntax**: boolean literal -![Invert boolean literal](../../images/refactorings/InvertBooleanLiteral.png) - -#### Invert conditional expression \(RR0160\) - -* **Syntax**: conditional expression -* **Span**: condition -![Invert conditional expression](../../images/refactorings/InvertConditionalExpression.png) - -#### Invert if \(RR0189\) - -* **Syntax**: if statement -* **Span**: if keyword - -#### Before - -```csharp -if (condition1) -{ - if (condition2) - { - Foo(); - } -} -``` - -#### After - -```csharp -if (!condition1) -{ - return; -} - -if (!condition2) -{ - return; -} - -Foo(); -``` - -- - - - -#### Before - -```csharp -if (!condition1) -{ - return; -} - -if (!condition2) -{ - return; -} - -Foo(); -``` - -#### After - -```csharp -if (condition1) -{ - if (condition2) - { - Foo(); - } -} -``` - -#### Invert if\-else \(RR0162\) - -* **Syntax**: if\-else statement -* **Span**: if keyword -![Invert if-else](../../images/refactorings/InvertIfElse.png) - -#### Invert is expression \(RR0081\) - -* **Syntax**: is expression -* **Span**: operator -![Invert is expression](../../images/refactorings/InvertIsExpression.png) - -#### Invert LINQ method call \(RR0116\) - -* **Syntax**: System\.Linq\.Enumerable\.Any\(Func\\) or System\.Linq\.Enumerable\.All\(Func\\) -* **Span**: method name - -#### Before - -```csharp -if (items.Any(predicate)) -{ -} -``` - -#### After - -```csharp -if (items.All(!predicate)) -{ -} -``` - -- - - - -#### Before - -```csharp -if (items.All(predicate)) -{ -} -``` - -#### After - -```csharp -if (items.Any(!predicate)) -{ -} -``` - -#### Invert operator \(RR0082\) - -* **Syntax**: \!=, &&, \|\|, \<, \<=, ==, >, >= -![Invert operator](../../images/refactorings/InvertOperator.png) - -#### Invert prefix/postfix unary operator \(RR0134\) - -* **Syntax**: prefix/postfix unary expression -* **Span**: operator token - -#### Before - -```csharp -int i = 0; - -i++; -``` - -#### After - -```csharp -int i = 0; - -i--; -``` - -- - - - -#### Before - -```csharp -int i = 0; - -++i; -``` - -#### After - -```csharp -int i = 0; - ---i; -``` - -#### Join string expressions \(RR0078\) - -* **Syntax**: concatenated string expressions -![Join string expressions](../../images/refactorings/JoinStringExpressions.png) - -![Join string expressions](../../images/refactorings/JoinStringLiterals.png) - -![Join string expressions](../../images/refactorings/JoinStringLiteralsIntoMultilineStringLiteral.png) - -#### Make member abstract \(RR0069\) - -* **Syntax**: non\-abstract indexer/method/property in abstract class -* **Span**: indexer/method/property header -![Make member abstract](../../images/refactorings/MakeMemberAbstract.png) - -#### Make member virtual \(RR0070\) - -* **Syntax**: method declaration, indexer declaration -![Make member virtual](../../images/refactorings/MakeMemberVirtual.png) - -#### Merge attributes \(RR0074\) - -* **Syntax**: selected attribute lists -![Merge attributes](../../images/refactorings/MergeAttributes.png) - -#### Merge 'if' statements \(RR0075\) - -* **Syntax**: selected 'if' statements - -#### Before - -```csharp -if (x) -{ - return false; -} - -if (y) -{ - return false; -} - -return true; -``` - -#### After - -```csharp -if (x || y) -{ - return false; -} - -return true; -``` - -#### Merge if with parent if \(RR0196\) - -* **Syntax**: if statement -* **Span**: if keyword - -#### Before - -```csharp -if (x) -{ - if (y) - { - } -} -else -{ -} -``` - -#### After - -```csharp -if (x && y) -{ -} -else -{ -} -``` - -#### Merge interpolation into interpolated string \(RR0076\) - -* **Syntax**: interpolation -![Merge interpolation into interpolated string](../../images/refactorings/MergeInterpolationIntoInterpolatedString.png) - -#### Merge local declarations \(RR0077\) - -* **Syntax**: local declarations with same type -![Merge local declarations](../../images/refactorings/MergeLocalDeclarations.png) - -#### Merge switch sections \(RR0110\) - -* **Syntax**: selected switch sections -![Merge switch sections](../../images/refactorings/MergeSwitchSections.png) - -#### Move unsafe context to containing declaration \(RR0202\) - -* **Syntax**: unsafe declaration -* **Span**: unsafe modifier - -#### Before - -```csharp -public class Foo -{ - public unsafe void Bar() - { - } -} -``` - -#### After - -```csharp -public unsafe class Foo -{ - public void Bar() - { - } -} -``` - -#### Notify when property changes \(RR0083\) - -* **Syntax**: property in class/struct that implements System\.ComponentModel\.INotifyPropertyChanged -* **Span**: setter -![Notify when property changes](../../images/refactorings/NotifyWhenPropertyChanges.png) - -#### Parenthesize expression \(RR0084\) - -* **Syntax**: selected expression -![Parenthesize expression](../../images/refactorings/ParenthesizeExpression.png) - -#### Promote local variable to parameter \(RR0085\) - -* **Syntax**: local declaration in method -![Promote local variable to parameter](../../images/refactorings/PromoteLocalVariableToParameter.png) - -#### Remove all comments \(RR0086\) - -* **Syntax**: singleline/multiline comment, singleline/multiline documentation documentation comment -![Remove all comments](../../images/refactorings/RemoveAllComments.png) - -#### Remove all comments \(except documentation comments\) \(RR0087\) - -* **Syntax**: singleline/multiline comment -![Remove all comments (except documentation comments)](../../images/refactorings/RemoveAllCommentsExceptDocumentationComments.png) - -#### Remove all documentation comments \(RR0088\) - -* **Syntax**: singleline/multiline documentation comment -![Remove all documentation comments](../../images/refactorings/RemoveAllDocumentationComments.png) - -#### Remove all member declarations \(RR0089\) - -* **Syntax**: namespace, class, struct, interface -* **Span**: opening or closing brace -![Remove all member declarations](../../images/refactorings/RemoveAllMemberDeclarations.png) - -#### Remove all preprocessor directives \(RR0090\) - -* **Syntax**: preprocessor directive -![Remove all preprocessor directives](../../images/refactorings/RemoveAllPreprocessorDirectives.png) - -#### Remove all region directives \(RR0091\) - -* **Syntax**: region directive -![Remove all region directives](../../images/refactorings/RemoveAllRegionDirectives.png) - -#### Remove all statements \(RR0092\) - -* **Syntax**: method, constructor, operator -* **Span**: opening or closing brace -![Remove all statements](../../images/refactorings/RemoveAllStatements.png) - -#### Remove all switch sections \(RR0093\) - -* **Syntax**: switch statement -* **Span**: opening or closing brace -![Remove all switch sections](../../images/refactorings/RemoveAllSwitchSections.png) - -#### Remove argument name \(RR0105\) - -* **Syntax**: selected argument\(s\) -![Remove argument name](../../images/refactorings/RemoveArgumentName.png) - -#### Remove async/await \(RR0209\) - -* **Syntax**: method declaration, local function, lambda, anonymous method -* **Span**: async keyword - -#### Before - -```csharp -class C -{ - async Task FooAsync() - { - return await BarAsync().ConfigureAwait(false); - } -} -``` - -#### After - -```csharp -class C -{ - Task FooAsync() - { - return BarAsync(); - } -} -``` - -#### Remove braces \(RR0094\) - -* **Syntax**: do statement, else clause, fixed statement, for statement, foreach statement, if statement, lock statement, using statement, while statement -* **Span**: block with a single statement -![Remove braces](../../images/refactorings/RemoveBraces.png) - -#### Remove braces from if\-else \(RR0095\) - -* **Syntax**: if\-else chain -* **Span**: embedded statement -![Remove braces from if-else](../../images/refactorings/RemoveBracesFromIfElse.png) - -#### Remove braces from switch section \(RR0096\) - -* **Syntax**: switch section -* **Span**: case or default keyword -![Remove braces from switch section](../../images/refactorings/RemoveBracesFromSwitchSection.png) - -#### Remove braces from switch sections \(RR0097\) - -* **Syntax**: switch statement -* **Span**: case or default keyword -![Remove braces from switch sections](../../images/refactorings/RemoveBracesFromSwitchSections.png) - -#### Remove comment \(RR0098\) - -* **Syntax**: singleline/multiline comment, singleline/multiline xml documentation comment -![Remove comment](../../images/refactorings/RemoveComment.png) - -#### Remove condition from last else clause \(RR0099\) - -* **Syntax**: else clause -* **Span**: else keyword -![Remove condition from last else clause](../../images/refactorings/RemoveConditionFromLastElse.png) - -#### Remove containing statement \(RR0045\) - -* **Syntax**: else clause, fixed statement, for statement, foreach statement, checked statement, if statement, lock statement, try statement, unsafe statement, using statement, while statement -![Remove containing statement](../../images/refactorings/RemoveContainingStatement.png) - -#### Remove empty lines \(RR0101\) - -* **Syntax**: selected lines -![Remove empty lines](../../images/refactorings/RemoveEmptyLines.png) - -#### Remove enum member value\(s\) \(RR0199\) - -* **Syntax**: selected enum member\(s\) - -#### Before - -```csharp -public enum Foo -{ - One = 1, - Two = 2, - Three = 3 -} -``` - -#### After - -```csharp -public enum Foo -{ - One, - Two, - Three -} -``` - -#### Remove instantiation of a local variable \(RR0185\) - -* **Syntax**: local variable with a new object creation - -#### Before - -```csharp -var x = new object(); -``` - -#### After - -```csharp -object x = null; -``` - -- - - - -#### Before - -```csharp -var arr = new object[0]; -``` - -#### After - -```csharp -object[] arr = null; -``` - -#### Remove interpolation \(RR0102\) - -* **Syntax**: string interpolation -* **Span**: opening or closing brace -![Remove interpolation](../../images/refactorings/RemoveInterpolation.png) - -#### Remove member declaration \(RR0103\) - -* **Syntax**: method, constructor, property, indexer, operator, event, namespace, class, struct, interface -* **Span**: opening or closing brace -![Remove member declaration](../../images/refactorings/RemoveMemberDeclaration.png) - -#### Remove member declarations above/below \(RR0104\) - -* **Syntax**: empty line between member declarations -![Remove member declarations above/below](../../images/refactorings/RemoveMemberDeclarations.png) - -#### Remove parentheses \(RR0106\) - -* **Syntax**: parenthesized expression -* **Span**: opening or closing parenthesis -![Remove parentheses](../../images/refactorings/RemoveParentheses.png) - -#### Remove preprocessor directive \(RR0100\) - -* **Syntax**: \#if directive, \#region directive -![Remove preprocessor directive](../../images/refactorings/RemovePreprocessorDirective.png) - -#### Remove property initializer \(RR0107\) - -* **Syntax**: property initializer -![Remove property initializer](../../images/refactorings/RemovePropertyInitializer.png) - -#### Remove region \(RR0108\) - -* **Syntax**: region directive -![Remove region](../../images/refactorings/RemoveRegion.png) - -#### Remove statement \(RR0109\) - -* **Syntax**: do statement, fixed statement, for statement, foreach statement, checked statement, if statement, lock statement, switch statement, try statement, unchecked statement, unsafe statement, using statement, while statement -* **Span**: open/close brace -![Remove statement](../../images/refactorings/RemoveStatement.png) - -#### Remove unnecessary assignment \(RR0073\) - -* **Syntax**: assignment expression followed with return statement -![Remove unnecessary assignment](../../images/refactorings/RemoveUnnecessaryAssignment.png) - -#### Rename identifier according to type name \(RR0112\) - -* **Syntax**: foreach statement, local/field/constant declaration -* **Span**: identifier -![Rename identifier according to type name](../../images/refactorings/RenameForEachIdentifierAccordingToTypeName.png) - -![Rename identifier according to type name](../../images/refactorings/RenameFieldIdentifierAccordingToTypeName.png) - -#### Rename method according to type name \(RR0113\) - -* **Syntax**: method -![Rename method according to type name](../../images/refactorings/RenameMethodAccordingToTypeName.png) - -#### Rename parameter according to its type name \(RR0114\) - -* **Syntax**: parameter -* **Span**: parameter identifier -![Rename parameter according to its type name](../../images/refactorings/RenameParameterAccordingToTypeName.png) - -#### Rename property according to type name \(RR0115\) - -* **Syntax**: property identifier -![Rename property according to type name](../../images/refactorings/RenamePropertyAccordingToTypeName.png) - -#### Replace 'as' expression with explicit cast \(RR0117\) - -* **Syntax**: as expression -![Replace 'as' expression with explicit cast](../../images/refactorings/ReplaceAsExpressionWithExplicitCast.png) - -#### Replace conditional expression with true/false branch \(RR0119\) - -* **Syntax**: conditional expression -* **Span**: selected true/false expression -![Replace conditional expression with true/false branch](../../images/refactorings/ReplaceConditionalExpressionWithTrueOrFalseBranch.png) - -#### Replace equality operator with string\.Equals \(RR0124\) - -* **Syntax**: equals expression, not equals expression -* **Span**: operator -![Replace equality operator with string.Equals](../../images/refactorings/ReplaceEqualityOperatorWithStringEquals.png) - -#### Replace equality operator with string\.IsNullOrEmpty \(RR0125\) - -* **Syntax**: equals expression, not equals expression -* **Span**: operator -![Replace equality operator with string.IsNullOrEmpty](../../images/refactorings/ReplaceEqualityOperatorWithStringIsNullOrEmpty.png) - -#### Replace equality operator with string\.IsNullOrWhiteSpace \(RR0126\) - -* **Syntax**: equals expression, not equals expression -* **Span**: operator -![Replace equality operator with string.IsNullOrWhiteSpace](../../images/refactorings/ReplaceEqualityOperatorWithStringIsNullOrWhiteSpace.png) - -#### Replace explicit cast expression 'as' expression \(RR0118\) - -* **Syntax**: cast expression -![Replace explicit cast expression 'as' expression](../../images/refactorings/ReplaceExplicitCastWithAsExpression.png) - -#### Replace interpolated string with interpolation expression \(RR0135\) - -* **Syntax**: interpolated string with single interpolation and no text -* **Span**: interpolation -![Replace interpolated string with interpolation expression](../../images/refactorings/ReplaceInterpolatedStringWithInterpolationExpression.png) - -#### Replace method with property \(RR0138\) - -* **Syntax**: method -* **Span**: method header -![Replace method with property](../../images/refactorings/ReplaceMethodWithProperty.png) - -#### Replace 'null' with 'default\(\.\.\.\)' \(RR0139\) - -* **Syntax**: argument -![Replace 'null' with 'default(...)'](../../images/refactorings/ReplaceNullLiteralWithDefaultExpression.png) - -#### Replace prefix operator to postfix operator \(RR0140\) - -* **Syntax**: prefix/postfix unary expression -![Replace prefix operator to postfix operator](../../images/refactorings/ReplacePrefixOperatorWithPostfixOperator.png) - -#### Replace property with method \(RR0141\) - -* **Syntax**: read\-only property -* **Span**: property header -![Replace property with method](../../images/refactorings/ReplacePropertyWithMethod.png) - -#### Reverse 'for' statement \(RR0152\) - -* **Syntax**: for statement -![Reverse 'for' statement](../../images/refactorings/ReverseForStatement.png) - -#### Simplify if \(RR0153\) - -* **Syntax**: if statement -* **Span**: top if keyword or selected if statement -![Simplify if](../../images/refactorings/SimplifyIf.png) - -#### Sort case labels \(RR0207\) - -* **Syntax**: selected case labels with string literal or enum field - -#### Before - -```csharp -bool Foo(string s) -{ - switch (s) - { - case "d": - case "b": - case "a": - case "c": - return true; - default: - return false; - } -} -``` - -#### After - -```csharp -bool Foo(string s) -{ - switch (s) - { - case "a": - case "b": - case "c": - case "d": - return true; - default: - return false; - } -} -``` - -#### Sort member declarations \(RR0155\) - -* **Syntax**: namespace declarations, class declarations, struct declarations, interface declarations, enum declarations -* **Span**: selected member declarations -![Sort member declarations](../../images/refactorings/SortMembersByKind.png) - -![Sort member declarations](../../images/refactorings/SortMembersByName.png) - -![Sort member declarations](../../images/refactorings/SortEnumMembersByName.png) - -![Sort member declarations](../../images/refactorings/SortEnumMembersByValue.png) - -#### Split attributes \(RR0156\) - -* **Syntax**: selected attribute list -![Split attributes](../../images/refactorings/SplitAttributes.png) - -#### Split if \(RR0184\) - -* **Syntax**: if statement that has 'logical or' expression as a condition -* **Span**: top if keyword or selected if statement -![Split if](../../images/refactorings/SplitIf.png) - -#### Split if\-else \(RR0190\) - -* **Syntax**: if statement -* **Span**: selected if statement or topmost if keyword - -#### Before - -```csharp -if (condition1) -{ - return Foo1(); -{ -else if (condition2) -{ - return Foo2(); -} -else -{ - return false; -} -``` - -#### After - -```csharp -if (condition1) -{ - return Foo1(); -{ - -if (condition2) -{ - return Foo2(); -} - -return false; -``` - -#### Split local declaration and assignment \(RR0194\) - -* **Syntax**: local variable declaration -* **Span**: equals token - -#### Before - -```csharp -var s = GetValue(); -``` - -#### After - -```csharp -string s; -s = GetValue(); -``` - -#### Split switch labels \(RR0157\) - -* **Syntax**: selected switch labels -![Split switch labels](../../images/refactorings/SplitSwitchLabels.png) - -#### Split variable declaration \(RR0158\) - -* **Syntax**: local declaration, field declaration, event field declaration -![Split variable declaration](../../images/refactorings/SplitLocalDeclaration.png) - -#### Swap binary operands \(RR0159\) - -* **Syntax**: binary expression -* **Span**: binary operator - -#### Before - -```csharp -if (x && y) -{ -{ -``` - -#### After - -```csharp -if (y && x) -{ -{ -``` - -#### Swap member declarations \(RR0161\) - -* **Syntax**: empty line between member declarations -![Swap member declarations](../../images/refactorings/SwapMemberDeclarations.png) - -#### Synchronize property name and backing field name \(RR0111\) - -* **Syntax**: field identifier inside property declaration -![Synchronize property name and backing field name](../../images/refactorings/SyncPropertyNameAndBackingFieldName.png) - -#### Uncomment multi\-line comment \(RR0200\) - -* **Syntax**: multi\-line comment - -#### Before - -```csharp -/*string s = null;*/ -``` - -#### After - -```csharp -string s = null; -``` - -#### Uncomment single\-line comment \(RR0163\) - -* **Syntax**: single\-line comment\(s\) -![Uncomment single-line comment](../../images/refactorings/UncommentSingleLineComment.png) - -#### Use "" instead of string\.Empty \(RR0168\) - -* **Syntax**: string\.Empty field -![Use "" instead of string.Empty](../../images/refactorings/UseEmptyStringLiteralInsteadOfStringEmpty.png) - -#### Use coalesce expression instead of if \(RR0165\) - -* **Syntax**: if statement -* **Span**: top if keyword or selected if statement -![Use coalesce expression instead of if](../../images/refactorings/UseCoalesceExpressionInsteadOfIf.png) - -#### Use constant instead of read\-only field \(RR0128\) - -* **Syntax**: read\-only field -![Use constant instead of read-only field](../../images/refactorings/UseConstantInsteadOfReadOnlyField.png) - -#### Use element access instead of LINQ method \(RR0167\) - -* **Syntax**: First/Last/ElementAt method invocation -* **Span**: method name -![Use element access instead of LINQ method](../../images/refactorings/UseElementAccessInsteadOfLinqMethod.png) - -#### Use enumerator explicitly \(RR0206\) - -* **Syntax**: foreach statement -* **Span**: foreach keyword - -#### Before - -```csharp -foreach (var item in items) -{ - yield return item; -} -``` - -#### After - -```csharp -using (var en = items.GetEnumerator()) -{ - while (en.MoveNext()) - { - yield return item; - } -} -``` - -#### Use explicit type \(RR0023\) - -* **Syntax**: variable declaration, foreach statement -* **Span**: type -![Use explicit type](../../images/refactorings/UseExplicitType.png) - -#### Use implicit type \(RR0018\) - -* **Syntax**: variable declaration, foreach statement -* **Span**: type -![Use implicit type](../../images/refactorings/UseImplicitType.png) - -#### Use index initializer \(RR0191\) - -* **Syntax**: collection initializer - -#### Before - -```csharp -var dic = new Dictionary() { { 0, "0" } }; -``` - -#### After - -```csharp -var dic = new Dictionary() { [0] = "0" }; -``` - -#### Use lambda instead of anonymous method \(RR0170\) - -* **Syntax**: anonymous method -* **Span**: delegate keyword -![Use lambda instead of anonymous method](../../images/refactorings/UseLambdaInsteadOfAnonymousMethod.png) - -#### Use List\ instead of yield \(RR0183\) - -* **Syntax**: yield return, yield break -![Use List\ instead of yield](../../images/refactorings/UseListInsteadOfYield.png) - -#### Use object initializer \(RR0026\) - -* **Syntax**: selected statements \(object creation followed with assignment\(s\)\) -![Use object initializer](../../images/refactorings/UseObjectInitializer.png) - -#### Use read\-only field instead of constant \(RR0121\) - -* **Syntax**: constant declaration -![Use read-only field instead of constant](../../images/refactorings/UseReadOnlyFieldInsteadOfConstant.png) - -#### Use StringBuilder instead of concatenation \(RR0182\) - -* **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 else clause \(RR0173\) - -* **Syntax**: statement -![Wrap in else clause](../../images/refactorings/WrapInElseClause.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 lines in \#region directive \(RR0175\) - -* **Syntax**: selected lines -![Wrap lines in #region directive](../../images/refactorings/WrapLinesInRegion.png) - -#### Wrap lines in preprocessor directive \(RR0174\) - -* **Syntax**: selected lines -![Wrap lines in preprocessor directive](../../images/refactorings/WrapLinesInPreprocessorDirective.png) - -#### Wrap lines in try\-catch \(RR0176\) - -* **Syntax**: selected statements -![Wrap lines in try-catch](../../images/refactorings/WrapLinesInTryCatch.png) - -#### 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) -{ -} -``` - -#### Wrap statements in condition \(RR0172\) - -* **Syntax**: selected statements -![Wrap statements in condition](../../images/refactorings/WrapStatementsInCondition.png) - -#### Wrap statements in 'using' statement \(RR0177\) - -* **Syntax**: selected statements where first is local declaration of type that implements IDisposable -![Wrap statements in 'using' statement](../../images/refactorings/WrapStatementsInUsingStatement.png) - - -*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file diff --git a/src/Analyzers.CodeFixes/Roslynator.Analyzers.nuspec b/src/Analyzers.CodeFixes/Roslynator.Analyzers.nuspec index e68563973e..448bbaa1ab 100644 --- a/src/Analyzers.CodeFixes/Roslynator.Analyzers.nuspec +++ b/src/Analyzers.CodeFixes/Roslynator.Analyzers.nuspec @@ -13,7 +13,7 @@ - This package is dependent on Microsoft.CodeAnalysis.CSharp.Workspaces 4.0.1. A collection of 200+ analyzers for C#, powered by Roslyn. - Copyright (c) 2016-2022 Josef Pihrt + Copyright (c) 2016-2023 Josef Pihrt Roslyn Analyzer Refactoring Productivity CodeAnalysis C# CSharp true diff --git a/src/Analyzers.CodeFixes/docs/NuGetReadme.md b/src/Analyzers.CodeFixes/docs/NuGetReadme.md index 52dd6c3c82..cab15d6349 100644 --- a/src/Analyzers.CodeFixes/docs/NuGetReadme.md +++ b/src/Analyzers.CodeFixes/docs/NuGetReadme.md @@ -1,6 +1,6 @@ # Roslynator.Analyzers -A collection of 200+ analyzers for C#, powered by [Roslyn](https://github.com/dotnet/roslyn). +A collection of 200+ [analyzers](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/README.md) for C#, powered by [Roslyn](https://github.com/dotnet/roslyn). ## Requirements diff --git a/src/Analyzers/README.md b/src/Analyzers/README.md index 74bd6ba0f4..1b444d402f 100644 --- a/src/Analyzers/README.md +++ b/src/Analyzers/README.md @@ -1,214 +1,3 @@ ## Roslynator\.Analyzers -[Search Analyzers](http://pihrt.net/Roslynator/Analyzers) - -| Id | Title | Severity | -| --- | ----- | -------- | -| RCS1001 | [Add braces (when expression spans over multiple lines)](../../docs/analyzers/RCS1001.md) | Info | -| RCS1002 | [Remove braces](../../docs/analyzers/RCS1002.md) | None | -| RCS1003 | [Add braces to if-else (when expression spans over multiple lines)](../../docs/analyzers/RCS1003.md) | Info | -| RCS1004 | [Remove braces from if-else](../../docs/analyzers/RCS1004.md) | None | -| RCS1005 | [Simplify nested using statement](../../docs/analyzers/RCS1005.md) | Hidden | -| RCS1006 | [Merge 'else' with nested 'if'](../../docs/analyzers/RCS1006.md) | Hidden | -| RCS1007 | [Add braces](../../docs/analyzers/RCS1007.md) | None | -| RCS1008 | [Use explicit type instead of 'var' (when the type is not obvious)](../../docs/analyzers/RCS1008.md) | None | -| RCS1009 | [Use explicit type instead of 'var' (foreach variable)](../../docs/analyzers/RCS1009.md) | None | -| RCS1010 | [Use 'var' instead of explicit type (when the type is obvious)](../../docs/analyzers/RCS1010.md) | None | -| RCS1012 | [Use explicit type instead of 'var' (when the type is obvious)](../../docs/analyzers/RCS1012.md) | None | -| RCS1013 | [Use predefined type](../../docs/analyzers/RCS1013.md) | None | -| RCS1014 | [Use explicitly/implicitly typed array](../../docs/analyzers/RCS1014.md) | None | -| RCS1015 | [Use nameof operator](../../docs/analyzers/RCS1015.md) | Info | -| RCS1016 | [Use block body or expression body](../../docs/analyzers/RCS1016.md) | None | -| RCS1018 | [Add/remove accessibility modifiers](../../docs/analyzers/RCS1018.md) | None | -| RCS1019 | [Order modifiers](../../docs/analyzers/RCS1019.md) | None | -| RCS1020 | [Simplify Nullable\ to T?](../../docs/analyzers/RCS1020.md) | Info | -| RCS1021 | [Convert lambda expression body to expression body](../../docs/analyzers/RCS1021.md) | Info | -| RCS1031 | [Remove unnecessary braces in switch section](../../docs/analyzers/RCS1031.md) | Hidden | -| RCS1032 | [Remove redundant parentheses](../../docs/analyzers/RCS1032.md) | Info | -| RCS1033 | [Remove redundant boolean literal](../../docs/analyzers/RCS1033.md) | Info | -| RCS1034 | [Remove redundant 'sealed' modifier](../../docs/analyzers/RCS1034.md) | Hidden | -| RCS1035 | [Remove redundant comma in initializer](../../docs/analyzers/RCS1035.md) | None | -| RCS1036 | [Remove unnecessary blank line](../../docs/analyzers/RCS1036.md) | Info | -| RCS1037 | [Remove trailing white-space](../../docs/analyzers/RCS1037.md) | Info | -| RCS1038 | [Remove empty statement](../../docs/analyzers/RCS1038.md) | Info | -| RCS1039 | [Remove argument list from attribute](../../docs/analyzers/RCS1039.md) | Hidden | -| RCS1040 | [Remove empty 'else' clause](../../docs/analyzers/RCS1040.md) | Hidden | -| RCS1041 | [Remove empty initializer](../../docs/analyzers/RCS1041.md) | Info | -| RCS1042 | [Remove enum default underlying type](../../docs/analyzers/RCS1042.md) | Hidden | -| RCS1043 | [Remove 'partial' modifier from type with a single part](../../docs/analyzers/RCS1043.md) | Hidden | -| RCS1044 | [Remove original exception from throw statement](../../docs/analyzers/RCS1044.md) | Warning | -| RCS1046 | [Asynchronous method name should end with 'Async'](../../docs/analyzers/RCS1046.md) | None | -| RCS1047 | [Non-asynchronous method name should not end with 'Async'](../../docs/analyzers/RCS1047.md) | Info | -| RCS1048 | [Use lambda expression instead of anonymous method](../../docs/analyzers/RCS1048.md) | Info | -| RCS1049 | [Simplify boolean comparison](../../docs/analyzers/RCS1049.md) | Info | -| RCS1050 | [Include/omit parentheses when creating new object](../../docs/analyzers/RCS1050.md) | None | -| RCS1051 | [Add/remove parentheses from condition in conditional operator](../../docs/analyzers/RCS1051.md) | None | -| RCS1052 | [Declare each attribute separately](../../docs/analyzers/RCS1052.md) | None | -| RCS1055 | [Avoid semicolon at the end of declaration](../../docs/analyzers/RCS1055.md) | Hidden | -| RCS1056 | [Avoid usage of using alias directive](../../docs/analyzers/RCS1056.md) | None | -| RCS1058 | [Use compound assignment](../../docs/analyzers/RCS1058.md) | Info | -| RCS1059 | [Avoid locking on publicly accessible instance](../../docs/analyzers/RCS1059.md) | Warning | -| RCS1060 | [Declare each type in separate file](../../docs/analyzers/RCS1060.md) | None | -| RCS1061 | [Merge 'if' with nested 'if'](../../docs/analyzers/RCS1061.md) | Hidden | -| RCS1063 | [(\[deprecated\] use RCS1252 instead) Avoid usage of do statement to create an infinite loop](../../docs/analyzers/RCS1063.md) | Info | -| RCS1064 | [(\[deprecated\] use RCS1252 instead) Avoid usage of for statement to create an infinite loop](../../docs/analyzers/RCS1064.md) | None | -| RCS1065 | [(\[deprecated\] use RCS1252 instead) Avoid usage of while statement to create an infinite loop](../../docs/analyzers/RCS1065.md) | None | -| RCS1066 | [Remove empty 'finally' clause](../../docs/analyzers/RCS1066.md) | Hidden | -| RCS1068 | [Simplify logical negation](../../docs/analyzers/RCS1068.md) | Info | -| RCS1069 | [Remove unnecessary case label](../../docs/analyzers/RCS1069.md) | Hidden | -| RCS1070 | [Remove redundant default switch section](../../docs/analyzers/RCS1070.md) | Hidden | -| RCS1071 | [Remove redundant base constructor call](../../docs/analyzers/RCS1071.md) | Hidden | -| RCS1072 | [Remove empty namespace declaration](../../docs/analyzers/RCS1072.md) | Info | -| RCS1073 | [Convert 'if' to 'return' statement](../../docs/analyzers/RCS1073.md) | Info | -| RCS1074 | [Remove redundant constructor](../../docs/analyzers/RCS1074.md) | Hidden | -| RCS1075 | [Avoid empty catch clause that catches System.Exception](../../docs/analyzers/RCS1075.md) | Warning | -| RCS1077 | [Optimize LINQ method call](../../docs/analyzers/RCS1077.md) | Info | -| RCS1078 | [Use "" or 'string.Empty'](../../docs/analyzers/RCS1078.md) | None | -| RCS1079 | [Throwing of new NotImplementedException](../../docs/analyzers/RCS1079.md) | None | -| RCS1080 | [Use 'Count/Length' property instead of 'Any' method](../../docs/analyzers/RCS1080.md) | None | -| RCS1081 | [Split variable declaration](../../docs/analyzers/RCS1081.md) | None | -| RCS1084 | [Use coalesce expression instead of conditional expression](../../docs/analyzers/RCS1084.md) | Info | -| RCS1085 | [Use auto-implemented property](../../docs/analyzers/RCS1085.md) | Info | -| RCS1089 | [Use --/++ operator instead of assignment](../../docs/analyzers/RCS1089.md) | Info | -| RCS1090 | [Add/remove 'ConfigureAwait(false)' call](../../docs/analyzers/RCS1090.md) | None | -| RCS1091 | [Remove empty region](../../docs/analyzers/RCS1091.md) | Hidden | -| RCS1093 | [Remove file with no code](../../docs/analyzers/RCS1093.md) | Info | -| RCS1094 | [Declare using directive on top level](../../docs/analyzers/RCS1094.md) | None | -| RCS1096 | [Use 'HasFlag' method or bitwise operator](../../docs/analyzers/RCS1096.md) | None | -| RCS1097 | [Remove redundant 'ToString' call](../../docs/analyzers/RCS1097.md) | Info | -| RCS1098 | [Constant values should be placed on right side of comparisons](../../docs/analyzers/RCS1098.md) | Info | -| RCS1099 | [Default label should be the last label in a switch section](../../docs/analyzers/RCS1099.md) | Info | -| RCS1100 | [(\[deprecated\] use RCS1253 instead) Format documentation summary on a single line](../../docs/analyzers/RCS1100.md) | None | -| RCS1101 | [(\[deprecated\] use RCS1253 instead) Format documentation summary on multiple lines](../../docs/analyzers/RCS1101.md) | None | -| RCS1102 | [Make class static](../../docs/analyzers/RCS1102.md) | Warning | -| RCS1103 | [Convert 'if' to assignment](../../docs/analyzers/RCS1103.md) | Info | -| RCS1104 | [Simplify conditional expression](../../docs/analyzers/RCS1104.md) | Info | -| RCS1105 | [Unnecessary interpolation](../../docs/analyzers/RCS1105.md) | Info | -| RCS1106 | [Remove empty destructor](../../docs/analyzers/RCS1106.md) | Info | -| RCS1107 | [Remove redundant 'ToCharArray' call](../../docs/analyzers/RCS1107.md) | Info | -| RCS1108 | [Add 'static' modifier to all partial class declarations](../../docs/analyzers/RCS1108.md) | Info | -| RCS1110 | [Declare type inside namespace](../../docs/analyzers/RCS1110.md) | Info | -| RCS1111 | [Add braces to switch section with multiple statements](../../docs/analyzers/RCS1111.md) | None | -| RCS1112 | [Combine 'Enumerable.Where' method chain](../../docs/analyzers/RCS1112.md) | Info | -| RCS1113 | [Use 'string.IsNullOrEmpty' method](../../docs/analyzers/RCS1113.md) | Info | -| RCS1114 | [Remove redundant delegate creation](../../docs/analyzers/RCS1114.md) | Info | -| RCS1118 | [Mark local variable as const](../../docs/analyzers/RCS1118.md) | Info | -| RCS1123 | [Add parentheses when necessary](../../docs/analyzers/RCS1123.md) | Info | -| RCS1124 | [Inline local variable](../../docs/analyzers/RCS1124.md) | Hidden | -| RCS1126 | [Add braces to if-else](../../docs/analyzers/RCS1126.md) | None | -| RCS1128 | [Use coalesce expression](../../docs/analyzers/RCS1128.md) | Info | -| RCS1129 | [Remove redundant field initialization](../../docs/analyzers/RCS1129.md) | Hidden | -| RCS1130 | [Bitwise operation on enum without Flags attribute](../../docs/analyzers/RCS1130.md) | Info | -| RCS1132 | [Remove redundant overriding member](../../docs/analyzers/RCS1132.md) | Info | -| RCS1133 | [Remove redundant Dispose/Close call](../../docs/analyzers/RCS1133.md) | Hidden | -| RCS1134 | [Remove redundant statement](../../docs/analyzers/RCS1134.md) | Hidden | -| RCS1135 | [Declare enum member with zero value (when enum has FlagsAttribute)](../../docs/analyzers/RCS1135.md) | Info | -| RCS1136 | [Merge switch sections with equivalent content](../../docs/analyzers/RCS1136.md) | Hidden | -| RCS1138 | [Add summary to documentation comment](../../docs/analyzers/RCS1138.md) | Warning | -| RCS1139 | [Add summary element to documentation comment](../../docs/analyzers/RCS1139.md) | Warning | -| RCS1140 | [Add exception to documentation comment](../../docs/analyzers/RCS1140.md) | Hidden | -| RCS1141 | [Add 'param' element to documentation comment](../../docs/analyzers/RCS1141.md) | Hidden | -| RCS1142 | [Add 'typeparam' element to documentation comment](../../docs/analyzers/RCS1142.md) | Hidden | -| RCS1143 | [Simplify coalesce expression](../../docs/analyzers/RCS1143.md) | Hidden | -| RCS1145 | [Remove redundant 'as' operator](../../docs/analyzers/RCS1145.md) | Hidden | -| RCS1146 | [Use conditional access](../../docs/analyzers/RCS1146.md) | Info | -| RCS1151 | [Remove redundant cast](../../docs/analyzers/RCS1151.md) | Hidden | -| RCS1154 | [Sort enum members](../../docs/analyzers/RCS1154.md) | Info | -| RCS1155 | [Use StringComparison when comparing strings](../../docs/analyzers/RCS1155.md) | Warning | -| RCS1156 | [Use string.Length instead of comparison with empty string](../../docs/analyzers/RCS1156.md) | Info | -| RCS1157 | [Composite enum value contains undefined flag](../../docs/analyzers/RCS1157.md) | Info | -| RCS1158 | [Static member in generic type should use a type parameter](../../docs/analyzers/RCS1158.md) | Info | -| RCS1159 | [Use EventHandler\](../../docs/analyzers/RCS1159.md) | Info | -| RCS1160 | [Abstract type should not have public constructors](../../docs/analyzers/RCS1160.md) | Info | -| RCS1161 | [Enum should declare explicit values](../../docs/analyzers/RCS1161.md) | Hidden | -| RCS1162 | [Avoid chain of assignments](../../docs/analyzers/RCS1162.md) | None | -| RCS1163 | [Unused parameter](../../docs/analyzers/RCS1163.md) | Info | -| RCS1164 | [Unused type parameter](../../docs/analyzers/RCS1164.md) | Info | -| RCS1165 | [Unconstrained type parameter checked for null](../../docs/analyzers/RCS1165.md) | Hidden | -| RCS1166 | [Value type object is never equal to null](../../docs/analyzers/RCS1166.md) | Info | -| RCS1168 | [Parameter name differs from base name](../../docs/analyzers/RCS1168.md) | Hidden | -| RCS1169 | [Make field read-only](../../docs/analyzers/RCS1169.md) | Info | -| RCS1170 | [Use read-only auto-implemented property](../../docs/analyzers/RCS1170.md) | Info | -| RCS1171 | [Simplify lazy initialization](../../docs/analyzers/RCS1171.md) | Info | -| RCS1172 | [Use 'is' operator instead of 'as' operator](../../docs/analyzers/RCS1172.md) | Warning | -| RCS1173 | [Use coalesce expression instead of 'if'](../../docs/analyzers/RCS1173.md) | Info | -| RCS1174 | [Remove redundant async/await](../../docs/analyzers/RCS1174.md) | None | -| RCS1175 | [Unused 'this' parameter](../../docs/analyzers/RCS1175.md) | Info | -| RCS1176 | [Use 'var' instead of explicit type (when the type is not obvious)](../../docs/analyzers/RCS1176.md) | None | -| RCS1177 | [Use 'var' instead of explicit type (in foreach)](../../docs/analyzers/RCS1177.md) | None | -| RCS1179 | [Unnecessary assignment](../../docs/analyzers/RCS1179.md) | Info | -| RCS1180 | [Inline lazy initialization](../../docs/analyzers/RCS1180.md) | Info | -| RCS1181 | [Convert comment to documentation comment](../../docs/analyzers/RCS1181.md) | Hidden | -| RCS1182 | [Remove redundant base interface](../../docs/analyzers/RCS1182.md) | Hidden | -| RCS1186 | [Use Regex instance instead of static method](../../docs/analyzers/RCS1186.md) | Hidden | -| RCS1187 | [Use constant instead of field](../../docs/analyzers/RCS1187.md) | Info | -| RCS1188 | [Remove redundant auto-property initialization](../../docs/analyzers/RCS1188.md) | Hidden | -| RCS1189 | [Add or remove region name](../../docs/analyzers/RCS1189.md) | Hidden | -| RCS1190 | [Join string expressions](../../docs/analyzers/RCS1190.md) | Info | -| RCS1191 | [Declare enum value as combination of names](../../docs/analyzers/RCS1191.md) | Info | -| RCS1192 | [Unnecessary usage of verbatim string literal](../../docs/analyzers/RCS1192.md) | Info | -| RCS1193 | [Overriding member should not change 'params' modifier](../../docs/analyzers/RCS1193.md) | Warning | -| RCS1194 | [Implement exception constructors](../../docs/analyzers/RCS1194.md) | Warning | -| RCS1195 | [Use ^ operator](../../docs/analyzers/RCS1195.md) | Info | -| RCS1196 | [Call extension method as instance method](../../docs/analyzers/RCS1196.md) | Info | -| RCS1197 | [Optimize StringBuilder.Append/AppendLine call](../../docs/analyzers/RCS1197.md) | Info | -| RCS1198 | [Avoid unnecessary boxing of value type](../../docs/analyzers/RCS1198.md) | None | -| RCS1199 | [Unnecessary null check](../../docs/analyzers/RCS1199.md) | Info | -| RCS1200 | [Call 'Enumerable.ThenBy' instead of 'Enumerable.OrderBy'](../../docs/analyzers/RCS1200.md) | Info | -| RCS1201 | [Use method chaining](../../docs/analyzers/RCS1201.md) | Hidden | -| RCS1202 | [Avoid NullReferenceException](../../docs/analyzers/RCS1202.md) | Info | -| RCS1203 | [Use AttributeUsageAttribute](../../docs/analyzers/RCS1203.md) | Warning | -| RCS1204 | [Use EventArgs.Empty](../../docs/analyzers/RCS1204.md) | Info | -| RCS1205 | [Order named arguments according to the order of parameters](../../docs/analyzers/RCS1205.md) | Info | -| RCS1206 | [Use conditional access instead of conditional expression](../../docs/analyzers/RCS1206.md) | Info | -| RCS1207 | [Use anonymous function or method group](../../docs/analyzers/RCS1207.md) | None | -| RCS1208 | [Reduce 'if' nesting](../../docs/analyzers/RCS1208.md) | None | -| RCS1209 | [Order type parameter constraints](../../docs/analyzers/RCS1209.md) | Info | -| RCS1210 | [Return completed task instead of returning null](../../docs/analyzers/RCS1210.md) | Warning | -| RCS1211 | [Remove unnecessary 'else'](../../docs/analyzers/RCS1211.md) | Hidden | -| RCS1212 | [Remove redundant assignment](../../docs/analyzers/RCS1212.md) | Info | -| RCS1213 | [Remove unused member declaration](../../docs/analyzers/RCS1213.md) | Info | -| RCS1214 | [Unnecessary interpolated string](../../docs/analyzers/RCS1214.md) | Info | -| RCS1215 | [Expression is always equal to true/false](../../docs/analyzers/RCS1215.md) | Warning | -| RCS1216 | [Unnecessary unsafe context](../../docs/analyzers/RCS1216.md) | Info | -| RCS1217 | [Convert interpolated string to concatenation](../../docs/analyzers/RCS1217.md) | Hidden | -| RCS1218 | [Simplify code branching](../../docs/analyzers/RCS1218.md) | Info | -| RCS1220 | [Use pattern matching instead of combination of 'is' operator and cast operator](../../docs/analyzers/RCS1220.md) | Info | -| RCS1221 | [Use pattern matching instead of combination of 'as' operator and null check](../../docs/analyzers/RCS1221.md) | Info | -| RCS1222 | [Merge preprocessor directives](../../docs/analyzers/RCS1222.md) | Info | -| RCS1223 | [Mark publicly visible type with DebuggerDisplay attribute](../../docs/analyzers/RCS1223.md) | None | -| RCS1224 | [Make method an extension method](../../docs/analyzers/RCS1224.md) | Info | -| RCS1225 | [Make class sealed](../../docs/analyzers/RCS1225.md) | Info | -| RCS1226 | [Add paragraph to documentation comment](../../docs/analyzers/RCS1226.md) | Info | -| RCS1227 | [Validate arguments correctly](../../docs/analyzers/RCS1227.md) | Info | -| RCS1228 | [Unused element in documentation comment](../../docs/analyzers/RCS1228.md) | Hidden | -| RCS1229 | [Use async/await when necessary](../../docs/analyzers/RCS1229.md) | Info | -| RCS1230 | [Unnecessary explicit use of enumerator](../../docs/analyzers/RCS1230.md) | Info | -| RCS1231 | [Make parameter ref read-only](../../docs/analyzers/RCS1231.md) | None | -| RCS1232 | [Order elements in documentation comment](../../docs/analyzers/RCS1232.md) | Info | -| RCS1233 | [Use short-circuiting operator](../../docs/analyzers/RCS1233.md) | Info | -| RCS1234 | [Duplicate enum value](../../docs/analyzers/RCS1234.md) | Info | -| RCS1235 | [Optimize method call](../../docs/analyzers/RCS1235.md) | Info | -| RCS1236 | [Use exception filter](../../docs/analyzers/RCS1236.md) | Info | -| RCS1237 | [(\[deprecated\] use RCS1254 instead) Use bit shift operator](../../docs/analyzers/RCS1237.md) | Hidden | -| RCS1238 | [Avoid nested ?: operators](../../docs/analyzers/RCS1238.md) | Hidden | -| RCS1239 | [Use 'for' statement instead of 'while' statement](../../docs/analyzers/RCS1239.md) | Info | -| RCS1240 | [Operator is unnecessary](../../docs/analyzers/RCS1240.md) | Info | -| RCS1241 | [Implement non-generic counterpart](../../docs/analyzers/RCS1241.md) | Hidden | -| RCS1242 | [Do not pass non-read-only struct by read-only reference](../../docs/analyzers/RCS1242.md) | Warning | -| RCS1243 | [Duplicate word in a comment](../../docs/analyzers/RCS1243.md) | Info | -| RCS1244 | [Simplify 'default' expression](../../docs/analyzers/RCS1244.md) | Hidden | -| RCS1246 | [Use element access](../../docs/analyzers/RCS1246.md) | Info | -| RCS1247 | [Fix documentation comment tag](../../docs/analyzers/RCS1247.md) | Info | -| RCS1248 | [Normalize null check](../../docs/analyzers/RCS1248.md) | None | -| RCS1249 | [Unnecessary null-forgiving operator](../../docs/analyzers/RCS1249.md) | Info | -| RCS1250 | [Use implicit/explicit object creation](../../docs/analyzers/RCS1250.md) | None | -| RCS1251 | [Remove unnecessary braces from record declaration](../../docs/analyzers/RCS1251.md) | Info | -| RCS1252 | [Normalize usage of infinite loop](../../docs/analyzers/RCS1252.md) | None | -| RCS1253 | [Format documentation comment summary](../../docs/analyzers/RCS1253.md) | None | -| RCS1254 | [Normalize format of enum flag value](../../docs/analyzers/RCS1254.md) | Info | -| RCS1255 | [Simplify argument null check](../../docs/analyzers/RCS1255.md) | None | -| RCS1256 | [Invalid argument null check](../../docs/analyzers/RCS1256.md) | Info | - - -*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file +[List of Analyzers](../../docs/analyzers/README.md) diff --git a/src/CSharp/CSharp/CSharpFacts.cs b/src/CSharp/CSharp/CSharpFacts.cs index 497bb4e433..860052277a 100644 --- a/src/CSharp/CSharp/CSharpFacts.cs +++ b/src/CSharp/CSharp/CSharpFacts.cs @@ -939,7 +939,7 @@ internal static bool CanBeInitializerExpressionInForStatement(SyntaxKind kind) return SyntaxFacts.IsAssignmentExpression(kind); } - // http://github.com/dotnet/docs/blob/main/docs/csharp/language-reference/operators/index.md + // https://github.com/dotnet/docs/blob/main/docs/csharp/language-reference/operators/index.md internal static int GetOperatorPrecedence(SyntaxKind kind) { switch (kind) diff --git a/src/CodeAnalysis.Analyzers.CodeFixes/Roslynator.CodeAnalysis.Analyzers.nuspec b/src/CodeAnalysis.Analyzers.CodeFixes/Roslynator.CodeAnalysis.Analyzers.nuspec index fd18f29442..aeb20a15e4 100644 --- a/src/CodeAnalysis.Analyzers.CodeFixes/Roslynator.CodeAnalysis.Analyzers.nuspec +++ b/src/CodeAnalysis.Analyzers.CodeFixes/Roslynator.CodeAnalysis.Analyzers.nuspec @@ -14,7 +14,7 @@ - This package is dependent on Microsoft.CodeAnalysis.CSharp.Workspaces 4.0.1. - This package is applicable for projects that reference Roslyn packages (Microsoft.CodeAnalysis*). A collection of analyzers for Roslyn API. - Copyright (c) 2016-2022 Josef Pihrt + Copyright (c) 2016-2023 Josef Pihrt Roslyn Analyzer CodeAnalysis C# CSharp true diff --git a/src/CodeAnalysis.Analyzers.CodeFixes/docs/NuGetReadme.md b/src/CodeAnalysis.Analyzers.CodeFixes/docs/NuGetReadme.md index 3499b67c00..8d6f3d161a 100644 --- a/src/CodeAnalysis.Analyzers.CodeFixes/docs/NuGetReadme.md +++ b/src/CodeAnalysis.Analyzers.CodeFixes/docs/NuGetReadme.md @@ -1,6 +1,6 @@ # Roslynator.CodeAnalysis.Analyzers -A collection of analyzers for Roslyn API, powered by [Roslyn](https://github.com/dotnet/roslyn). +A collection of [analyzers](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/README.md) for Roslyn API, powered by [Roslyn](https://github.com/dotnet/roslyn). The package is applicable for projects that reference Roslyn packages (Microsoft.CodeAnalysis*). diff --git a/src/CodeAnalysis.Analyzers/README.md b/src/CodeAnalysis.Analyzers/README.md index 05cea4cd7c..05394e26de 100644 --- a/src/CodeAnalysis.Analyzers/README.md +++ b/src/CodeAnalysis.Analyzers/README.md @@ -1,20 +1,3 @@ ## Roslynator\.CodeAnalysis\.Analyzers -[Search Analyzers](http://pihrt.net/Roslynator/Analyzers) - -| Id | Title | Severity | -| --- | ----- | -------- | -| RCS9001 | [Use pattern matching](../../docs/analyzers/RCS9001.md) | Hidden | -| RCS9002 | [Use property SyntaxNode.SpanStart](../../docs/analyzers/RCS9002.md) | Info | -| RCS9003 | [Unnecessary conditional access](../../docs/analyzers/RCS9003.md) | Info | -| RCS9004 | [Call 'Any' instead of accessing 'Count'](../../docs/analyzers/RCS9004.md) | Info | -| RCS9005 | [Unnecessary null check](../../docs/analyzers/RCS9005.md) | Info | -| RCS9006 | [Use element access](../../docs/analyzers/RCS9006.md) | Info | -| RCS9007 | [Use return value](../../docs/analyzers/RCS9007.md) | Warning | -| RCS9008 | [Call 'Last' instead of using \[\]](../../docs/analyzers/RCS9008.md) | Info | -| RCS9009 | [Unknown language name](../../docs/analyzers/RCS9009.md) | Warning | -| RCS9010 | [Specify ExportCodeRefactoringProviderAttribute.Name](../../docs/analyzers/RCS9010.md) | Hidden | -| RCS9011 | [Specify ExportCodeFixProviderAttribute.Name](../../docs/analyzers/RCS9011.md) | Hidden | - - -*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file +[List of Analyzers](../../docs/analyzers/README.md) diff --git a/src/CodeFixes/README.md b/src/CodeFixes/README.md index 55ef5c2862..9b63201ffa 100644 --- a/src/CodeFixes/README.md +++ b/src/CodeFixes/README.md @@ -1,176 +1,3 @@ ## Compiler Diagnostics Fixable with Roslynator -| Id | Title | -| --- | ----- | -| [CS0019](../../docs/cs/CS0019.md) | Operator 'operator' cannot be applied to operands of type 'type' and 'type'\. | -| [CS0021](../../docs/cs/CS0021.md) | Cannot apply indexing with \[\] to an expression of type 'type'\. | -| [CS0023](../../docs/cs/CS0023.md) | Operator 'operator' cannot be applied to operand of type 'type'\. | -| [CS0029](../../docs/cs/CS0029.md) | Cannot implicitly convert type 'type' to 'type'\. | -| [CS0030](../../docs/cs/CS0030.md) | Cannot convert type 'type' to 'type'\. | -| [CS0037](../../docs/cs/CS0037.md) | Cannot convert null to 'type' because it is a non\-nullable value type\. | -| [CS0069](../../docs/cs/CS0069.md) | An event in an interface cannot have add or remove accessors\. | -| [CS0077](../../docs/cs/CS0077.md) | The as operator must be used with a reference type or nullable type \('type' is a non\-nullable value type\)\. | -| [CS0080](../../docs/cs/CS0080.md) | Constraints are not allowed on non\-generic declarations\. | -| [CS0101](../../docs/cs/CS0101.md) | The namespace 'namespace' already contains a definition for 'type'\. | -| [CS0102](../../docs/cs/CS0102.md) | The type 'type name' already contains a definition for 'identifier'\. | -| [CS0103](../../docs/cs/CS0103.md) | The name 'identifier' does not exist in the current context\. | -| [CS0107](../../docs/cs/CS0107.md) | More than one protection modifier\. | -| [CS0109](../../docs/cs/CS0109.md) | The member 'member' does not hide an inherited member\. The new keyword is not required\. | -| [CS0112](../../docs/cs/CS0112.md) | A static member 'function' cannot be marked as override, virtual or abstract\. | -| [CS0114](../../docs/cs/CS0114.md) | 'function1' hides inherited member 'function2'\. To make the current method override that implementation, add the override keyword\. Otherwise add the new keyword\. | -| [CS0115](../../docs/cs/CS0115.md) | 'function': no suitable method found to override\. | -| [CS0119](../../docs/cs/CS0119.md) | 'identifier' is a 'construct', which is not valid in the given context\. | -| [CS0120](../../docs/cs/CS0120.md) | An object reference is required for the nonstatic field, method, or property 'member'\. | -| [CS0123](../../docs/cs/CS0123.md) | No overload for 'method' matches delegate 'delegate'\. | -| [CS0126](../../docs/cs/CS0126.md) | An object of a type convertible to 'type' is required\. | -| [CS0127](../../docs/cs/CS0127.md) | Since 'function' returns void, a return keyword must not be followed by an object expression\. | -| [CS0128](../../docs/cs/CS0128.md) | A local variable named 'variable' is already defined in this scope\. | -| [CS0131](../../docs/cs/CS0131.md) | The left\-hand side of an assignment must be a variable, property or indexer\. | -| [CS0132](../../docs/cs/CS0132.md) | 'constructor': a static constructor must be parameterless\. | -| [CS0133](../../docs/cs/CS0133.md) | The expression being assigned to 'variable' must be constant\. | -| [CS0136](../../docs/cs/CS0136.md) | A local variable named 'var' cannot be declared in this scope because it would give a different meaning to 'var', which is already used in a 'parent or current/child' scope to denote something else\. | -| [CS0139](../../docs/cs/CS0139.md) | No enclosing loop out of which to break or continue\. | -| [CS0152](../../docs/cs/CS0152.md) | The switch statement contains multiple cases with same label value\. | -| [CS0161](../../docs/cs/CS0161.md) | 'method': not all code paths return a value\. | -| [CS0162](../../docs/cs/CS0162.md) | Unreachable code detected\. | -| [CS0163](../../docs/cs/CS0163.md) | Control cannot fall through from one case label \('label'\) to another\. | -| [CS0164](../../docs/cs/CS0164.md) | This label has not been referenced\. | -| [CS0165](../../docs/cs/CS0165.md) | Use of unassigned local variable 'name'\. | -| [CS0168](../../docs/cs/CS0168.md) | The variable 'var' is declared but never used\. | -| [CS0173](../../docs/cs/CS0173.md) | Type of conditional expression cannot be determined because there is no implicit conversion between 'class1' and 'class2'\. | -| [CS0177](../../docs/cs/CS0177.md) | The out parameter 'parameter' must be assigned to before control leaves the current method\. | -| [CS0191](../../docs/cs/CS0191.md) | A readonly field cannot be assigned to \(except in a constructor or a variable initializer\)\. | -| [CS0192](../../docs/cs/CS0192.md) | Readonly field 'name' cannot be used as ref or out value \(except in a constructor\)\. | -| [CS0201](../../docs/cs/CS0201.md) | Only assignment, call, increment, decrement, and new object expressions can be used as a statement\. | -| [CS0214](../../docs/cs/CS0214.md) | Pointers and fixed size buffers may only be used in an unsafe context\. | -| [CS0216](../../docs/cs/CS0216.md) | The operator 'operator' requires a matching operator 'missing\_operator' to also be defined\. | -| [CS0219](../../docs/cs/CS0219.md) | The variable 'variable' is assigned but its value is never used\. | -| [CS0221](../../docs/cs/CS0221.md) | Constant value 'value' cannot be converted to a 'type' \(use 'unchecked' syntax to override\)\. | -| [CS0225](../../docs/cs/CS0225.md) | The params parameter must be a single dimensional array\. | -| [CS0238](../../docs/cs/CS0238.md) | 'identifier' cannot be sealed because it is not an override\. | -| [CS0246](../../docs/cs/CS0246.md) | The type or namespace name 'type/namespace' could not be found \(are you missing a using directive or an assembly reference?\)\. | -| [CS0260](../../docs/cs/CS0260.md) | Missing partial modifier on declaration of type 'type'; another partial declaration of this type exists\. | -| [CS0262](../../docs/cs/CS0262.md) | Partial declarations of 'type' have conflicting accessibility modifiers\. | -| [CS0266](../../docs/cs/CS0266.md) | Cannot implicitly convert type 'type1' to 'type2'\. An explicit conversion exists \(are you missing a cast?\)\. | -| [CS0267](../../docs/cs/CS0267.md) | The partial modifier can only appear immediately before 'class', 'struct', or 'interface'\. | -| [CS0275](../../docs/cs/CS0275.md) | 'accessor': accessibility modifiers may not be used on accessors in an interface\. | -| [CS0305](../../docs/cs/CS0305.md) | Using the generic type 'generic type' requires 'number' type arguments\. | -| [CS0401](../../docs/cs/CS0401.md) | The new\(\) constraint must be the last constraint specified\. | -| [CS0403](../../docs/cs/CS0403.md) | Cannot convert null to type parameter 'name' because it could be a non\-nullable value type\. Consider using default\('T'\) instead\. | -| [CS0405](../../docs/cs/CS0405.md) | Duplicate constraint 'constraint' for type parameter 'type parameter'\. | -| [CS0407](../../docs/cs/CS0407.md) | 'return\-type method' has the wrong return type\. | -| [CS0409](../../docs/cs/CS0409.md) | A constraint clause has already been specified for type parameter 'type parameter'\. All of the constraints for a type parameter must be specified in a single where clause\. | -| [CS0428](../../docs/cs/CS0428.md) | Cannot convert method group 'identifier' to non\-delegate type 'type'\. Did you intend to invoke the method? | -| [CS0441](../../docs/cs/CS0441.md) | 'class': a class cannot be both static and sealed\. | -| [CS0442](../../docs/cs/CS0442.md) | 'property': abstract properties cannot have private accessors\. | -| [CS0449](../../docs/cs/CS0449.md) | The 'class' or 'struct' constraint must come before any other constraints\. | -| [CS0450](../../docs/cs/CS0450.md) | 'type parameter name': cannot specify both a constraint class and the 'class' or 'struct' constraint\. | -| [CS0451](../../docs/cs/CS0451.md) | The 'new\(\)' constraint cannot be used with the 'struct' constraint\. | -| [CS0472](../../docs/cs/CS0472.md) | The result of the expression is always 'value1' since a value of type 'value2' is never equal to 'null' of type 'value3'\. | -| [CS0500](../../docs/cs/CS0500.md) | 'class member' cannot declare a body because it is marked abstract\. | -| [CS0501](../../docs/cs/CS0501.md) | 'member function' must declare a body because it is not marked abstract, extern, or partial\. | -| [CS0507](../../docs/cs/CS0507.md) | 'function1': cannot change access modifiers when overriding 'access' inherited member 'function2'\. | -| [CS0508](../../docs/cs/CS0508.md) | 'type1': return type must be 'type2' to match overridden member 'member name'\. | -| [CS0513](../../docs/cs/CS0513.md) | 'function' is abstract but it is contained in nonabstract class 'class'\. | -| [CS0515](../../docs/cs/CS0515.md) | 'function': access modifiers are not allowed on static constructors\. | -| [CS0525](../../docs/cs/CS0525.md) | Interfaces cannot contain fields\. | -| [CS0527](../../docs/cs/CS0527.md) | Type 'type' in interface list is not an interface\. | -| [CS0531](../../docs/cs/CS0531.md) | 'member': interface members cannot have a definition\. | -| [CS0539](../../docs/cs/CS0539.md) | 'member' in explicit interface declaration is not a member of interface | -| [CS0541](../../docs/cs/CS0541.md) | 'declaration': explicit interface declaration can only be declared in a class or struct\. | -| [CS0549](../../docs/cs/CS0549.md) | New virtual member in sealed class\. | -| [CS0558](../../docs/cs/CS0558.md) | User\-defined operator 'operator' must be declared static and public\. | -| [CS0567](../../docs/cs/CS0567.md) | Interfaces cannot contain operators\. | -| [CS0568](../../docs/cs/CS0568.md) | Structs cannot contain explicit parameterless constructors\. | -| [CS0573](../../docs/cs/CS0573.md) | 'field declaration': cannot have instance field initializers in structs\. | -| [CS0574](../../docs/cs/CS0574.md) | Name of destructor must match name of class\. | -| [CS0575](../../docs/cs/CS0575.md) | Only class types can contain destructors\. | -| [CS0579](../../docs/cs/CS0579.md) | Duplicate 'attribute' attribute\. | -| [CS0592](../../docs/cs/CS0592.md) | Attribute 'attribute' is not valid on this declaration type\. It is valid on 'type' declarations only\. | -| [CS0621](../../docs/cs/CS0621.md) | 'member': virtual or abstract members cannot be private\. | -| [CS0628](../../docs/cs/CS0628.md) | member' : new protected member declared in sealed class\. | -| [CS0659](../../docs/cs/CS0659.md) | 'class' overrides Object\.Equals\(object o\) but does not override Object\.GetHashCode\(\)\. | -| [CS0660](../../docs/cs/CS0660.md) | 'class' defines operator == or operator \!= but does not override Object\.Equals\(object o\)\. | -| [CS0661](../../docs/cs/CS0661.md) | 'class' defines operator == or operator \!= but does not override Object\.GetHashCode\(\)\. | -| [CS0678](../../docs/cs/CS0678.md) | 'variable': a field can not be both volatile and readonly\. | -| [CS0693](../../docs/cs/CS0693.md) | Type parameter 'type parameter' has the same name as the type parameter from outer type 'type'\. | -| [CS0708](../../docs/cs/CS0708.md) | 'field': cannot declare instance members in a static class\. | -| [CS0710](../../docs/cs/CS0710.md) | Static classes cannot have instance constructors | -| [CS0713](../../docs/cs/CS0713.md) | Static class 'static type' cannot derive from type 'type'\. Static classes must derive from object\. | -| [CS0714](../../docs/cs/CS0714.md) | Static class cannot implement interfaces\. | -| [CS0718](../../docs/cs/CS0718.md) | 'type': static types cannot be used as type arguments\. | -| [CS0750](../../docs/cs/CS0750.md) | A partial method cannot have access modifiers or the virtual, abstract, override, new, sealed, or extern modifiers\. | -| [CS0751](../../docs/cs/CS0751.md) | A partial method must be declared in a partial class or partial struct\. | -| [CS0753](../../docs/cs/CS0753.md) | Only methods, classes, structs, or interfaces may be partial\. | -| [CS0756](../../docs/cs/CS0756.md) | A partial method may not have multiple defining declarations\. | -| [CS0759](../../docs/cs/CS0759.md) | No defining declaration found for implementing declaration of partial method 'method'\. | -| [CS0766](../../docs/cs/CS0766.md) | Partial methods must have a void return type\. | -| [CS0815](../../docs/cs/CS0815.md) | Cannot assign 'expression' to an implicitly typed local\. | -| [CS0819](../../docs/cs/CS0819.md) | Implicitly typed locals cannot have multiple declarators\. | -| [CS0822](../../docs/cs/CS0822.md) | Implicitly typed locals cannot be const\. | -| [CS1003](../../docs/cs/CS1003.md) | Syntax error, 'char' expected\. | -| [CS1004](../../docs/cs/CS1004.md) | Duplicate 'modifier' modifier\. | -| [CS1012](../../docs/cs/CS1012.md) | Too many characters in character literal\. | -| [CS1023](../../docs/cs/CS1023.md) | Embedded statement cannot be a declaration or labeled statement\. | -| [CS1031](../../docs/cs/CS1031.md) | Type expected\. | -| [CS1057](../../docs/cs/CS1057.md) | 'member': static classes cannot contain protected members\. | -| [CS1061](../../docs/cs/CS1061.md) | 'type' does not contain a definition for 'member' and no extension method 'name' accepting a first argument of type 'type' could be found \(are you missing a using directive or an assembly reference?\)\. | -| [CS1100](../../docs/cs/CS1100.md) | Method 'name' has a parameter modifier 'this' which is not on the first parameter\. | -| [CS1105](../../docs/cs/CS1105.md) | Extension methods must be static\. | -| [CS1106](../../docs/cs/CS1106.md) | Extension methods must be defined in a non\-generic static class\. | -| [CS1503](../../docs/cs/CS1503.md) | Argument 'number' cannot convert from 'type1' to 'type2'\. | -| [CS1522](../../docs/cs/CS1522.md) | Empty switch block\. | -| [CS1526](../../docs/cs/CS1526.md) | A new expression requires \(\), \[\], or \{\} after type\. | -| [CS1527](../../docs/cs/CS1527.md) | Elements defined in a namespace cannot be explicitly declared as private, protected, protected internal or private protected\. | -| [CS1591](../../docs/cs/CS1591.md) | Missing XML comment for publicly visible type or member 'name'\. | -| [CS1597](../../docs/cs/CS1597.md) | Semicolon after method or accessor block is not valid\. | -| [CS1609](../../docs/cs/CS1609.md) | Modifiers cannot be placed on event accessor declarations\. | -| [CS1615](../../docs/cs/CS1615.md) | Argument 'number' should not be passed with the 'keyword' keyword\. | -| [CS1620](../../docs/cs/CS1620.md) | Argument 'number' must be passed with the 'keyword' keyword\. | -| [CS1621](../../docs/cs/CS1621.md) | The yield statement cannot be used inside an anonymous method or lambda expression\. | -| [CS1622](../../docs/cs/CS1622.md) | Cannot return a value from an iterator\. Use the yield return statement to return a value, or yield break to end the iteration\. | -| [CS1623](../../docs/cs/CS1623.md) | Iterators cannot have ref or out parameters\. | -| [CS1624](../../docs/cs/CS1624.md) | The body of 'identifier' cannot be an iterator block because 'type' is not an iterator interface type\. | -| [CS1643](../../docs/cs/CS1643.md) | Not all code paths return a value in method of type 'type'\. | -| [CS1674](../../docs/cs/CS1674.md) | 'T': type used in a using statement must be implicitly convertible to 'System\.IDisposable'\. | -| [CS1689](../../docs/cs/CS1689.md) | Attribute 'attribute' is only valid on methods or attribute classes\. | -| [CS1715](../../docs/cs/CS1715.md) | 'type1': type must be 'type2' to match overridden member 'member'\. | -| [CS1717](../../docs/cs/CS1717.md) | Assignment made to same variable; did you mean to assign something else? | -| [CS1722](../../docs/cs/CS1722.md) | Base class 'class' must come before any interfaces\. | -| [CS1737](../../docs/cs/CS1737.md) | Optional parameters must appear after all required parameters\. | -| [CS1741](../../docs/cs/CS1741.md) | A ref or out parameter cannot have a default value\. | -| [CS1743](../../docs/cs/CS1743.md) | Cannot specify a default value for the 'this' parameter\. | -| [CS1750](../../docs/cs/CS1750.md) | A value of type 'type1' cannot be used as a default parameter because there are no standard conversions to type 'type2\. | -| [CS1751](../../docs/cs/CS1751.md) | Cannot specify a default value for a parameter array\. | -| [CS1955](../../docs/cs/CS1955.md) | Non\-invocable member 'name' cannot be used like a method\. | -| [CS1983](../../docs/cs/CS1983.md) | The return type of an async method must be void, Task or Task\\. | -| [CS1988](../../docs/cs/CS1988.md) | Async methods cannot have ref or out parameters\. | -| [CS1994](../../docs/cs/CS1994.md) | The 'async' modifier can only be used in methods that have a body\. | -| [CS1997](../../docs/cs/CS1997.md) | Since 'RemoveReturnKeywordOrReturnExpression\.FooAsync\(\)' is an async method that returns 'Task', a return keyword must not be followed by an object expression\. Did you intend to return 'Task\>'? | -| [CS3000](../../docs/cs/CS3000.md) | Methods with variable arguments are not CLS\-compliant\. | -| [CS3001](../../docs/cs/CS3001.md) | Argument type 'type' is not CLS\-compliant\. | -| [CS3002](../../docs/cs/CS3002.md) | Return type of 'method' is not CLS\-compliant\. | -| [CS3003](../../docs/cs/CS3003.md) | Type of 'variable' is not CLS\-compliant\. | -| [CS3005](../../docs/cs/CS3005.md) | Identifier 'identifier' differing only in case is not CLS\-compliant\. | -| [CS3006](../../docs/cs/CS3006.md) | Overloaded method 'method' differing only in ref or out, or in array rank, is not CLS\-compliant\. | -| [CS3007](../../docs/cs/CS3007.md) | Overloaded method 'method' differing only by unnamed array types is not CLS\-compliant\. | -| [CS3008](../../docs/cs/CS3008.md) | Identifier 'identifier' is not CLS\-compliant\. | -| [CS3009](../../docs/cs/CS3009.md) | Base type 'type' is not CLS\-compliant\. | -| [CS3016](../../docs/cs/CS3016.md) | Arrays as attribute arguments is not CLS\-compliant\. | -| [CS3024](../../docs/cs/CS3024.md) | Constraint type 'type' is not CLS\-compliant\. | -| [CS3027](../../docs/cs/CS3027.md) | 'type\_1' is not CLS\-compliant because base interface 'type\_2' is not CLS\-compliant\. | -| [CS7036](../../docs/cs/CS7036.md) | There is no argument given that corresponds to the required formal parameter 'parameter' of 'member'\. | -| [CS8050](../../docs/cs/CS8050.md) | Only auto\-implemented properties can have initializers\. | -| [CS8070](../../docs/cs/CS8070.md) | Control cannot fall out of switch from final case label \('default'\)\. | -| [CS8112](../../docs/cs/CS8112.md) | 'function' is a local function and must therefore always have a body\. | -| [CS8139](../../docs/cs/CS8139.md) | Cannot change tuple element names when overriding inherited member\. | -| [CS8340](../../docs/cs/CS8340.md) | Instance fields of read\-only structs must be read\-only\. | -| [CS8403](../../docs/cs/CS8403.md) | Method with an iterator block must be 'async' to return 'IAsyncEnumerable\Josef Pihrt Josef Pihrt Apache-2.0 - http://github.com/JosefPihrt/Roslynator + https://github.com/JosefPihrt/Roslynator icon.png false A collection of code fixes for C# compiler diagnostics (CS....), powered by Roslyn. @@ -14,7 +14,7 @@ - This package cannot be used with Visual Studio 2015. - This package is dependent on Microsoft.CodeAnalysis.CSharp.Workspaces 2.3.0. A collection of code fixes for C# compiler diagnostics (CS....), powered by Roslyn. - Copyright (c) 2016-2022 Josef Pihrt + Copyright (c) 2016-2023 Josef Pihrt Roslyn Analyzer Refactoring Productivity CodeAnalysis C# CSharp true diff --git a/src/Common/CSharp/Analysis/AddExceptionToDocumentationComment/AddExceptionToDocumentationCommentAnalysis.cs b/src/Common/CSharp/Analysis/AddExceptionToDocumentationComment/AddExceptionToDocumentationCommentAnalysis.cs index 8900f90aed..ead8f50cc9 100644 --- a/src/Common/CSharp/Analysis/AddExceptionToDocumentationComment/AddExceptionToDocumentationCommentAnalysis.cs +++ b/src/Common/CSharp/Analysis/AddExceptionToDocumentationComment/AddExceptionToDocumentationCommentAnalysis.cs @@ -170,7 +170,7 @@ private static bool ContainsException(SyntaxList attributes, if (SymbolEqualityComparer.Default.Equals(exceptionSymbol, symbol)) return true; - // http://github.com/dotnet/roslyn/issues/22923 + // https://github.com/dotnet/roslyn/issues/22923 if (exceptionSymbol.IsGenericType && symbol.IsGenericType && SymbolEqualityComparer.Default.Equals(exceptionSymbol.ConstructedFrom, symbol.ConstructedFrom)) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 4128d4ac64..ff2b8377a5 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -5,24 +5,24 @@ true $(MSBuildThisFileDirectory)Roslynator.snk Josef Pihrt - Copyright (c) 2016-2022 Josef Pihrt + Copyright (c) 2016-2023 Josef Pihrt false 0024000004800000940000000602000000240000525341310004000001000100d348e1a51bc190259aed17cfe132736241fef462de45a5de6c881c7f9d705073c7a2a08ba5ae493c7e878fe5f3cf7909e89045cca696422f03b284b147daf6b93c47bc53dd61ceeae60f73149d183032f029761d0d59aab49a26be4f6af71cd8194ace937642bdcb515f07530096122e97cfe6c8549a843530f71c24c7e3dab8 - 4.2.0.0 - 4.2.0 - 4.2.0.0 - 4.2.0 - 0.5.0.0 - 0.5.0 - 4.2.0.0 - 4.2.0 - 4.2.0.0 - 4.2.0 - 4.2.0.0 - 4.2.0 + 4.3.0.0 + 4.3.0 + 4.3.0.0 + 4.3.0 + 0.6.0.0 + 0.6.0 + 4.3.0.0 + 4.3.0 + 4.3.0.0 + 4.3.0 + 4.3.0.0 + 4.3.0 2.0.0 1.0.0 diff --git a/src/Documentation/Documentation.csproj b/src/Documentation/Documentation.csproj index 1e9b56bc88..296292524f 100644 --- a/src/Documentation/Documentation.csproj +++ b/src/Documentation/Documentation.csproj @@ -30,11 +30,11 @@ Roslynator.Documentation.DocumentationWriter Roslynator.Documentation.DocumentationGenerator false Apache-2.0 - http://github.com/JosefPihrt/Roslynator + https://github.com/JosefPihrt/Roslynator icon.png Roslyn;Documentation;GitHub;C#;CSharp - http://github.com/JosefPihrt/Roslynator.git + https://github.com/JosefPihrt/Roslynator.git git diff --git a/src/Formatting.Analyzers.CodeFixes/Roslynator.Formatting.Analyzers.nuspec b/src/Formatting.Analyzers.CodeFixes/Roslynator.Formatting.Analyzers.nuspec index e2af6e9289..546e1ae528 100644 --- a/src/Formatting.Analyzers.CodeFixes/Roslynator.Formatting.Analyzers.nuspec +++ b/src/Formatting.Analyzers.CodeFixes/Roslynator.Formatting.Analyzers.nuspec @@ -14,7 +14,7 @@ - This package is dependent on Microsoft.CodeAnalysis.CSharp.Workspaces 4.0.1. - All analyzers are disabled by default. A collection of formatting analyzers, powered by Roslyn. - Copyright (c) 2016-2022 Josef Pihrt + Copyright (c) 2016-2023 Josef Pihrt Roslyn Analyzer Formatting Productivity CodeAnalysis C# CSharp true diff --git a/src/Formatting.Analyzers.CodeFixes/docs/NuGetReadme.md b/src/Formatting.Analyzers.CodeFixes/docs/NuGetReadme.md index 67a7be5c1b..5b1ee056bc 100644 --- a/src/Formatting.Analyzers.CodeFixes/docs/NuGetReadme.md +++ b/src/Formatting.Analyzers.CodeFixes/docs/NuGetReadme.md @@ -1,6 +1,6 @@ # Roslynator.Formatting.Analyzers -A collection of formatting analyzers for C#, powered by [Roslyn](https://github.com/dotnet/roslyn). +A collection of formatting [analyzers](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/README.md) for C#, powered by [Roslyn](https://github.com/dotnet/roslyn). ## Requirements diff --git a/src/Formatting.Analyzers/README.md b/src/Formatting.Analyzers/README.md index 647b215515..5bec176483 100644 --- a/src/Formatting.Analyzers/README.md +++ b/src/Formatting.Analyzers/README.md @@ -1,61 +1,3 @@ ## Roslynator\.Formatting\.Analyzers -[Search Analyzers](http://pihrt.net/Roslynator/Analyzers) - -| Id | Title | Severity | -| --- | ----- | -------- | -| RCS0001 | [Add blank line after embedded statement](../../docs/analyzers/RCS0001.md) | None | -| RCS0002 | [Add blank line after #region](../../docs/analyzers/RCS0002.md) | None | -| RCS0003 | [Add blank line after using directive list](../../docs/analyzers/RCS0003.md) | None | -| RCS0005 | [Add blank line before #endregion](../../docs/analyzers/RCS0005.md) | None | -| RCS0006 | [Add blank line before using directive list](../../docs/analyzers/RCS0006.md) | None | -| RCS0007 | [Add blank line between accessors](../../docs/analyzers/RCS0007.md) | None | -| RCS0008 | [Add blank line between closing brace and next statement](../../docs/analyzers/RCS0008.md) | None | -| RCS0009 | [Add blank line between declaration and documentation comment](../../docs/analyzers/RCS0009.md) | None | -| RCS0010 | [Add blank line between declarations](../../docs/analyzers/RCS0010.md) | None | -| RCS0011 | [Add/remove blank line between single-line accessors](../../docs/analyzers/RCS0011.md) | None | -| RCS0012 | [Add blank line between single-line declarations](../../docs/analyzers/RCS0012.md) | None | -| RCS0013 | [Add blank line between single-line declarations of different kind](../../docs/analyzers/RCS0013.md) | None | -| RCS0014 | [Add blank line between switch sections](../../docs/analyzers/RCS0014.md) | None | -| RCS0015 | [Add/remove blank line between using directives](../../docs/analyzers/RCS0015.md) | None | -| RCS0016 | [Put attribute list on its own line](../../docs/analyzers/RCS0016.md) | None | -| RCS0020 | [Format accessor's braces on a single line or multiple lines](../../docs/analyzers/RCS0020.md) | None | -| RCS0021 | [Format block's braces on a single line or multiple lines](../../docs/analyzers/RCS0021.md) | None | -| RCS0022 | [Add new line after opening brace of empty block](../../docs/analyzers/RCS0022.md) | None | -| RCS0023 | [Format type declaration's braces](../../docs/analyzers/RCS0023.md) | None | -| RCS0024 | [Add new line after switch label](../../docs/analyzers/RCS0024.md) | None | -| RCS0025 | [Put full accessor on its own line](../../docs/analyzers/RCS0025.md) | None | -| RCS0027 | [Place new line after/before binary operator](../../docs/analyzers/RCS0027.md) | None | -| RCS0028 | [Place new line after/before '?:' operator](../../docs/analyzers/RCS0028.md) | None | -| RCS0029 | [Put constructor initializer on its own line](../../docs/analyzers/RCS0029.md) | None | -| RCS0030 | [Add new line before embedded statement](../../docs/analyzers/RCS0030.md) | None | -| RCS0031 | [Put enum member on its own line](../../docs/analyzers/RCS0031.md) | None | -| RCS0032 | [Place new line after/before arrow token](../../docs/analyzers/RCS0032.md) | None | -| RCS0033 | [Add new line before statement](../../docs/analyzers/RCS0033.md) | None | -| RCS0034 | [Put type parameter constraint on its own line](../../docs/analyzers/RCS0034.md) | None | -| RCS0036 | [Remove blank line between single-line declarations of same kind](../../docs/analyzers/RCS0036.md) | None | -| RCS0038 | [Remove blank line between using directives with same root namespace](../../docs/analyzers/RCS0038.md) | None | -| RCS0039 | [Remove new line before base list](../../docs/analyzers/RCS0039.md) | None | -| RCS0041 | [Remove new line between 'if' keyword and 'else' keyword](../../docs/analyzers/RCS0041.md) | None | -| RCS0042 | [Put auto-accessors on a single line](../../docs/analyzers/RCS0042.md) | None | -| RCS0043 | [Format accessor's braces on a single line when expression is on single line](../../docs/analyzers/RCS0043.md) | None | -| RCS0044 | [Use carriage return + linefeed as new line](../../docs/analyzers/RCS0044.md) | None | -| RCS0045 | [Use linefeed as new line](../../docs/analyzers/RCS0045.md) | None | -| RCS0046 | [Use spaces instead of tab](../../docs/analyzers/RCS0046.md) | None | -| RCS0047 | [\[deprecated\] Wrap and indent each node in list](../../docs/analyzers/RCS0047.md) | None | -| RCS0048 | [Put initializer on a single line](../../docs/analyzers/RCS0048.md) | None | -| RCS0049 | [Add blank line after top comment](../../docs/analyzers/RCS0049.md) | None | -| RCS0050 | [Add blank line before top declaration](../../docs/analyzers/RCS0050.md) | None | -| RCS0051 | [Add/remove new line before 'while' in 'do' statement](../../docs/analyzers/RCS0051.md) | None | -| RCS0052 | [Place new line after/before equals token](../../docs/analyzers/RCS0052.md) | None | -| RCS0053 | [Fix formatting of a list](../../docs/analyzers/RCS0053.md) | None | -| RCS0054 | [Fix formatting of a call chain](../../docs/analyzers/RCS0054.md) | None | -| RCS0055 | [Fix formatting of a binary expression chain](../../docs/analyzers/RCS0055.md) | None | -| RCS0056 | [A line is too long](../../docs/analyzers/RCS0056.md) | None | -| RCS0057 | [Normalize whitespace at the beginning of a file](../../docs/analyzers/RCS0057.md) | None | -| RCS0058 | [Normalize whitespace at the end of a file](../../docs/analyzers/RCS0058.md) | None | -| RCS0059 | [Place new line after/before null-conditional operator](../../docs/analyzers/RCS0059.md) | None | -| RCS0060 | [Add/remove line after file scoped namespace declaration](../../docs/analyzers/RCS0060.md) | None | - - -*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file +[List of Analyzers](../../docs/analyzers/README.md) diff --git a/src/Refactorings/README.md b/src/Refactorings/README.md index 987e99b43b..b9ea042779 100644 --- a/src/Refactorings/README.md +++ b/src/Refactorings/README.md @@ -1,207 +1,3 @@ ## Roslynator Refactorings -[Search Refactorings](http://pihrt.net/Roslynator/Refactorings) - -| Id | Title | Enabled by Default | -| --- | ----- |:------------------:| -| RR0216 | [Add all properties to initializer](../../docs/refactorings/RR0216.md) | ✓ | -| RR0011 | [Add argument name](../../docs/refactorings/RR0011.md) | ✓ | -| RR0002 | [Add braces](../../docs/refactorings/RR0002.md) | ✓ | -| RR0003 | [Add braces to if-else](../../docs/refactorings/RR0003.md) | ✓ | -| RR0004 | [Add braces to switch section](../../docs/refactorings/RR0004.md) | ✓ | -| RR0005 | [Add braces to switch sections](../../docs/refactorings/RR0005.md) | ✓ | -| RR0007 | [Add default value to parameter](../../docs/refactorings/RR0007.md) | ✓ | -| RR0205 | [Add empty line between declarations](../../docs/refactorings/RR0205.md) | ✓ | -| RR0009 | [Add 'exception' element to documentation comment](../../docs/refactorings/RR0009.md) | ✓ | -| RR0178 | [Add generic parameter to a declaration](../../docs/refactorings/RR0178.md) | ✓ | -| RR0195 | [Add member to interface](../../docs/refactorings/RR0195.md) | ✓ | -| RR0059 | [Add missing cases to switch statement](../../docs/refactorings/RR0059.md) | ✓ | -| RR0213 | [Add parameter to interface member](../../docs/refactorings/RR0213.md) | ✓ | -| RR0208 | [Add tag to documentation comment](../../docs/refactorings/RR0208.md) | ✓ | -| RR0013 | [Add using directive](../../docs/refactorings/RR0013.md) | ✓ | -| RR0014 | [Add using static directive](../../docs/refactorings/RR0014.md) | ✓ | -| RR0016 | [Call extension method as instance method](../../docs/refactorings/RR0016.md) | ✓ | -| RR0144 | [Call string.IndexOf instead of string.Contains](../../docs/refactorings/RR0144.md) | ✓ | -| RR0186 | [Change accessibility](../../docs/refactorings/RR0186.md) | ✓ | -| RR0021 | [Change method return type to 'void'](../../docs/refactorings/RR0021.md) | ✓ | -| RR0022 | [Change type according to expression](../../docs/refactorings/RR0022.md) | ✓ | -| RR0024 | [Check expression for null](../../docs/refactorings/RR0024.md) | ✓ | -| RR0025 | [Check parameter for null](../../docs/refactorings/RR0025.md) | ✓ | -| RR0027 | [Comment out member declaration](../../docs/refactorings/RR0027.md) | ✓ | -| RR0028 | [Comment out statement](../../docs/refactorings/RR0028.md) | ✓ | -| RR0171 | [Convert "" to string.Empty](../../docs/refactorings/RR0171.md) | \- | -| RR0120 | [Convert ?: to if-else](../../docs/refactorings/RR0120.md) | ✓ | -| RR0041 | [Convert auto-property to full property](../../docs/refactorings/RR0041.md) | ✓ | -| RR0040 | [Convert auto-property to full property (without backing field)](../../docs/refactorings/RR0040.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) | ✓ | -| RR0188 | [Convert 'foreach' to 'for' and reverse loop](../../docs/refactorings/RR0188.md) | \- | -| RR0164 | [Convert 'HasFlag' call to bitwise operation](../../docs/refactorings/RR0164.md) | ✓ | -| RR0132 | [Convert hexadecimal literal to decimal literal](../../docs/refactorings/RR0132.md) | ✓ | -| RR0166 | [Convert 'if' to ?:](../../docs/refactorings/RR0166.md) | ✓ | -| RR0133 | [Convert 'if' to 'switch'](../../docs/refactorings/RR0133.md) | ✓ | -| 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) | ✓ | -| RR0154 | [Convert lambda block body to expression body](../../docs/refactorings/RR0154.md) | ✓ | -| RR0039 | [Convert lambda expression body to block body](../../docs/refactorings/RR0039.md) | ✓ | -| RR0137 | [Convert method group to lambda](../../docs/refactorings/RR0137.md) | ✓ | -| RR0142 | [Convert regular string literal to verbatim string literal](../../docs/refactorings/RR0142.md) | ✓ | -| RR0143 | [Convert 'return' statement to 'if'](../../docs/refactorings/RR0143.md) | ✓ | -| RR0211 | [Convert statements to if-else](../../docs/refactorings/RR0211.md) | ✓ | -| RR0145 | [Convert 'string.Format' to interpolated string](../../docs/refactorings/RR0145.md) | ✓ | -| RR0214 | [Convert 'switch' expression to 'switch' statement](../../docs/refactorings/RR0214.md) | ✓ | -| RR0147 | [Convert 'switch' to 'if'](../../docs/refactorings/RR0147.md) | ✓ | -| RR0148 | [Convert verbatim string literal to regular string literal](../../docs/refactorings/RR0148.md) | ✓ | -| RR0149 | [Convert verbatim string literal to regular string literals](../../docs/refactorings/RR0149.md) | ✓ | -| RR0150 | [Convert 'while' statement to 'do' statement](../../docs/refactorings/RR0150.md) | ✓ | -| RR0151 | [Convert 'while' statement to 'for' statement](../../docs/refactorings/RR0151.md) | ✓ | -| RR0030 | [Copy argument](../../docs/refactorings/RR0030.md) | ✓ | -| RR0029 | [Copy documentation comment from base member](../../docs/refactorings/RR0029.md) | ✓ | -| RR0031 | [Copy member declaration](../../docs/refactorings/RR0031.md) | ✓ | -| RR0032 | [Copy parameter](../../docs/refactorings/RR0032.md) | ✓ | -| RR0033 | [Copy statement](../../docs/refactorings/RR0033.md) | ✓ | -| RR0212 | [Copy switch section](../../docs/refactorings/RR0212.md) | ✓ | -| RR0217 | [Deconstruct foreach variable](../../docs/refactorings/RR0217.md) | ✓ | -| RR0035 | [Expand coalesce expression](../../docs/refactorings/RR0035.md) | ✓ | -| RR0034 | [Expand compound assignment](../../docs/refactorings/RR0034.md) | ✓ | -| RR0036 | [Expand event declaration](../../docs/refactorings/RR0036.md) | ✓ | -| RR0038 | [Expand initializer](../../docs/refactorings/RR0038.md) | \- | -| RR0215 | [Expand positional constructor](../../docs/refactorings/RR0215.md) | ✓ | -| RR0203 | [Extract event handler method](../../docs/refactorings/RR0203.md) | ✓ | -| RR0043 | [Extract expression from condition](../../docs/refactorings/RR0043.md) | ✓ | -| RR0046 | [Extract type declaration to a new file](../../docs/refactorings/RR0046.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) | ✓ | -| RR0057 | [Generate enum values](../../docs/refactorings/RR0057.md) | ✓ | -| RR0058 | [Generate event invoking method](../../docs/refactorings/RR0058.md) | ✓ | -| RR0204 | [Generate property for DebuggerDisplay attribute](../../docs/refactorings/RR0204.md) | ✓ | -| RR0210 | [Implement custom enumerator](../../docs/refactorings/RR0210.md) | ✓ | -| RR0179 | [Implement IEquatable\](../../docs/refactorings/RR0179.md) | ✓ | -| RR0197 | [Initialize field from constructor](../../docs/refactorings/RR0197.md) | ✓ | -| RR0060 | [Initialize local variable with default value](../../docs/refactorings/RR0060.md) | ✓ | -| RR0061 | [Inline alias expression](../../docs/refactorings/RR0061.md) | ✓ | -| RR0181 | [Inline constant declaration](../../docs/refactorings/RR0181.md) | ✓ | -| RR0127 | [Inline constant value](../../docs/refactorings/RR0127.md) | ✓ | -| RR0062 | [Inline method](../../docs/refactorings/RR0062.md) | ✓ | -| RR0198 | [Inline property](../../docs/refactorings/RR0198.md) | ✓ | -| RR0180 | [Inline using static directive](../../docs/refactorings/RR0180.md) | ✓ | -| RR0063 | [Insert string interpolation](../../docs/refactorings/RR0063.md) | ✓ | -| RR0064 | [Introduce and initialize field](../../docs/refactorings/RR0064.md) | ✓ | -| RR0065 | [Introduce and initialize property](../../docs/refactorings/RR0065.md) | ✓ | -| RR0066 | [Introduce constructor](../../docs/refactorings/RR0066.md) | \- | -| RR0067 | [Introduce field to lock on](../../docs/refactorings/RR0067.md) | ✓ | -| RR0068 | [Introduce local variable](../../docs/refactorings/RR0068.md) | ✓ | -| RR0079 | [Invert binary expression](../../docs/refactorings/RR0079.md) | ✓ | -| RR0080 | [Invert boolean literal](../../docs/refactorings/RR0080.md) | ✓ | -| RR0160 | [Invert conditional expression](../../docs/refactorings/RR0160.md) | ✓ | -| RR0189 | [Invert if](../../docs/refactorings/RR0189.md) | ✓ | -| RR0162 | [Invert if-else](../../docs/refactorings/RR0162.md) | ✓ | -| RR0081 | [Invert is expression](../../docs/refactorings/RR0081.md) | ✓ | -| RR0116 | [Invert LINQ method call](../../docs/refactorings/RR0116.md) | ✓ | -| RR0082 | [Invert operator](../../docs/refactorings/RR0082.md) | ✓ | -| RR0134 | [Invert prefix/postfix unary operator](../../docs/refactorings/RR0134.md) | ✓ | -| RR0078 | [Join string expressions](../../docs/refactorings/RR0078.md) | ✓ | -| RR0069 | [Make member abstract](../../docs/refactorings/RR0069.md) | ✓ | -| RR0070 | [Make member virtual](../../docs/refactorings/RR0070.md) | ✓ | -| RR0074 | [Merge attributes](../../docs/refactorings/RR0074.md) | ✓ | -| RR0075 | [Merge 'if' statements](../../docs/refactorings/RR0075.md) | ✓ | -| RR0196 | [Merge if with parent if](../../docs/refactorings/RR0196.md) | ✓ | -| RR0077 | [Merge local declarations](../../docs/refactorings/RR0077.md) | ✓ | -| RR0110 | [Merge switch sections](../../docs/refactorings/RR0110.md) | ✓ | -| RR0202 | [Move unsafe context to containing declaration](../../docs/refactorings/RR0202.md) | ✓ | -| RR0083 | [Notify when property changes](../../docs/refactorings/RR0083.md) | ✓ | -| RR0084 | [Parenthesize expression](../../docs/refactorings/RR0084.md) | ✓ | -| RR0085 | [Promote local variable to parameter](../../docs/refactorings/RR0085.md) | ✓ | -| RR0086 | [Remove all comments](../../docs/refactorings/RR0086.md) | ✓ | -| RR0087 | [Remove all comments (except documentation comments)](../../docs/refactorings/RR0087.md) | ✓ | -| RR0088 | [Remove all documentation comments](../../docs/refactorings/RR0088.md) | \- | -| RR0089 | [Remove all member declarations](../../docs/refactorings/RR0089.md) | ✓ | -| RR0090 | [Remove all preprocessor directives](../../docs/refactorings/RR0090.md) | ✓ | -| RR0091 | [Remove all region directives](../../docs/refactorings/RR0091.md) | ✓ | -| RR0092 | [Remove all statements](../../docs/refactorings/RR0092.md) | ✓ | -| RR0093 | [Remove all switch sections](../../docs/refactorings/RR0093.md) | ✓ | -| RR0105 | [Remove argument name](../../docs/refactorings/RR0105.md) | ✓ | -| RR0209 | [Remove async/await](../../docs/refactorings/RR0209.md) | ✓ | -| RR0094 | [Remove braces](../../docs/refactorings/RR0094.md) | ✓ | -| RR0095 | [Remove braces from if-else](../../docs/refactorings/RR0095.md) | ✓ | -| RR0096 | [Remove braces from switch section](../../docs/refactorings/RR0096.md) | ✓ | -| RR0097 | [Remove braces from switch sections](../../docs/refactorings/RR0097.md) | ✓ | -| RR0098 | [Remove comment](../../docs/refactorings/RR0098.md) | ✓ | -| RR0099 | [Remove condition from last else clause](../../docs/refactorings/RR0099.md) | ✓ | -| RR0045 | [Remove containing statement](../../docs/refactorings/RR0045.md) | ✓ | -| RR0101 | [Remove empty lines](../../docs/refactorings/RR0101.md) | ✓ | -| RR0199 | [Remove enum member value(s)](../../docs/refactorings/RR0199.md) | ✓ | -| RR0185 | [Remove instantiation of a local variable](../../docs/refactorings/RR0185.md) | ✓ | -| RR0102 | [Remove interpolation](../../docs/refactorings/RR0102.md) | ✓ | -| RR0103 | [Remove member declaration](../../docs/refactorings/RR0103.md) | ✓ | -| RR0104 | [Remove member declarations above/below](../../docs/refactorings/RR0104.md) | ✓ | -| RR0106 | [Remove parentheses](../../docs/refactorings/RR0106.md) | ✓ | -| RR0100 | [Remove preprocessor directive](../../docs/refactorings/RR0100.md) | ✓ | -| RR0107 | [Remove property initializer](../../docs/refactorings/RR0107.md) | ✓ | -| RR0108 | [Remove region](../../docs/refactorings/RR0108.md) | ✓ | -| RR0109 | [Remove statement](../../docs/refactorings/RR0109.md) | ✓ | -| RR0073 | [Remove unnecessary assignment](../../docs/refactorings/RR0073.md) | ✓ | -| RR0112 | [Rename identifier according to type name](../../docs/refactorings/RR0112.md) | ✓ | -| RR0113 | [Rename method according to type name](../../docs/refactorings/RR0113.md) | ✓ | -| RR0114 | [Rename parameter according to its type name](../../docs/refactorings/RR0114.md) | ✓ | -| RR0115 | [Rename property according to type name](../../docs/refactorings/RR0115.md) | ✓ | -| RR0117 | [Replace 'as' expression with explicit cast](../../docs/refactorings/RR0117.md) | ✓ | -| RR0119 | [Replace conditional expression with true/false branch](../../docs/refactorings/RR0119.md) | ✓ | -| RR0124 | [Replace equality operator with string.Equals](../../docs/refactorings/RR0124.md) | ✓ | -| RR0125 | [Replace equality operator with string.IsNullOrEmpty](../../docs/refactorings/RR0125.md) | ✓ | -| RR0126 | [Replace equality operator with string.IsNullOrWhiteSpace](../../docs/refactorings/RR0126.md) | ✓ | -| RR0118 | [Replace explicit cast expression 'as' expression](../../docs/refactorings/RR0118.md) | ✓ | -| RR0135 | [Replace interpolated string with interpolation expression](../../docs/refactorings/RR0135.md) | ✓ | -| RR0138 | [Replace method with property](../../docs/refactorings/RR0138.md) | \- | -| RR0139 | [Replace 'null' with 'default(...)'](../../docs/refactorings/RR0139.md) | ✓ | -| RR0140 | [Replace prefix operator to postfix operator](../../docs/refactorings/RR0140.md) | ✓ | -| RR0141 | [Replace property with method](../../docs/refactorings/RR0141.md) | ✓ | -| RR0152 | [Reverse 'for' statement](../../docs/refactorings/RR0152.md) | ✓ | -| RR0153 | [Simplify if](../../docs/refactorings/RR0153.md) | ✓ | -| RR0207 | [Sort case labels](../../docs/refactorings/RR0207.md) | ✓ | -| RR0155 | [Sort member declarations](../../docs/refactorings/RR0155.md) | ✓ | -| RR0156 | [Split attributes](../../docs/refactorings/RR0156.md) | ✓ | -| RR0184 | [Split if](../../docs/refactorings/RR0184.md) | ✓ | -| RR0190 | [Split if-else](../../docs/refactorings/RR0190.md) | ✓ | -| RR0194 | [Split local declaration and assignment](../../docs/refactorings/RR0194.md) | ✓ | -| RR0157 | [Split switch labels](../../docs/refactorings/RR0157.md) | ✓ | -| RR0158 | [Split variable declaration](../../docs/refactorings/RR0158.md) | ✓ | -| RR0159 | [Swap binary operands](../../docs/refactorings/RR0159.md) | ✓ | -| RR0161 | [Swap member declarations](../../docs/refactorings/RR0161.md) | ✓ | -| RR0111 | [Synchronize property name and backing field name](../../docs/refactorings/RR0111.md) | ✓ | -| RR0200 | [Uncomment multi-line comment](../../docs/refactorings/RR0200.md) | ✓ | -| RR0163 | [Uncomment single-line comment](../../docs/refactorings/RR0163.md) | ✓ | -| RR0165 | [Use coalesce expression instead of if](../../docs/refactorings/RR0165.md) | ✓ | -| RR0128 | [Use constant instead of read-only field](../../docs/refactorings/RR0128.md) | ✓ | -| RR0167 | [Use element access instead of LINQ method](../../docs/refactorings/RR0167.md) | ✓ | -| RR0206 | [Use enumerator explicitly](../../docs/refactorings/RR0206.md) | ✓ | -| RR0023 | [Use explicit type](../../docs/refactorings/RR0023.md) | ✓ | -| RR0018 | [Use implicit type](../../docs/refactorings/RR0018.md) | ✓ | -| RR0191 | [Use index initializer](../../docs/refactorings/RR0191.md) | ✓ | -| RR0170 | [Use lambda instead of anonymous method](../../docs/refactorings/RR0170.md) | ✓ | -| RR0183 | [Use List\ instead of yield](../../docs/refactorings/RR0183.md) | ✓ | -| RR0026 | [Use object initializer](../../docs/refactorings/RR0026.md) | ✓ | -| RR0121 | [Use read-only field instead of constant](../../docs/refactorings/RR0121.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) | ✓ | -| RR0052 | [Wrap initializer expressions](../../docs/refactorings/RR0052.md) | ✓ | -| RR0175 | [Wrap lines in #region directive](../../docs/refactorings/RR0175.md) | ✓ | -| RR0174 | [Wrap lines in preprocessor directive](../../docs/refactorings/RR0174.md) | ✓ | -| RR0176 | [Wrap lines in try-catch](../../docs/refactorings/RR0176.md) | ✓ | -| RR0053 | [Wrap parameters](../../docs/refactorings/RR0053.md) | ✓ | -| RR0172 | [Wrap statements in condition](../../docs/refactorings/RR0172.md) | ✓ | -| RR0177 | [Wrap statements in 'using' statement](../../docs/refactorings/RR0177.md) | ✓ | - - -*\(Generated with [DotMarkdown](http://github.com/JosefPihrt/DotMarkdown)\)* \ No newline at end of file +[List of Refactorings](../../docs/refactorings/README.md) diff --git a/src/Tools/CodeGeneration/CSharp/CodeFixesOptionsPageGenerator.cs b/src/Tools/CodeGeneration/CSharp/CodeFixesOptionsPageGenerator.cs index ab5fd3b66c..7ef915453f 100644 --- a/src/Tools/CodeGeneration/CSharp/CodeFixesOptionsPageGenerator.cs +++ b/src/Tools/CodeGeneration/CSharp/CodeFixesOptionsPageGenerator.cs @@ -13,10 +13,11 @@ public static CompilationUnitSyntax Generate() { return CompilationUnit( UsingDirectives("Roslynator.CSharp"), - NamespaceDeclaration( - "Roslynator.VisualStudio", + List(new MemberDeclarationSyntax[] { + FileScopedNamespaceDeclaration(ParseName("Roslynator.VisualStudio")), ClassDeclaration( Modifiers.Public_Partial(), - "CodeFixesOptionsPage"))); + "CodeFixesOptionsPage") + })); } } diff --git a/src/Tools/CodeGeneration/CSharp/RefactoringsOptionsPageGenerator.cs b/src/Tools/CodeGeneration/CSharp/RefactoringsOptionsPageGenerator.cs index f7485854da..185c142e4b 100644 --- a/src/Tools/CodeGeneration/CSharp/RefactoringsOptionsPageGenerator.cs +++ b/src/Tools/CodeGeneration/CSharp/RefactoringsOptionsPageGenerator.cs @@ -18,12 +18,13 @@ public static CompilationUnitSyntax Generate(IEnumerable re UsingDirectives( "System.Collections.Generic", "Roslynator.CSharp.Refactorings"), - NamespaceDeclaration( - "Roslynator.VisualStudio", + List(new MemberDeclarationSyntax[] { + FileScopedNamespaceDeclaration(ParseName("Roslynator.VisualStudio")), ClassDeclaration( Modifiers.Public_Partial(), "RefactoringsOptionsPage", - CreateMembers(refactorings, comparer).ToSyntaxList()))); + CreateMembers(refactorings, comparer).ToSyntaxList()) + })); } private static IEnumerable CreateMembers(IEnumerable refactorings, IComparer comparer) diff --git a/src/Tools/CodeGeneration/Html/HtmlGenerator.cs b/src/Tools/CodeGeneration/Html/HtmlGenerator.cs index f0b380c0f1..9591f9b8ad 100644 --- a/src/Tools/CodeGeneration/Html/HtmlGenerator.cs +++ b/src/Tools/CodeGeneration/Html/HtmlGenerator.cs @@ -66,7 +66,7 @@ private static void WriteAnalyzers(XmlWriter writer, IEnumerable CreateSeeAlso(params object[] content) + { + yield return Heading2("See Also"); + yield return BulletList(content); + } } public static string CreateAnalyzerMarkdown(AnalyzerMetadata analyzer, ImmutableArray options, IEnumerable<(string title, string url)> appliesTo = null) @@ -247,12 +253,6 @@ private static IEnumerable CreateAppliesTo(IEnumerable<(string title, } } - private static IEnumerable CreateSeeAlso(params object[] content) - { - yield return Heading2("See Also"); - yield return BulletList(content); - } - public static string CreateCompilerDiagnosticMarkdown( CompilerDiagnosticMetadata diagnostic, IEnumerable codeFixes, @@ -302,14 +302,24 @@ public static string CreateAnalyzersReadMe(IEnumerable analyze { MDocument document = Document( Heading2(title), - Link("Search Analyzers", "http://pihrt.net/Roslynator/Analyzers"), + Heading3("Overview"), + Table( + TableRow("Package", "Prefix", "Comment"), + TableRow(Link("Roslynator.Analyzers", "https://www.nuget.org/packages/Roslynator.Analyzers"), InlineCode("RCS1"), "common analyzers"), + TableRow(Link("Roslynator.Formatting.Analyzers", "https://www.nuget.org/packages/Roslynator.Formatting.Analyzers"), InlineCode("RCS0"), "-"), + TableRow( + Link("Roslynator.CodeAnalysis.Analyzers", "https://www.nuget.org/packages/Roslynator.CodeAnalysis.Analyzers"), + InlineCode("RCS9"), + Inline("suitable for projects that reference Roslyn packages (", InlineCode("Microsoft.CodeAnalysis*"), ")")) + ), + Heading3("List of Analyzers"), Table( TableRow("Id", "Title", "Severity"), analyzers.OrderBy(f => f.Id, comparer).Select(f => { return TableRow( f.Id, - Link(f.Title.TrimEnd('.'), $"../../docs/analyzers/{f.Id}.md"), + Link(f.Title.TrimEnd('.'), $"{f.Id}.md"), (f.IsEnabledByDefault) ? f.DefaultSeverity : "None"); }))); @@ -322,14 +332,13 @@ public static string CreateRefactoringsReadMe(IEnumerable r { MDocument document = Document( Heading2("Roslynator Refactorings"), - Link("Search Refactorings", "http://pihrt.net/Roslynator/Refactorings"), Table( TableRow("Id", "Title", TableColumn(HorizontalAlignment.Center, "Enabled by Default")), - refactorings.OrderBy(f => f.Title, comparer).Select(f => + refactorings.OrderBy(f => f.Id, comparer).Select(f => { return TableRow( f.Id, - Link(f.Title.TrimEnd('.'), $"../../docs/refactorings/{f.Id}.md"), + Link(f.Title.TrimEnd('.'), $"{f.Id}.md"), CheckboxOrHyphen(f.IsEnabledByDefault)); }))); @@ -356,7 +365,7 @@ IEnumerable GetRows() .OrderBy(f => f.Id, comparer)) { yield return TableRow( - Link(diagnostic.Id, $"../../docs/cs/{diagnostic.Id}.md"), + Link(diagnostic.Id, $"{diagnostic.Id}.md"), diagnostic.Title); } } diff --git a/src/Tools/CodeGenerator/Program.cs b/src/Tools/CodeGenerator/Program.cs index 13567a9b14..97ef9144bd 100644 --- a/src/Tools/CodeGenerator/Program.cs +++ b/src/Tools/CodeGenerator/Program.cs @@ -54,7 +54,7 @@ private static void Main(string[] args) RefactoringIdentifiersGenerator.Generate(refactorings, obsolete: true, comparer: comparer)); WriteCompilationUnit( - @"VisualStudio.Common\RefactoringsOptionsPage.Generated.cs", + @"VisualStudio\RefactoringsOptionsPage.Generated.cs", RefactoringsOptionsPageGenerator.Generate(refactorings.Where(f => !f.IsObsolete), comparer)); WriteDiagnostics(@"Analyzers\CSharp", analyzers, @namespace: "Roslynator.CSharp", categoryName: nameof(DiagnosticCategories.Roslynator)); @@ -78,7 +78,7 @@ private static void Main(string[] args) CodeFixIdentifiersGenerator.Generate(codeFixes, comparer)); WriteCompilationUnit( - @"VisualStudio.Common\CodeFixesOptionsPage.Generated.cs", + @"VisualStudio\CodeFixesOptionsPage.Generated.cs", CodeFixesOptionsPageGenerator.Generate()); WriteCompilationUnit( diff --git a/src/Tools/MetadataGenerator/MetadataGenerator.csproj b/src/Tools/MetadataGenerator/MetadataGenerator.csproj index 22ebc3be01..f80df41e84 100644 --- a/src/Tools/MetadataGenerator/MetadataGenerator.csproj +++ b/src/Tools/MetadataGenerator/MetadataGenerator.csproj @@ -2,7 +2,7 @@ Exe - net48 + net7.0 @@ -13,7 +13,7 @@ - + diff --git a/src/Tools/MetadataGenerator/Program.cs b/src/Tools/MetadataGenerator/Program.cs index 0f6483b584..f88c9ea0a6 100644 --- a/src/Tools/MetadataGenerator/Program.cs +++ b/src/Tools/MetadataGenerator/Program.cs @@ -49,13 +49,11 @@ private static async Task Main(string[] args) ImmutableArray codeFixes = metadata.CodeFixes; ImmutableArray compilerDiagnostics = metadata.CompilerDiagnostics; - WriteAnalyzersReadMe(@"Analyzers\README.md", analyzers, "Roslynator.Analyzers"); - - WriteAnalyzersReadMe(@"CodeAnalysis.Analyzers\README.md", codeAnalysisAnalyzers, "Roslynator.CodeAnalysis.Analyzers"); - - WriteAnalyzersReadMe(@"Formatting.Analyzers\README.md", formattingAnalyzers, "Roslynator.Formatting.Analyzers"); + WriteAllText( + @"..\docs\analyzers\README.md", + MarkdownGenerator.CreateAnalyzersReadMe(metadata.GetAllAnalyzers().Where(f => !f.IsObsolete), "Roslynator Analyzers", comparer)); #if !DEBUG - VisualStudioInstance instance = MSBuildLocator.QueryVisualStudioInstances().First(f => f.Version.Major == 17); + VisualStudioInstance instance = MSBuildLocator.QueryVisualStudioInstances().First(f => f.Version.Major == 7); MSBuildLocator.RegisterInstance(instance); @@ -123,25 +121,18 @@ private static async Task Main(string[] args) } WriteAllText( - @"..\docs\refactorings\Refactorings.md", - MarkdownGenerator.CreateRefactoringsMarkdown(refactorings, comparer)); - - WriteAllText( - @"Refactorings\README.md", + @"..\docs\refactorings\README.md", MarkdownGenerator.CreateRefactoringsReadMe(refactorings.Where(f => !f.IsObsolete), comparer)); WriteAllText( - @"CodeFixes\README.md", + @"..\docs\cs\README.md", MarkdownGenerator.CreateCodeFixesReadMe(fixableCompilerDiagnostics, comparer)); // find files to delete foreach (string path in Directory.EnumerateFiles(GetPath(@"..\docs\refactorings"))) { - if (Path.GetFileName(path) != "Refactorings.md" - && !refactorings.Any(f => f.Id == Path.GetFileNameWithoutExtension(path))) - { + if (!refactorings.Any(f => f.Id == Path.GetFileNameWithoutExtension(path))) Console.WriteLine($"FILE TO DELETE: {path}"); - } } // find missing samples @@ -213,13 +204,6 @@ void DeleteInvalidAnalyzerMarkdowns() } } - void WriteAnalyzersReadMe(string path, ImmutableArray descriptors, string title) - { - WriteAllText( - path, - MarkdownGenerator.CreateAnalyzersReadMe(descriptors.Where(f => !f.IsObsolete), title, comparer)); - } - void UpdateChangeLog() { var issueRegex = new Regex(@"\(\#(?\d+)\)"); diff --git a/src/VisualStudio.Refactorings/Overview.md b/src/VisualStudio.Refactorings/Overview.md index d5d2d93fda..a57161bca9 100644 --- a/src/VisualStudio.Refactorings/Overview.md +++ b/src/VisualStudio.Refactorings/Overview.md @@ -1,10 +1,10 @@ ## Overview -* A collection of 300+ refactorings and fixes for C#, powered by [Roslyn](http://github.com/dotnet/roslyn). -* [Project website](http://github.com/JosefPihrt/Roslynator) -* [List of refactorings](http://github.com/JosefPihrt/Roslynator/blob/main/src/Refactorings/README.md) -* [List of code fixes for CS diagnostics](http://github.com/JosefPihrt/Roslynator/blob/main/src/CodeFixes/README.md) -* [Release notes](http://github.com/JosefPihrt/Roslynator/blob/main/ChangeLog.md) +* A collection of 300+ refactorings and fixes for C#, powered by [Roslyn](https://github.com/dotnet/roslyn). +* [Project website](https://github.com/JosefPihrt/Roslynator) +* [List of refactorings](https://github.com/JosefPihrt/Roslynator/blob/main/docs/refactorings/README.md) +* [List of code fixes for CS diagnostics](https://github.com/JosefPihrt/Roslynator/blob/main/docs/cs/README.md) +* [Release notes](https://github.com/JosefPihrt/Roslynator/blob/main/ChangeLog.md) ## Donation @@ -17,5 +17,5 @@ Although Roslynator Refactorings is free of charge, any [donation](https://www.p ## Documentation -* [How to Configure Roslynator](http://github.com/JosefPihrt/Roslynator/blob/main/docs/Configuration.md) -* [Analyzers vs. Refactorings](http://github.com/JosefPihrt/Roslynator/blob/main/docs/AnalyzersVsRefactorings.md) +* [How to Configure Roslynator](https://github.com/JosefPihrt/Roslynator/blob/main/docs/Configuration.md) +* [Analyzers vs. Refactorings](https://github.com/JosefPihrt/Roslynator/blob/main/docs/AnalyzersVsRefactorings.md) diff --git a/src/VisualStudio.Refactorings/Properties/AssemblyInfo.cs b/src/VisualStudio.Refactorings/Properties/AssemblyInfo.cs index bfcdae9fa7..4d6e419199 100644 --- a/src/VisualStudio.Refactorings/Properties/AssemblyInfo.cs +++ b/src/VisualStudio.Refactorings/Properties/AssemblyInfo.cs @@ -12,7 +12,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Pihrtsoft")] [assembly: AssemblyProduct("VisualStudio.Refactorings")] -[assembly: AssemblyCopyright("Copyright (c) 2016-2019 Josef Pihrt")] +[assembly: AssemblyCopyright("Copyright (c) 2016-2023 Josef Pihrt")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/src/VisualStudio.Refactorings/source.extension.vsixmanifest b/src/VisualStudio.Refactorings/source.extension.vsixmanifest index 61949045f1..08cabdfc24 100644 --- a/src/VisualStudio.Refactorings/source.extension.vsixmanifest +++ b/src/VisualStudio.Refactorings/source.extension.vsixmanifest @@ -4,9 +4,9 @@ Roslynator Refactorings 2019 A collection of 300+ refactorings and fixes for C#, powered by Roslyn. - http://github.com/JosefPihrt/Roslynator + https://github.com/JosefPihrt/Roslynator LICENSE.txt - http://github.com/JosefPihrt/Roslynator/blob/main/ChangeLog.md + https://github.com/JosefPihrt/Roslynator/blob/main/ChangeLog.md Roslynator.ico RoslynatorPreview.png Roslyn;Refactoring;C#;CSharp;Productivity diff --git a/src/VisualStudio/CodeFixesOptionsPage.Generated.cs b/src/VisualStudio/CodeFixesOptionsPage.Generated.cs index f258ee1350..f42566c835 100644 --- a/src/VisualStudio/CodeFixesOptionsPage.Generated.cs +++ b/src/VisualStudio/CodeFixesOptionsPage.Generated.cs @@ -5,7 +5,6 @@ using Roslynator.CSharp; namespace Roslynator.VisualStudio; - public partial class CodeFixesOptionsPage { } \ No newline at end of file diff --git a/src/VisualStudio/Overview.md b/src/VisualStudio/Overview.md index 64e7642ef8..d90c0d7bca 100644 --- a/src/VisualStudio/Overview.md +++ b/src/VisualStudio/Overview.md @@ -1,11 +1,11 @@ ## Overview -* A collection of 500+ analyzers, refactorings and fixes for C#, powered by [Roslyn](http://github.com/dotnet/roslyn). -* [Project website](http://github.com/JosefPihrt/Roslynator) -* [List of analyzers](http://github.com/JosefPihrt/Roslynator/blob/main/src/Analyzers/README.md) -* [List of refactorings](http://github.com/JosefPihrt/Roslynator/blob/main/src/Refactorings/README.md) -* [List of code fixes for CS diagnostics](http://github.com/JosefPihrt/Roslynator/blob/main/src/CodeFixes/README.md) -* [Release notes](http://github.com/JosefPihrt/Roslynator/blob/main/ChangeLog.md) +* A collection of 500+ analyzers, refactorings and fixes for C#, powered by [Roslyn](https://github.com/dotnet/roslyn). +* [Project website](https://github.com/JosefPihrt/Roslynator) +* [List of analyzers](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/README.md) +* [List of refactorings](https://github.com/JosefPihrt/Roslynator/blob/main/docs/refactorings/README.md) +* [List of code fixes for CS diagnostics](https://github.com/JosefPihrt/Roslynator/blob/main/docs/cs/README.md) +* [Release notes](https://github.com/JosefPihrt/Roslynator/blob/main/ChangeLog.md) ## Donation @@ -17,5 +17,5 @@ Although Roslynator is free of charge, any [donation](https://www.paypal.com/cgi ## Documentation -* [How to Configure Roslynator](http://github.com/JosefPihrt/Roslynator/blob/main/docs/Configuration.md) -* [Analyzers vs. Refactorings](http://github.com/JosefPihrt/Roslynator/blob/main/docs/AnalyzersVsRefactorings.md) +* [How to Configure Roslynator](https://github.com/JosefPihrt/Roslynator/blob/main/docs/Configuration.md) +* [Analyzers vs. Refactorings](https://github.com/JosefPihrt/Roslynator/blob/main/docs/AnalyzersVsRefactorings.md) diff --git a/src/VisualStudio/Properties/AssemblyInfo.cs b/src/VisualStudio/Properties/AssemblyInfo.cs index eb05937d7b..18e8621626 100644 --- a/src/VisualStudio/Properties/AssemblyInfo.cs +++ b/src/VisualStudio/Properties/AssemblyInfo.cs @@ -12,7 +12,7 @@ //[assembly: AssemblyConfiguration("")] //[assembly: AssemblyCompany("Josef Pihrt")] //[assembly: AssemblyProduct("Roslynator.VisualStudio.2022")] -//[assembly: AssemblyCopyright("Copyright (c) 2016-2021 Josef Pihrt")] +//[assembly: AssemblyCopyright("Copyright (c) 2016-2023 Josef Pihrt")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -31,7 +31,7 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -//[assembly: AssemblyVersion("4.2.0.0")] +//[assembly: AssemblyVersion("4.3.0.0")] //[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: NeutralResourcesLanguage("en-US")] diff --git a/src/VisualStudio/RefactoringsOptionsPage.Generated.cs b/src/VisualStudio/RefactoringsOptionsPage.Generated.cs index 2efcee4726..7dd57a3f61 100644 --- a/src/VisualStudio/RefactoringsOptionsPage.Generated.cs +++ b/src/VisualStudio/RefactoringsOptionsPage.Generated.cs @@ -6,7 +6,6 @@ using Roslynator.CSharp.Refactorings; namespace Roslynator.VisualStudio; - public partial class RefactoringsOptionsPage { protected override void Fill(ICollection refactorings) @@ -186,6 +185,7 @@ protected override void Fill(ICollection refactorings) refactorings.Add(new BaseModel(RefactoringIdentifiers.UseIndexInitializer, "Use index initializer", IsEnabled(RefactoringIdentifiers.UseIndexInitializer))); refactorings.Add(new BaseModel(RefactoringIdentifiers.ConvertCommentToDocumentationComment, "Convert comment to documentation comment", IsEnabled(RefactoringIdentifiers.ConvertCommentToDocumentationComment))); refactorings.Add(new BaseModel(RefactoringIdentifiers.ConvertInterpolatedStringToConcatenation, "Convert interpolated string to concatenation", IsEnabled(RefactoringIdentifiers.ConvertInterpolatedStringToConcatenation))); + refactorings.Add(new BaseModel(RefactoringIdentifiers.SplitLocalDeclarationAndAssignment, "Split local declaration and assignment", IsEnabled(RefactoringIdentifiers.SplitLocalDeclarationAndAssignment))); refactorings.Add(new BaseModel(RefactoringIdentifiers.AddMemberToInterface, "Add member to interface", IsEnabled(RefactoringIdentifiers.AddMemberToInterface))); refactorings.Add(new BaseModel(RefactoringIdentifiers.MergeIfWithParentIf, "Merge if with parent if", IsEnabled(RefactoringIdentifiers.MergeIfWithParentIf))); refactorings.Add(new BaseModel(RefactoringIdentifiers.InitializeFieldFromConstructor, "Initialize field from constructor", IsEnabled(RefactoringIdentifiers.InitializeFieldFromConstructor))); @@ -208,5 +208,6 @@ protected override void Fill(ICollection refactorings) refactorings.Add(new BaseModel(RefactoringIdentifiers.ConvertSwitchExpressionToSwitchStatement, "Convert 'switch' expression to 'switch' statement", IsEnabled(RefactoringIdentifiers.ConvertSwitchExpressionToSwitchStatement))); refactorings.Add(new BaseModel(RefactoringIdentifiers.ExpandPositionalConstructor, "Expand positional constructor", IsEnabled(RefactoringIdentifiers.ExpandPositionalConstructor))); refactorings.Add(new BaseModel(RefactoringIdentifiers.AddAllPropertiesToInitializer, "Add all properties to initializer", IsEnabled(RefactoringIdentifiers.AddAllPropertiesToInitializer))); + refactorings.Add(new BaseModel(RefactoringIdentifiers.DeconstructForeachVariable, "Deconstruct foreach variable", IsEnabled(RefactoringIdentifiers.DeconstructForeachVariable))); } } \ No newline at end of file diff --git a/src/VisualStudio/source.extension.vsixmanifest b/src/VisualStudio/source.extension.vsixmanifest index f7bd8e0771..5323237d68 100644 --- a/src/VisualStudio/source.extension.vsixmanifest +++ b/src/VisualStudio/source.extension.vsixmanifest @@ -1,12 +1,12 @@  - + Roslynator 2022 A collection of 500+ analyzers, refactorings and fixes for C#, powered by Roslyn. - http://github.com/JosefPihrt/Roslynator + https://github.com/JosefPihrt/Roslynator LICENSE.txt - http://github.com/JosefPihrt/Roslynator/blob/main/ChangeLog.md + https://github.com/JosefPihrt/Roslynator/blob/main/ChangeLog.md Roslynator.ico RoslynatorPreview.png Roslyn;Refactoring;Analyzer;CodeAnalysis;C#;CSharp;Productivity;Diagnostic diff --git a/src/VisualStudioCode/package/CHANGELOG.md b/src/VisualStudioCode/package/CHANGELOG.md index 4a325d970f..8d29f97748 100644 --- a/src/VisualStudioCode/package/CHANGELOG.md +++ b/src/VisualStudioCode/package/CHANGELOG.md @@ -7,6 +7,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [4.3.0] - 2023-04-24 + +### Changed + +- [CLI] Bump Roslyn to 4.5.0 ([#1043](https://github.com/josefpihrt/roslynator/pull/1043)). +- [CLI] Downgrade version of Microsoft.Build.Locator from 1.5.5 to 1.4.1 ([#1079](https://github.com/JosefPihrt/Roslynator/pull/1079)) + +### Fixed + +- Fix [RCS1084](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1084.md) ([#1006](https://github.com/josefpihrt/roslynator/pull/1006)). +- Fix [RCS1244](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1244.md) ([#1007](https://github.com/josefpihrt/roslynator/pull/1007)). +- [CLI] Add nullable reference type modifier when creating a list of symbols (`list-symbols` command) ([#1013](https://github.com/josefpihrt/roslynator/pull/1013)). +- Add/remove blank line after file scoped namespace declaration ([RCS0060](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS0060.md)) ([#1014](https://github.com/josefpihrt/roslynator/pull/1014)). +- Do not remove overriding member in record ([RCS1132](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1132.md)) ([#1015](https://github.com/josefpihrt/roslynator/pull/1015)). +- Do not remove parameterless empty constructor in a struct with field initializers ([RCS1074](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1074.md)) ([#1021](https://github.com/josefpihrt/roslynator/pull/1021)). +- Do not suggest to use generic event handler ([RCS1159](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1159.md)) ([#1022](https://github.com/josefpihrt/roslynator/pull/1022)). +- Fix ([RCS1077](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1077.md)) ([#1023](https://github.com/josefpihrt/roslynator/pull/1023)). +- Fix ([RCS1097](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1097.md)) ([#1037](https://github.com/JosefPihrt/Roslynator/pull/1037) by @jamesHargreaves12). +- Do not report ([RCS1170](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1170.md)) when `Microsoft.AspNetCore.Components.InjectAttribute` is used ([#1046](https://github.com/JosefPihrt/Roslynator/pull/1046)). +- Fix ([RCS1235](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1235.md)) ([#1047](https://github.com/JosefPihrt/Roslynator/pull/1047)). +- Fix ([RCS1206](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1206.md)) ([#1049](https://github.com/JosefPihrt/Roslynator/pull/1049)). +- Prevent possible recursion in ([RCS1235](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1235.md)) ([#1054](https://github.com/JosefPihrt/Roslynator/pull/1054)). +- Fix ([RCS1223](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1223.md)) ([#1051](https://github.com/JosefPihrt/Roslynator/pull/1051) by @jamesHargreaves12). +- Do not remove braces in the cases where there are overlapping local variables. ([RCS1031](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1031.md), [RCS1211](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1211.md), [RCS1208](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1208.md), [RCS1061](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1061.md)) ([#1039](https://github.com/JosefPihrt/Roslynator/pull/1039), [#1062](https://github.com/JosefPihrt/Roslynator/pull/1062) by @jamesHargreaves12). +- [CLI] Analyze command does not create the XML output file and returns incorrect exit code when only compiler diagnostics are reported ([#1056](https://github.com/JosefPihrt/Roslynator/pull/1056) by @PeterKaszab). +- [CLI] Fix exit code when multiple projects are processed ([#1061](https://github.com/JosefPihrt/Roslynator/pull/1061) by @PeterKaszab). +- Fix code fix for CS0164 ([#1031](https://github.com/JosefPihrt/Roslynator/pull/1031) by @jamesHargreaves12). +- Do not report `System.Windows.DependencyPropertyChangedEventArgs` as unused parameter ([RCS1163](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1163.md)) ([#1068](https://github.com/JosefPihrt/Roslynator/pull/1068)). +- Fix ([RCS1032](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1032.md)) ([#1064](https://github.com/JosefPihrt/Roslynator/pull/1064) by @jamesHargreaves12). +- Update processing of .globalconfig file to prioritize file-specific diagnostic severities over global diagnostic severities ([#1066](https://github.com/JosefPihrt/Roslynator/pull/1066/files) by @jamesHargreaves12). +- Fix RCS1009 to handles discard designations ([#1063](https://github.com/JosefPihrt/Roslynator/pull/1063/files) by @jamesHargreaves12). +- [CLI] Fix number of formatted documents, file banners added ([#1072](https://github.com/JosefPihrt/Roslynator/pull/1072)). +- Improve support for coalesce expressions in code fixes that require computing the logical inversion of an expression, such as [RCS1208](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/RCS1208.md) ([#1069](https://github.com/JosefPihrt/Roslynator/pull/1069) by @jamesHargreaves12). + ## [4.2.0] - 2022-11-27 ### Added diff --git a/src/VisualStudioCode/package/README.md b/src/VisualStudioCode/package/README.md index 6680c3d709..2e8735b5cb 100644 --- a/src/VisualStudioCode/package/README.md +++ b/src/VisualStudioCode/package/README.md @@ -1,6 +1,6 @@ # Roslynator for Visual Studio Code -A collection of 500+ [analyzers](https://github.com/JosefPihrt/Roslynator/blob/main/src/Analyzers/README.md), [refactorings](https://github.com/JosefPihrt/Roslynator/blob/main/src/Refactorings/README.md) and [fixes](https://github.com/JosefPihrt/Roslynator/blob/main/src/CodeFixes/README.md) for C#, powered by [Roslyn](https://github.com/dotnet/roslyn). +A collection of 500+ [analyzers](https://github.com/JosefPihrt/Roslynator/blob/main/docs/analyzers/README.md), [refactorings](https://github.com/JosefPihrt/Roslynator/blob/main/docs/refactorings/README.md) and [fixes](https://github.com/JosefPihrt/Roslynator/blob/main/docs/cs/README.md) for C#, powered by [Roslyn](https://github.com/dotnet/roslyn). For further information please visit Roslynator [repo](https://github.com/JosefPihrt/Roslynator). diff --git a/src/VisualStudioCode/package/package-lock.json b/src/VisualStudioCode/package/package-lock.json index 83cb5ec2a7..7afd7d9d4c 100644 --- a/src/VisualStudioCode/package/package-lock.json +++ b/src/VisualStudioCode/package/package-lock.json @@ -1,12 +1,12 @@ { "name": "roslynator", - "version": "4.2.0", + "version": "4.3.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "roslynator", - "version": "4.2.0", + "version": "4.3.0", "license": "Apache-2.0", "dependencies": { "json5": "^2.1.1" diff --git a/src/VisualStudioCode/package/package.json b/src/VisualStudioCode/package/package.json index b2d6368374..8900a91539 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": "4.2.0", + "version": "4.3.0", "author": "Josef Pihrt", "license": "Apache-2.0", "homepage": "https://github.com/josefpihrt/roslynator", diff --git a/src/Workspaces.Common/CSharp/Refactorings/AddExceptionToDocumentationComment/AddExceptionElementToDocumentationCommentRefactoring.cs b/src/Workspaces.Common/CSharp/Refactorings/AddExceptionToDocumentationComment/AddExceptionElementToDocumentationCommentRefactoring.cs index 6eb68b4d12..d0f10adbac 100644 --- a/src/Workspaces.Common/CSharp/Refactorings/AddExceptionToDocumentationComment/AddExceptionElementToDocumentationCommentRefactoring.cs +++ b/src/Workspaces.Common/CSharp/Refactorings/AddExceptionToDocumentationComment/AddExceptionElementToDocumentationCommentRefactoring.cs @@ -181,7 +181,7 @@ private static bool ContainsException(SyntaxList attributes, if (SymbolEqualityComparer.Default.Equals(exceptionSymbol, symbol)) return true; - // http://github.com/dotnet/roslyn/issues/22923 + // https://github.com/dotnet/roslyn/issues/22923 if (exceptionSymbol.IsGenericType && symbol.IsGenericType && SymbolEqualityComparer.Default.Equals(exceptionSymbol.ConstructedFrom, symbol.ConstructedFrom)) diff --git a/tools/build.cmd b/tools/build.cmd index aa10be6efd..6ae9ca6127 100644 --- a/tools/build.cmd +++ b/tools/build.cmd @@ -2,11 +2,11 @@ set _programFiles=%ProgramFiles% -set _msbuildPath="%_programFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild" +set _msbuildPath="%_programFiles%\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild" set _properties=Configuration=Release,Deterministic=true,TreatWarningsAsErrors=true,WarningsNotAsErrors=1591 set _outDir=..\out\Release -set _version=4.2.0 -set _version4=4.2.0.0 +set _version=4.3.0 +set _version4=4.3.0.0 orang replace "..\src\VisualStudio\source.extension.vsixmanifest" ^ -c "patterns\vsix_manifest_version.txt" from-file -t m r ^ @@ -14,11 +14,10 @@ orang replace "..\src\VisualStudio\source.extension.vsixmanifest" ^ orang replace ^ "..\src\VisualStudio\Properties\AssemblyInfo.cs" ^ - "..\src\VisualStudio.Common\Properties\AssemblyInfo.cs" ^ -c "patterns\assembly_info_version.txt" from-file -t m r ^ -r %_version4% -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 +orang delete "..\src" -a d -n "bin,obj" l li e -i "packages,node_modules" l li e ne -t n --content-only -u echo. @@ -26,8 +25,7 @@ dotnet restore "..\src\Roslynator.sln" dotnet restore "..\src\VisualStudio.sln" dotnet restore "..\src\Tools\Tools.sln" -%_msbuildPath% "..\src\Tools\Tools.sln" ^ - /t:Build ^ +dotnet build "..\src\Tools\Tools.sln" ^ /p:%_properties% ^ /v:normal ^ /m @@ -37,7 +35,7 @@ if errorlevel 1 ( exit ) -"..\src\Tools\MetadataGenerator\bin\Release\net48\Roslynator.MetadataGenerator.exe" "..\src" +"..\src\Tools\MetadataGenerator\bin\Release\net7.0\Roslynator.MetadataGenerator.exe" "..\src" dotnet "..\src\Tools\CodeGenerator\bin\Release\netcoreapp3.1\Roslynator.CodeGenerator.dll" "..\src" %_msbuildPath% "..\src\Roslynator.sln" ^ diff --git a/tools/build_cli.cmd b/tools/build_cli.cmd index ed856cb135..360ec2a96b 100644 --- a/tools/build_cli.cmd +++ b/tools/build_cli.cmd @@ -1,19 +1,17 @@ @echo off -set _programFiles=%ProgramFiles% - set _outDir=..\out\Release md "%_outDir%" del /Q "%_outDir%\Roslynator.CommandLine.*.nupkg" del /Q "%_outDir%\Roslynator.DotNet.Cli.*.nupkg" -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 +orang delete "../src" -a d -n "bin,obj" l li e -i "packages,node_modules" l li e ne -t n --content-only -u dotnet restore --force "..\src\CommandLine.sln" /p:RoslynatorCommandLine=true rd /S /Q "..\src\CommandLine\bin\Release" -"%_programFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild" "..\src\CommandLine.sln" ^ +dotnet build "..\src\CommandLine.sln" ^ /t:Clean,Publish ^ /p:Configuration=Release,RoslynatorCommandLine=true,Deterministic=true,TreatWarningsAsErrors=true,WarningsNotAsErrors="1591" ^ /v:normal ^ @@ -28,7 +26,7 @@ dotnet pack -c Release --no-build -v normal /p:RoslynatorCommandLine=true "..\sr copy "..\src\CommandLine\bin\Release\Roslynator.CommandLine.*.nupkg" "%_outDir%" -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 +orang delete "../src" -a d -n "bin,obj" l li e -i "packages,node_modules" l li e ne -t n --content-only -u dotnet pack "..\src\CommandLine\CommandLine.csproj" -c Release -v normal ^ /p:RoslynatorDotNetCli=true,Deterministic=true,TreatWarningsAsErrors=true,WarningsNotAsErrors="1591" diff --git a/tools/build_cli.ps1 b/tools/build_cli.ps1 index dfc951e96a..ff964c1308 100644 --- a/tools/build_cli.ps1 +++ b/tools/build_cli.ps1 @@ -7,7 +7,7 @@ Remove-Item "$outDir/Roslynator.CommandLine.*.nupkg" Remove-Item "$outDir/Roslynator.DotNet.Cli.*.nupkg" Remove-Item -Path "../src/CommandLine/bin/Release" -Recurse -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 +orang delete "../src" -a d -n "bin,obj" l li e -i "packages,node_modules" l li e ne -t n --content-only -u dotnet clean "../src/CommandLine.sln" ` dotnet publish "../src/CommandLine.sln" -c Release ` @@ -19,7 +19,7 @@ dotnet pack -c Release --no-build -v normal /p:RoslynatorCommandLine=true "../sr Copy-Item -Path "../src/CommandLine/bin/Release/Roslynator.CommandLine.*.nupkg" -Destination "$outDir" -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 +orang delete "../src" -a d -n "bin,obj" l li e -i "packages,node_modules" l li e ne -t n --content-only -u dotnet clean "../src/CommandLine.sln" dotnet pack "../src/CommandLine/CommandLine.csproj" -c Release -v normal ` diff --git a/tools/build_vscode.cmd b/tools/build_vscode.cmd index 6cf9a5beb6..2a5e69a434 100644 --- a/tools/build_vscode.cmd +++ b/tools/build_vscode.cmd @@ -1,10 +1,6 @@ @echo off -set _programFiles=%ProgramFiles% - -set _msbuildPath="%_programFiles%\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild" -set _properties=Configuration=Release,Deterministic=true,TreatWarningsAsErrors=true,WarningsNotAsErrors=1591,DefineConstants=VSCODE -set _version=4.2.0 +set _version=4.3.0 orang replace "..\src\VisualStudioCode\package\package.json" ^ -c "patterns\vscode_version.txt" from-file -t m r ^ @@ -12,9 +8,9 @@ orang replace "..\src\VisualStudioCode\package\package.json" ^ dotnet restore --force "..\src\VisualStudioCode.sln" -%_msbuildPath% "..\src\VisualStudioCode.sln" ^ +dotnet build "..\src\VisualStudioCode.sln" ^ /t:Clean,Build ^ - /p:%_properties% ^ + /p:Configuration=Release,Deterministic=true,TreatWarningsAsErrors=true,WarningsNotAsErrors=1591,DefineConstants=VSCODE ^ /v:normal ^ /m