Improve linting of weapon and trait yaml removals.
This commit is contained in:
@@ -32,10 +32,15 @@ namespace OpenRA.Mods.Common.Lint
|
||||
{
|
||||
foreach (var t in actor.Value.Nodes)
|
||||
{
|
||||
// Removals can never define children
|
||||
if (t.Key.StartsWith("-", StringComparison.Ordinal) && t.Value.Nodes.Any())
|
||||
// Removals can never define children or values
|
||||
if (t.Key.StartsWith("-", StringComparison.Ordinal))
|
||||
{
|
||||
emitError("{0} defines child nodes, which are not valid for removals.".F(t.Location));
|
||||
if (t.Value.Nodes.Any())
|
||||
emitError("{0} {1} defines child nodes, which are not valid for removals.".F(t.Location, t.Key));
|
||||
|
||||
if (!string.IsNullOrEmpty(t.Value.Value))
|
||||
emitError("{0} {1} defines a value, which is not valid for removals.".F(t.Location, t.Key));
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,10 +34,15 @@ namespace OpenRA.Mods.Common.Lint
|
||||
{
|
||||
foreach (var field in weapon.Value.Nodes)
|
||||
{
|
||||
// Removals can never define children
|
||||
if (field.Key.StartsWith("-", StringComparison.Ordinal) && field.Value.Nodes.Any())
|
||||
// Removals can never define children or values
|
||||
if (field.Key.StartsWith("-", StringComparison.Ordinal))
|
||||
{
|
||||
emitError("{0} has child nodes, which is not valid for removals.".F(field.Key));
|
||||
if (field.Value.Nodes.Any())
|
||||
emitError("{0} {1} defines child nodes, which is not valid for removals.".F(field.Location, field.Key));
|
||||
|
||||
if (!string.IsNullOrEmpty(field.Value.Value))
|
||||
emitError("{0} {1} defines a value, which is not valid for removals.".F(field.Location, field.Key));
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user