-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Set WarnAsError to false by default for build.cmd script #32027
Conversation
This doesn't feel like the right thing to do. Regular compiler warnings should be treated as errors, only the formatting warnings shouldn't. |
@AlekseyTs dude, what did you mean by this comment then?
Which problem with build.cmd were you referring to? When the CI accepts build warnings, and the IDE accepts build warnings, why should build.cmd default to disallowing them? Evidently (since the warnings were checked in in the first place) no quality gate blocks introducing these warnings. The getting started docs for this repo indicate a new user should run build.cmd to build the repo, and it has been broken for the last week because this is the only script that breaks on warnings. If we want to prevent warnings from creeping in, the right place to block them is at least the CI/PR system so they are never allowed to be shared. If after that, build.cmd wants to help make that a measurable bar in a local build, that's fine. |
By the comment I mean that warnings about formatting (they are not reported by the compiler and are added for Roslyn recently with intent that they will not be considered as errors) should not be treated as errors. That doesn't mean that all other warnings shouldn't be treated as errors. |
Actually, I believe they are reported by the compiler, since the compiler is what runs the In my projects, I solve this by making all local builds emit warnings, and then my PR/CI treat warnings as errors. This allows an efficient dev inner-loop where formatting and other warnings are permissible while developing, but the PR build ensures that they've been cleaned up before being merged. I also (sometimes) set the "Release" configuration to treat warnings as errors so that developers can easily run a local build that will fail if the PR build would fail, allowing them to fix the issues more consistently before submitting the PR in the first place. |
There is a way to specify that some specific warnings shouldn't be treated as errors. I could be wrong, but the set of formatting warnings is probably small and they all can be handled individually, at least for now. |
No, if you pass |
You can set See https://github.com/dotnet/roslyn/blob/master/eng/common/tools.ps1#L27 |
It would be better though to switch it off only for local builds, i.e. when |
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.
We should set this to false only when $ci
is $false
.
The same should be done in build.sh
.
This would result in excluding both |
You can pass
Can you elaborate a bit? |
This script isn't used for CI builds anyway. If it were, the build warnings that crept in recently wouldn't have been allowed. |
|
@AArnott It is used for CI: |
@sharwell What's the intent? Is it to have IDE055 reported on command line (both locally and in the CI) as an error, but in IDE as a warning? |
@tmat IDE0055 should be reported in CI, command line, and IDE as a warning. All other warnings should be reported as warnings in the IDE, but errors in both CI and command line. |
@sharwell Removing I think this should do what we want:
|
@tmat IDE0055 is expected to be reported as a warning on the command line. This design is incompatible with |
I see. I don't think such design is viable then with the current msbuild capabilities. Maintaining list of all possible warning IDs that non-C# tasks may report is not reasonable. I think we need a new switch For now, as a workaround, we can set |
The MSBuild |
Closing as the issue has been addressed by #32152. |
As requested in #31993 (comment)