.Any(), .Count() -> .Count or .Length
This commit is contained in:
committed by
atlimit8
parent
6eb4fe8980
commit
79f321cb44
@@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
}
|
||||
|
||||
// Logic classes can declare the data key names that specify hotkeys
|
||||
if (node.Key == "Logic" && node.Value.Nodes.Any())
|
||||
if (node.Key == "Logic" && node.Value.Nodes.Count > 0)
|
||||
{
|
||||
var typeNames = FieldLoader.GetValue<string[]>(node.Key, node.Value.Value);
|
||||
var checkArgKeys = new List<string>();
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
var ios = actorInfo.Value.TraitInfoOrDefault<IOccupySpaceInfo>();
|
||||
if (ios == null)
|
||||
emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{vis.GetType()}` but has no IOccupySpace traits!");
|
||||
else if (!ios.OccupiedCells(actorInfo.Value, CPos.Zero).Any())
|
||||
else if (ios.OccupiedCells(actorInfo.Value, CPos.Zero).Count == 0)
|
||||
emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{vis.GetType()}` but does not have any footprint cells!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenRA.Server;
|
||||
|
||||
namespace OpenRA.Mods.Common.Lint
|
||||
@@ -38,7 +37,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
if (title == null)
|
||||
emitError("Map does not define a valid title.");
|
||||
|
||||
if (!categories.Any())
|
||||
if (categories.Length == 0)
|
||||
emitError("Map does not define any categories.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
if (player.OwnsWorld)
|
||||
{
|
||||
worldOwnerFound = true;
|
||||
if (player.Enemies.Any() || player.Allies.Any())
|
||||
if (player.Enemies.Length > 0 || player.Allies.Length > 0)
|
||||
emitWarning($"The player {player.Name} owning the world should not have any allies or enemies.");
|
||||
|
||||
if (player.Playable)
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenRA.Mods.Common.Traits;
|
||||
using OpenRA.Server;
|
||||
using OpenRA.Traits;
|
||||
@@ -41,7 +40,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
|
||||
if (ios == null)
|
||||
emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{rsi.GetType()}` but has no IOccupySpace traits!");
|
||||
else if (!ios.OccupiedCells(actorInfo.Value, CPos.Zero).Any())
|
||||
else if (ios.OccupiedCells(actorInfo.Value, CPos.Zero).Count == 0)
|
||||
emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{rsi.GetType()}` but does not have any footprint cells!");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.FileSystem;
|
||||
using OpenRA.Server;
|
||||
|
||||
@@ -53,7 +52,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
// Removals can never define children or values
|
||||
if (t.Key.StartsWith("-", StringComparison.Ordinal))
|
||||
{
|
||||
if (t.Value.Nodes.Any())
|
||||
if (t.Value.Nodes.Count > 0)
|
||||
emitError($"{t.Location} {t.Key} defines child nodes, which are not valid for removals.");
|
||||
|
||||
if (!string.IsNullOrEmpty(t.Value.Value))
|
||||
@@ -65,7 +64,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
var traitName = NormalizeName(t.Key);
|
||||
|
||||
// Inherits can never define children
|
||||
if (traitName == "Inherits" && t.Value.Nodes.Any())
|
||||
if (traitName == "Inherits" && t.Value.Nodes.Count > 0)
|
||||
{
|
||||
emitError($"{t.Location} defines child nodes, which are not valid for Inherits.");
|
||||
continue;
|
||||
@@ -91,7 +90,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
foreach (var f in mapFiles)
|
||||
CheckActors(MiniYaml.FromStream(fileSystem.Open(f), f), emitError, modData);
|
||||
|
||||
if (ruleDefinitions.Nodes.Any())
|
||||
if (ruleDefinitions.Nodes.Count > 0)
|
||||
CheckActors(ruleDefinitions.Nodes, emitError, modData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.FileSystem;
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Server;
|
||||
@@ -55,7 +54,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
// Removals can never define children or values
|
||||
if (field.Key.StartsWith("-", StringComparison.Ordinal))
|
||||
{
|
||||
if (field.Value.Nodes.Any())
|
||||
if (field.Value.Nodes.Count > 0)
|
||||
emitError($"{field.Location} {field.Key} defines child nodes, which is not valid for removals.");
|
||||
|
||||
if (!string.IsNullOrEmpty(field.Value.Value))
|
||||
@@ -108,7 +107,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
foreach (var f in mapFiles)
|
||||
CheckWeapons(MiniYaml.FromStream(fileSystem.Open(f), f), emitError, emitWarning, modData);
|
||||
|
||||
if (weaponDefinitions.Nodes.Any())
|
||||
if (weaponDefinitions.Nodes.Count > 0)
|
||||
CheckWeapons(weaponDefinitions.Nodes, emitError, emitWarning, modData);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user