Review StyleCop rules.
- Enforce SA1604 ElementDocumentationShouldHaveSummary. - Enforce SA1629 DocumentationTextShouldEndWithAPeriod. - Turn off some rules covered by IDExxxx rules. - Remaining rules are treated as part of OpenRA style.
This commit is contained in:
@@ -315,13 +315,13 @@ namespace OpenRA.Mods.Common.UpdateRules
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Checks if node is a removal (has '-' prefix)</summary>
|
||||
/// <summary>Checks if node is a removal (has '-' prefix).</summary>
|
||||
public static bool IsRemoval(this MiniYamlNode node)
|
||||
{
|
||||
return node.Key[0].ToString() == "-";
|
||||
}
|
||||
|
||||
/// <summary>Renames a yaml key preserving any @suffix</summary>
|
||||
/// <summary>Renames a yaml key preserving any @suffix.</summary>
|
||||
public static void RenameKey(this MiniYamlNode node, string newKey, bool preserveSuffix = true, bool includeRemovals = true)
|
||||
{
|
||||
var prefix = includeRemovals && node.IsRemoval() ? "-" : "";
|
||||
@@ -370,13 +370,13 @@ namespace OpenRA.Mods.Common.UpdateRules
|
||||
node.MoveNode(fromNode, toNode);
|
||||
}
|
||||
|
||||
/// <summary>Removes children with keys equal to [match] or [match]@[arbitrary suffix]</summary>
|
||||
/// <summary>Removes children with keys equal to [match] or [match]@[arbitrary suffix].</summary>
|
||||
public static int RemoveNodes(this MiniYamlNode node, string match, bool ignoreSuffix = true, bool includeRemovals = true)
|
||||
{
|
||||
return node.Value.Nodes.RemoveAll(n => n.KeyMatches(match, ignoreSuffix, includeRemovals));
|
||||
}
|
||||
|
||||
/// <summary>Returns true if the node is of the form [match] or [match]@[arbitrary suffix]</summary>
|
||||
/// <summary>Returns true if the node is of the form [match] or [match]@[arbitrary suffix].</summary>
|
||||
public static bool KeyMatches(this MiniYamlNode node, string match, bool ignoreSuffix = true, bool includeRemovals = true)
|
||||
{
|
||||
if (node.Key == null)
|
||||
@@ -394,7 +394,7 @@ namespace OpenRA.Mods.Common.UpdateRules
|
||||
return atPosition > 0 && node.Key.Substring(0, atPosition) == prefix + match;
|
||||
}
|
||||
|
||||
/// <summary>Returns true if the node is of the form [match], [match]@[arbitrary suffix] or [arbitrary suffix]@[match]</summary>
|
||||
/// <summary>Returns true if the node is of the form [match], [match]@[arbitrary suffix] or [arbitrary suffix]@[match].</summary>
|
||||
public static bool KeyContains(this MiniYamlNode node, string match, bool ignoreSuffix = true, bool includeRemovals = true)
|
||||
{
|
||||
if (node.Key == null)
|
||||
@@ -409,13 +409,13 @@ namespace OpenRA.Mods.Common.UpdateRules
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>Returns children with keys equal to [match] or [match]@[arbitrary suffix]</summary>
|
||||
/// <summary>Returns children with keys equal to [match] or [match]@[arbitrary suffix].</summary>
|
||||
public static IEnumerable<MiniYamlNode> ChildrenMatching(this MiniYamlNode node, string match, bool ignoreSuffix = true, bool includeRemovals = true)
|
||||
{
|
||||
return node.Value.Nodes.Where(n => n.KeyMatches(match, ignoreSuffix, includeRemovals));
|
||||
}
|
||||
|
||||
/// <summary>Returns children whose keys contain 'match' (optionally in the suffix)</summary>
|
||||
/// <summary>Returns children whose keys contain 'match' (optionally in the suffix).</summary>
|
||||
public static IEnumerable<MiniYamlNode> ChildrenContaining(this MiniYamlNode node, string match, bool ignoreSuffix = true, bool includeRemovals = true)
|
||||
{
|
||||
return node.Value.Nodes.Where(n => n.KeyContains(match, ignoreSuffix, includeRemovals));
|
||||
|
||||
Reference in New Issue
Block a user