Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions eng/CodeAnalysis.src.globalconfig
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ dotnet_diagnostic.CA1860.severity = warning
# CA1861: Avoid constant arrays as arguments
dotnet_diagnostic.CA1861.severity = warning

# CA1862: Prefer using 'StringComparer'/'StringComparison' to perform case-insensitive string comparisons
# CA1862: Use the 'StringComparison' method overloads to perform case-insensitive string comparisons
dotnet_diagnostic.CA1862.severity = suggestion

# CA1863: Use 'CompositeFormat'
Expand Down Expand Up @@ -513,6 +513,15 @@ dotnet_diagnostic.CA1871.severity = warning
# CA1872: Prefer 'Convert.ToHexString' and 'Convert.ToHexStringLower' over call chains based on 'BitConverter.ToString'
dotnet_diagnostic.CA1872.severity = warning

# CA1873: Avoid potentially expensive logging
dotnet_diagnostic.CA1873.severity = warning

# CA1874: Use 'Regex.IsMatch'
dotnet_diagnostic.CA1874.severity = warning

# CA1875: Use 'Regex.Count'
dotnet_diagnostic.CA1875.severity = warning

# CA2000: Dispose objects before losing scope
dotnet_diagnostic.CA2000.severity = none

Expand Down Expand Up @@ -564,7 +573,13 @@ dotnet_diagnostic.CA2021.severity = warning
# CA2022: Avoid inexact read with 'Stream.Read'
dotnet_diagnostic.CA2022.severity = warning

# CA2025: Ensure tasks using 'IDisposable' instances complete before the instances are disposed
# CA2023: Invalid braces in message template
dotnet_diagnostic.CA2023.severity = warning

# CA2024: Do not use 'StreamReader.EndOfStream' in async methods
dotnet_diagnostic.CA2024.severity = warning

# CA2025: Do not pass 'IDisposable' instances into unawaited tasks
dotnet_diagnostic.CA2025.severity = warning

# CA2100: Review SQL queries for security vulnerabilities
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ private void MatchType(TypeDesc type, Regex regex, XPathNavigator nav)
{
StringBuilder sb = new StringBuilder();
CecilTypeNameFormatter.Instance.AppendName(sb, type);
if (regex.Match(sb.ToString()).Success)
if (regex.IsMatch(sb.ToString()))
ProcessType(type, nav);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,11 @@ public Task WaitForStartAsync(CancellationToken cancellationToken)

private void OnApplicationStarted()
{
Logger.LogInformation("Application started. Hosting environment: {EnvironmentName}; Content root path: {ContentRoot}",
Environment.EnvironmentName, Environment.ContentRootPath);
if (Logger.IsEnabled(LogLevel.Information))
{
Logger.LogInformation("Application started. Hosting environment: {EnvironmentName}; Content root path: {ContentRoot}",
Environment.EnvironmentName, Environment.ContentRootPath);
}

SystemdNotifier.Notify(ServiceState.Ready);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,11 @@ public Task WaitForStartAsync(CancellationToken cancellationToken)
cancellationToken.Register(() => _delayStart.TrySetCanceled());
ApplicationLifetime.ApplicationStarted.Register(() =>
{
Logger.LogInformation("Application started. Hosting environment: {EnvName}; Content root path: {ContentRoot}",
if (Logger.IsEnabled(LogLevel.Information))
{
Logger.LogInformation("Application started. Hosting environment: {EnvName}; Content root path: {ContentRoot}",
Environment.EnvironmentName, Environment.ContentRootPath);
}
});
ApplicationLifetime.ApplicationStopping.Register(() =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,12 @@ public Task WaitForStartAsync(CancellationToken cancellationToken)

private void OnApplicationStarted()
{
Logger.LogInformation("Application started. Press Ctrl+C to shut down.");
Logger.LogInformation("Hosting environment: {EnvName}", Environment.EnvironmentName);
Logger.LogInformation("Content root path: {ContentRoot}", Environment.ContentRootPath);
if (Logger.IsEnabled(LogLevel.Information))
{
Logger.LogInformation("Application started. Press Ctrl+C to shut down.");
Logger.LogInformation("Hosting environment: {EnvName}", Environment.EnvironmentName);
Logger.LogInformation("Content root path: {ContentRoot}", Environment.ContentRootPath);
}
}

private void OnApplicationStopping()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>$(AspNetCoreAppCurrent)</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<NoWarn>$(NoWarn),CA2007</NoWarn>
<NoWarn>$(NoWarn),CA2007,CA1873</NoWarn>
<UseAppHost>false</UseAppHost>
<RollForward>Major</RollForward>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>$(AspNetCoreAppCurrent)</TargetFramework>
<NoWarn>$(NoWarn),CA2007</NoWarn>
<NoWarn>$(NoWarn),CA2007,CA1873</NoWarn>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/mono/wasm/host/WasmAppHost.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>$(AspNetCoreAppCurrent)</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<NoWarn>$(NoWarn);CA2007</NoWarn>
<NoWarn>$(NoWarn);CA2007;CA1873</NoWarn>
<Nullable>enable</Nullable>
<UseAppHost>false</UseAppHost>
<RollForward>LatestMajor</RollForward>
Expand Down
1 change: 1 addition & 0 deletions src/mono/wasm/symbolicator/WasmSymbolicator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<NoWarn>$(NoWarn);CA1873</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ protected virtual void ProcessTypes(AssemblyDefinition assembly, XPathNavigator

void MatchType(TypeDefinition type, Regex regex, XPathNavigator nav)
{
if (regex.Match(type.FullName).Success)
if (regex.IsMatch(type.FullName))
ProcessType(type, nav);

if (!type.HasNestedTypes)
Expand All @@ -238,7 +238,7 @@ protected virtual bool ProcessTypePattern(string fullname, AssemblyDefinition as
{
foreach (var exported in assembly.MainModule.ExportedTypes)
{
if (regex.Match(exported.FullName).Success)
if (regex.IsMatch(exported.FullName))
{
var type = ProcessExportedType(exported, assembly, nav);
if (type != null)
Expand Down
Loading