Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce code style rule IDE0055 #21199

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 2 additions & 5 deletions .editorconfig
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
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
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
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
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
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