Reputation: 1775
Is there any standard code annotation which would warn developpers that a method, a property or a field should not be renamed while refactoring?
As complex project evolves, it is good practice to rename some methods / variables to better suit the new perimeter.
Problem is : if this method/property was exposed through an interface (or stored into an external system not directly tied to the codebase), you can introduce breaking changes without being aware of it before automatic testing.
So, as a trade-off between don't mess with existing code and keep variable names accurate, I was wondering if there is any standard way to signal that a piece of code should not be changed in the future?
Ideally, trying to change it would trigger a "if you do that, things will break and you will have a tough time. Please sign this waiver." warning.
The ///DO NOT CHANGE
comment from this example seems a bit old-fashioned, is there anything better? I am using VS 2019 and Resharper.
Upvotes: 1
Views: 166
Reputation: 106
Depending on how liberally you interpret "standard", I think you want the PublicAPIAttribute from JetBrains.Annotations.
Upvotes: 1