RCS0056 - roslynator_max_line_length = 160

This commit is contained in:
RoosterDragon
2024-07-27 16:09:46 +01:00
committed by Matthias Mailänder
parent 9d5d2ab493
commit 0649f3dc32
129 changed files with 606 additions and 245 deletions

View File

@@ -64,8 +64,15 @@ namespace OpenRA.Mods.Common.Lint
}
}
static void CheckInner(ModData modData, string[] namedKeys, (string Widget, string Field)[] checkWidgetFields, Dictionary<string, List<string>> customLintMethods,
IEnumerable<MiniYamlNode> nodes, string filename, MiniYamlNode parent, Action<string> emitError)
static void CheckInner(
ModData modData,
string[] namedKeys,
(string Widget, string Field)[] checkWidgetFields,
Dictionary<string, List<string>> customLintMethods,
IEnumerable<MiniYamlNode> nodes,
string filename,
MiniYamlNode parent,
Action<string> emitError)
{
foreach (var node in nodes)
{

View File

@@ -42,7 +42,9 @@ namespace OpenRA.Mods.Common.Lint
if (count == 0)
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: {string.Join(", ", visibilityTypes.Select(vis => vis.GetType().Name))}.");
emitError(
$"Actor type `{actorInfo.Key}` defines multiple default visibility types: " +
$"{string.Join(", ", visibilityTypes.Select(vis => vis.GetType().Name))}.");
else
{
var vis = actorInfo.Value.TraitInfoOrDefault<HiddenUnderShroudInfo>();
@@ -50,9 +52,13 @@ 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().Name}` but has no IOccupySpace traits.");
emitError(
$"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{vis.GetType().Name}` " +
"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().Name}` but does not have any footprint cells.");
emitError(
$"Actor type `{actorInfo.Key}` defines VisibilityType.Footprint in `{vis.GetType().Name}` " +
"but does not have any footprint cells.");
}
}
}

View File

@@ -38,7 +38,8 @@ namespace OpenRA.Mods.Common.Lint
Run(emitError, emitWarning, map.Players, map.Visibility, map.WorldActorInfo, map.SpawnPoints);
}
static void Run(Action<string> emitError, Action<string> emitWarning, MapPlayers players, MapVisibility visibility, ActorInfo worldActorInfo, CPos[] spawnPoints)
static void Run(Action<string> emitError, Action<string> emitWarning,
MapPlayers players, MapVisibility visibility, ActorInfo worldActorInfo, CPos[] spawnPoints)
{
if (players.Players.Count > 64)
emitError("Defining more than 64 players is not allowed.");

View File

@@ -97,10 +97,13 @@ namespace OpenRA.Mods.Common.Lint
// TODO: Remove prefixed sequence references and instead use explicit lists of lintable references.
if (!sequences.Sequences(i).Any(s => s.StartsWith(sequence, StringComparison.Ordinal)))
emitWarning(
$"Actor type `{actorInfo.Value.Name}` trait `{traitName}` field `{field.Name}` defines a prefix `{sequence}` that does not match any sequences on image `{i}`.");
$"Actor type `{actorInfo.Value.Name}` trait `{traitName}` field `{field.Name}` " +
$"defines a prefix `{sequence}` that does not match any sequences on image `{i}`.");
}
else if (!sequences.HasSequence(i, sequence))
emitError($"Actor type `{actorInfo.Value.Name}` trait `{traitName}` field `{field.Name}` references an undefined sequence `{sequence}` on image `{i}`.");
emitError(
$"Actor type `{actorInfo.Value.Name}` trait `{traitName}` field `{field.Name}` " +
$"references an undefined sequence `{sequence}` on image `{i}`.");
}
}
}
@@ -145,10 +148,14 @@ namespace OpenRA.Mods.Common.Lint
{
// TODO: Remove prefixed sequence references and instead use explicit lists of lintable references.
if (!sequences.Sequences(image).Any(s => s.StartsWith(sequence, StringComparison.Ordinal)))
emitWarning($"Weapon type `{weaponInfo.Key}` projectile field `{field.Name}` defines a prefix `{sequence}` that does not match any sequences on image `{image}`.");
emitWarning(
$"Weapon type `{weaponInfo.Key}` projectile field `{field.Name}` " +
$"defines a prefix `{sequence}` that does not match any sequences on image `{image}`.");
}
else if (!sequences.HasSequence(image, sequence))
emitError($"Weapon type `{weaponInfo.Key}` projectile field `{field.Name}` references an undefined sequence `{sequence}` on image `{image}`.");
emitError(
$"Weapon type `{weaponInfo.Key}` projectile field `{field.Name}` " +
$"references an undefined sequence `{sequence}` on image `{image}`.");
}
}
}

View File

@@ -209,7 +209,9 @@ namespace OpenRA.Mods.Common.Lint
{
var userInterface = typeof(UserInterfaceGlobal).GetCustomAttribute<ScriptGlobalAttribute>().Name;
const string Translate = nameof(UserInterfaceGlobal.Translate);
emitWarning($"{context} calls {userInterface}.{Translate} with key `{key}` and translate args passed as `{variable}`. Inline the args at the callsite for lint analysis.");
emitWarning(
$"{context} calls {userInterface}.{Translate} with key `{key}` and translate args passed as `{variable}`." +
"Inline the args at the callsite for lint analysis.");
}
}
}

View File

@@ -63,7 +63,9 @@ 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 +110,9 @@ 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(", ")}.");
}
}
}