Skip to content

Commit

Permalink
Update NetAnalyzers version (#54511)
Browse files Browse the repository at this point in the history
* Update NetAnalyzers version

* Add NetAnalyzers to dependency flow

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
  • Loading branch information
stephentoub and ViktorHofer committed Jun 23, 2021
1 parent d87b783 commit cd0b3ef
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 9 deletions.
1 change: 1 addition & 0 deletions eng/CodeAnalysis.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
<Rule Id="CA1844" Action="Warning" /> <!-- Provide memory-based overrides of async methods when subclassing 'Stream' -->
<Rule Id="CA1845" Action="Warning" /> <!-- Use span-based 'string.Concat' -->
<Rule Id="CA1846" Action="Warning" /> <!-- Prefer 'AsSpan' over 'Substring' -->
<Rule Id="CA1847" Action="Warning" /> <!-- Use char literal for a single character lookup -->
<Rule Id="CA2000" Action="None" /> <!-- Dispose objects before losing scope -->
<Rule Id="CA2002" Action="None" /> <!-- Do not lock on objects with weak identity -->
<Rule Id="CA2007" Action="Warning" /> <!-- Consider calling ConfigureAwait on the awaited task -->
Expand Down
4 changes: 4 additions & 0 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -219,5 +219,9 @@
<Uri>https://github.com/dotnet/runtime-assets</Uri>
<Sha>8d7b898b96cbdb868cac343e938173105287ed9e</Sha>
</Dependency>
<Dependency Name="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0-rc1.21320.2">
<Uri>https://github.com/dotnet/roslyn-analyzers</Uri>
<Sha>fcddb771f42866f9521f23f093b1f30e129018bb</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
3 changes: 2 additions & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@
<MicrosoftCodeAnalysisVersion>3.8.0</MicrosoftCodeAnalysisVersion>
</PropertyGroup>
<PropertyGroup>
<MicrosoftCodeAnalysisNetAnalyzersVersion>6.0.0-preview6.21281.1</MicrosoftCodeAnalysisNetAnalyzersVersion>
<!-- Code analysis dependencies -->
<MicrosoftCodeAnalysisCSharpCodeStyleVersion>3.10.0-2.final</MicrosoftCodeAnalysisCSharpCodeStyleVersion>
<MicrosoftCodeAnalysisCSharpVersion>3.10.0-2.final</MicrosoftCodeAnalysisCSharpVersion>
<MicrosoftCodeAnalysisNetAnalyzersVersion>6.0.0-rc1.21320.2</MicrosoftCodeAnalysisNetAnalyzersVersion>
<!-- Arcade dependencies -->
<MicrosoftDotNetApiCompatVersion>6.0.0-beta.21311.3</MicrosoftDotNetApiCompatVersion>
<MicrosoftDotNetBuildTasksFeedVersion>6.0.0-beta.21311.3</MicrosoftDotNetBuildTasksFeedVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,7 @@ private static bool IsValueValidInternal(string? keyvalue)
bool compValue = s_connectionStringValidValueRegex.IsMatch(keyvalue);
Debug.Assert((-1 == keyvalue.IndexOf('\u0000')) == compValue, "IsValueValid mismatch with regex");
#endif
// string.Contains(char) is .NetCore2.1+ specific
return (-1 == keyvalue.IndexOf('\u0000'));
return (-1 == keyvalue.IndexOf('\u0000')); // string.Contains(char) is .NetCore2.1+ specific
}
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -628,8 +628,7 @@ private static string FixupName(string name)
{
Debug.Assert(name != null, "[FixupName]name!=null");

// string.Contains(char) is .NetCore2.1+ specific
if (name.IndexOf('\\') == -1)
if (!name.Contains('\\'))
{
return name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<TargetFrameworks>$(NetCoreAppCurrent);netstandard2.0;net461</TargetFrameworks>
<!-- opt-out of trimming until it works https://github.com/dotnet/runtime/issues/49062 -->
<SetIsTrimmable>false</SetIsTrimmable>
<NoWarn>$(NoWarn);CA1847</NoWarn>
</PropertyGroup>
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);netcoreapp3.1-windows;netcoreapp3.1;netstandard2.0;net461</TargetFrameworks>
<NoWarn>$(NoWarn);CA1838</NoWarn>
<NoWarn>$(NoWarn);CA1838;CA1847</NoWarn>
</PropertyGroup>
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);netcoreapp3.1-windows;netcoreapp3.1;netstandard2.0;net461</TargetFrameworks>
<NoWarn>$(NoWarn);CA1847</NoWarn>
</PropertyGroup>
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static DriveInfo[] GetDrives()

private static string NormalizeDriveName(string driveName)
{
if (driveName.Contains("\0")) // string.Contains(char) is .NetCore2.1+ specific
if (driveName.Contains('\0'))
{
throw new ArgumentException(SR.Format(SR.Arg_InvalidDriveChars, driveName), nameof(driveName));
}
Expand Down
2 changes: 1 addition & 1 deletion src/libraries/System.Speech/src/System.Speech.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent);netcoreapp3.1-windows;netcoreapp3.1;netstandard2.0</TargetFrameworks>
<!-- CS0649: uninitialized interop type fields -->
<!-- SA1129: https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/3277 -->
<NoWarn>$(NoWarn);CS0649;SA1129</NoWarn>
<NoWarn>$(NoWarn);CS0649;SA1129;CA1847</NoWarn>
<SetIsTrimmable>false</SetIsTrimmable>
</PropertyGroup>
<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/tasks/AndroidAppBuilder/ApkBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ private static string GetLatestBuildTools(string androidSdkDir)
{
string? buildTools = Directory.GetDirectories(Path.Combine(androidSdkDir, "build-tools"))
.Select(Path.GetFileName)
.Where(file => !file!.Contains("-"))
.Where(file => !file!.Contains('-'))
.Select(file => { Version.TryParse(Path.GetFileName(file), out Version? version); return version; })
.OrderByDescending(v => v)
.FirstOrDefault()?.ToString();
Expand Down

0 comments on commit cd0b3ef

Please sign in to comment.