Fix CA1822
This commit is contained in:
committed by
Pavel Penev
parent
e4cac1fffc
commit
277699cbd5
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
CheckTrait(emitError, actorInfo.Value, traitInfo, mapRules);
|
||||
}
|
||||
|
||||
void CheckTrait(Action<string> emitError, ActorInfo actorInfo, TraitInfo traitInfo, Ruleset rules)
|
||||
static void CheckTrait(Action<string> emitError, ActorInfo actorInfo, TraitInfo traitInfo, Ruleset rules)
|
||||
{
|
||||
var actualType = traitInfo.GetType();
|
||||
foreach (var field in Utility.GetFields(actualType))
|
||||
@@ -53,7 +53,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
}
|
||||
}
|
||||
|
||||
void CheckActorReference(Action<string> emitError, ActorInfo actorInfo, TraitInfo traitInfo,
|
||||
static void CheckActorReference(Action<string> emitError, ActorInfo actorInfo, TraitInfo traitInfo,
|
||||
FieldInfo fieldInfo, IReadOnlyDictionary<string, ActorInfo> dict, ActorReferenceAttribute attribute)
|
||||
{
|
||||
var values = LintExts.GetFieldValues(traitInfo, fieldInfo, attribute.DictionaryReference);
|
||||
@@ -79,7 +79,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
}
|
||||
}
|
||||
|
||||
void CheckWeaponReference(Action<string> emitError, ActorInfo actorInfo, TraitInfo traitInfo,
|
||||
static void CheckWeaponReference(Action<string> emitError, ActorInfo actorInfo, TraitInfo traitInfo,
|
||||
FieldInfo fieldInfo, IReadOnlyDictionary<string, WeaponInfo> dict)
|
||||
{
|
||||
var values = LintExts.GetFieldValues(traitInfo, fieldInfo);
|
||||
@@ -93,7 +93,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
}
|
||||
}
|
||||
|
||||
void CheckVoiceReference(Action<string> emitError, ActorInfo actorInfo, TraitInfo traitInfo,
|
||||
static void CheckVoiceReference(Action<string> emitError, ActorInfo actorInfo, TraitInfo traitInfo,
|
||||
FieldInfo fieldInfo, IReadOnlyDictionary<string, SoundInfo> dict)
|
||||
{
|
||||
var values = LintExts.GetFieldValues(traitInfo, fieldInfo);
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
foreach (var weaponInfo in rules.Weapons)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, emitWarning, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Action<string> emitWarning, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Action<string> emitWarning, Ruleset rules)
|
||||
{
|
||||
foreach (var actorInfo in rules.Actors)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, modData, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, ModData modData, Ruleset rules)
|
||||
static void Run(Action<string> emitError, ModData modData, Ruleset rules)
|
||||
{
|
||||
var fileSystem = modData.DefaultFileSystem;
|
||||
var sequenceYaml = MiniYaml.Merge(modData.Manifest.Cursors.Select(s => MiniYaml.FromStream(fileSystem.Open(s), s)));
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
foreach (var actorInfo in rules.Actors)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
foreach (var actorInfo in rules.Actors)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules, modData);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules, ModData modData)
|
||||
static void Run(Action<string> emitError, Ruleset rules, ModData modData)
|
||||
{
|
||||
// As the map has not been created we need to get MapGrid info directly from manifest.
|
||||
var grid = modData.Manifest.Get<MapGrid>();
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
var worldActor = rules.Actors[SystemActors.World];
|
||||
var locomotorInfos = worldActor.TraitInfos<LocomotorInfo>().ToArray();
|
||||
@@ -58,7 +58,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
}
|
||||
}
|
||||
|
||||
void CheckLocomotors(ActorInfo actorInfo, Action<string> emitError, LocomotorInfo[] locomotorInfos, string locomotor)
|
||||
static 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.");
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, map.MapFormat, map.Author, map.Title, map.Categories);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, int mapFormat, string author, string title, string[] categories)
|
||||
static 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}`.");
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
foreach (var actorInfo in rules.Actors)
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
var palettes = new List<string>();
|
||||
var playerPalettes = new List<string>();
|
||||
@@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
}
|
||||
}
|
||||
|
||||
void GetPalettes(Ruleset rules, List<string> palettes, List<string> playerPalettes, Action<string> emitError)
|
||||
static void GetPalettes(Ruleset rules, List<string> palettes, List<string> playerPalettes, Action<string> emitError)
|
||||
{
|
||||
// Palettes are only defined on the world actor.
|
||||
var worldActorInfo = rules.Actors[SystemActors.World];
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, emitWarning, map.Players, map.Visibility, map.WorldActorInfo, map.SpawnPoints);
|
||||
}
|
||||
|
||||
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.");
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
foreach (var weaponInfo in rules.Weapons)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
foreach (var actorInfo in rules.Actors)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, emitWarning, rules, sequences);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Action<string> emitWarning, Ruleset rules, SequenceSet sequences)
|
||||
static void Run(Action<string> emitError, Action<string> emitWarning, Ruleset rules, SequenceSet sequences)
|
||||
{
|
||||
var factions = rules.Actors[SystemActors.World].TraitInfos<FactionInfo>().Select(f => f.InternalName).ToArray();
|
||||
foreach (var actorInfo in rules.Actors)
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
foreach (var actorInfo in rules.Actors)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
foreach (var actorInfo in rules.Actors)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, emitWarning, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Action<string> emitWarning, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Action<string> emitWarning, Ruleset rules)
|
||||
{
|
||||
foreach (var actorInfo in rules.Actors)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
CheckMapYaml(emitError, modData, map, map.RuleDefinitions);
|
||||
}
|
||||
|
||||
string NormalizeName(string key)
|
||||
static string NormalizeName(string key)
|
||||
{
|
||||
var name = key.Split('@')[0];
|
||||
if (name.StartsWith("-", StringComparison.Ordinal))
|
||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
return name;
|
||||
}
|
||||
|
||||
void CheckActors(IEnumerable<MiniYamlNode> actors, Action<string> emitError, ModData modData)
|
||||
static void CheckActors(IEnumerable<MiniYamlNode> actors, Action<string> emitError, ModData modData)
|
||||
{
|
||||
foreach (var actor in actors)
|
||||
{
|
||||
@@ -89,7 +89,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
}
|
||||
}
|
||||
|
||||
void CheckMapYaml(Action<string> emitError, ModData modData, IReadOnlyFileSystem fileSystem, MiniYaml ruleDefinitions)
|
||||
static void CheckMapYaml(Action<string> emitError, ModData modData, IReadOnlyFileSystem fileSystem, MiniYaml ruleDefinitions)
|
||||
{
|
||||
if (ruleDefinitions == null)
|
||||
return;
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
CheckMapYaml(emitError, emitWarning, modData, map, map.WeaponDefinitions);
|
||||
}
|
||||
|
||||
string NormalizeName(string key)
|
||||
static string NormalizeName(string key)
|
||||
{
|
||||
var name = key.Split('@')[0];
|
||||
if (name.StartsWith("-", StringComparison.Ordinal))
|
||||
@@ -44,7 +44,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
return name;
|
||||
}
|
||||
|
||||
void CheckWeapons(IEnumerable<MiniYamlNode> weapons, Action<string> emitError, Action<string> emitWarning, ModData modData)
|
||||
static void CheckWeapons(IEnumerable<MiniYamlNode> weapons, Action<string> emitError, Action<string> emitWarning, ModData modData)
|
||||
{
|
||||
var weaponInfo = typeof(WeaponInfo);
|
||||
foreach (var weapon in weapons)
|
||||
@@ -110,7 +110,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
}
|
||||
}
|
||||
|
||||
void CheckMapYaml(Action<string> emitError, Action<string> emitWarning, ModData modData, IReadOnlyFileSystem fileSystem, MiniYaml weaponDefinitions)
|
||||
static void CheckMapYaml(Action<string> emitError, Action<string> emitWarning, ModData modData, IReadOnlyFileSystem fileSystem, MiniYaml weaponDefinitions)
|
||||
{
|
||||
if (weaponDefinitions == null)
|
||||
return;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
foreach (var actorInfo in rules.Actors)
|
||||
{
|
||||
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
}
|
||||
}
|
||||
|
||||
void CheckVoices(ActorInfo actorInfo, Action<string> emitError, Ruleset rules, string voiceSet)
|
||||
static void CheckVoices(ActorInfo actorInfo, Action<string> emitError, Ruleset rules, string voiceSet)
|
||||
{
|
||||
var soundInfo = rules.Voices[voiceSet.ToLowerInvariant()];
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
CheckMapYaml(emitError, modData, map, map.RuleDefinitions);
|
||||
}
|
||||
|
||||
void CheckMapYaml(Action<string> emitError, ModData modData, IReadOnlyFileSystem fileSystem, MiniYaml ruleDefinitions)
|
||||
static void CheckMapYaml(Action<string> emitError, ModData modData, IReadOnlyFileSystem fileSystem, MiniYaml ruleDefinitions)
|
||||
{
|
||||
if (ruleDefinitions == null)
|
||||
return;
|
||||
@@ -59,7 +59,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, nodes);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, List<MiniYamlNode> nodes)
|
||||
static void Run(Action<string> emitError, List<MiniYamlNode> nodes)
|
||||
{
|
||||
// Build a list of all inheritance relationships.
|
||||
var inheritsMap = new Dictionary<string, List<string>>();
|
||||
@@ -74,7 +74,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
CheckInheritance(emitError, "Player", inheritsMap);
|
||||
}
|
||||
|
||||
void CheckInheritance(Action<string> emitError, string actor, Dictionary<string, List<string>> inheritsMap)
|
||||
static void CheckInheritance(Action<string> emitError, string actor, Dictionary<string, List<string>> inheritsMap)
|
||||
{
|
||||
var toResolve = new Queue<string>(inheritsMap.Keys.Where(k => string.Equals(k, actor, StringComparison.InvariantCultureIgnoreCase)));
|
||||
while (toResolve.TryDequeue(out var key))
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Lint
|
||||
Run(emitError, mapRules);
|
||||
}
|
||||
|
||||
void Run(Action<string> emitError, Ruleset rules)
|
||||
static void Run(Action<string> emitError, Ruleset rules)
|
||||
{
|
||||
var providedPrereqs = rules.Actors.SelectMany(a => a.Value.TraitInfos<ITechTreePrerequisiteInfo>().SelectMany(p => p.Prerequisites(a.Value)));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user