Fix CA1862
This commit is contained in:
committed by
Pavel Penev
parent
ed90322a0b
commit
332ab244a7
@@ -913,6 +913,9 @@ dotnet_diagnostic.CA1858.severity = warning
|
||||
# Avoid using 'Enumerable.Any()' extension method.
|
||||
dotnet_diagnostic.CA1860.severity = warning
|
||||
|
||||
# Use the 'StringComparison' method overloads to perform case-insensitive string comparisons.
|
||||
dotnet_diagnostic.CA1862.severity = warning
|
||||
|
||||
# Use 'CompositeFormat'.
|
||||
dotnet_diagnostic.CA1863.severity = suggestion # TODO: Change to warning once using .NET 7 or later.
|
||||
|
||||
|
||||
@@ -130,7 +130,8 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
|
||||
Console.WriteLine("\t\tIntoActor: " + undeploysInto);
|
||||
}
|
||||
|
||||
if (artIni.Sections.Any(s => s.Name == building.ToLowerInvariant()))
|
||||
var buildingLower = building.ToLowerInvariant();
|
||||
if (artIni.Sections.Any(s => s.Name == buildingLower))
|
||||
{
|
||||
var artSection = artIni.GetSection(building);
|
||||
|
||||
|
||||
@@ -138,7 +138,8 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
|
||||
Console.WriteLine("\t\tUseTilesetCode: false");
|
||||
}
|
||||
|
||||
if (file.Sections.Any(s => s.Name == sequence.ToLowerInvariant()))
|
||||
var sequenceLower = sequence.ToLowerInvariant();
|
||||
if (file.Sections.Any(s => s.Name == sequenceLower))
|
||||
{
|
||||
var sequenceSection = file.GetSection(sequence);
|
||||
var guard = sequenceSection.GetValue("Guard", string.Empty);
|
||||
|
||||
@@ -150,7 +150,9 @@ namespace OpenRA.Mods.Common.Activities
|
||||
var positionable = (IPositionable)movement;
|
||||
var mobile = positionable as Mobile;
|
||||
minefield.RemoveAll(c => self.World.ActorMap.GetActorsAt(c)
|
||||
.Any(a => a.Info.Name == minelayer.Info.Mine.ToLowerInvariant() && a.CanBeViewedByPlayer(self.Owner)) ||
|
||||
.Any(a =>
|
||||
string.Equals(a.Info.Name, minelayer.Info.Mine, System.StringComparison.OrdinalIgnoreCase)
|
||||
&& a.CanBeViewedByPlayer(self.Owner)) ||
|
||||
((!positionable.CanEnterCell(c, null, BlockedByActor.Immovable) || (mobile != null && !mobile.CanStayInCell(c)))
|
||||
&& self.Owner.Shroud.IsVisible(c)));
|
||||
}
|
||||
|
||||
@@ -336,7 +336,9 @@ namespace OpenRA.Mods.Common.UpdateRules
|
||||
|
||||
public static bool IsAlreadyExtracted(string key)
|
||||
{
|
||||
#pragma warning disable CA1862 // Use the 'StringComparison' method overloads to perform case-insensitive string comparisons
|
||||
if (key == key.ToLowerInvariant() && key.Any(c => c == '-') && key.All(c => c != ' '))
|
||||
#pragma warning restore CA1862
|
||||
{
|
||||
Console.WriteLine($"Skipping {key} because it is already extracted.");
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user