Skip to content

Commit d0e8c6e

Browse files
authored
Merge pull request #1 from deniszykov/master
Take from base repo
2 parents cd45e33 + 3533e2b commit d0e8c6e

File tree

4 files changed

+99
-91
lines changed

4 files changed

+99
-91
lines changed

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ Installation
1010
```
1111
Install-Package CodeContractsRemover
1212
```
13+
or
14+
```
15+
Download and un-zip from https://www.nuget.org/api/v2/package/CodeContractsRemover
16+
```
1317

1418
Usage
1519
============
1620
Tool is located at "PROJECT_DIR/packages/CodeContractsRemover.VERSION/tools/".
1721

1822
```bash
19-
CodeContractsRemover.exe <Convert|Remove> <directoryPath> [--searchPattern *.cs *.csproj] [--encoding utf-8] [--ignorePattern .svn/ ]
23+
CodeContractsRemover.exe <Convert|Stats> <directoryPath> [--searchPattern *.cs *.csproj] [--encoding utf-8] [--ignorePattern .svn/ ]
2024
```
2125
Example
2226
```bash
@@ -43,7 +47,7 @@ To run using [mono](http://www.mono-project.com/download/#download-lin) on Linux
4347
- 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).
4448
- Removes CodeContract properties and constants from project files
4549

46-
#### Mode - Remove
50+
~~#### Mode - Remove~~
4751
- Removes any [Contract](https://msdn.microsoft.com/en-us/library/system.diagnostics.contracts.contract(v=vs.110).aspx) invocations.
4852
- Invariant methods are preserved
4953
- Attributes and Contract classes are removed
@@ -74,3 +78,7 @@ Include annotations only for work in Visual Studio/Rider before compilation. Whe
7478
#### Mode - IncludeIntoBinaries
7579
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/).
7680

81+
# Contributors
82+
* @ishatalkin
83+
* @mgaffigan
84+

src/CodeContractsRemover/CS/ContractCSharpSyntaxRewriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public ContractCSharpSyntaxRewriter(ContractReplacementMode mode)
1616
{
1717
var modes = new[] {ContractReplacementMode.Convert, ContractReplacementMode.ConvertAndAddAnnotations};
1818
if(!modes.Contains(mode))
19-
throw new ArgumentOutOfRangeException(nameof(mode), mode, $"Use only {string.Join(", ", modes)}");
19+
throw new ArgumentOutOfRangeException(nameof(mode), mode, $"Mode '${mode}' is not supported. Use only {string.Join(", ", modes)}");
2020

2121
_mode = mode;
2222
}
Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,85 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
<PropertyGroup>
3-
<TargetFramework>net472</TargetFramework>
4-
<Authors>Denis Zykov</Authors>
5-
<Version>1.0.7</Version>
6-
<PackageProjectUrl>https://github.com/deniszykov/code-contracts-remover</PackageProjectUrl>
7-
<PackageLicenseUrl>https://raw.githubusercontent.com/deniszykov/code-contracts-remover/master/LICENSE</PackageLicenseUrl>
8-
<Copyright>(c) Denis Zykov, GameDevWare 2019</Copyright>
9-
<RepositoryUrl>https://github.com/deniszykov/code-contracts-remover</RepositoryUrl>
10-
<RepositoryType>git</RepositoryType>
11-
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
12-
<PackageTags>code contracts tool</PackageTags>
13-
<PackageReleaseNotes />
14-
<ApplicationIcon />
15-
<OutputType>Exe</OutputType>
16-
<StartupObject />
17-
<IsTool>true</IsTool>
18-
</PropertyGroup>
19-
<Target Name="Repack" AfterTargets="BuiltProjectOutputGroup" Condition="' $(TargetFramework)' != '' AND '$(GeneratePackageOnBuild)' == 'true' ">
20-
<GetFrameworkPath>
21-
<Output TaskParameter="Path" PropertyName="FrameworkPath" />
22-
</GetFrameworkPath>
23-
<ItemGroup>
24-
<NetPlatformFolders Include="$(NuGetPackageFolders.Split(';'))" />
25-
</ItemGroup>
26-
<ItemGroup>
27-
<AllowDup Include="JetBrains.%2A" />
28-
</ItemGroup>
29-
<ItemGroup>
30-
<RapackTarget Include="$(TargetDir)Microsoft.Build.Framework.dll" />
31-
<RapackTarget Include="$(TargetDir)Microsoft.Build.dll" />
32-
<RapackTarget Include="$(TargetDir)Microsoft.Build.Framework.dll" />
33-
<RapackTarget Include="$(TargetDir)Microsoft.CodeAnalysis.CSharp.dll" />
34-
<RapackTarget Include="$(TargetDir)Microsoft.CodeAnalysis.CSharp.Workspaces.dll" />
35-
<RapackTarget Include="$(TargetDir)Microsoft.CodeAnalysis.dll" />
36-
<RapackTarget Include="$(TargetDir)Microsoft.CodeAnalysis.VisualBasic.dll" />
37-
<RapackTarget Include="$(TargetDir)Microsoft.CodeAnalysis.dll" />
38-
<RapackTarget Include="$(TargetDir)Microsoft.CodeAnalysis.VisualBasic.dll" />
39-
<RapackTarget Include="$(TargetDir)Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll" />
40-
<RapackTarget Include="$(TargetDir)Microsoft.CodeAnalysis.Workspaces.dll" />
41-
<RapackTarget Include="$(TargetDir)System.Buffers.dll" />
42-
<RapackTarget Include="$(TargetDir)System.Collections.Immutable.dll" />
43-
<RapackTarget Include="$(TargetDir)System.Composition.AttributedModel.dll" />
44-
<RapackTarget Include="$(TargetDir)System.Composition.Convention.dll" />
45-
<RapackTarget Include="$(TargetDir)System.Composition.Hosting.dll" />
46-
<RapackTarget Include="$(TargetDir)System.Composition.Runtime.dll" />
47-
<RapackTarget Include="$(TargetDir)System.Composition.TypedParts.dll" />
48-
<RapackTarget Include="$(TargetDir)System.Memory.dll" />
49-
<RapackTarget Include="$(TargetDir)System.Numerics.Vectors.dll" />
50-
<RapackTarget Include="$(TargetDir)System.Reflection.Metadata.dll" />
51-
<RapackTarget Include="$(TargetDir)System.Text.Encoding.CodePages.dll" />
52-
<RapackTarget Include="$(TargetDir)System.Threading.Tasks.Dataflow.dll" />
53-
<RapackTarget Include="$(TargetDir)System.Threading.Tasks.Extensions.dll" />
54-
<RapackTarget Include="$(TargetDir)ConsoleApp.CommandLine.dll" />
55-
<RapackTarget Include="$(TargetDir)Microsoft.VisualStudio.Setup.Configuration.Interop.dll" />
56-
<RapackTarget Include="$(TargetDir)System.Runtime.CompilerServices.Unsafe.dll" />
57-
</ItemGroup>
58-
<PropertyGroup>
59-
<ILRepack Condition="'$(ILRepack)' == ''">$(NuGetPackageRoot)ilrepack\2.1.0-beta1\tools\ILRepack.exe</ILRepack>
60-
<ILRepackTargetPlatform>v4,$(FrameworkPath)</ILRepackTargetPlatform>
61-
<IlRepackSignKey>$(ProjectDir)sign.snk</IlRepackSignKey>
62-
<IlRepackAllowDup>@(AllowDup->'"/allowdup:%(Identity)"', ' ')</IlRepackAllowDup>
63-
<IlRepackTargets>@(RapackTarget->'"%(Identity)"', ' ')</IlRepackTargets>
64-
</PropertyGroup>
65-
<Exec Command="&quot;$(ILRepack)&quot; /target:exe &quot;/targetplatform:$(ILRepackTargetPlatform)&quot; &quot;/keyfile:$(IlRepackSignKey)&quot; /xmldocs /union /parallel /internalize $(IlRepackAllowDup) &quot;/out:$(TargetPath)&quot; &quot;$(TargetPath)&quot; $(IlRepackTargets)" WorkingDirectory="$(ProjectDir)" />
66-
<Delete Files="@(RapackTarget)" />
67-
</Target>
68-
<ItemGroup>
69-
<Compile Remove="Temp\**" />
70-
<EmbeddedResource Remove="Temp\**" />
71-
<None Remove="Temp\**" />
72-
</ItemGroup>
73-
<ItemGroup>
74-
<PackageReference Include="ConsoleApp.CommandLine" Version="1.3.2" />
75-
<PackageReference Include="Microsoft.Build" Version="16.0.461" />
76-
<PackageReference Include="Microsoft.CodeAnalysis" Version="3.0.0" />
77-
<PackageReference Include="ILRepack" Version="2.1.0-beta1" />
78-
</ItemGroup>
79-
<ItemGroup>
80-
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
81-
</ItemGroup>
82-
<ItemGroup>
83-
<Folder Include="Properties\" />
84-
</ItemGroup>
85-
</Project>
2+
<PropertyGroup>
3+
<TargetFramework>net472</TargetFramework>
4+
<Authors>Denis Zykov, ishatalkin, mgaffigan</Authors>
5+
<Version>1.0.8</Version>
6+
<PackageProjectUrl>https://github.com/deniszykov/code-contracts-remover</PackageProjectUrl>
7+
<PackageLicenseUrl>https://raw.githubusercontent.com/deniszykov/code-contracts-remover/master/LICENSE</PackageLicenseUrl>
8+
<Copyright>(c) Denis Zykov, ishatalkin, mgaffigan</Copyright>
9+
<RepositoryUrl>https://github.com/deniszykov/code-contracts-remover</RepositoryUrl>
10+
<RepositoryType>git</RepositoryType>
11+
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
12+
<PackageTags>code contracts tool</PackageTags>
13+
<PackageReleaseNotes />
14+
<ApplicationIcon />
15+
<OutputType>Exe</OutputType>
16+
<StartupObject />
17+
<IsTool>true</IsTool>
18+
19+
</PropertyGroup>
20+
<Target Name="Repack" AfterTargets="BuiltProjectOutputGroup" Condition=" '$(TargetFramework)' != '' AND '$(GeneratePackageOnBuild)' != '' ">
21+
<GetFrameworkPath>
22+
<Output TaskParameter="Path" PropertyName="FrameworkPath" />
23+
</GetFrameworkPath>
24+
<ItemGroup>
25+
<NetPlatformFolders Include="$(NuGetPackageFolders.Split(';'))" />
26+
</ItemGroup>
27+
<ItemGroup>
28+
<AllowDup Include="JetBrains.%2A" />
29+
</ItemGroup>
30+
<ItemGroup>
31+
<RepackTarget Include="$(TargetDir)ConsoleApp.CommandLine.dll" />
32+
<RepackTarget Include="$(TargetDir)Humanizer.dll" />
33+
<RepackTarget Include="$(TargetDir)Microsoft.Bcl.AsyncInterfaces.dll" />
34+
<RepackTarget Include="$(TargetDir)Microsoft.Build.dll" />
35+
<RepackTarget Include="$(TargetDir)Microsoft.Build.Framework.dll" />
36+
<RepackTarget Include="$(TargetDir)Microsoft.CodeAnalysis.CSharp.dll" />
37+
<RepackTarget Include="$(TargetDir)Microsoft.CodeAnalysis.CSharp.Workspaces.dll" />
38+
<RepackTarget Include="$(TargetDir)Microsoft.CodeAnalysis.dll" />
39+
<RepackTarget Include="$(TargetDir)Microsoft.CodeAnalysis.VisualBasic.dll" />
40+
<RepackTarget Include="$(TargetDir)Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll" />
41+
<RepackTarget Include="$(TargetDir)Microsoft.CodeAnalysis.Workspaces.dll" />
42+
<RepackTarget Include="$(TargetDir)Microsoft.VisualStudio.Setup.Configuration.Interop.dll" />
43+
<RepackTarget Include="$(TargetDir)System.Buffers.dll" />
44+
<RepackTarget Include="$(TargetDir)System.Collections.Immutable.dll" />
45+
<RepackTarget Include="$(TargetDir)System.Composition.AttributedModel.dll" />
46+
<RepackTarget Include="$(TargetDir)System.Composition.Convention.dll" />
47+
<RepackTarget Include="$(TargetDir)System.Composition.Hosting.dll" />
48+
<RepackTarget Include="$(TargetDir)System.Composition.Runtime.dll" />
49+
<RepackTarget Include="$(TargetDir)System.Composition.TypedParts.dll" />
50+
<RepackTarget Include="$(TargetDir)System.Memory.dll" />
51+
<RepackTarget Include="$(TargetDir)System.Numerics.Vectors.dll" />
52+
<RepackTarget Include="$(TargetDir)System.Reflection.Metadata.dll" />
53+
<RepackTarget Include="$(TargetDir)System.Runtime.CompilerServices.Unsafe.dll" />
54+
<RepackTarget Include="$(TargetDir)System.Text.Encoding.CodePages.dll" />
55+
<RepackTarget Include="$(TargetDir)System.Threading.Tasks.Dataflow.dll" />
56+
<RepackTarget Include="$(TargetDir)System.Threading.Tasks.Extensions.dll" />
57+
</ItemGroup>
58+
<PropertyGroup>
59+
<ILRepack Condition="'$(ILRepack)' == ''">$(NuGetPackageRoot)ilrepack\2.1.0-beta1\tools\ILRepack.exe</ILRepack>
60+
<ILRepackTargetPlatform>v4,$(FrameworkPath)</ILRepackTargetPlatform>
61+
<IlRepackSignKey>$(ProjectDir)sign.snk</IlRepackSignKey>
62+
<IlRepackAllowDup>@(AllowDup->'"/allowdup:%(Identity)"', ' ')</IlRepackAllowDup>
63+
<IlRepackTargets>@(RepackTarget->'"%(Identity)"', ' ')</IlRepackTargets>
64+
</PropertyGroup>
65+
<Exec Command="&quot;$(ILRepack)&quot; /target:exe &quot;/targetplatform:$(ILRepackTargetPlatform)&quot; &quot;/keyfile:$(IlRepackSignKey)&quot; /xmldocs /union /parallel /internalize $(IlRepackAllowDup) &quot;/out:$(TargetPath)&quot; &quot;$(TargetPath)&quot; $(IlRepackTargets)" WorkingDirectory="$(ProjectDir)" />
66+
<Delete Files="@(RepackTarget)" />
67+
</Target>
68+
<ItemGroup>
69+
<Compile Remove="Temp\**" />
70+
<EmbeddedResource Remove="Temp\**" />
71+
<None Remove="Temp\**" />
72+
</ItemGroup>
73+
<ItemGroup>
74+
<PackageReference Include="ConsoleApp.CommandLine" Version="1.3.4" />
75+
<PackageReference Include="Microsoft.Build" Version="16.6.0" />
76+
<PackageReference Include="Microsoft.CodeAnalysis" Version="3.7.0" />
77+
<PackageReference Include="ILRepack" Version="2.1.0-beta1" PrivateAssets="all" />
78+
</ItemGroup>
79+
<ItemGroup>
80+
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
81+
</ItemGroup>
82+
<ItemGroup>
83+
<Folder Include="Properties\" />
84+
</ItemGroup>
85+
</Project>

src/CodeContractsRemoverTests/CodeContractsRemoverTests.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<PackageReference Include="ApprovalUtilities" Version="5.4.2" />
6666
<PackageReference Include="DiffEngine" Version="6.0.0" />
6767
<PackageReference Include="EmptyFiles" Version="2.0.5" />
68-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.4" />
68+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="3.1.8" />
6969
<PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" />
7070
<PackageReference Include="NUnit" Version="3.12.0" />
7171
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
@@ -74,9 +74,9 @@
7474
<PackageReference Include="System.Security.AccessControl" Version="4.7.0" />
7575
<PackageReference Include="System.Security.Principal.Windows" Version="4.7.0" />
7676
<PackageReference Include="TextCopy" Version="4.2.0" />
77-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
78-
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
79-
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
77+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
78+
<PackageReference Include="MSTest.TestAdapter" Version="2.1.2" />
79+
<PackageReference Include="MSTest.TestFramework" Version="2.1.2" />
8080
</ItemGroup>
8181
<ItemGroup>
8282
<ProjectReference Include="..\CodeContractsRemover\CodeContractsRemover.csproj" />

0 commit comments

Comments
 (0)