Skip to content

Commit

Permalink
Align .editorconfig with WinForms (#10080)
Browse files Browse the repository at this point in the history
This effectively copies the .editorconfig from WinForms to align the baseline.

As there are many deviations from the rules in the sources, added a temporary .editorconfig in the product src directory. This will need to have rules pulled bit by bit as the projects are fixed. Most of the rules are pretty easy to fix, but would require some pretty massive codefix changes. They are reasonably safe to do, but they will create disruption for existing PRs as they'll need to rebase.

Created another .editorconfig specifically for the cycle breaker projects. Fixed the headers in the cycle breakers, but otherwise mostly left them alone.

Test projects were updated to pass without needing any overrides. As a general rule, we try to not disable rules for test projects as we want to keep good habits over the entire codebase.

The sooner the automated fixes are done, the better. It is better to have this done before Preview 1 and it is better to aggressively push to do them. Don't wait for full test passes in between changes, do a full pass once they are committed. The recommendation:

1. For each rule where there is an automated fix, run the fix and create a PR that says that you ran the codefix
2. Sanity review and merge each as quickly as possible (check off, merge as soon as green)
3. Run a full test pass when finished

Clearing the automated fixes should be able to be done in a couple weeks at most. Once the rules are turned on it will significantly improve the contribution process. Less clean up to review, less iteration over rules, etc.

Co-authored-by: Harshit <[email protected]>
  • Loading branch information
JeremyKuhne and harshit7962 authored Nov 18, 2024
1 parent d209c5c commit d73dd1d
Show file tree
Hide file tree
Showing 95 changed files with 2,858 additions and 2,198 deletions.
2,268 changes: 2,193 additions & 75 deletions .editorconfig

Large diffs are not rendered by default.

21 changes: 16 additions & 5 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
<!-- Packages that come from https://github.com/dotnet/arcade -->
<PropertyGroup>
<MicrosoftDotNetApiCompatVersion>9.0.0-beta.24053.1</MicrosoftDotNetApiCompatVersion>
<MicrosoftDotNetCodeAnalysisPackageVersion>10.0.0-beta.24564.1</MicrosoftDotNetCodeAnalysisPackageVersion>
</PropertyGroup>
<!-- Sourcelink -->
<PropertyGroup>
Expand Down Expand Up @@ -83,10 +82,6 @@
<NetFramework48RefAssembliesVersion>0.0.0.1</NetFramework48RefAssembliesVersion>
<MicrosoftWindowsCsWin32PackageVersion>0.3.106</MicrosoftWindowsCsWin32PackageVersion>
</PropertyGroup>
<!-- External Analyzers -->
<PropertyGroup>
<MicrosoftCodeAnalysisNetAnalyzersVersion>7.0.0</MicrosoftCodeAnalysisNetAnalyzersVersion>
</PropertyGroup>
<!-- XUnit-related (not extensions) -->
<PropertyGroup>
<XUnitVersion>2.9.0</XUnitVersion>
Expand All @@ -111,6 +106,22 @@
<CodecovVersion>1.9.0</CodecovVersion>
<ReportGeneratorVersion>4.0.9</ReportGeneratorVersion>
</PropertyGroup>
<!-- External Analyzers -->
<PropertyGroup>
<CSharpIsNullAnalyzersVersion>0.1.495</CSharpIsNullAnalyzersVersion>
<DotNetAnalyzersDocumentationAnalyzersVersion>1.0.0-beta.59</DotNetAnalyzersDocumentationAnalyzersVersion>
<MicrosoftCodeAnalysisAnalyzersVersion>3.11.0-beta1.24219.2</MicrosoftCodeAnalysisAnalyzersVersion>
<MicrosoftCodeAnalysisCommonPackageVersion>4.10.0-3.final</MicrosoftCodeAnalysisCommonPackageVersion>
<MicrosoftCodeAnalysisCSharpPackageVersion>$(MicrosoftCodeAnalysisCommonPackageVersion)</MicrosoftCodeAnalysisCSharpPackageVersion>
<MicrosoftCodeAnalysisVisualBasicPackageVersion>$(MicrosoftCodeAnalysisCommonPackageVersion)</MicrosoftCodeAnalysisVisualBasicPackageVersion>
<MicrosoftCodeAnalysisCSharpWorkspacesVersion>$(MicrosoftCodeAnalysisCommonPackageVersion)</MicrosoftCodeAnalysisCSharpWorkspacesVersion>
<MicrosoftCodeAnalysisVisualBasicWorkspacesVersion>$(MicrosoftCodeAnalysisCommonPackageVersion)</MicrosoftCodeAnalysisVisualBasicWorkspacesVersion>
<MicrosoftCodeAnalysisPackagesVersion>1.1.3-beta1.24352.1</MicrosoftCodeAnalysisPackagesVersion>
<MicrosoftCodeAnalysisPublicApiAnalyzersVersion>$(MicrosoftCodeAnalysisAnalyzersVersion)</MicrosoftCodeAnalysisPublicApiAnalyzersVersion>
<MicrosoftCodeAnalysisNetAnalyzersVersion>8.0.0</MicrosoftCodeAnalysisNetAnalyzersVersion>
<StyleCopAnalyzersVersion>1.2.0-beta.556</StyleCopAnalyzersVersion>
<NugetPackagingVersion>6.11.0</NugetPackagingVersion>
</PropertyGroup>
<!--Package names-->
<PropertyGroup>
<SystemReflectionMetadataLoadContextPackage>System.Reflection.MetadataLoadContext</SystemReflectionMetadataLoadContextPackage>
Expand Down
9 changes: 8 additions & 1 deletion eng/WpfArcadeSdk/tools/CodeAnalysis.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
<Project>

<PropertyGroup>
<!-- Do not warn about the version of analyzers being used in this project -->
<!-- Only upgrade NuGetAudit warnings to errors for official builds. -->
<WarningsNotAsErrors Condition="'$(OfficialBuild)' != 'true'">$(WarningsNotAsErrors);NU1901;NU1902;NU1903;NU1904</WarningsNotAsErrors>

<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>

<!--
Don't let Microsoft.CodeAnalysis.NetAnalyzers complain about the version being older than what is in the SDK.
-->
<_SkipUpgradeNetAnalyzersNuGetWarning>true</_SkipUpgradeNetAnalyzersNuGetWarning>
</PropertyGroup>

Expand Down
19 changes: 13 additions & 6 deletions eng/WpfArcadeSdk/tools/CodeAnalysis.targets
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
<Project>
<ItemGroup Condition="'$(IsTestProject)'!='true' AND '$(EnableAnalyzers)'=='true'">
<EditorConfigFiles Include="$(MSBuildThisFileDirectory)CodeAnalysis\CodeAnalysis.src.globalconfig" />
<!-- Managed Code Reference analyzers -->
<PackageReference Include="Microsoft.DotNet.CodeAnalysis" Version="$(MicrosoftDotNetCodeAnalysisPackageVersion)" />
<ItemGroup Condition="'$(EnableAnalyzers)'=='true'">
<!-- Managed Code analyzers -->

<!-- https://github.com/DotNetAnalyzers/StyleCopAnalyzers -->
<PackageReference Include="StyleCop.Analyzers" Version="$(StyleCopAnalyzersVersion)" PrivateAssets="all" />

<!-- https://github.com/dotnet/roslyn-analyzers -->
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="$(MicrosoftCodeAnalysisNetAnalyzersVersion)" PrivateAssets="all" />
<PackageReference Include="System.Runtime.Analyzers" Version="1.1.0" />
<PackageReference Include="System.Runtime.InteropServices.Analyzers" Version="1.1.0" />

<!-- https://github.com/DotNetAnalyzers/DocumentationAnalyzers -->
<PackageReference Include="DotNetAnalyzers.DocumentationAnalyzers" Version="$(DotNetAnalyzersDocumentationAnalyzersVersion)" PrivateAssets="all" />

<!-- https://github.com/AArnott/CSharpIsNull -->
<PackageReference Include="CSharpIsNullAnalyzer" Version="$(CSharpIsNullAnalyzersVersion)" PrivateAssets="all" />
</ItemGroup>
</Project>
Loading

0 comments on commit d73dd1d

Please sign in to comment.