From eb528ae0f05f057e671eb9e92f44f1caa9bcc84b Mon Sep 17 00:00:00 2001 From: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Date: Mon, 24 Jul 2023 18:35:04 +0200 Subject: 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 --- src/Ryujinx.Graphics.Texture/Astc/AstcDecoder.cs | 4 ++-- .../Astc/IntegerEncoded.cs | 8 ++++---- src/Ryujinx.Graphics.Texture/ETC2Decoder.cs | 6 +++--- .../Encoders/BC7Encoder.cs | 4 ++-- .../Encoders/EncodeMode.cs | 2 +- src/Ryujinx.Graphics.Texture/LayoutConverter.cs | 8 ++++---- src/Ryujinx.Graphics.Texture/Utils/BC67Tables.cs | 22 +++++++++++----------- src/Ryujinx.Graphics.Texture/Utils/BC67Utils.cs | 2 +- src/Ryujinx.Graphics.Texture/Utils/RgbaColor8.cs | 2 +- 9 files changed, 29 insertions(+), 29 deletions(-) (limited to 'src/Ryujinx.Graphics.Texture') diff --git a/src/Ryujinx.Graphics.Texture/Astc/AstcDecoder.cs b/src/Ryujinx.Graphics.Texture/Astc/AstcDecoder.cs index 6f633e4a..1f781d2f 100644 --- a/src/Ryujinx.Graphics.Texture/Astc/AstcDecoder.cs +++ b/src/Ryujinx.Graphics.Texture/Astc/AstcDecoder.cs @@ -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; diff --git a/src/Ryujinx.Graphics.Texture/Astc/IntegerEncoded.cs b/src/Ryujinx.Graphics.Texture/Astc/IntegerEncoded.cs index 56e78cc3..361140dd 100644 --- a/src/Ryujinx.Graphics.Texture/Astc/IntegerEncoded.cs +++ b/src/Ryujinx.Graphics.Texture/Astc/IntegerEncoded.cs @@ -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 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, }; } } diff --git a/src/Ryujinx.Graphics.Texture/ETC2Decoder.cs b/src/Ryujinx.Graphics.Texture/ETC2Decoder.cs index 21ff4be4..57f2e98d 100644 --- a/src/Ryujinx.Graphics.Texture/ETC2Decoder.cs +++ b/src/Ryujinx.Graphics.Texture/ETC2Decoder.cs @@ -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 data, int width, int height, int depth, int levels, int layers) diff --git a/src/Ryujinx.Graphics.Texture/Encoders/BC7Encoder.cs b/src/Ryujinx.Graphics.Texture/Encoders/BC7Encoder.cs index d0d1666a..21aa225a 100644 --- a/src/Ryujinx.Graphics.Texture/Encoders/BC7Encoder.cs +++ b/src/Ryujinx.Graphics.Texture/Encoders/BC7Encoder.cs @@ -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 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 diff --git a/src/Ryujinx.Graphics.Texture/Encoders/EncodeMode.cs b/src/Ryujinx.Graphics.Texture/Encoders/EncodeMode.cs index 5734d301..8db3b3c0 100644 --- a/src/Ryujinx.Graphics.Texture/Encoders/EncodeMode.cs +++ b/src/Ryujinx.Graphics.Texture/Encoders/EncodeMode.cs @@ -5,6 +5,6 @@ Fast, Exhaustive, ModeMask = 0xff, - Multithreaded = 1 << 8 + Multithreaded = 1 << 8, } } diff --git a/src/Ryujinx.Graphics.Texture/LayoutConverter.cs b/src/Ryujinx.Graphics.Texture/LayoutConverter.cs index 0f7c304e..d9a666c3 100644 --- a/src/Ryujinx.Graphics.Texture/LayoutConverter.cs +++ b/src/Ryujinx.Graphics.Texture/LayoutConverter.cs @@ -89,7 +89,7 @@ namespace Ryujinx.Graphics.Texture 8 => Convert(dst, data), 12 => Convert(dst, data), 16 => Convert>(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(output, data), 12 => Convert(output, data), 16 => Convert>(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(dst, data), 12 => Convert(dst, data), 16 => Convert>(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(output, data), 12 => Convert(output, data), 16 => Convert>(output, data), - _ => throw new NotSupportedException($"Unable to convert ${bytesPerPixel} bpp pixel format.") + _ => throw new NotSupportedException($"Unable to convert ${bytesPerPixel} bpp pixel format."), }; } diff --git a/src/Ryujinx.Graphics.Texture/Utils/BC67Tables.cs b/src/Ryujinx.Graphics.Texture/Utils/BC67Tables.cs index d890652c..f1745d23 100644 --- a/src/Ryujinx.Graphics.Texture/Utils/BC67Tables.cs +++ b/src/Ryujinx.Graphics.Texture/Utils/BC67Tables.cs @@ -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 + }, }; } } diff --git a/src/Ryujinx.Graphics.Texture/Utils/BC67Utils.cs b/src/Ryujinx.Graphics.Texture/Utils/BC67Utils.cs index 3f69cb4c..0916cc2c 100644 --- a/src/Ryujinx.Graphics.Texture/Utils/BC67Utils.cs +++ b/src/Ryujinx.Graphics.Texture/Utils/BC67Utils.cs @@ -1199,7 +1199,7 @@ namespace Ryujinx.Graphics.Texture.Utils RgbaColor32 weightV = new(colorWeight) { - A = alphaWeight + A = alphaWeight, }; RgbaColor32 invWeightV = new RgbaColor32(64) - weightV; diff --git a/src/Ryujinx.Graphics.Texture/Utils/RgbaColor8.cs b/src/Ryujinx.Graphics.Texture/Utils/RgbaColor8.cs index 401bec38..eced3d75 100644 --- a/src/Ryujinx.Graphics.Texture/Utils/RgbaColor8.cs +++ b/src/Ryujinx.Graphics.Texture/Utils/RgbaColor8.cs @@ -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)), }; } } -- cgit v1.2.3