unoplatform / uno.ui.runtimetests.engine

In-App MS Tests Runner for Uno Platform and WinAppSDK
https://platform.uno/
Other
7 stars 3 forks source link

Source files should either be marked as auto-generated or at least suppress formatting warnings #174

Open Youssef1313 opened 2 months ago

Youssef1313 commented 2 months ago

Current behavior

The HRApp in Uno runtime tests is using the runtimetests engine package and the app builds with formatting warnings:

[5/7/2024 9:48:15 AM] HRAppBuild: C:\Users\VssAdministrator\.nuget\packages\uno.ui.runtimetests.engine\0.15.0-dev.56\src\Library\InputInjectorHelper.cs(18,1): warning IDE0055: Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055) [D:\a\1\s\src\Uno.UI.RuntimeTests\Tests\HotReload\Frame\HRApp\Uno.UI.RuntimeTests.HRApp.Skia.Gtk.csproj]
[5/7/2024 9:48:15 AM] HRAppBuild: C:\Users\VssAdministrator\.nuget\packages\uno.ui.runtimetests.engine\0.15.0-dev.56\src\Library\InputInjectorHelper.cs(20,1): warning IDE0055: Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055) [D:\a\1\s\src\Uno.UI.RuntimeTests\Tests\HotReload\Frame\HRApp\Uno.UI.RuntimeTests.HRApp.Skia.Gtk.csproj]
[5/7/2024 9:48:15 AM] HRAppBuild: C:\Users\VssAdministrator\.nuget\packages\uno.ui.runtimetests.engine\0.15.0-dev.56\src\Library\InputInjectorHelper.cs(21,1): warning IDE0055: Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055) [D:\a\1\s\src\Uno.UI.RuntimeTests\Tests\HotReload\Frame\HRApp\Uno.UI.RuntimeTests.HRApp.Skia.Gtk.csproj]
[5/7/2024 9:48:15 AM] HRAppBuild: C:\Users\VssAdministrator\.nuget\packages\uno.ui.runtimetests.engine\0.15.0-dev.56\src\Library\InputInjectorHelper.cs(22,1): warning IDE0055: Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055) [D:\a\1\s\src\Uno.UI.RuntimeTests\Tests\HotReload\Frame\HRApp\Uno.UI.RuntimeTests.HRApp.Skia.Gtk.csproj]
[5/7/2024 9:48:15 AM] HRAppBuild: C:\Users\VssAdministrator\.nuget\packages\uno.ui.runtimetests.engine\0.15.0-dev.56\src\Library\InputInjectorHelper.cs(23,1): warning IDE0055: Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055) [D:\a\1\s\src\Uno.UI.RuntimeTests\Tests\HotReload\Frame\HRApp\Uno.UI.RuntimeTests.HRApp.Skia.Gtk.csproj]
[5/7/2024 9:48:15 AM] HRAppBuild: C:\Users\VssAdministrator\.nuget\packages\uno.ui.runtimetests.engine\0.15.0-dev.56\src\Library\InputInjectorHelper.cs(25,1): warning IDE0055: Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055) [D:\a\1\s\src\Uno.UI.RuntimeTests\Tests\HotReload\Frame\HRApp\Uno.UI.RuntimeTests.HRApp.Skia.Gtk.csproj]
[5/7/2024 9:48:15 AM] HRAppBuild: C:\Users\VssAdministrator\.nuget\packages\uno.ui.runtimetests.engine\0.15.0-dev.56\src\Library\InputInjectorHelper.cs(26,1): warning IDE0055: Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055) [D:\a\1\s\src\Uno.UI.RuntimeTests\Tests\HotReload\Frame\HRApp\Uno.UI.RuntimeTests.HRApp.Skia.Gtk.csproj]
[5/7/2024 9:48:15 AM] HRAppBuild: C:\Users\VssAdministrator\.nuget\packages\uno.ui.runtimetests.engine\0.15.0-dev.56\src\Library\InputInjectorHelper.cs(27,1): warning IDE0055: Fix formatting (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/ide0055) [D:\a\1\s\src\Uno.UI.RuntimeTests\Tests\HotReload\Frame\HRApp\Uno.UI.RuntimeTests.HRApp.Skia.Gtk.csproj]

Expected behavior

NOTE: We don't know what formatting rules are set by the consuming apps, so fixing formatting warnings isn't possible. Instead, we should have #pragma warning disable IDE0055 or have // <auto-generated> tag at the top.

How to reproduce it (as minimally and precisely as possible)

Environment

Nuget Package:

Package Version(s):

Affected platform(s):

Visual Studio:

Relevant plugins:

Anything else we need to know?

dansiegel commented 2 months ago

If we cannot pre-compile this then autogenerated is probably best since we have no idea what additional analyzers may be present where autogenerated excludes the file from all of these additional analyzers which means you won't get warnings/errors for things like formatting or nullability, etc.

Youssef1313 commented 1 month ago

@dansiegel Just came across a nullability error after upgrading MSTest

[5/7/2024 10:32:46 AM] HRAppBuild: C:\Users\VssAdministrator.nuget\packages\uno.ui.runtimetests.engine\0.15.0-dev.56\src\UI\UnitTestMethodInfo.cs(94,43): error CS8619: Nullability of reference types in value of type 'object?[]' doesn't match target type 'object[]'. [D:\a\1\s\src\Uno.UI.RuntimeTests\Tests\HotReload\Frame\HRApp\Uno.UI.RuntimeTests.HRApp.Skia.Gtk.csproj]

So indeed, suppressing only formatting warnings isn't going to work very well. For now we'll need to have // <auto-generated>