I'm writing in C# with ReSharper 8.0 and VS2012 for .NET 4.0.
ReSharper includes an attribute: JetBrains.Annotations.PureAttribute. This is used to provide the inspection "Return value of Pure method is not used".
Code Contracts includes an attribute: System.Diagnostics.Contracts.PureAttribute. This is used by the code contract checking to ensure that the call will produce no visible state changes, and therefore will not require re-checking the object's state.
Currently, to get the functionality of both of these tools, methods need to be annotated with attribute from each. Worse, because they both share the same type name, you need to qualify each attribute.
[Pure]
[Jetbrains.Annotations.Pure]
public bool isFinished() {
...
To avoid this situation, there should be three approaches:
Are any of these possible?
ReSharper already understands System.Diagnostics.Contracts.PureAttribute
and treats it the same way as JetBrains.Annotations.PureAttribute
, so you can just use the one from Code Contracts, and both tools will be happy.