-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Treat warnings as errors for initial projects #15019
Treat warnings as errors for initial projects #15019
Conversation
…Umbraco.Cms.Api.Delivery projects.
Hi there @emmagarland, thank you for this contribution! 👍 While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:
Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution. If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request. Thanks, from your friendly Umbraco GitHub bot 🤖 🙂 |
…co.Cms.Imaging.ImageSharp2 projects
…mbraco.Cms.Persistence.EFCore.SqlServer and Umbraco.Cms.StaticAssets
Thanks @emmagarland for initiating this warning cleanup 👍 I like the idea of preventing those warnings to come back, but I'm wondering if treating all as error would not have the side effect that people would just set "ignore" flags on those warnings? On the other hand, I don't see what else we could put in place 😅 |
@mikecp I get what you mean, but in my experience of doing this on other projects, that hasn't happened. And if it did, the pull request reviewers would be able to comment about it and hopefully it wouldn't be a problem 👍 |
Yes it's true, we'll just need to watch out 😁 |
@mikecp it will take a while to remove all warnings from some of the projects, anyway. Perhaps, if HQ are happy to try this, we could merge this PR with warnings as errors initially, and see how it goes? |
@emmagarland Yes indeed I guess we could give it a try if that would be OK for HQ. And it shouldn't be too complex to come back to the current situation if needed 😉 |
Hey y'all HQ is ok with the approach. As soon as all warnings have been removed in a given project, this setting can be turned on for that project. Thanks for all the work @emmagarland #H5YR! |
Ah that's amazing! Thanks so much @Migaroez for sorting. I'll hopefully get some time to do some more on Friday. 😃 |
… hotfix/15015-warnings-aserrors
(Switching back to draft as more warnings have been introduced since the initial PR that I need to fix/remove) |
@Migaroez It's been a while, but I've merged from v14 and removed some where warnings had come in, but there's still a fair few warnings as errors switched on here. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great initiative! A cleaner way to gradually enable this on all projects would be to add <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
to Directory.Build.props
(in the property group next to WarningsAsErrors
, omitting the conditions used in this PR) and then disable them per project:
<PropertyGroup>
<!-- TODO: Fix all warnings and remove this override -->
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
Or only for specific warning numbers, like CS0618
(referenced obsolete members):
<PropertyGroup>
<!-- TODO: Remove all usages of obsolete members and remove this override -->
<WarningsNotAsErrors>CS0618</WarningsNotAsErrors>
</PropertyGroup>
Package validation uses a similar approach:
Umbraco-CMS/Directory.Build.props
Line 32 in d105968
<EnablePackageValidation>true</EnablePackageValidation> |
<EnablePackageValidation>false</EnablePackageValidation> |
Cool, I like that idea @ronaldbarendse. I'll tweak that later and push the updates. |
…ings where appropriate as per PR review suggestions.
This reverts commit 3734c45.
Hi @ronaldbarendse and @Migaroez Thanks for the suggestion, I've now updated as per the PR request to update the Please let me know if you have any other feedback, Thanks Emma |
Hey Emma, I am still seeing a few errors creep up on your branch
|
Thanks Sven, I didn’t catch that locally when I built it so I’ll check it
out later today
…On Mon, 26 Aug 2024 at 11:50, Sven Geusens ***@***.***> wrote:
Hey Emma, I am still seeing a few errors creep up on your branch
GoogleBackOfficeExternalLoginProviderOptions.cs(30, 40): [CS0618] 'Constants.Security.EditorGroupAlias' is obsolete: 'Use EditorGroupKey instead. Scheduled for removal in V15.'
ContextualAuthorizeAttribute.cs(114, 41): [CS1998] This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.
ContextualAuthorizeAttribute.cs(72, 9): [SA1117] The parameters should all be placed on the same line or each parameter should be placed on its own line (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1117.md)
GoogleBackOfficeExternalLoginProviderOptions.cs(43, 9): [SA1111] Closing parenthesis should be on line of last parameter (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1111.md)
PerformanceHelper.cs(11, 14): [SA1649] File name should match first type name (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1649.md)
—
Reply to this email directly, view it on GitHub
<#15019 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMSZPYIAYT7AP6SYA73AMDZTMCAVAVCNFSM6AAAAAA6LAU2OWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBZHEYTOMBXGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I am an idiot, these things are from my test stash🤦 All good to go. The only thing that worries me is the pipeline failing on the code analyzers. I had a similar issue when first checking out your branch. But it got auto resolved after swapping branches back and forth 🤷 I can't find any packages that are different from v14/dev... |
…Microsoft.CodeAnalysis.CSharp.Workspaces 4.10.0
I added 2 commits. The sdk one is cherry picked from #16963 so the pipeline can run before merging into contrib |
Nice one @Migaroez, sounds good with those cherry picked build fixes! |
Treat warnings as errors for initial projects:
Prerequisites
If there's an existing issue for this PR then this fixes #15015
Description
There are numerous warnings in the Umbraco source code. I have created an issue #15015 to suggest removing these warnings.
To ensure that warnings don't creep back in, I propose setting warnings as errors project-by-project (as these warnings are removed). This will help ensure that we no longer end up in a situation with so many warnings, because people/the build server will not be able to compile the code with warnings in it.
(Conversations with HQ have approved this initiative)