Skip to content

Commit

Permalink
Fix IDE0055
Browse files Browse the repository at this point in the history
This rule no longer appears to be buggy, so enforce it. Some of the automated fixes are adjusted in order to improve the result. #pragma directives have no option to control indentation, so remove them where possible.
  • Loading branch information
RoosterDragon authored and penev92 committed Nov 16, 2023
1 parent 60cbf79 commit 360f24f
Show file tree
Hide file tree
Showing 58 changed files with 706 additions and 701 deletions.
7 changes: 2 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,7 @@ dotnet_diagnostic.IDE0077.severity = warning

### Formatting Rules (IDE0055)
### https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0055

# We may eventually wish to enforce this rule, however some existing formatting conflicts with the rule despite being reasonable.
# Additionally, the rule is buggy and likes to report spuriously after invoking Format Document in the IDE.
dotnet_diagnostic.IDE0055.severity = none
dotnet_diagnostic.IDE0055.severity = warning

#dotnet_sort_system_directives_first = true
#dotnet_separate_import_directive_groups = false
Expand All @@ -448,7 +445,7 @@ dotnet_diagnostic.IDE0055.severity = none
#csharp_indent_labels = one_less_than_current
#csharp_indent_block_contents = true
#csharp_indent_braces = false
#csharp_indent_case_contents_when_block = true
csharp_indent_case_contents_when_block = false

#csharp_space_after_cast = false
#csharp_space_after_keywords_in_control_flow_statements = true
Expand Down
4 changes: 2 additions & 2 deletions OpenRA.Game/FileFormats/Png.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public Png(Stream s)
var length = IPAddress.NetworkToHostOrder(s.ReadInt32());
var type = s.ReadASCII(4);
var content = s.ReadBytes(length);
/*var crc = */s.ReadInt32();
s.ReadInt32(); // crc

if (!headerParsed && type != "IHDR")
throw new InvalidDataException("Invalid PNG file - header does not appear first.");
Expand All @@ -76,7 +76,7 @@ public Png(Stream s)
Data = new byte[Width * Height * PixelStride];

var compression = ms.ReadUInt8();
/*var filter = */ms.ReadUInt8();
ms.ReadUInt8(); // filter
var interlace = ms.ReadUInt8();

if (compression != 0)
Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Game/Graphics/ModelVertex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public ModelShaderBindings()
: base("model")
{ }

public override ShaderVertexAttribute[] Attributes { get; } = new[]
public override ShaderVertexAttribute[] Attributes { get; } = new[]
{
new ShaderVertexAttribute("aVertexPosition", ShaderVertexAttributeType.Float, 3, 0),
new ShaderVertexAttribute("aVertexTexCoord", ShaderVertexAttributeType.Float, 4, 12),
Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Game/Graphics/TerrainSpriteLayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public TerrainSpriteLayer(World world, WorldRenderer wr, Sprite emptySprite, Ble

indexRowStride = 6 * map.MapSize.X;
lock (IndexBuffers)
{
{
indexBufferWrapper = IndexBuffers.GetValue(world, world => new IndexBufferRc(world));
indexBufferWrapper.AddRef();
}
Expand Down
2 changes: 1 addition & 1 deletion OpenRA.Game/Graphics/Vertex.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public CombinedShaderBindings()
: base("combined")
{ }

public override ShaderVertexAttribute[] Attributes { get; } = new[]
public override ShaderVertexAttribute[] Attributes { get; } = new[]
{
new ShaderVertexAttribute("aVertexPosition", ShaderVertexAttributeType.Float, 3, 0),
new ShaderVertexAttribute("aVertexTexCoord", ShaderVertexAttributeType.Float, 4, 12),
Expand Down
5 changes: 3 additions & 2 deletions OpenRA.Game/Map/ActorReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ public void Add(ActorInit init)
// If a more specific init is not available, fall back to an unnamed init.
// If duplicate inits are defined, take the last to match standard yaml override expectations
if (info != null && !string.IsNullOrEmpty(info.InstanceName))
return inits.LastOrDefault(i => i.InstanceName == info.InstanceName) ??
inits.LastOrDefault(i => string.IsNullOrEmpty(i.InstanceName));
return
inits.LastOrDefault(i => i.InstanceName == info.InstanceName) ??
inits.LastOrDefault(i => string.IsNullOrEmpty(i.InstanceName));

// Untagged traits will only use untagged inits
return inits.LastOrDefault(i => string.IsNullOrEmpty(i.InstanceName));
Expand Down

0 comments on commit 360f24f

Please sign in to comment.