Skip to content

Commit

Permalink
Use shared settings for enabling analyzers in LibraryImportGenerator (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
elinor-fung committed May 18, 2022
1 parent 2e6bdff commit 42d1644
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/libraries/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<PropertyGroup>
<GenFacadesIgnoreBuildAndRevisionMismatch>true</GenFacadesIgnoreBuildAndRevisionMismatch>
<!-- Disable analyzers for tests and unsupported projects -->
<RunAnalyzers Condition="'$(IsTestProject)' != 'true' and '$(IsSourceProject)' != 'true'">false</RunAnalyzers>
<RunAnalyzers Condition="'$(IsTestProject)' != 'true' and '$(IsSourceProject)' != 'true' and '$(IsGeneratorProject)' != 'true'">false</RunAnalyzers>
<!-- Enable documentation file generation by the compiler for all libraries except for vbproj. -->
<GenerateDocumentationFile Condition="'$(IsSourceProject)' == 'true' and '$(MSBuildProjectExtension)' != '.vbproj'">true</GenerateDocumentationFile>
<CLSCompliant Condition="'$(CLSCompliant)' == '' and '$(IsTestProject)' != 'true' and '$(IsTestSupportProject)' != 'true'">true</CLSCompliant>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<UsingToolXliff>true</UsingToolXliff>
<CLSCompliant>false</CLSCompliant>
<AnalyzerLanguage>cs</AnalyzerLanguage>
<RunAnalyzers>false</RunAnalyzers>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,12 @@ private static Guid GenerateGuidFromName(string name)
bytes.CopyTo(combinedBytes, namespaceBytes.Length);
namespaceBytes.CopyTo(combinedBytes);

#pragma warning disable CA5350 // Do Not Use Weak Cryptographic Algorithms
using (SHA1 sha = SHA1.Create())
{
bytes = sha.ComputeHash(combinedBytes);
}
#pragma warning restore CA5350 // Do Not Use Weak Cryptographic Algorithms

Array.Resize(ref bytes, 16);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RootNamespace>Microsoft.Interop</RootNamespace>
<IsRoslynComponent>true</IsRoslynComponent>
<RunAnalyzers>true</RunAnalyzers>
<!-- Disable RS2008: Enable analyzer release tracking
Diagnostics in runtime use a different mechanism (docs/project/list-of-diagnostics.md) -->
<NoWarn>RS2008;$(NoWarn)</NoWarn>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Microsoft.Interop</RootNamespace>
<RunAnalyzers>true</RunAnalyzers>
<DefineConstants>$(DefineConstants);MICROSOFT_INTEROP_SOURCEGENERATION</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems>
<UsingToolXliff>true</UsingToolXliff>
<AnalyzerLanguage>cs</AnalyzerLanguage>
<RunAnalyzers>false</RunAnalyzers>
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);REGEXGENERATOR</DefineConstants>
<AnalyzerLanguage>cs</AnalyzerLanguage>
<RunAnalyzers>false</RunAnalyzers>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 42d1644

Please sign in to comment.