diff --git a/.editorconfig b/.editorconfig index 506dd29ec0..d23d7921d6 100644 --- a/.editorconfig +++ b/.editorconfig @@ -53,6 +53,14 @@ dotnet_style_readonly_field = true:warning # Parameter preferences dotnet_code_quality_unused_parameters = all:warning +# Expression preferences +dotnet_style_prefer_compound_assignment = true:warning + +# Dispose rules (CA2000 and CA2213) ported to IDE analyzers. We already execute the CA rules on the repo, so disable the IDE ones. +dotnet_diagnostic.IDE0067.severity = none +dotnet_diagnostic.IDE0068.severity = none +dotnet_diagnostic.IDE0069.severity = none + ### CSharp code style settings ### [*.cs] @@ -77,6 +85,8 @@ csharp_style_pattern_matching_over_as_with_null_check = true:suggestion csharp_style_inlined_variable_declaration = true:suggestion csharp_style_throw_expression = true:suggestion csharp_style_conditional_delegate_call = true:suggestion +csharp_prefer_static_local_function = true:warning +csharp_prefer_simple_using_statement = true:warning # Newline settings csharp_new_line_before_open_brace = all @@ -88,6 +98,7 @@ csharp_new_line_before_members_in_anonymous_types = true # Expression-level preferences csharp_style_unused_value_assignment_preference = discard_variable:warning +csharp_style_pattern_matching_over_as_with_null_check = true:warning ### Visual Basic code style settings ### [*.vb] diff --git a/PostReleaseActivities.md b/PostReleaseActivities.md index 4c2f1d4d35..8921f01fdf 100644 --- a/PostReleaseActivities.md +++ b/PostReleaseActivities.md @@ -14,8 +14,9 @@ Please follow the below steps after publishing analyzer NuGet packages from this 4. Update `eng\Versions.props`: 1. Bump up the `VersionPrefix`. 2. Reset `PreReleaseVersionLabel` to `beta1`. - 3. Update `MicrosoftCodeAnalysisFXCopAnalyersVersion` to the latest released package version. Build the repo by invoking `Build.cmd` and fix/suppress any new CA diagnostics, as appropriate. - 5. Create and submit a PR with the above changes. + 3. Update `MicrosoftCodeAnalysisFXCopAnalyersVersion` to the latest released package version. + 5. Build the repo by invoking `eng\common\CIBuild.cmd` and fix/suppress any new CA diagnostics, as appropriate. This should also update the analyzer documentation files in the repo to use the new version prefix. + 6. Create and submit a PR with the above changes. Steps to generate Release Notes ================================================================= diff --git a/nuget/Microsoft.CodeAnalysis.FlowAnalysis.Utilities/Microsoft.CodeAnalysis.FlowAnalysis.Utilities.Package.csproj b/nuget/Microsoft.CodeAnalysis.FlowAnalysis.Utilities/Microsoft.CodeAnalysis.FlowAnalysis.Utilities.Package.csproj index 1e3d8750b5..05e384f0ba 100644 --- a/nuget/Microsoft.CodeAnalysis.FlowAnalysis.Utilities/Microsoft.CodeAnalysis.FlowAnalysis.Utilities.Package.csproj +++ b/nuget/Microsoft.CodeAnalysis.FlowAnalysis.Utilities/Microsoft.CodeAnalysis.FlowAnalysis.Utilities.Package.csproj @@ -16,6 +16,9 @@ --> *$(MSBuildProjectFullPath)* false + + + $(VersionPrefix).0 diff --git a/src/GenerateAnalyzerRulesets/CodeFixerExtensions.cs b/src/GenerateAnalyzerRulesets/CodeFixerExtensions.cs index 98ac3aa711..982489164b 100644 --- a/src/GenerateAnalyzerRulesets/CodeFixerExtensions.cs +++ b/src/GenerateAnalyzerRulesets/CodeFixerExtensions.cs @@ -40,7 +40,7 @@ public static ImmutableArray GetFixers(this AnalyzerFileReferen ExportCodeFixProviderAttribute attribute = typeInfo.GetCustomAttribute(); if (attribute != null) { - builder = builder ?? ImmutableArray.CreateBuilder(); + builder ??= ImmutableArray.CreateBuilder(); var fixer = (CodeFixProvider)Activator.CreateInstance(typeInfo.AsType()); if (HasImplementation(fixer)) { diff --git a/src/GenerateAnalyzerRulesets/Program.cs b/src/GenerateAnalyzerRulesets/Program.cs index 32ece859f2..383b9b4da9 100644 --- a/src/GenerateAnalyzerRulesets/Program.cs +++ b/src/GenerateAnalyzerRulesets/Program.cs @@ -64,7 +64,7 @@ public static int Main(string[] args) var analyzers = analyzerFileReference.GetAnalyzersForAllLanguages(); var rulesById = new SortedList(); - var assemblyRulesMetadata = (path: path, rules: new SortedList()); + var assemblyRulesMetadata = (path, rules: new SortedList()); foreach (var analyzer in analyzers) { @@ -337,7 +337,7 @@ void createPropsFile() File.WriteAllText(fileWithPath, fileContents); } - string getFlowAnalysisFeatureFlag() + static string getFlowAnalysisFeatureFlag() { return @" @@ -404,7 +404,7 @@ string getRulesetOverrides() return string.Empty; } - string getEditorConfigAsAdditionalFile() + static string getEditorConfigAsAdditionalFile() { return $@"