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:
RoosterDragon
2023-03-18 09:29:56 +00:00
committed by Gustas
parent 88ba974ea5
commit bcfa0c9ae9
42 changed files with 120 additions and 110 deletions

View File

@@ -587,7 +587,7 @@ namespace OpenRA
return InvalidConditionToken;
}
/// <summary>Returns whether the specified token is valid for RevokeCondition</summary>
/// <summary>Returns whether the specified token is valid for RevokeCondition.</summary>
public bool TokenValid(int token)
{
return conditionTokens.ContainsKey(token);

View File

@@ -181,10 +181,12 @@ namespace OpenRA
/// <summary>
/// Removes invalid mod registrations:
/// * LaunchPath no longer exists
/// * LaunchPath and mod id matches the active mod, but the version is different
/// * Filename doesn't match internal key
/// * Fails to parse as a mod registration
/// <list type="bullet">
/// <item>LaunchPath no longer exists.</item>
/// <item>LaunchPath and mod id matches the active mod, but the version is different.</item>
/// <item>Filename doesn't match internal key.</item>
/// <item>Fails to parse as a mod registration.</item>
/// </list>
/// </summary>
internal void ClearInvalidRegistrations(ModRegistration registration)
{

View File

@@ -271,7 +271,7 @@ namespace OpenRA.FileSystem
}
/// <summary>
/// Returns true if the given filename references an external mod via an explicit mount
/// Returns true if the given filename references an external mod via an explicit mount.
/// </summary>
public bool IsExternalModFile(string filename)
{

View File

@@ -131,7 +131,7 @@ namespace OpenRA.GameRules
public readonly List<IWarhead> Warheads = new List<IWarhead>();
/// <summary>
/// This constructor is used solely for documentation generation!
/// This constructor is used solely for documentation generation.
/// </summary>
public WeaponInfo() { }

View File

@@ -26,7 +26,7 @@ namespace OpenRA.Graphics
float[] Bounds(uint frame);
ModelRenderData RenderData(uint section);
/// <summary>Returns the smallest rectangle that covers all rotations of all frames in a model</summary>
/// <summary>Returns the smallest rectangle that covers all rotations of all frames in a model.</summary>
Rectangle AggregateBounds { get; }
}

View File

@@ -78,7 +78,7 @@ namespace OpenRA.Graphics
/// <summary>
/// Calculate the 2D intersection of two lines.
/// Will behave badly if the lines are parallel.
/// Z position is the average of a and b (ignores actual intersection point if it exists)
/// Z position is the average of a and b (ignores actual intersection point if it exists).
/// </summary>
float3 IntersectionOf(in float3 a, in float3 da, in float3 b, in float3 db)
{

View File

@@ -18,7 +18,7 @@ namespace OpenRA.Graphics
/// <summary>
/// Describes the format of the pixel data in a ISpriteFrame.
/// Note that the channel order is defined for little-endian bytes, so BGRA corresponds
/// to a 32bit ARGB value, such as that returned by Color.ToArgb()!
/// to a 32bit ARGB value, such as that returned by Color.ToArgb().
/// </summary>
public enum SpriteFrameType
{

View File

@@ -224,10 +224,10 @@ namespace OpenRA.Graphics
}
/// <summary>Rotates a quad about its center in the x-y plane.</summary>
/// <param name="tl">The top left vertex of the quad</param>
/// <param name="size">A float3 containing the X, Y, and Z lengths of the quad</param>
/// <param name="rotation">The number of radians to rotate by</param>
/// <returns>An array of four vertices representing the rotated quad (top-left, top-right, bottom-right, bottom-left)</returns>
/// <param name="tl">The top left vertex of the quad.</param>
/// <param name="size">A float3 containing the X, Y, and Z lengths of the quad.</param>
/// <param name="rotation">The number of radians to rotate by.</param>
/// <returns>An array of four vertices representing the rotated quad (top-left, top-right, bottom-right, bottom-left).</returns>
public static float3[] RotateQuad(float3 tl, float3 size, float rotation)
{
var center = tl + 0.5f * size;
@@ -258,9 +258,9 @@ namespace OpenRA.Graphics
/// <summary>
/// Returns the bounds of an object. Used for determining which objects need to be rendered on screen, and which do not.
/// </summary>
/// <param name="offset">The top left vertex of the object</param>
/// <param name="size">A float 3 containing the X, Y, and Z lengths of the object</param>
/// <param name="rotation">The angle to rotate the object by (use 0f if there is no rotation)</param>
/// <param name="offset">The top left vertex of the object.</param>
/// <param name="size">A float 3 containing the X, Y, and Z lengths of the object.</param>
/// <param name="rotation">The angle to rotate the object by (use 0f if there is no rotation).</param>
public static Rectangle BoundingRectangle(float3 offset, float3 size, float rotation)
{
if (rotation == 0f)

View File

@@ -278,7 +278,7 @@ namespace OpenRA.Graphics
return worldRenderer.World.Map.CellContaining(worldRenderer.ProjectedPosition(ViewToWorldPx(view)));
}
/// <summary> Returns an unfiltered list of all cells that could potentially contain the mouse cursor</summary>
/// <summary>Returns an unfiltered list of all cells that could potentially contain the mouse cursor.</summary>
IEnumerable<MPos> CandidateMouseoverCells(int2 world)
{
var map = worldRenderer.World.Map;

View File

@@ -14,7 +14,7 @@ using System;
namespace OpenRA
{
/// <summary>
/// A reference to either a named hotkey (defined in the game settings) or a statically assigned hotkey
/// A reference to either a named hotkey (defined in the game settings) or a statically assigned hotkey.
/// </summary>
public class HotkeyReference
{

View File

@@ -64,7 +64,7 @@ namespace OpenRA
}
/// <summary>
/// Projected map position
/// Projected map position.
/// </summary>
public readonly struct PPos : IEquatable<PPos>
{

View File

@@ -64,7 +64,7 @@ namespace OpenRA
public bool Hidden;
}
/// <summary> Describes what is to be loaded in order to run a mod. </summary>
/// <summary>Describes what is to be loaded in order to run a mod.</summary>
public class Manifest : IDisposable
{
public readonly string Id;

View File

@@ -72,7 +72,7 @@ namespace OpenRA
return uv.V * Size.Width + uv.U;
}
/// <summary>Gets or sets the <see cref="CellLayer"/> using cell coordinates</summary>
/// <summary>Gets or sets the <see cref="CellLayer"/> using cell coordinates.</summary>
public T this[CPos cell]
{
get => Entries[Index(cell)];
@@ -85,7 +85,7 @@ namespace OpenRA
}
}
/// <summary>Gets or sets the layer contents using raw map coordinates (not CPos!)</summary>
/// <summary>Gets or sets the layer contents using raw map coordinates (not CPos!).</summary>
public T this[MPos uv]
{
get => Entries[Index(uv)];

View File

@@ -43,13 +43,13 @@ namespace OpenRA
Array.Copy(anotherLayer.Entries, Entries, Entries.Length);
}
/// <summary>Clears the layer contents with their default value</summary>
/// <summary>Clears the layer contents with their default value.</summary>
public virtual void Clear()
{
Array.Clear(Entries, 0, Entries.Length);
}
/// <summary>Clears the layer contents with a known value</summary>
/// <summary>Clears the layer contents with a known value.</summary>
public virtual void Clear(T clearValue)
{
Array.Fill(Entries, clearValue);

View File

@@ -155,7 +155,7 @@ namespace OpenRA
public const int CurrentMapFormat = 12;
const short InvalidCachedTerrainIndex = -1;
/// <summary>Defines the order of the fields in map.yaml</summary>
/// <summary>Defines the order of the fields in map.yaml.</summary>
static readonly MapField[] YamlFields =
{
new MapField("MapFormat"),
@@ -993,7 +993,7 @@ namespace OpenRA
}
/// <summary>
/// The size of the map Height step in world units
/// The size of the map Height step in world units.
/// </summary>
/// RectangularIsometric defines 1024 units along the diagonal axis,
/// giving a half-tile height step of sqrt(2) * 512

View File

@@ -43,7 +43,7 @@ namespace OpenRA
readonly List<MapDirectoryTracker> mapDirectoryTrackers = new List<MapDirectoryTracker>();
/// <summary>
/// The most recently modified or loaded map at runtime
/// The most recently modified or loaded map at runtime.
/// </summary>
public string LastModifiedMap { get; private set; } = null;
readonly Dictionary<string, string> mapUpdates = new Dictionary<string, string>();
@@ -51,7 +51,7 @@ namespace OpenRA
string lastLoadedLastModifiedMap;
/// <summary>
/// If LastModifiedMap was picked already, returns a null
/// If LastModifiedMap was picked already, returns a null.
/// </summary>
public string PickLastModifiedMap(MapVisibility visibility)
{

View File

@@ -63,7 +63,7 @@ namespace OpenRA
public class MapPreview : IDisposable, IReadOnlyFileSystem
{
/// <summary>Wrapper that enables map data to be replaced in an atomic fashion</summary>
/// <summary>Wrapper that enables map data to be replaced in an atomic fashion.</summary>
class InnerData
{
public int MapFormat;

View File

@@ -36,7 +36,7 @@ namespace OpenRA
/// <summary>
/// Sets the "Home" location, which can be used by traits and scripts to e.g. set the initial camera
/// location or choose the map edge for reinforcements.
/// This will usually be overridden for client (lobby slot) players with a location based on the Spawn index
/// This will usually be overridden for client (lobby slot) players with a location based on the Spawn index.
/// </summary>
public CPos HomeLocation = CPos.Zero;

View File

@@ -61,34 +61,34 @@ namespace OpenRA.Network
public const int ProtocolVersion = 2;
/// <summary>Online game number or -1 for LAN games</summary>
/// <summary>Online game number or -1 for LAN games.</summary>
public readonly int Id = -1;
/// <summary>Name of the server</summary>
/// <summary>Name of the server.</summary>
public readonly string Name = null;
/// <summary>ip:port string to connect to.</summary>
public readonly string Address = null;
/// <summary>Port of the server</summary>
/// <summary>Port of the server.</summary>
public readonly int Port = 0;
/// <summary>The current state of the server (waiting/playing/completed)</summary>
/// <summary>The current state of the server (waiting/playing/completed).</summary>
public readonly int State = 0;
/// <summary>The number of slots available for non-bot players</summary>
/// <summary>The number of slots available for non-bot players.</summary>
public readonly int MaxPlayers = 0;
/// <summary>UID of the map</summary>
/// <summary>UID of the map.</summary>
public readonly string Map = null;
/// <summary>Mod ID</summary>
/// <summary>Mod ID.</summary>
public readonly string Mod = "";
/// <summary>Mod Version</summary>
/// <summary>Mod Version.</summary>
public readonly string Version = "";
/// <summary>Human-readable mod title</summary>
/// <summary>Human-readable mod title.</summary>
public readonly string ModTitle = "";
/// <summary>URL to show in game listings for custom/unknown mods.</summary>
@@ -100,13 +100,13 @@ namespace OpenRA.Network
/// <summary>GeoIP resolved server location.</summary>
public readonly string Location = "";
/// <summary>Password protected</summary>
/// <summary>Password protected.</summary>
public readonly bool Protected = false;
/// <summary>Players must be authenticated with the OpenRA forum</summary>
/// <summary>Players must be authenticated with the OpenRA forum.</summary>
public readonly bool Authentication = false;
/// <summary>UTC datetime string when the game changed to the Playing state</summary>
/// <summary>UTC datetime string when the game changed to the Playing state.</summary>
public readonly string Started = null;
/// <summary>Number of non-spectator, non-bot players. Only defined if GameServer is parsed from yaml.</summary>
@@ -132,7 +132,7 @@ namespace OpenRA.Network
[FieldLoader.LoadUsing(nameof(LoadClients))]
public readonly GameClient[] Clients;
/// <summary>The list of spawnpoints that are disabled for this game</summary>
/// <summary>The list of spawnpoints that are disabled for this game.</summary>
public readonly int[] DisabledSpawnPoints = Array.Empty<int>();
public string ModLabel => $"{ModTitle} ({Version})";

View File

@@ -28,7 +28,7 @@ namespace OpenRA.Network
public Session LobbyInfo = new Session();
/// <summary> Null when watching a replay </summary>
/// <summary>Null when watching a replay.</summary>
public Session.Client LocalClient => LobbyInfo.ClientWithIndex(Connection.LocalClientId);
public World World;
public int OrderQueueLength => pendingOrders.Count > 0 ? pendingOrders.Min(q => q.Value.Count) : 0;
@@ -58,7 +58,11 @@ namespace OpenRA.Network
int sentOrdersFrame = 0;
float tickScale = 1f;
/// <Remarks> Should only be set in <see cref="OutOfSync"/></Remarks>
/// <summary>
/// Indicates if the world state of other players or a replay has diverged from the local state.
/// The game cannot reliably continue in this condition and is unusable.
/// </summary>
/// <remarks>Should only be set in <see cref="OutOfSync"/>.</remarks>
public bool IsOutOfSync { get; private set; } = false;
public struct ClientOrder

View File

@@ -253,7 +253,7 @@ namespace OpenRA
return PlayerRelationship.Neutral;
}
/// <summary> returns true if player is null </summary>
/// <summary>Returns true if player is null.</summary>
public bool IsAlliedWith(Player p)
{
return RelationshipWith(p) == PlayerRelationship.Ally;

View File

@@ -102,7 +102,7 @@ namespace OpenRA
/// <summary>
/// Find the index of CosineTable that has the value closest to the given value.
/// The first or last index will be returned for values above or below the valid range
/// The first or last index will be returned for values above or below the valid range.
/// </summary>
static int ClosestCosineIndex(int value)
{

View File

@@ -37,12 +37,12 @@ namespace OpenRA
public static bool operator !=(in WPos me, in WPos other) { return !(me == other); }
/// <summary>
/// Returns the linear interpolation between points 'a' and 'b'
/// Returns the linear interpolation between points 'a' and 'b'.
/// </summary>
public static WPos Lerp(in WPos a, in WPos b, int mul, int div) { return a + (b - a) * mul / div; }
/// <summary>
/// Returns the linear interpolation between points 'a' and 'b'
/// Returns the linear interpolation between points 'a' and 'b'.
/// </summary>
public static WPos Lerp(in WPos a, in WPos b, long mul, long div)
{

View File

@@ -53,7 +53,7 @@ namespace OpenRA
/// <summary>
/// Construct a rotation from an axis and angle.
/// The axis is expected to be normalized to length 1024
/// The axis is expected to be normalized to length 1024.
/// </summary>
public WRot(WVec axis, WAngle angle)
{

View File

@@ -125,9 +125,9 @@ namespace OpenRA.Widgets
return handled;
}
/// <summary>Possibly handle keyboard input (if this widget has keyboard focus)</summary>
/// <returns><c>true</c>, if keyboard input was handled, <c>false</c> if the input should bubble to the parent widget</returns>
/// <param name="e">Key input data</param>
/// <summary>Possibly handle keyboard input (if this widget has keyboard focus).</summary>
/// <returns><c>true</c>, if keyboard input was handled, <c>false</c> if the input should bubble to the parent widget.</returns>
/// <param name="e">Key input data.</param>
public static bool HandleKeyPress(KeyInput e)
{
if (KeyboardFocusWidget != null)
@@ -395,8 +395,8 @@ namespace OpenRA.Widgets
public virtual void MouseExited() { }
/// <summary>Possibly handles mouse input (click, drag, scroll, etc).</summary>
/// <returns><c>true</c>, if mouse input was handled, <c>false</c> if the input should bubble to the parent widget</returns>
/// <param name="mi">Mouse input data</param>
/// <returns><c>true</c>, if mouse input was handled, <c>false</c> if the input should bubble to the parent widget.</returns>
/// <param name="mi">Mouse input data.</param>
public virtual bool HandleMouseInput(MouseInput mi) { return false; }
public bool HandleMouseInputOuter(MouseInput mi)

View File

@@ -69,7 +69,8 @@ namespace OpenRA
public event Action GameOver = () => { };
/// <Remarks> Should only be set in <see cref="EndGame"/></Remarks>
/// <summary>Indicates that the game has ended.</summary>
/// <remarks>Should only be set in <see cref="EndGame"/>.</remarks>
public bool IsGameOver { get; private set; }
public void EndGame()
{