You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31-5Lines changed: 31 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,13 +36,39 @@ To run using [mono](http://www.mono-project.com/download/#download-lin) on Linux
36
36
## Modes
37
37
38
38
#### Mode - Convert
39
-
- Converts all [Contract.Requires](https://msdn.microsoft.com/en-us/library/system.diagnostics.contracts.contract.requires(v=vs.110).aspx) to "if(!x) throw new ArgumentException()" pattern.
40
-
- Converts all [Contract.Assert](https://msdn.microsoft.com/en-us/library/system.diagnostics.contracts.contract.assert(v=vs.110).aspx) to [Debug.Assert](https://msdn.microsoft.com/en-us/library/system.diagnostics.debug.assert(v=vs.110).aspx)
41
-
- Removes any other [Contract](https://msdn.microsoft.com/en-us/library/system.diagnostics.contracts.contract(v=vs.110).aspx) invocations.
42
-
- Invariant methods are preserved
43
-
- Attributes and Contract classes are removed
39
+
- Converts all [Contract.Requires](https://msdn.microsoft.com/en-us/library/system.diagnostics.contracts.contract.requires(v=vs.110).aspx) to "if(!x) throw new ArgumentException()" pattern at the beginning of method/property/constructor.
40
+
- Converts all [Contract.Ensures](https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.contracts.contract.ensures?view=netcore-3.1) to "if(!x) throw new InvalidOperationException()" pattern before each return incide method/property/constructor.
41
+
- Converts all [Contract.Assert](https://msdn.microsoft.com/en-us/library/system.diagnostics.contracts.contract.assert(v=vs.110).aspx) and [Contract.Assume](https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.contracts.contract.assume?view=netcore-3.1) to "if(!x) throw new ArgumentException()" pattern.
42
+
- Invokes invariant methods before each return incide method/property/constructor.
43
+
- Preserves all other [Contract](https://msdn.microsoft.com/en-us/library/system.diagnostics.contracts.contract(v=vs.110).aspx) invocations (including Attributes and Contract classes).
44
+
- Removes CodeContract properties and constants from project files
44
45
45
46
#### Mode - Remove
46
47
- Removes any [Contract](https://msdn.microsoft.com/en-us/library/system.diagnostics.contracts.contract(v=vs.110).aspx) invocations.
47
48
- Invariant methods are preserved
48
49
- Attributes and Contract classes are removed
50
+
- Removes CodeContract properties and constants from project files
51
+
52
+
#### Mode - Stats
53
+
- Collects statistics about how [Contracts](https://msdn.microsoft.com/en-us/library/system.diagnostics.contracts.contract(v=vs.110).aspx) are used. Example of result:
54
+
[ContractClassFor] 1
55
+
[ContractInvariantMethod] 2
56
+
Contract.Assert 1
57
+
Contract.Ensures 6
58
+
Contract.Invariant 2
59
+
Contract.Requires 6
60
+
Contract.Result 5
61
+
62
+
## Annotation modes
63
+
64
+
In Convert mode [Jet Brains annotations](https://blog.jetbrains.com/dotnet/2018/05/02/improving-rider-resharper-code-analysis-using-jetbrains-annotations/) ([NotNull]) can be added to class members. Jet Brains annotations are added using [JetBrains.Annotations NuGet package](https://www.nuget.org/packages/JetBrains.Annotations/).
65
+
66
+
#### Mode - None
67
+
Don't add annotations
68
+
69
+
#### Mode - Add
70
+
Include annotations only for work in Visual Studio/Rider before compilation. When project is compiled, annotations would be removed. When dll is referenced into other project, Rider/Re# wouldn't show hints. This mode is recommended for applications. Read more on [Jet Brains site](https://blog.jetbrains.com/dotnet/2015/08/12/how-to-use-jetbrains-annotations-to-improve-resharper-inspections/).
71
+
72
+
#### Mode - IncludeIntoBinaries
73
+
Annotations will be included into binaries, so Rider/Re# would show hints before and after compilation (when binary is referenced into other project). This mode is recommended for packages. Read more on [Jet Brains site](https://blog.jetbrains.com/dotnet/2015/08/12/how-to-use-jetbrains-annotations-to-improve-resharper-inspections/).
0 commit comments