Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add public api analyzers #1318

Merged
merged 2 commits into from
Oct 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ dotnet_diagnostic.CA1854.severity = warning
# CA1806: Do not ignore method results
dotnet_diagnostic.CA1806.severity = warning

dotnet_diagnostic.RS0037.severity = none

#### Naming styles ####

# Naming rules (define naming rule using dotnet_naming_rule.<rule_name>.<option>)
Expand Down
4 changes: 3 additions & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@
<MoqVersion>4.18.1</MoqVersion>
<CastleCoreVersion>5.0.0</CastleCoreVersion>
<FluentAssertionsVersion>6.7.0</FluentAssertionsVersion>
<StyleCopAnalyzersVersion>1.0.0</StyleCopAnalyzersVersion>
<!-- These are used to test compability with legacy MSTest, please do not update -->
<Legacy__MicrosoftNETTestSdkVersion>15.7.0</Legacy__MicrosoftNETTestSdkVersion>
<Legacy__MSTestTestAdapterVersion>1.2.0</Legacy__MSTestTestAdapterVersion>
<Legacy__MSTestTestFrameworkVersion>1.2.0</Legacy__MSTestTestFrameworkVersion>
<!-- / These are used to test compability with legacy MSTest, please do not update -->
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
<!-- Code analyzers -->
<StyleCopAnalyzersVersion>1.0.0</StyleCopAnalyzersVersion>
<RoslynPublicApiAnalyzersVersion>3.3.4-beta1.21554.2</RoslynPublicApiAnalyzersVersion>
<!-- Libs -->
<CommandLineParserVersion>2.2.1</CommandLineParserVersion>
<CredentialManagementVersion>1.0.2</CredentialManagementVersion>
Expand Down
13 changes: 13 additions & 0 deletions scripts/build/TestFx.targets
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@
<Analyzer Include="$(NuGetPackageRoot)\StyleCop.Analyzers\$(StyleCopAnalyzersVersion)\analyzers\dotnet\cs\StyleCop.Analyzers.dll" />
</ItemGroup>-->

<!--
Include PublicApi analyzers into all projects that are in our src directory, this can't use TestProject == true
because some projects in test are not tests, but we don't want to analyze those for public apis, because we
don't ship them.
Use relative path between the project and the root to avoid including the analyzer if the path above the root contains 'src' (e.g. C:\src\vstest).
-->
<ItemGroup Condition="$([MSBuild]::MakeRelative($(RepoRoot), $(MSBuildProjectFullPath)).StartsWith('src/')) OR $([MSBuild]::MakeRelative($(RepoRoot), $(MSBuildProjectFullPath)).StartsWith('src\'))">
<PackageReference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" Version="$(RoslynPublicApiAnalyzersVersion)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<!-- WARNING remove this when SDK-style project conversion is being done. -->
<!--
We are generating an AssemblyInfo file with certain attributes here,
Expand Down
9 changes: 9 additions & 0 deletions src/Adapter/MSTest.TestAdapter/MSTest.TestAdapter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@
</PackageReference>
</ItemGroup>

<ItemGroup>
<!-- API that is common to all frameworks that we build for. -->
<AdditionalFiles Include="PublicAPI\PublicAPI.Shipped.txt" />
<AdditionalFiles Include="PublicAPI\PublicAPI.Unshipped.txt" />
<!-- Framework specific API -->
<AdditionalFiles Include="PublicAPI\$(TargetFramework)\PublicAPI.Shipped.txt" />
<AdditionalFiles Include="PublicAPI\$(TargetFramework)\PublicAPI.Unshipped.txt" />
</ItemGroup>

<ItemGroup>
<Compile Update="Resources\Resource.Designer.cs">
<AutoGen>True</AutoGen>
Expand Down
146 changes: 146 additions & 0 deletions src/Adapter/MSTest.TestAdapter/PublicAPI/PublicAPI.Shipped.txt

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Empty file.
Empty file.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Nullable>disable</Nullable>
</PropertyGroup>

<!-- Properties specific to UWP -->
Expand Down Expand Up @@ -66,6 +67,15 @@
<PackageReference Include="System.Private.Uri" Version="$(SystemPrivateUriVersion)" />
</ItemGroup>

<ItemGroup>
<!-- API that is common to all frameworks that we build for. -->
<AdditionalFiles Include="PublicAPI\PublicAPI.Shipped.txt" />
<AdditionalFiles Include="PublicAPI\PublicAPI.Unshipped.txt" />
<!-- Framework specific API -->
<AdditionalFiles Include="PublicAPI\$(TargetFramework)\PublicAPI.Shipped.txt" />
<AdditionalFiles Include="PublicAPI\$(TargetFramework)\PublicAPI.Unshipped.txt" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' != '$(UwpMinimum)' ">
<Compile Include="$(RepoRoot)src\Adapter\PlatformServices.Shared\netstandard1.3\Resources\Resource.Designer.cs">
<Link>Resources\Resource.Designer.cs</Link>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

// Extra .0 at the end is a workaround for https://github.com/dotnet/roslyn-analyzers/issues/5728
// Can be removed after the issue is closed.
[assembly: SupportedOSPlatform("windows10.0.17763.0")]
[assembly: SupportedOSPlatform("windows10.0.18362.0")]
#endif

#if NETFRAMEWORK
Expand Down