-
-
Notifications
You must be signed in to change notification settings - Fork 2
Detect unused usings when building via dotnet CLI #714
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
Conversation
dotnet format for commit 1416ac8❗ dotnet format found files that did not respect the code guidelines and pushed commit 326588e. Please review it before merging the PR. You can review the workflow that pushed this commit here. NoteSometimes the fix provided by the analyzers produces unnecessary comments when formatting files. This should only happen if the project supports multiple target frameworks and the fix doesn't produce the same output for all. However, it seems that sometimes the If this happens, just delete the comments added. Otherwise, consider incorporating the commented out code using preprocessor directives to control conditional compilation. #if NET5_0
...
#elif NETCOREAPP3_1
...
#endif |
Test runs on ubuntu-latest for commit 7cab225✔️ Pass - DotNet.Sdk.Extensions.Testing.Tests.dll on .NETCoreApp,Version=v5.0---- ## Run Summary Overall Result: ✔️ Pass Run Duration: 4s 700ms GitHub Runner OS: ubuntu-latest Operating System: Linux 5.15.0-1042-azure #49-Ubuntu SMP Tue Jul 11 17:28:46 UTC 2023 Framework: .NETCoreApp,Version=v5.0 Assembly: DotNet.Sdk.Extensions.Testing.Tests.dll
Informational✔️ Pass - DotNet.Sdk.Extensions.Tests.dll on .NETCoreApp,Version=v5.0---- ## Run Summary Overall Result: ✔️ Pass Run Duration: 11s 818ms GitHub Runner OS: ubuntu-latest Operating System: Linux 5.15.0-1042-azure #49-Ubuntu SMP Tue Jul 11 17:28:46 UTC 2023 Framework: .NETCoreApp,Version=v5.0 Assembly: DotNet.Sdk.Extensions.Tests.dll
Informational✔️ Pass - DotNet.Sdk.Extensions.Testing.Tests.dll on .NETCoreApp,Version=v6.0---- ## Run Summary Overall Result: ✔️ Pass Run Duration: 4s 111ms GitHub Runner OS: ubuntu-latest Operating System: Linux 5.15.0-1042-azure #49-Ubuntu SMP Tue Jul 11 17:28:46 UTC 2023 Framework: .NETCoreApp,Version=v6.0 Assembly: DotNet.Sdk.Extensions.Testing.Tests.dll
Informational✔️ Pass - DotNet.Sdk.Extensions.Tests.dll on .NETCoreApp,Version=v6.0---- ## Run Summary Overall Result: ✔️ Pass Run Duration: 12s 136ms GitHub Runner OS: ubuntu-latest Operating System: Linux 5.15.0-1042-azure #49-Ubuntu SMP Tue Jul 11 17:28:46 UTC 2023 Framework: .NETCoreApp,Version=v6.0 Assembly: DotNet.Sdk.Extensions.Tests.dll
Informational✔️ Pass - DotNet.Sdk.Extensions.Testing.Tests.dll on .NETCoreApp,Version=v7.0---- ## Run Summary Overall Result: ✔️ Pass Run Duration: 35s 508ms GitHub Runner OS: ubuntu-latest Operating System: Linux 5.15.0-1042-azure #49-Ubuntu SMP Tue Jul 11 17:28:46 UTC 2023 Framework: .NETCoreApp,Version=v7.0 Assembly: DotNet.Sdk.Extensions.Testing.Tests.dll
Informational✔️ Pass - DotNet.Sdk.Extensions.Tests.dll on .NETCoreApp,Version=v7.0---- ## Run Summary Overall Result: ✔️ Pass Run Duration: 11s 685ms GitHub Runner OS: ubuntu-latest Operating System: Linux 5.15.0-1042-azure #49-Ubuntu SMP Tue Jul 11 17:28:46 UTC 2023 Framework: .NETCoreApp,Version=v7.0 Assembly: DotNet.Sdk.Extensions.Tests.dll
Informational✔️ Pass - DotNet.Sdk.Extensions.Testing.Tests.dll on .NETCoreApp,Version=v3.1---- ## Run Summary Overall Result: ✔️ Pass Run Duration: 5s 460ms GitHub Runner OS: ubuntu-latest Operating System: Linux 5.15.0-1042-azure #49-Ubuntu SMP Tue Jul 11 17:28:46 UTC 2023 Framework: .NETCoreApp,Version=v3.1 Assembly: DotNet.Sdk.Extensions.Testing.Tests.dll
Informational✔️ Pass - DotNet.Sdk.Extensions.Tests.dll on .NETCoreApp,Version=v3.1---- ## Run Summary Overall Result: ✔️ Pass Run Duration: 11s 827ms GitHub Runner OS: ubuntu-latest Operating System: Linux 5.15.0-1042-azure #49-Ubuntu SMP Tue Jul 11 17:28:46 UTC 2023 Framework: .NETCoreApp,Version=v3.1 Assembly: DotNet.Sdk.Extensions.Tests.dll
Informational |
Test runs on windows-latest for commit 7cab225✔️ Pass - DotNet.Sdk.Extensions.Testing.Tests.dll on .NETCoreApp,Version=v5.0---- ## Run Summary Overall Result: ✔️ Pass Run Duration: 4s 591ms GitHub Runner OS: windows-latest Operating System: Microsoft Windows 10.0.20348 Framework: .NETCoreApp,Version=v5.0 Assembly: DotNet.Sdk.Extensions.Testing.Tests.dll
Informational✔️ Pass - DotNet.Sdk.Extensions.Tests.dll on .NETCoreApp,Version=v5.0---- ## Run Summary Overall Result: ✔️ Pass Run Duration: 12s 82ms GitHub Runner OS: windows-latest Operating System: Microsoft Windows 10.0.20348 Framework: .NETCoreApp,Version=v5.0 Assembly: DotNet.Sdk.Extensions.Tests.dll
Informational✔️ Pass - DotNet.Sdk.Extensions.Testing.Tests.dll on .NETCoreApp,Version=v6.0---- ## Run Summary Overall Result: ✔️ Pass Run Duration: 3s 169ms GitHub Runner OS: windows-latest Operating System: Microsoft Windows 10.0.20348 Framework: .NETCoreApp,Version=v6.0 Assembly: DotNet.Sdk.Extensions.Testing.Tests.dll
Informational✔️ Pass - DotNet.Sdk.Extensions.Tests.dll on .NETCoreApp,Version=v6.0---- ## Run Summary Overall Result: ✔️ Pass Run Duration: 11s 913ms GitHub Runner OS: windows-latest Operating System: Microsoft Windows 10.0.20348 Framework: .NETCoreApp,Version=v6.0 Assembly: DotNet.Sdk.Extensions.Tests.dll
Informational✔️ Pass - DotNet.Sdk.Extensions.Testing.Tests.dll on .NETCoreApp,Version=v7.0---- ## Run Summary Overall Result: ✔️ Pass Run Duration: 6s 79ms GitHub Runner OS: windows-latest Operating System: Microsoft Windows 10.0.20348 Framework: .NETCoreApp,Version=v7.0 Assembly: DotNet.Sdk.Extensions.Testing.Tests.dll
Informational✔️ Pass - DotNet.Sdk.Extensions.Tests.dll on .NETCoreApp,Version=v7.0---- ## Run Summary Overall Result: ✔️ Pass Run Duration: 12s 432ms GitHub Runner OS: windows-latest Operating System: Microsoft Windows 10.0.20348 Framework: .NETCoreApp,Version=v7.0 Assembly: DotNet.Sdk.Extensions.Tests.dll
Informational✔️ Pass - DotNet.Sdk.Extensions.Testing.Tests.dll on .NETCoreApp,Version=v3.1---- ## Run Summary Overall Result: ✔️ Pass Run Duration: 5s 314ms GitHub Runner OS: windows-latest Operating System: Microsoft Windows 10.0.20348 Framework: .NETCoreApp,Version=v3.1 Assembly: DotNet.Sdk.Extensions.Testing.Tests.dll
Informational✔️ Pass - DotNet.Sdk.Extensions.Tests.dll on .NETCoreApp,Version=v3.1---- ## Run Summary Overall Result: ✔️ Pass Run Duration: 12s 92ms GitHub Runner OS: windows-latest Operating System: Microsoft Windows 10.0.20348 Framework: .NETCoreApp,Version=v3.1 Assembly: DotNet.Sdk.Extensions.Tests.dll
Informational |
Codecov Report
@@ Coverage Diff @@
## main #714 +/- ##
=======================================
Coverage 86.79% 86.79%
=======================================
Files 77 77
Lines 1409 1409
Branches 219 219
=======================================
Hits 1223 1223
Misses 100 100
Partials 86 86 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
What
With the update to dotnet SDK 7.0.400 I started getting warnings about enabling the creation of documentation files if I wanted to get accurate reporting for IDE0005:
It turns out that IDE0005 which reports unused usings has only been working when building in Visual Studio. When building via the dotnet CLI the analyzer does not work.
I hadn't noticed it before because dotnet format does still work and my GitHub workflow with it has been working as expected. Nevertheless, even if dotnet format covers this for me I want to make sure that I also get the warnings at build time.
Resolution
Use the workaround proposed in dotnet/roslyn#41640
Perhaps this can be revisited once dotnet/roslyn#41640 gets closed.
More info
I'm still leaving the
GenerateDocumentationFileattribute on the/srcprojects because I'm unsure how dotnet/roslyn#41640 will progress. It might be that I removeGenerateDocumentationFilefromDirectory.Build.props, which this PR is adding, but then I still want it on thecsprojfor the/srcprojects. For now I'm fine with theGenerateDocumentationFileattribute being duplicated between thecsprojfor the/srcprojects and theDirectory.Build.props.See:
GenerateDocumentationFilewarning instead of using the above workaround: Add workaround for new warning Particular/RepoStandards#89