Fix lint error formatting
This commit is contained in:
committed by
Matthias Mailänder
parent
3188532e59
commit
1ac6912c2a
@@ -68,14 +68,14 @@ namespace OpenRA.Mods.Common.Lint
|
||||
|
||||
if (!dict.ContainsKey(v))
|
||||
{
|
||||
emitError($"{actorInfo.Name}.{traitInfo.GetType().Name}.{fieldInfo.Name}: Missing actor `{value}`.");
|
||||
emitError($"`{actorInfo.Name}.{traitInfo.GetType().Name}.{fieldInfo.Name}`: Missing actor `{value}`.");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (var requiredTrait in attribute.RequiredTraits)
|
||||
if (!dict[v].TraitsInConstructOrder().Any(t => t.GetType() == requiredTrait || t.GetType().IsSubclassOf(requiredTrait)))
|
||||
emitError($"Actor type {value} does not have trait {requiredTrait.Name} which is required by {traitInfo.GetType().Name}.{fieldInfo.Name}.");
|
||||
emitError($"Actor type `{value}` does not have trait `{requiredTrait.Name}` which is required by `{traitInfo.GetType().Name}.{fieldInfo.Name}`.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
continue;
|
||||
|
||||
if (!dict.ContainsKey(value.ToLowerInvariant()))
|
||||
emitError($"{actorInfo.Name}.{traitInfo.GetType().Name}.{fieldInfo.Name}: Missing weapon `{value}`.");
|
||||
emitError($"`{actorInfo.Name}.{traitInfo.GetType().Name}.{fieldInfo.Name}`: Missing weapon `{value}`.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
continue;
|
||||
|
||||
if (!dict.ContainsKey(value.ToLowerInvariant()))
|
||||
emitError($"{actorInfo.Name}.{traitInfo.GetType().Name}.{fieldInfo.Name}: Missing voice `{value}`.");
|
||||
emitError($"`{actorInfo.Name}.{traitInfo.GetType().Name}.{fieldInfo.Name}`: Missing voice `{value}`.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
var actorTypes = map.ActorDefinitions.Select(a => a.Value.Value);
|
||||
foreach (var actor in actorTypes)
|
||||
if (!map.Rules.Actors.Keys.Contains(actor.ToLowerInvariant()))
|
||||
emitError($"Actor {actor} is not defined by any rule.");
|
||||
emitError($"Actor `{actor}` is not defined by any rule.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,16 +61,16 @@ namespace OpenRA.Mods.Common.Lint
|
||||
static void CheckLaunchAngles(string weaponInfo, int minAngle, bool testMaxAngle, int maxAngle, Action<string> emitError)
|
||||
{
|
||||
if (InvalidAngle(minAngle))
|
||||
emitError($"Weapon `{weaponInfo}`: Projectile minimum LaunchAngle must not exceed (-)255!");
|
||||
emitError($"Weapon `{weaponInfo}`: Projectile minimum LaunchAngle must not exceed (-)255.");
|
||||
if (testMaxAngle && InvalidAngle(maxAngle))
|
||||
emitError($"Weapon `{weaponInfo}`: Projectile maximum LaunchAngle must not exceed (-)255!");
|
||||
emitError($"Weapon `{weaponInfo}`: Projectile maximum LaunchAngle must not exceed (-)255.");
|
||||
|
||||
if ((minAngle < 256) && (maxAngle < 256) && (minAngle > maxAngle))
|
||||
emitError($"Weapon `{weaponInfo}`: Projectile minimum LaunchAngle must not exceed maximum LaunchAngle!");
|
||||
emitError($"Weapon `{weaponInfo}`: Projectile minimum LaunchAngle must not exceed maximum LaunchAngle.");
|
||||
if ((minAngle > 768) && (maxAngle > 768) && (minAngle > maxAngle))
|
||||
emitError($"Weapon `{weaponInfo}`: Projectile minimum LaunchAngle must not exceed maximum LaunchAngle!");
|
||||
emitError($"Weapon `{weaponInfo}`: Projectile minimum LaunchAngle must not exceed maximum LaunchAngle.");
|
||||
if ((minAngle < 256) && (maxAngle > 768))
|
||||
emitError($"Weapon `{weaponInfo}`: Projectile minimum LaunchAngle must not exceed maximum LaunchAngle!");
|
||||
emitError($"Weapon `{weaponInfo}`: Projectile minimum LaunchAngle must not exceed maximum LaunchAngle.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
{
|
||||
// Keys are valid if they refer to a named key or can be parsed as a regular Hotkey.
|
||||
if (!namedKeys.Contains(node.Value.Value) && !Hotkey.TryParse(node.Value.Value, out var unused))
|
||||
emitError($"{node.Location} refers to a Key named `{node.Value.Value}` that does not exist");
|
||||
emitError($"{node.Location} refers to a Key named `{node.Value.Value}` that does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
|
||||
foreach (var name in keyNames)
|
||||
if (!namedKeys.Contains(name) && !Hotkey.TryParse(name, out var unused))
|
||||
emitError($"{node.Location} refers to a Key named `{name}` that does not exist");
|
||||
emitError($"{node.Location} refers to a Key named `{name}` that does not exist.");
|
||||
}
|
||||
|
||||
// Logic classes can declare the data key names that specify hotkeys.
|
||||
@@ -110,7 +110,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
foreach (var n in node.Value.Nodes)
|
||||
if (checkArgKeys.Contains(n.Key))
|
||||
if (!namedKeys.Contains(n.Value.Value) && !Hotkey.TryParse(n.Value.Value, out var unused))
|
||||
emitError($"{filename} {node.Value.Value}:{n.Key} refers to a Key named `{n.Value.Value}` that does not exist");
|
||||
emitError($"{filename} {node.Value.Value}:{n.Key} refers to a Key named `{n.Value.Value}` that does not exist.");
|
||||
}
|
||||
|
||||
if (node.Value.Nodes != null)
|
||||
|
||||
@@ -37,9 +37,9 @@ namespace OpenRA.Mods.Common.Lint
|
||||
{
|
||||
var type = Game.ModData.ObjectCreator.FindType(typeName);
|
||||
if (type == null)
|
||||
emitError($"{filename} refers to a logic object `{typeName}` that does not exist");
|
||||
emitError($"{filename} refers to a logic object `{typeName}` that does not exist.");
|
||||
else if (!typeof(ChromeLogic).IsAssignableFrom(type))
|
||||
emitError($"{filename} refers to a logic object `{typeName}` that does not inherit from ChromeLogic");
|
||||
emitError($"{filename} refers to a logic object `{typeName}` that does not inherit from ChromeLogic.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,11 +68,11 @@ namespace OpenRA.Mods.Common.Lint
|
||||
|
||||
var unconsumed = granted.Except(consumed);
|
||||
if (unconsumed.Any())
|
||||
emitWarning($"Actor type `{actorInfo.Key}` grants conditions that are not consumed: {unconsumed.JoinWith(", ")}");
|
||||
emitWarning($"Actor type `{actorInfo.Key}` grants conditions that are not consumed: {unconsumed.JoinWith(", ")}.");
|
||||
|
||||
var ungranted = consumed.Except(granted);
|
||||
if (ungranted.Any())
|
||||
emitError($"Actor type `{actorInfo.Key}` consumes conditions that are not granted: {ungranted.JoinWith(", ")}");
|
||||
emitError($"Actor type `{actorInfo.Key}` consumes conditions that are not granted: {ungranted.JoinWith(", ")}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
var selectable = actorInfo.Value.TraitInfos<SelectableInfo>().Count();
|
||||
var interactable = actorInfo.Value.TraitInfos<InteractableInfo>().Count();
|
||||
if (selectable > 0 && selectable != interactable)
|
||||
emitWarning($"Actor {actorInfo.Value.Name} defines both Interactable and Selectable traits. This may cause unexpected results.");
|
||||
emitWarning($"Actor `{actorInfo.Value.Name}` defines both Interactable and Selectable traits. This may cause unexpected results.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
continue;
|
||||
|
||||
if (!cursors.Contains(cursor))
|
||||
emitError($"Undefined cursor {cursor} for actor {actorInfo.Value.Name} with trait {traitInfo}.");
|
||||
emitError($"Undefined cursor `{cursor}` for actor `{actorInfo.Value.Name}` with trait `{traitInfo}`.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,9 +39,9 @@ namespace OpenRA.Mods.Common.Lint
|
||||
var count = actorInfo.Value.TraitInfos<IDefaultVisibilityInfo>().Count();
|
||||
|
||||
if (count == 0)
|
||||
emitError($"Actor type `{actorInfo.Key}` does not define a default visibility type!");
|
||||
emitError($"Actor type `{actorInfo.Key}` does not define a default visibility type.");
|
||||
else if (count > 1)
|
||||
emitError($"Actor type `{actorInfo.Key}` defines multiple default visibility types!");
|
||||
emitError($"Actor type `{actorInfo.Key}` defines multiple default visibility types.");
|
||||
else
|
||||
{
|
||||
var vis = actorInfo.Value.TraitInfoOrDefault<HiddenUnderShroudInfo>();
|
||||
@@ -49,15 +49,15 @@ 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!");
|
||||
emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{vis.GetType()}` but has no IOccupySpace traits.");
|
||||
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!");
|
||||
emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{vis.GetType()}` but does not have any footprint cells.");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (InvalidOperationException e)
|
||||
{
|
||||
emitError($"{e.Message} (Actor type `{actorInfo.Key}`)");
|
||||
emitError($"{e.Message} (Actor type `{actorInfo.Key}`).");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@ namespace OpenRA.Mods.Common.Lint
|
||||
|
||||
var hitShapes = actorInfo.Value.TraitInfos<HitShapeInfo>();
|
||||
if (!hitShapes.Any())
|
||||
emitError($"Actor type `{actorInfo.Key}` has a Health trait but no HitShape trait!");
|
||||
emitError($"Actor type `{actorInfo.Key}` has a Health trait but no HitShape trait.");
|
||||
}
|
||||
catch (InvalidOperationException e)
|
||||
{
|
||||
emitError($"{e.Message} (Actor type `{actorInfo.Key}`)");
|
||||
emitError($"{e.Message} (Actor type `{actorInfo.Key}`).");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,14 +42,14 @@ namespace OpenRA.Mods.Common.Lint
|
||||
continue;
|
||||
|
||||
if (HasInvalidBounds(interactable.Bounds, grid.TileSize, grid.TileScale))
|
||||
emitError($"{nameof(interactable.Bounds)} of actor {actorInfo.Key} are empty or negative.");
|
||||
emitError($"{nameof(interactable.Bounds)} of actor `{actorInfo.Key}` are empty or negative.");
|
||||
|
||||
if (HasInvalidBounds(interactable.DecorationBounds, grid.TileSize, grid.TileScale))
|
||||
emitError($"{nameof(interactable.DecorationBounds)} of actor {actorInfo.Key} are empty or negative.");
|
||||
emitError($"{nameof(interactable.DecorationBounds)} of actor `{actorInfo.Key}` are empty or negative.");
|
||||
}
|
||||
catch (InvalidOperationException e)
|
||||
{
|
||||
emitError($"{e.Message} (Actor type `{actorInfo.Key}`)");
|
||||
emitError($"{e.Message} (Actor type `{actorInfo.Key}`).");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
foreach (var li in locomotorInfos)
|
||||
foreach (var otherLocomotor in locomotorInfos)
|
||||
if (li != otherLocomotor && li.Name == otherLocomotor.Name)
|
||||
emitError($"There is more than one Locomotor with name {li.Name}!");
|
||||
emitError($"There is more than one Locomotor with name `{li.Name}`.");
|
||||
|
||||
foreach (var actorInfo in rules.Actors)
|
||||
{
|
||||
@@ -61,7 +61,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
void CheckLocomotors(ActorInfo actorInfo, Action<string> emitError, LocomotorInfo[] locomotorInfos, string locomotor)
|
||||
{
|
||||
if (!locomotorInfos.Any(l => l.Name == locomotor))
|
||||
emitError($"Actor {actorInfo.Name} defines Locomotor {locomotor} not found on World actor.");
|
||||
emitError($"Actor `{actorInfo.Name}` defines Locomotor `{locomotor}` not found on World actor.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
|| map.Bounds.Right == map.MapSize.X || map.Bounds.Bottom == map.MapSize.Y)
|
||||
emitError("This map does not define a valid cordon.\n"
|
||||
+ "A one cell (or greater) border is required on all four sides "
|
||||
+ "between the playable bounds and the map edges");
|
||||
+ "between the playable bounds and the map edges.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
void Run(Action<string> emitError, int mapFormat, string author, string title, string[] categories)
|
||||
{
|
||||
if (mapFormat < Map.SupportedMapFormat)
|
||||
emitError($"Map format {mapFormat} does not match the supported version {Map.CurrentMapFormat}.");
|
||||
emitError($"Map format `{mapFormat}` does not match the supported version `{Map.CurrentMapFormat}`.");
|
||||
|
||||
if (author == null)
|
||||
emitError("Map does not define a valid author.");
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
public void Run(Action<string> emitError, Action<string> emitWarning, ModData modData, Map map)
|
||||
{
|
||||
foreach (var kv in map.ReplacedInvalidTerrainTiles)
|
||||
emitError($"Cell {kv.Key} references invalid terrain tile {kv.Value}.");
|
||||
emitError($"Cell `{kv.Key}` references invalid terrain tile `{kv.Value}`.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
|
||||
if (string.IsNullOrEmpty(type) || !rules.Notifications.TryGetValue(type.ToLowerInvariant(), out var soundInfo) ||
|
||||
!soundInfo.Notifications.ContainsKey(notification))
|
||||
emitError($"Undefined notification reference {type ?? "(null)"}.{notification} detected at {traitInfo.GetType().Name} for {actorInfo.Key}");
|
||||
emitError($"Undefined notification reference `{type ?? "(null)"}.{notification}` detected at `{traitInfo.GetType().Name}` for `{actorInfo.Key}`.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,16 +33,16 @@ namespace OpenRA.Mods.Common.Lint
|
||||
var actorReference = new ActorReference(kv.Value.Value, kv.Value.ToDictionary());
|
||||
var ownerInit = actorReference.GetOrDefault<OwnerInit>();
|
||||
if (ownerInit == null)
|
||||
emitError($"Actor {kv.Key} is not owned by any player.");
|
||||
emitError($"Actor `{kv.Key}` is not owned by any player.");
|
||||
else
|
||||
{
|
||||
var ownerName = ownerInit.InternalName;
|
||||
if (!playerNames.Contains(ownerName))
|
||||
emitError($"Actor {kv.Key} is owned by unknown player {ownerName}.");
|
||||
emitError($"Actor `{kv.Key}` is owned by unknown player `{ownerName}`.");
|
||||
|
||||
if (actorsWithRequiredOwner.TryGetValue(kv.Value.Value, out var info))
|
||||
if (!info.ValidOwnerNames.Contains(ownerName))
|
||||
emitError($"Actor {kv.Key} owner {ownerName} is not one of ValidOwnerNames: {info.ValidOwnerNames.JoinWith(", ")}");
|
||||
emitError($"Actor `{kv.Key}` owner `{ownerName}` is not one of ValidOwnerNames: {info.ValidOwnerNames.JoinWith(", ")}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,12 +64,12 @@ namespace OpenRA.Mods.Common.Lint
|
||||
if (isPlayerPalette)
|
||||
{
|
||||
if (!playerPalettes.Contains(reference))
|
||||
emitError($"Undefined player palette reference {reference} detected at {traitInfo} for {actorInfo.Key}");
|
||||
emitError($"Undefined player palette reference `{reference}` detected at `{traitInfo}` for `{actorInfo.Key}`");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!palettes.Contains(reference))
|
||||
emitError($"Undefined palette reference {reference} detected at {traitInfo} for {actorInfo.Key}");
|
||||
emitError($"Undefined palette reference `{reference}` detected at `{traitInfo}` for `{actorInfo.Key}`");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,12 +107,12 @@ namespace OpenRA.Mods.Common.Lint
|
||||
if (isPlayerPalette)
|
||||
{
|
||||
if (!playerPalettes.Contains(reference))
|
||||
emitError($"Undefined player palette reference {reference} detected at weapon {weaponInfo.Key}.");
|
||||
emitError($"Undefined player palette reference `{reference}` detected at weapon `{weaponInfo.Key}`.");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!palettes.Contains(reference))
|
||||
emitError($"Undefined palette reference {reference} detected at weapon {weaponInfo.Key}.");
|
||||
emitError($"Undefined palette reference `{reference}` detected at weapon `{weaponInfo.Key}`.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -121,7 +121,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
|
||||
void GetPalettes(Ruleset rules, List<string> palettes, List<string> playerPalettes, Action<string> emitError)
|
||||
{
|
||||
// Palettes are only defined on the world actor
|
||||
// Palettes are only defined on the world actor.
|
||||
var worldActorInfo = rules.Actors[SystemActors.World];
|
||||
var tilesetPalettes = new List<(string Tileset, string PaletteName)>();
|
||||
foreach (var traitInfo in worldActorInfo.TraitInfos<TraitInfo>())
|
||||
@@ -139,7 +139,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
if (paletteDefinition.IsPlayerPalette)
|
||||
{
|
||||
if (playerPalettes.Contains(value))
|
||||
emitError($"Duplicate player palette definition for palette name {value}");
|
||||
emitError($"Duplicate player palette definition for palette name `{value}`.");
|
||||
|
||||
playerPalettes.Add(value);
|
||||
}
|
||||
@@ -151,7 +151,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
{
|
||||
var tilesetPalette = (tilesetSpecificPaletteInfo.Tileset, value);
|
||||
if (tilesetPalettes.Contains(tilesetPalette))
|
||||
emitError($"Duplicate palette definition for palette name {value}");
|
||||
emitError($"Duplicate palette definition for palette name `{value}`.");
|
||||
else
|
||||
{
|
||||
tilesetPalettes.Add(tilesetPalette);
|
||||
@@ -164,7 +164,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
else
|
||||
{
|
||||
if (palettes.Contains(value))
|
||||
emitError($"Duplicate palette definition for palette name {value}");
|
||||
emitError($"Duplicate palette definition for palette name `{value}`.");
|
||||
|
||||
palettes.Add(value);
|
||||
}
|
||||
|
||||
@@ -50,11 +50,11 @@ namespace OpenRA.Mods.Common.Lint
|
||||
{
|
||||
foreach (var ally in player.Allies)
|
||||
if (!playerNames.Contains(ally))
|
||||
emitError($"Allies contains player {ally} that is not in list.");
|
||||
emitError($"Allies contains player `{ally}` that is not in list.");
|
||||
|
||||
foreach (var enemy in player.Enemies)
|
||||
if (!playerNames.Contains(enemy))
|
||||
emitError($"Enemies contains player {enemy} that is not in list.");
|
||||
emitError($"Enemies contains player `{enemy}` that is not in list.");
|
||||
|
||||
if (player.Playable)
|
||||
playablePlayerFound = true;
|
||||
@@ -63,15 +63,15 @@ namespace OpenRA.Mods.Common.Lint
|
||||
{
|
||||
worldOwnerFound = true;
|
||||
if (player.Enemies.Length > 0 || player.Allies.Length > 0)
|
||||
emitWarning($"The player {player.Name} owning the world should not have any allies or enemies.");
|
||||
emitWarning($"The player `{player.Name}` owning the world should not have any allies or enemies.");
|
||||
|
||||
if (player.Playable)
|
||||
emitError($"The player {player.Name} owning the world can't be playable.");
|
||||
emitError($"The player `{player.Name}` owning the world can't be playable.");
|
||||
}
|
||||
else if (visibility == MapVisibility.MissionSelector && player.Playable && !player.LockFaction)
|
||||
{
|
||||
// Missions must lock the faction of the player to force the server to override the default Random faction
|
||||
emitError($"The player {player.Name} must specify LockFaction: True.");
|
||||
emitError($"The player `{player.Name}` must specify LockFaction: True.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,13 +84,13 @@ namespace OpenRA.Mods.Common.Lint
|
||||
var factions = worldActorInfo.TraitInfos<FactionInfo>().Select(f => f.InternalName).ToHashSet();
|
||||
foreach (var player in players.Players.Values)
|
||||
if (!string.IsNullOrWhiteSpace(player.Faction) && !factions.Contains(player.Faction))
|
||||
emitError($"Invalid faction {player.Faction} chosen for player {player.Name}.");
|
||||
emitError($"Invalid faction `{player.Faction}` chosen for player `{player.Name}`.");
|
||||
|
||||
if (worldActorInfo.HasTraitInfo<MapStartingLocationsInfo>())
|
||||
{
|
||||
var playerCount = players.Players.Count(p => p.Value.Playable);
|
||||
if (playerCount > spawnPoints.Length)
|
||||
emitError($"The map allows {playerCount} possible players, but defines only {spawnPoints.Length} spawn points");
|
||||
emitError($"The map allows {playerCount} possible players, but defines only {spawnPoints.Length} spawn points.");
|
||||
|
||||
if (spawnPoints.Distinct().Count() != spawnPoints.Length)
|
||||
emitError("Duplicate spawn point locations detected.");
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
var range = weaponInfo.Value.Range;
|
||||
|
||||
if (weaponInfo.Value.Projectile is MissileInfo missile && missile.RangeLimit > WDist.Zero && missile.RangeLimit < range)
|
||||
emitError($"Weapon `{weaponInfo.Key}`: projectile RangeLimit lower than weapon range!");
|
||||
emitError($"Weapon `{weaponInfo.Key}`: projectile RangeLimit lower than weapon range.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,14 +42,14 @@ namespace OpenRA.Mods.Common.Lint
|
||||
continue;
|
||||
|
||||
if (ios == null)
|
||||
emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{rsi.GetType()}` but has no IOccupySpace traits!");
|
||||
emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{rsi.GetType()}` but has no IOccupySpace traits.");
|
||||
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!");
|
||||
emitError($"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{rsi.GetType()}` but does not have any footprint cells.");
|
||||
}
|
||||
}
|
||||
catch (InvalidOperationException e)
|
||||
{
|
||||
emitError($"{e.Message} (Actor type `{actorInfo.Key}`)");
|
||||
emitError($"{e.Message} (Actor type `{actorInfo.Key}`).");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
if (string.IsNullOrEmpty(imageOverride))
|
||||
{
|
||||
if (!sequenceReference.AllowNullImage)
|
||||
emitError($"Actor type `{actorInfo.Value.Name}` trait `{traitName}` must define a value for `{sequenceReference.ImageReference}`");
|
||||
emitError($"Actor type `{actorInfo.Value.Name}` trait `{traitName}` must define a value for `{sequenceReference.ImageReference}`.");
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -129,7 +129,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
if (string.IsNullOrEmpty(image))
|
||||
{
|
||||
if (!sequenceReference.AllowNullImage)
|
||||
emitError($"Weapon type `{weaponInfo.Key}` projectile field `{sequenceReference.ImageReference}` must define a value");
|
||||
emitError($"Weapon type `{weaponInfo.Key}` projectile field `{sequenceReference.ImageReference}` must define a value.");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
var wsbs = actorInfo.Value.TraitInfos<WithSpriteBodyInfo>();
|
||||
foreach (var wsb in wsbs)
|
||||
if (wsbs.Any(w => w != wsb && w.Name == wsb.Name))
|
||||
emitError($"Actor type `{actorInfo.Key}` has more than one *SpriteBody with Name: {wsb.Name}!");
|
||||
emitError($"Actor type `{actorInfo.Key}` has more than one *SpriteBody with Name: {wsb.Name}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
{
|
||||
foreach (var type in types)
|
||||
if (!TypeImplementsSync(type) && AnyTypeMemberIsSynced(type))
|
||||
emitWarning($"{type.FullName} has members with the Sync attribute but does not implement ISync");
|
||||
emitWarning($"{type.FullName} has members with the Sync attribute but does not implement ISync.");
|
||||
}
|
||||
|
||||
static void CheckTypesImplementingSyncInterfaceHaveSyncableMembers(IEnumerable<Type> types, Action<string> emitWarning)
|
||||
|
||||
@@ -41,11 +41,11 @@ namespace OpenRA.Mods.Common.Lint
|
||||
|
||||
var tooltip = actorInfo.Value.TraitInfos<TooltipInfo>().FirstOrDefault(info => info.EnabledByDefault);
|
||||
if (tooltip == null)
|
||||
emitError("The following buildable actor has no (enabled) Tooltip: " + actorInfo.Key);
|
||||
emitError($"The following buildable actor has no (enabled) Tooltip: `{actorInfo.Key}`.");
|
||||
}
|
||||
catch (InvalidOperationException e)
|
||||
{
|
||||
emitError($"{e.Message} (Actor type `{actorInfo.Key}`)");
|
||||
emitError($"{e.Message} (Actor type `{actorInfo.Key}`).");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
var traitName = traitInfo.GetType().Name;
|
||||
traitName = traitName.Remove(traitName.Length - 4);
|
||||
var locations = traitLocation.SystemActors.ToString().Replace(", ", " or ");
|
||||
emitError($"{traitName} does not belong on {actorInfo.Key}. It is a system trait meant for {locations}.");
|
||||
emitError($"`{traitName}` does not belong on `{actorInfo.Key}`. It is a system trait meant for {locations}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,11 +35,11 @@ namespace OpenRA.Mods.Common.Lint
|
||||
{
|
||||
var hasTraits = actorInfo.Value.TraitsInConstructOrder().Any();
|
||||
if (!hasTraits)
|
||||
emitWarning($"Actor {actorInfo.Key} has no traits. Is this intended?");
|
||||
emitWarning($"Actor `{actorInfo.Key}` has no traits. Is this intended?");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
emitError($"Actor {actorInfo.Key} is not constructible; failure: {e.Message}");
|
||||
emitError($"Actor `{actorInfo.Key}` is not constructible; failure: {e.Message}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
TestTraits(modData.DefaultRules, emitError, key =>
|
||||
{
|
||||
if (!translation.HasMessage(key))
|
||||
emitError($"{key} not present in `{language}` translation.");
|
||||
emitError($"`{key}` not present in `{language}` translation.");
|
||||
});
|
||||
|
||||
var gameSpeeds = modData.Manifest.Get<GameSpeeds>();
|
||||
@@ -114,7 +114,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
|
||||
if (fieldInfo.FieldType != typeof(string))
|
||||
{
|
||||
emitError($"Translation attribute on non string field {fieldInfo.Name}.");
|
||||
emitError($"Translation attribute on non string field `{fieldInfo.Name}`.");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
foreach (var entry in resource.Entries)
|
||||
{
|
||||
if (entry is Junk junk)
|
||||
emitError($"{junk.GetId()}: {junk.AsStr()} in {file} {junk.Content}");
|
||||
emitError($"{junk.GetId()}: {junk.AsStr()} in {file} {junk.Content}.");
|
||||
|
||||
if (entry is AstMessage message)
|
||||
{
|
||||
|
||||
@@ -53,10 +53,10 @@ namespace OpenRA.Mods.Common.Lint
|
||||
if (t.Key.StartsWith("-", StringComparison.Ordinal))
|
||||
{
|
||||
if (t.Value.Nodes.Count > 0)
|
||||
emitError($"{t.Location} {t.Key} defines child nodes, which are not valid for removals.");
|
||||
emitError($"{t.Location} `{t.Key}` defines child nodes, which are not valid for removals.");
|
||||
|
||||
if (!string.IsNullOrEmpty(t.Value.Value))
|
||||
emitError($"{t.Location} {t.Key} defines a value, which is not valid for removals.");
|
||||
emitError($"{t.Location} `{t.Key}` defines a value, which is not valid for removals.");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -55,10 +55,10 @@ namespace OpenRA.Mods.Common.Lint
|
||||
if (field.Key.StartsWith("-", StringComparison.Ordinal))
|
||||
{
|
||||
if (field.Value.Nodes.Count > 0)
|
||||
emitError($"{field.Location} {field.Key} defines child nodes, which is not valid for removals.");
|
||||
emitError($"{field.Location} `{field.Key}` defines child nodes, which is not valid for removals.");
|
||||
|
||||
if (!string.IsNullOrEmpty(field.Value.Value))
|
||||
emitError($"{field.Location} {field.Key} defines a value, which is not valid for removals.");
|
||||
emitError($"{field.Location} `{field.Key}` defines a value, which is not valid for removals.");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
continue;
|
||||
|
||||
if (!soundInfo.Voices.ContainsKey(voice))
|
||||
emitError($"Actor {actorInfo.Name} using voice set {voiceSet} does not define {voice} voice required by {traitInfo}.");
|
||||
emitError($"Actor `{actorInfo.Name}` using voice set `{voiceSet}` does not define `{voice}` voice required by `{traitInfo}`.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
foreach (var inherit in inherits)
|
||||
{
|
||||
if (inherit[0] != '^')
|
||||
emitError($"{actor} definition inherits from {inherit}, which is not an abstract template.");
|
||||
emitError($"`{actor}` definition inherits from `{inherit}`, which is not an abstract template.");
|
||||
|
||||
toResolve.Enqueue(inherit);
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@ namespace OpenRA.Mods.Common.Lint
|
||||
if (bi != null)
|
||||
foreach (var prereq in bi.Prerequisites)
|
||||
if (!prereq.StartsWith("~disabled") && !providedPrereqs.Contains(prereq.Replace("!", "").Replace("~", "")))
|
||||
emitError($"Buildable actor {actorInfo.Key} has prereq {prereq} not provided by anything.");
|
||||
emitError($"Buildable actor `{actorInfo.Key}` has prereq `{prereq}` not provided by anything.");
|
||||
}
|
||||
catch (InvalidOperationException e)
|
||||
{
|
||||
emitError($"{e.Message} (Actor type `{actorInfo.Key}`)");
|
||||
emitError($"{e.Message} (Actor type `{actorInfo.Key}`).");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
"BooleanExpression", "IntegerExpression"
|
||||
};
|
||||
|
||||
throw new InvalidOperationException($"Bad type for reference on {ruleInfo.GetType().Name}.{fieldInfo.Name}. Supported types: {supportedTypes.JoinWith(", ")}");
|
||||
throw new InvalidOperationException($"Bad type for reference on `{ruleInfo.GetType().Name}.{fieldInfo.Name}`. Supported types: {supportedTypes.JoinWith(", ")}.");
|
||||
}
|
||||
|
||||
public static IEnumerable<string> GetPropertyValues(object ruleInfo, PropertyInfo propertyInfo,
|
||||
@@ -108,7 +108,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
"BooleanExpression", "IntegerExpression"
|
||||
};
|
||||
|
||||
throw new InvalidOperationException($"Bad type for reference on {ruleInfo.GetType().Name}.{propertyInfo.Name}. Supported types: {supportedTypes.JoinWith(", ")}");
|
||||
throw new InvalidOperationException($"Bad type for reference on `{ruleInfo.GetType().Name}.{propertyInfo.Name}`. Supported types: {supportedTypes.JoinWith(", ")}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,8 +53,8 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
||||
Log.AddChannel("perf", null);
|
||||
|
||||
// bind some nonfatal error handling into FieldLoader, so we don't just *explode*.
|
||||
ObjectCreator.MissingTypeAction = s => EmitError($"Missing Type: {s}");
|
||||
FieldLoader.UnknownFieldAction = (s, f) => EmitError($"FieldLoader: Missing field `{s}` on `{f.Name}`");
|
||||
ObjectCreator.MissingTypeAction = s => EmitError($"Missing Type: {s}.");
|
||||
FieldLoader.UnknownFieldAction = (s, f) => EmitError($"FieldLoader: Missing field `{s}` on `{f.Name}`.");
|
||||
|
||||
var maps = new List<(IReadWritePackage Package, string Map)>();
|
||||
if (args.Length < 2)
|
||||
|
||||
Reference in New Issue
Block a user