-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[Built-in analyzer] Property that starts with an underscore is set #9891
Comments
How about props/targets files in NuGet packages; are underscores okay in those? I hope it won't be based on whether the package name starts with "Microsoft." |
"What is the scope of this analysis" is definitely the key question here. I think initially it should be "code in the repo doesn't do this"; eventually a nice extension would be "don't touch private variables that don't belong to you", with some kind of detection where like paired props/targets or "within a NuGet package" are allowed but not touching "someone else's". |
The |
@JanKrivanek many MSBuild-prefix properties are intended to be set in user code, like |
We might seed this with some initial list of reserved properties (beyond the |
I think, as a user, that I'd prefer to have that split in three error codes:
Mostly just so the docs page for the error can be super clear about remediation, especially around 3. |
I like that idea. (all those rules would still be contained within single executing BuildCheck) |
Suggestion by @rainersigwald: the configurable deny list would be nice to have it's own code (so different rule in same Check) |
Background
This issue tracks one of the BuildCheck analyzers we would like to ship in-box with MSBuild.
Goal
Implement an analyzer with the following rule: Properties whose name starts with an underscore should not be set in project files that are part of the project (as opposed to SDK project files).
Notes
By convention, the leading underscore is used to mark properties as internal to common targets or SDK, and not expected to be modified by the user.
The text was updated successfully, but these errors were encountered: