Skip to content
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

How to declare all CS* warnings as errors within .editorconfig #52051

Closed
TiltonJH opened this issue Mar 22, 2021 · 7 comments
Closed

How to declare all CS* warnings as errors within .editorconfig #52051

TiltonJH opened this issue Mar 22, 2021 · 7 comments
Labels
Area-Compilers fabric-bot-test Testing the impact of changes to the fabric bot Need More Info The issue needs more information to proceed.

Comments

@TiltonJH
Copy link

TiltonJH commented Mar 22, 2021

I am missing the announcement of a major braking change in Summary of What's New in this Release of Visual Studio 2019 version 16.9.0.

#43051 broke hundreds of solution builds over thousands of projects for us. :-(

TreatWarningsAsErrors has changed its scope. In the past it only ever effected CS* messages. Now it affects all others (SA*, CA*, IDE*, ...) as well. We are actually expecting the project based .editorconfig to override the more general rules of MsBuild.

And still I am grateful that is has changed. In the past I was always wondering why TreatWarningsAsErrors did not affect all warnings and things like StyleCopTreatErrorsAsWarnings or CodeAnalysisTreatWarningsAsErrors had to be used.

To repair our builds I will need to remove all TreatWarningsAsErrors from everywhere and only make use of the .editorconfig to tailor project individual settings. Can someone point me to where I can find a way to declare all CS* warnings as errors without listing each single one in the .editorconfig?

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead labels Mar 22, 2021
@sharwell
Copy link
Member

sharwell commented Mar 22, 2021

In the past [TreatWarningsAsErrors] only ever effected CS* messages.

Note that this is not correct in the broader scope. The property has always affected all messages (including messages produced by analyzers) outside of one edge case that only existed for a limited time. 16.9 restored the original behavior of this flag in the context of the edge case.

@sharwell
Copy link
Member

This appears to be a duplicate of #16535

@TiltonJH
Copy link
Author

TiltonJH commented Mar 23, 2021

Yes, I agree. :-)

Once my initial anger and confusion had lifted, I understood why this got changed/fixed.

However, if one uses any kind of stable and therefore predictable system, one adjust one self to it. Or in other words, one starts to dependent on it. Change is then perceived as somewhat of an evil thing. So some kind of warning would have been nice. And we would have been able to postpone the usage of VS 16.9. until we got our builds adjusted.

Looking at #16535, yes this is kind of a duplicate.

Going forward I will most likely remove all the usage of TreatWarningsAsErrors is our system and replace it with more precise adjustment within the .editorconfig. I am still looking for a way to declare all CS* warnings as errors within a .editorconfig. Thinking about it, I like to be able to make all warnings into error (SA and CA as well as IDE ...) and then push a few of those back to warning. (Like CS0618 for example or CS1591 only within our test projects et cetera.)

Is there a way already?

@TiltonJH TiltonJH changed the title How to declare all CS* warnings as errors or how #43051 broke all of our builds. How to declare all CS* warnings as errors within .editorconfig Mar 23, 2021
@TiltonJH
Copy link
Author

Something like

dotnet_diagnostic.CS*.severity = error
dotnet_diagnostic.CS1591.severity = warning

would be nice.

@jaredpar
Copy link
Member

This appears to be a duplicate of #16535

That issue seems to cover treating the diagnostics differently depending on the context: compilation vs. VS analysis. This issue is more about how to make blanket exclusions. Where are you seeing the link here that I'm missing?

Something like

@mavasani @chsienki is there a mechanism like this or a feature tracking one?

@jaredpar jaredpar added Need More Info The issue needs more information to proceed. and removed untriaged Issues and PRs which have not yet been triaged by a lead labels Mar 23, 2021
@mavasani
Copy link
Contributor

We have had similar globbing based diagnostic configuration requests in the past: #16535 (comment)

@ghost ghost added the fabric-bot-test Testing the impact of changes to the fabric bot label Aug 10, 2021
@ghost ghost closed this as completed Sep 15, 2021
@ghost
Copy link

ghost commented Sep 15, 2021

Closing this issue as we've seen no reply to the request for more information. If you are able to get the requested information, please add it to the issue and we will retriage it.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Compilers fabric-bot-test Testing the impact of changes to the fabric bot Need More Info The issue needs more information to proceed.
Projects
None yet
Development

No branches or pull requests

5 participants