Add workflow to automatically check code style issues for PRs (#4670)

* Add workflow to perform automated checks for PRs

* Downgrade Microsoft.CodeAnalysis to 4.4.0

This is a workaround to fix issues with dotnet-format.
See:
- https://github.com/dotnet/format/issues/1805
- https://github.com/dotnet/format/issues/1800

* Adjust editorconfig to be more compatible with Ryujinx code-style

* Adjust .editorconfig line endings to match .gitattributes

* Disable 'prefer switch expression' rule

* Remove naming styles

These are the default rules, so we don't need to override them.

* Silence IDE0060 in .editorconfig

* Slightly adjust .editorconfig

* Add lost workflow changes

* Move .editorconfig comment to the top

* .editorconfig: private static readonly fields should be _lowerCamelCase

* .editorconfig: Remove alignment for declarations as well

* editorconfig: Add rule for local constants

* Disable CA1822 for HLE services

* Disable CA1822 for ViewModels

Bindings won't work with static members, but this issue is silently ignored.

* Run dotnet format for the whole solution

* Check result code of SDL_GetDisplayBounds

* Fix dotnet format style issues

* Add missing trailing commas

* Update Microsoft.CodeAnalysis.CSharp to 4.6.0

Skipping 4.5.0 since it breaks dotnet format

* Restore old default naming rules for dotnet format

* Add naming rule exception for CPU tests

* checks: Include all files before excluding paths

* Fix dotnet format issues

* Check dotnet format version

* checks: Run dotnet format with severity info again

* checks: Disable naming style rules until they won't crash the process anymore

* Remove unread private member

* checks: Attempt to run analyzers 3 times before giving up

* checks: Enable naming style rules again with the new retry logic
This commit is contained in:
TSRBerry 2023-07-24 18:35:04 +02:00 committed by GitHub
parent 487261592e
commit eb528ae0f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
84 changed files with 252 additions and 160 deletions

View file

@ -889,7 +889,7 @@ namespace Ryujinx.Graphics.Texture.Astc
0 => 0,
1 => 32,
2 => 63,
_ => 0
_ => 0,
};
break;
@ -942,7 +942,7 @@ namespace Ryujinx.Graphics.Texture.Astc
2 => 32,
3 => 47,
4 => 63,
_ => 0
_ => 0,
};
break;

View file

@ -12,7 +12,7 @@ namespace Ryujinx.Graphics.Texture.Astc
{
JustBits,
Quint,
Trit
Trit,
}
readonly EIntegerEncoding _encoding;
@ -162,7 +162,7 @@ namespace Ryujinx.Graphics.Texture.Astc
IntegerEncoded intEncoded = new(EIntegerEncoding.Quint, numberBitsPerValue)
{
BitValue = m[i],
QuintValue = encodings[i]
QuintValue = encodings[i],
};
listIntegerEncoded.Add(ref intEncoded);
@ -309,7 +309,7 @@ namespace Ryujinx.Graphics.Texture.Astc
2, 1, 1, 1, 2, 1, 1, 2, 1, 2, 0, 2, 1, 1, 2,
1, 2, 1, 1, 2, 2, 2, 1, 1, 2, 2, 1, 2, 1, 2,
0, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 1, 2, 2, 2
2, 1, 2, 2, 2,
};
private static ReadOnlySpan<byte> QuintEncodings => new byte[]
@ -339,7 +339,7 @@ namespace Ryujinx.Graphics.Texture.Astc
0, 1, 4, 1, 1, 4, 0, 2, 3, 1, 2, 3, 2, 2, 3,
3, 2, 3, 4, 2, 3, 2, 4, 3, 0, 2, 4, 1, 2, 4,
0, 3, 3, 1, 3, 3, 2, 3, 3, 3, 3, 3, 4, 3, 3,
3, 4, 3, 0, 3, 4, 1, 3, 4
3, 4, 3, 0, 3, 4, 1, 3, 4,
};
}
}

View file

@ -21,12 +21,12 @@ namespace Ryujinx.Graphics.Texture
new int[] { 18, 60, -18, -60 },
new int[] { 24, 80, -24, -80 },
new int[] { 33, 106, -33, -106 },
new int[] { 47, 183, -47, -183 }
new int[] { 47, 183, -47, -183 },
};
private static readonly int[] _etc2Lut =
{
3, 6, 11, 16, 23, 32, 41, 64
3, 6, 11, 16, 23, 32, 41, 64,
};
private static readonly int[][] _etc2AlphaLut =
@ -46,7 +46,7 @@ namespace Ryujinx.Graphics.Texture
new int[] { -3, -4, -7, -10, 2, 3, 6, 9 },
new int[] { -1, -2, -3, -10, 0, 1, 2, 9 },
new int[] { -4, -6, -8, -9, 3, 5, 7, 8 },
new int[] { -3, -5, -7, -9, 2, 4, 6, 8 }
new int[] { -3, -5, -7, -9, 2, 4, 6, 8 },
};
public static byte[] DecodeRgb(ReadOnlySpan<byte> data, int width, int height, int depth, int levels, int layers)

View file

@ -59,7 +59,7 @@ namespace Ryujinx.Graphics.Texture.Encoders
private static readonly int[] _mostFrequentPartitions = new int[]
{
0, 13, 2, 1, 15, 14, 10, 23
0, 13, 2, 1, 15, 14, 10, 23,
};
private static Block CompressBlock(ReadOnlySpan<byte> data, int x, int y, int width, int height, bool fastMode)
@ -233,7 +233,7 @@ namespace Ryujinx.Graphics.Texture.Encoders
1 => new RgbaColor8(255, 0, 0, 0).ToUInt32(),
2 => new RgbaColor8(0, 255, 0, 0).ToUInt32(),
3 => new RgbaColor8(0, 0, 255, 0).ToUInt32(),
_ => new RgbaColor8(0, 0, 0, 255).ToUInt32()
_ => new RgbaColor8(0, 0, 0, 255).ToUInt32(),
};
}
else

View file

@ -5,6 +5,6 @@
Fast,
Exhaustive,
ModeMask = 0xff,
Multithreaded = 1 << 8
Multithreaded = 1 << 8,
}
}

View file

@ -89,7 +89,7 @@ namespace Ryujinx.Graphics.Texture
8 => Convert<ulong>(dst, data),
12 => Convert<Bpp12Pixel>(dst, data),
16 => Convert<Vector128<byte>>(dst, data),
_ => throw new NotSupportedException($"Unable to convert ${bytesPerPixel} bpp pixel format.")
_ => throw new NotSupportedException($"Unable to convert ${bytesPerPixel} bpp pixel format."),
};
}
@ -240,7 +240,7 @@ namespace Ryujinx.Graphics.Texture
8 => Convert<ulong>(output, data),
12 => Convert<Bpp12Pixel>(output, data),
16 => Convert<Vector128<byte>>(output, data),
_ => throw new NotSupportedException($"Unable to convert ${bytesPerPixel} bpp pixel format.")
_ => throw new NotSupportedException($"Unable to convert ${bytesPerPixel} bpp pixel format."),
};
}
return output;
@ -359,7 +359,7 @@ namespace Ryujinx.Graphics.Texture
8 => Convert<ulong>(dst, data),
12 => Convert<Bpp12Pixel>(dst, data),
16 => Convert<Vector128<byte>>(dst, data),
_ => throw new NotSupportedException($"Unable to convert ${bytesPerPixel} bpp pixel format.")
_ => throw new NotSupportedException($"Unable to convert ${bytesPerPixel} bpp pixel format."),
};
}
@ -504,7 +504,7 @@ namespace Ryujinx.Graphics.Texture
8 => Convert<ulong>(output, data),
12 => Convert<Bpp12Pixel>(output, data),
16 => Convert<Vector128<byte>>(output, data),
_ => throw new NotSupportedException($"Unable to convert ${bytesPerPixel} bpp pixel format.")
_ => throw new NotSupportedException($"Unable to convert ${bytesPerPixel} bpp pixel format."),
};
}

View file

@ -11,21 +11,21 @@
new BC7ModeInfo(1, 0, 0, 2, 1, 2, 3, 5, 6),
new BC7ModeInfo(1, 0, 0, 2, 0, 2, 2, 7, 8),
new BC7ModeInfo(1, 0, 2, 0, 0, 4, 0, 7, 7),
new BC7ModeInfo(2, 6, 4, 0, 0, 2, 0, 5, 5)
new BC7ModeInfo(2, 6, 4, 0, 0, 2, 0, 5, 5),
};
public static readonly byte[][] Weights =
{
new byte[] { 0, 21, 43, 64 },
new byte[] { 0, 9, 18, 27, 37, 46, 55, 64 },
new byte[] { 0, 4, 9, 13, 17, 21, 26, 30, 34, 38, 43, 47, 51, 55, 60, 64 }
new byte[] { 0, 4, 9, 13, 17, 21, 26, 30, 34, 38, 43, 47, 51, 55, 60, 64 },
};
public static readonly byte[][] InverseWeights =
{
new byte[] { 64, 43, 21, 0 },
new byte[] { 64, 55, 46, 37, 27, 18, 9, 0 },
new byte[] { 64, 60, 55, 51, 47, 43, 38, 34, 30, 26, 21, 17, 13, 9, 4, 0 }
new byte[] { 64, 60, 55, 51, 47, 43, 38, 34, 30, 26, 21, 17, 13, 9, 4, 0 },
};
public static readonly byte[][][] FixUpIndices = new byte[3][][]
@ -47,7 +47,7 @@
new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 },
new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 },
new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 },
new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }
new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 }, new byte[] { 0, 0, 0 },
},
new byte[64][]
{
@ -66,7 +66,7 @@
new byte[] { 0, 6, 0 }, new byte[] { 0, 2, 0 }, new byte[] { 0, 6, 0 }, new byte[] { 0, 8, 0 },
new byte[] { 0, 15, 0 }, new byte[] { 0, 15, 0 }, new byte[] { 0, 2, 0 }, new byte[] { 0, 2, 0 },
new byte[] { 0, 15, 0 }, new byte[] { 0, 15, 0 }, new byte[] { 0, 15, 0 }, new byte[] { 0, 15, 0 },
new byte[] { 0, 15, 0 }, new byte[] { 0, 2, 0 }, new byte[] { 0, 2, 0 }, new byte[] { 0, 15, 0 }
new byte[] { 0, 15, 0 }, new byte[] { 0, 2, 0 }, new byte[] { 0, 2, 0 }, new byte[] { 0, 15, 0 },
},
new byte[64][]
{
@ -85,8 +85,8 @@
new byte[] { 0, 3, 15 }, new byte[] { 0, 15, 3 }, new byte[] { 0, 5, 15 }, new byte[] { 0, 5, 15 },
new byte[] { 0, 5, 15 }, new byte[] { 0, 8, 15 }, new byte[] { 0, 5, 15 }, new byte[] { 0, 10, 15 },
new byte[] { 0, 5, 15 }, new byte[] { 0, 10, 15 }, new byte[] { 0, 8, 15 }, new byte[] { 0, 13, 15 },
new byte[] { 0, 15, 3 }, new byte[] { 0, 12, 15 }, new byte[] { 0, 3, 15 }, new byte[] { 0, 3, 8 }
}
new byte[] { 0, 15, 3 }, new byte[] { 0, 12, 15 }, new byte[] { 0, 3, 15 }, new byte[] { 0, 3, 8 },
},
};
public static readonly byte[][][] PartitionTable = new byte[3][][]
@ -156,7 +156,7 @@
new byte[16] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 60
new byte[16] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 61
new byte[16] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 62
new byte[16] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } // 63
new byte[16] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 63
},
new byte[64][]
{
@ -223,7 +223,7 @@
new byte[16] { 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1 }, // 60
new byte[16] { 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0 }, // 61
new byte[16] { 0, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0 }, // 62
new byte[16] { 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1 } // 63
new byte[16] { 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1 }, // 63
},
new byte[64][]
{
@ -290,8 +290,8 @@
new byte[16] { 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1 }, // 60
new byte[16] { 0, 2, 2, 2, 1, 2, 2, 2, 0, 2, 2, 2, 1, 2, 2, 2 }, // 61
new byte[16] { 0, 1, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, // 62
new byte[16] { 0, 1, 1, 1, 2, 0, 1, 1, 2, 2, 0, 1, 2, 2, 2, 0 } // 63
}
new byte[16] { 0, 1, 1, 1, 2, 0, 1, 1, 2, 2, 0, 1, 2, 2, 2, 0 }, // 63
},
};
}
}

View file

@ -1199,7 +1199,7 @@ namespace Ryujinx.Graphics.Texture.Utils
RgbaColor32 weightV = new(colorWeight)
{
A = alphaWeight
A = alphaWeight,
};
RgbaColor32 invWeightV = new RgbaColor32(64) - weightV;

View file

@ -77,7 +77,7 @@ namespace Ryujinx.Graphics.Texture.Utils
1 => G,
2 => B,
3 => A,
_ => throw new ArgumentOutOfRangeException(nameof(index))
_ => throw new ArgumentOutOfRangeException(nameof(index)),
};
}
}