diff --git a/.gitignore b/.gitignore index d4e47a0..cba84c6 100644 --- a/.gitignore +++ b/.gitignore @@ -170,3 +170,9 @@ $RECYCLE.BIN/ .DS_Store ContractExtensions.sln.ide /ContractExtensions/bin.R82/lib +/ContractExtensions/bin/lib +*.nupkg +.vs/ + +/ContractExtensions/Scripts/ +/ReSharper.ContractExtensions.Tests/Scripts/ \ No newline at end of file diff --git a/ContractExtensions.nuspec b/ContractExtensions.nuspec index 960f2b3..6bc82f4 100644 --- a/ContractExtensions.nuspec +++ b/ContractExtensions.nuspec @@ -1,11 +1,11 @@ - + ReSharper.ContractExtensions - 0.9.0.2 + 0.9.2.0 Code Contract editing extensions - Sergey Teplyakov + Sergey Teplyakov, https://github.com/Diagonactic SergeyTeplyakov https://github.com/SergeyTeplyakov/ReSharperContractExtensions https://github.com/SergeyTeplyakov/ReSharperContractExtensions/raw/master/Content/DesignByContract.ico @@ -14,7 +14,16 @@ Simplifies adding preconditions, postconditions and object invariant during day-to-day activities. Detects Code Contract error/warnings in the IDE. + + + + +*What's new in 0.9.2.0* +Updated to API for ReSharper 9.2 +Minor bug fixes. +Support for nameof(s) in requires + *What's new in 0.9.0.2* Fixed false positive warnings on Code Contract preconditions in the async methods and iterator blocks (#48) Added quick fix for "suspicious legacy precondition" in async methods and iterator blocks. @@ -87,14 +96,9 @@ New features (v.0.6.0) Bug fixes - Fixed issue with invalid order of Contract.Invariant statements in the object invariant method. - - - code contracts design by contract - - - + diff --git a/ContractExtensions.sln b/ContractExtensions.sln index 4b9dae4..c1bb217 100644 --- a/ContractExtensions.sln +++ b/ContractExtensions.sln @@ -1,13 +1,12 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.21005.1 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ReSharper.ContractExtensions", "ContractExtensions\ReSharper.ContractExtensions.csproj", "{015F0C46-EB80-40FA-A508-CAD66B02B7E6}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{A30DAFF8-9B8B-447A-801F-15337A16833D}" ProjectSection(SolutionItems) = preProject - TODO.txt = TODO.txt UsefullNotes.txt = UsefullNotes.txt EndProjectSection EndProject @@ -40,23 +39,18 @@ Global {45CDD107-FF9E-4C98-BCC7-0151953B6CAA}.Release|Any CPU.ActiveCfg = Release|Any CPU {45CDD107-FF9E-4C98-BCC7-0151953B6CAA}.Release|Any CPU.Build.0 = Release|Any CPU {E4AF008B-F55E-495A-8F54-AFFF5B43E500}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E4AF008B-F55E-495A-8F54-AFFF5B43E500}.Debug|Any CPU.Build.0 = Debug|Any CPU {E4AF008B-F55E-495A-8F54-AFFF5B43E500}.Release|Any CPU.ActiveCfg = Release|Any CPU {E4AF008B-F55E-495A-8F54-AFFF5B43E500}.Release|Any CPU.Build.0 = Release|Any CPU {B0A3DCD3-5B44-4E3B-9208-42C9AD545D35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B0A3DCD3-5B44-4E3B-9208-42C9AD545D35}.Debug|Any CPU.Build.0 = Debug|Any CPU {B0A3DCD3-5B44-4E3B-9208-42C9AD545D35}.Release|Any CPU.ActiveCfg = Release|Any CPU {B0A3DCD3-5B44-4E3B-9208-42C9AD545D35}.Release|Any CPU.Build.0 = Release|Any CPU {9751E034-79DD-4AA8-A308-89E44E8C2C0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9751E034-79DD-4AA8-A308-89E44E8C2C0C}.Debug|Any CPU.Build.0 = Debug|Any CPU {9751E034-79DD-4AA8-A308-89E44E8C2C0C}.Release|Any CPU.ActiveCfg = Release|Any CPU {9751E034-79DD-4AA8-A308-89E44E8C2C0C}.Release|Any CPU.Build.0 = Release|Any CPU {056D871D-0F3D-43C3-9EE3-FAD4B18BF3D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {056D871D-0F3D-43C3-9EE3-FAD4B18BF3D9}.Debug|Any CPU.Build.0 = Debug|Any CPU {056D871D-0F3D-43C3-9EE3-FAD4B18BF3D9}.Release|Any CPU.ActiveCfg = Release|Any CPU {056D871D-0F3D-43C3-9EE3-FAD4B18BF3D9}.Release|Any CPU.Build.0 = Release|Any CPU {1FD4BE17-1953-4803-A4D3-D01C92F794DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1FD4BE17-1953-4803-A4D3-D01C92F794DD}.Debug|Any CPU.Build.0 = Debug|Any CPU {1FD4BE17-1953-4803-A4D3-D01C92F794DD}.Release|Any CPU.ActiveCfg = Release|Any CPU {1FD4BE17-1953-4803-A4D3-D01C92F794DD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection diff --git a/ContractExtensions/ContextActions/ContractsFor/AddContractClassAvailability.cs b/ContractExtensions/ContextActions/ContractsFor/AddContractClassAvailability.cs index fdf9d99..a8f424f 100644 --- a/ContractExtensions/ContextActions/ContractsFor/AddContractClassAvailability.cs +++ b/ContractExtensions/ContextActions/ContractsFor/AddContractClassAvailability.cs @@ -1,7 +1,6 @@ using System.Diagnostics.Contracts; using System.Linq; -using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; -using JetBrains.ReSharper.Feature.Services.Generate; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.ReSharper.Psi.Tree; diff --git a/ContractExtensions/ContextActions/ContractsFor/AddContractClassContextAction.cs b/ContractExtensions/ContextActions/ContractsFor/AddContractClassContextAction.cs index 8f00774..54ed544 100644 --- a/ContractExtensions/ContextActions/ContractsFor/AddContractClassContextAction.cs +++ b/ContractExtensions/ContextActions/ContractsFor/AddContractClassContextAction.cs @@ -1,5 +1,7 @@ using System.Diagnostics.Contracts; using JetBrains.ReSharper.Feature.Services.Bulbs; +using JetBrains.ReSharper.Feature.Services.ContextActions; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; using ReSharper.ContractExtensions.ContextActions.Infrastructure; diff --git a/ContractExtensions/ContextActions/ContractsFor/AddContractClassExecutor.cs b/ContractExtensions/ContextActions/ContractsFor/AddContractClassExecutor.cs index 95f84fe..025fc1b 100644 --- a/ContractExtensions/ContextActions/ContractsFor/AddContractClassExecutor.cs +++ b/ContractExtensions/ContextActions/ContractsFor/AddContractClassExecutor.cs @@ -4,6 +4,7 @@ using System.Linq; using JetBrains.Application.Progress; using JetBrains.Application.Settings; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Generate; using JetBrains.ReSharper.Feature.Services.Generate; @@ -162,7 +163,7 @@ private void ImplementContractForAbstractClass(IClassDeclaration contractClass, workflow.Context.InputElements.AddRange(workflow.Context.ProvidedElements); - workflow.GenerateAndFinish("Generate contract class", NullProgressIndicator.Instance); + workflow.Generate("Generate contract class", NullProgressIndicator.Instance); } } @@ -194,20 +195,20 @@ private void ImplementContractForInterface(IClassDeclaration contractClass, return; using (var workflow = GeneratorWorkflowFactory.CreateWorkflowWithoutTextControl( - GeneratorStandardKinds.Implementations, + GeneratorStandardKinds.MissingMembers, contractClass, interfaceDeclaration)) { Contract.Assert(workflow != null); - workflow.Context.SetGlobalOptionValue( - CSharpBuilderOptions.ImplementationKind, - CSharpBuilderOptions.ImplementationKindExplicit); - workflow.Context.InputElements.Clear(); workflow.Context.InputElements.AddRange(workflow.Context.ProvidedElements); - workflow.GenerateAndFinish("Generate contract class", NullProgressIndicator.Instance); + workflow.Context.SetOption( + CSharpBuilderOptions.ImplementationKind, + CSharpBuilderOptions.ImplementationKindExplicit); + + workflow.Generate("Generate contract class", NullProgressIndicator.Instance); } } @@ -246,8 +247,8 @@ private void AddNonDefaultConstructorIfNeeded(IClassDeclaration contractClass) { workflow.Context.InputElements.Clear(); workflow.Context.InputElements.Add(ctor); - workflow.BuildInputOptions(); - workflow.GenerateAndFinish("Generate missing constructor", NullProgressIndicator.Instance); + workflow.BuildOptions(); + workflow.Generate("Generate missing constructor", NullProgressIndicator.Instance); } } diff --git a/ContractExtensions/ContextActions/Ensures/ComboEnsuresAvailability.cs b/ContractExtensions/ContextActions/Ensures/ComboEnsuresAvailability.cs index 616e5a8..2146ee4 100644 --- a/ContractExtensions/ContextActions/Ensures/ComboEnsuresAvailability.cs +++ b/ContractExtensions/ContextActions/Ensures/ComboEnsuresAvailability.cs @@ -1,4 +1,5 @@ using System.Diagnostics.Contracts; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; using JetBrains.ReSharper.Psi.CSharp.Tree; using ReSharper.ContractExtensions.ContextActions.ContractsFor; diff --git a/ContractExtensions/ContextActions/Ensures/ComboEnsuresContextAction.cs b/ContractExtensions/ContextActions/Ensures/ComboEnsuresContextAction.cs index 3ef9745..b1b7ed4 100644 --- a/ContractExtensions/ContextActions/Ensures/ComboEnsuresContextAction.cs +++ b/ContractExtensions/ContextActions/Ensures/ComboEnsuresContextAction.cs @@ -3,8 +3,9 @@ using JetBrains.Application.Progress; using JetBrains.ProjectModel; using JetBrains.ReSharper.Feature.Services.Bulbs; +using JetBrains.ReSharper.Feature.Services.ContextActions; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; -using JetBrains.ReSharper.Intentions.Extensibility; using JetBrains.TextControl; using JetBrains.Util; using ReSharper.ContractExtensions.ContextActions.Infrastructure; diff --git a/ContractExtensions/ContextActions/Ensures/ComboEnsuresExecutor.cs b/ContractExtensions/ContextActions/Ensures/ComboEnsuresExecutor.cs index f1db204..d07f777 100644 --- a/ContractExtensions/ContextActions/Ensures/ComboEnsuresExecutor.cs +++ b/ContractExtensions/ContextActions/Ensures/ComboEnsuresExecutor.cs @@ -1,6 +1,7 @@ using System.Diagnostics.Contracts; using JetBrains.Application.Progress; using JetBrains.ProjectModel; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; using JetBrains.ReSharper.Psi.CSharp.Tree; using ReSharper.ContractExtensions.ContextActions.ContractsFor; diff --git a/ContractExtensions/ContextActions/Ensures/EnsuresAvailability.cs b/ContractExtensions/ContextActions/Ensures/EnsuresAvailability.cs index f02f84a..7363a22 100644 --- a/ContractExtensions/ContextActions/Ensures/EnsuresAvailability.cs +++ b/ContractExtensions/ContextActions/Ensures/EnsuresAvailability.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; diff --git a/ContractExtensions/ContextActions/Ensures/EnsuresContextAction.cs b/ContractExtensions/ContextActions/Ensures/EnsuresContextAction.cs index 2611f9f..2531fc6 100644 --- a/ContractExtensions/ContextActions/Ensures/EnsuresContextAction.cs +++ b/ContractExtensions/ContextActions/Ensures/EnsuresContextAction.cs @@ -3,8 +3,9 @@ using JetBrains.Application.Progress; using JetBrains.ProjectModel; using JetBrains.ReSharper.Feature.Services.Bulbs; +using JetBrains.ReSharper.Feature.Services.ContextActions; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; -using JetBrains.ReSharper.Intentions.Extensibility; using JetBrains.TextControl; using JetBrains.Util; using ReSharper.ContractExtensions.ContextActions.Ensures; diff --git a/ContractExtensions/ContextActions/Ensures/EnsuresExecutor.cs b/ContractExtensions/ContextActions/Ensures/EnsuresExecutor.cs index 2f480da..10dfc04 100644 --- a/ContractExtensions/ContextActions/Ensures/EnsuresExecutor.cs +++ b/ContractExtensions/ContextActions/Ensures/EnsuresExecutor.cs @@ -3,6 +3,7 @@ using System; using System.Diagnostics.Contracts; using System.Linq; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp; diff --git a/ContractExtensions/ContextActions/Ensures/ReturnTypeEnsuresAvailability.cs b/ContractExtensions/ContextActions/Ensures/ReturnTypeEnsuresAvailability.cs index ae33c86..2f45b96 100644 --- a/ContractExtensions/ContextActions/Ensures/ReturnTypeEnsuresAvailability.cs +++ b/ContractExtensions/ContextActions/Ensures/ReturnTypeEnsuresAvailability.cs @@ -1,5 +1,6 @@ using System; using System.Diagnostics.Contracts; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; diff --git a/ContractExtensions/ContextActions/EnumChecks/EnumCheckEnsuresContextAction.cs b/ContractExtensions/ContextActions/EnumChecks/EnumCheckEnsuresContextAction.cs index 847fbc6..1f80a9f 100644 --- a/ContractExtensions/ContextActions/EnumChecks/EnumCheckEnsuresContextAction.cs +++ b/ContractExtensions/ContextActions/EnumChecks/EnumCheckEnsuresContextAction.cs @@ -3,8 +3,9 @@ using JetBrains.Application.Progress; using JetBrains.ProjectModel; using JetBrains.ReSharper.Feature.Services.Bulbs; +using JetBrains.ReSharper.Feature.Services.ContextActions; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; -using JetBrains.ReSharper.Intentions.Extensibility; using JetBrains.TextControl; using JetBrains.Util; using ReSharper.ContractExtensions.ContextActions.Ensures; diff --git a/ContractExtensions/ContextActions/EnumChecks/EnumCheckRequiresAvailability.cs b/ContractExtensions/ContextActions/EnumChecks/EnumCheckRequiresAvailability.cs index c4f2bbe..4326696 100644 --- a/ContractExtensions/ContextActions/EnumChecks/EnumCheckRequiresAvailability.cs +++ b/ContractExtensions/ContextActions/EnumChecks/EnumCheckRequiresAvailability.cs @@ -1,4 +1,6 @@ using System.Diagnostics.Contracts; +using JetBrains.Metadata.Reader.API; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; diff --git a/ContractExtensions/ContextActions/EnumChecks/EnumCheckRequiresContextAction.cs b/ContractExtensions/ContextActions/EnumChecks/EnumCheckRequiresContextAction.cs index 5eec5ac..d2b2a6c 100644 --- a/ContractExtensions/ContextActions/EnumChecks/EnumCheckRequiresContextAction.cs +++ b/ContractExtensions/ContextActions/EnumChecks/EnumCheckRequiresContextAction.cs @@ -2,6 +2,8 @@ using JetBrains.Application.Progress; using JetBrains.ProjectModel; using JetBrains.ReSharper.Feature.Services.Bulbs; +using JetBrains.ReSharper.Feature.Services.ContextActions; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; using JetBrains.ReSharper.Psi.Naming.Impl; using JetBrains.TextControl; diff --git a/ContractExtensions/ContextActions/Infrastructure/ContextActionAvailabilityBase.cs b/ContractExtensions/ContextActions/Infrastructure/ContextActionAvailabilityBase.cs index 3c5645f..56481be 100644 --- a/ContractExtensions/ContextActions/Infrastructure/ContextActionAvailabilityBase.cs +++ b/ContractExtensions/ContextActions/Infrastructure/ContextActionAvailabilityBase.cs @@ -1,5 +1,6 @@ using System; using System.Diagnostics.Contracts; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; namespace ReSharper.ContractExtensions.ContextActions.Infrastructure diff --git a/ContractExtensions/ContextActions/Infrastructure/ContextActionExecutorBase.cs b/ContractExtensions/ContextActions/Infrastructure/ContextActionExecutorBase.cs index 692c169..bd3ff4a 100644 --- a/ContractExtensions/ContextActions/Infrastructure/ContextActionExecutorBase.cs +++ b/ContractExtensions/ContextActions/Infrastructure/ContextActionExecutorBase.cs @@ -1,5 +1,8 @@ using System.Diagnostics.Contracts; using JetBrains.Application.Settings.Storage.Persistence; +using JetBrains.Metadata.Reader.API; +using JetBrains.Metadata.Reader.Impl; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp; diff --git a/ContractExtensions/ContextActions/Infrastructure/ContractsContextActionBase.cs b/ContractExtensions/ContextActions/Infrastructure/ContractsContextActionBase.cs index faccd41..c179d5e 100644 --- a/ContractExtensions/ContextActions/Infrastructure/ContractsContextActionBase.cs +++ b/ContractExtensions/ContextActions/Infrastructure/ContractsContextActionBase.cs @@ -2,8 +2,10 @@ using System.Diagnostics.Contracts; using JetBrains.Application.Progress; using JetBrains.ProjectModel; +using JetBrains.ReSharper.Feature.Services.ContextActions; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; -using JetBrains.ReSharper.Intentions.Extensibility; + using JetBrains.TextControl; using JetBrains.Util; using ReSharper.ContractExtensions.Utilities; diff --git a/ContractExtensions/ContextActions/Invariants/InvariantActionExecutor.cs b/ContractExtensions/ContextActions/Invariants/InvariantActionExecutor.cs index 51aa979..4944f7e 100644 --- a/ContractExtensions/ContextActions/Invariants/InvariantActionExecutor.cs +++ b/ContractExtensions/ContextActions/Invariants/InvariantActionExecutor.cs @@ -2,6 +2,7 @@ using System.Diagnostics.Contracts; using System.Linq; using JetBrains.Annotations; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; diff --git a/ContractExtensions/ContextActions/Invariants/InvariantAvailability.cs b/ContractExtensions/ContextActions/Invariants/InvariantAvailability.cs index 7917dc0..919dbcd 100644 --- a/ContractExtensions/ContextActions/Invariants/InvariantAvailability.cs +++ b/ContractExtensions/ContextActions/Invariants/InvariantAvailability.cs @@ -1,5 +1,6 @@ using System.Diagnostics.Contracts; using System.Linq; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; diff --git a/ContractExtensions/ContextActions/Invariants/InvariantContextAction.cs b/ContractExtensions/ContextActions/Invariants/InvariantContextAction.cs index d214f6e..9d3f2f7 100644 --- a/ContractExtensions/ContextActions/Invariants/InvariantContextAction.cs +++ b/ContractExtensions/ContextActions/Invariants/InvariantContextAction.cs @@ -3,8 +3,9 @@ using JetBrains.Application.Progress; using JetBrains.ProjectModel; using JetBrains.ReSharper.Feature.Services.Bulbs; +using JetBrains.ReSharper.Feature.Services.ContextActions; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; -using JetBrains.ReSharper.Intentions.Extensibility; using JetBrains.TextControl; using JetBrains.Util; using ReSharper.ContractExtensions.ContextActions.Infrastructure; diff --git a/ContractExtensions/ContextActions/Requires/AddRequiresAvailability.cs b/ContractExtensions/ContextActions/Requires/AddRequiresAvailability.cs index df790c3..0a77d5d 100644 --- a/ContractExtensions/ContextActions/Requires/AddRequiresAvailability.cs +++ b/ContractExtensions/ContextActions/Requires/AddRequiresAvailability.cs @@ -2,6 +2,8 @@ using System.Collections.ObjectModel; using System.Diagnostics.Contracts; using System.Linq; +using JetBrains.Metadata.Reader.API; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; diff --git a/ContractExtensions/ContextActions/Requires/AddRequiresContextAction.cs b/ContractExtensions/ContextActions/Requires/AddRequiresContextAction.cs index 733213c..8723443 100644 --- a/ContractExtensions/ContextActions/Requires/AddRequiresContextAction.cs +++ b/ContractExtensions/ContextActions/Requires/AddRequiresContextAction.cs @@ -1,5 +1,7 @@ using System.Diagnostics.Contracts; using JetBrains.ReSharper.Feature.Services.Bulbs; +using JetBrains.ReSharper.Feature.Services.ContextActions; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; namespace ReSharper.ContractExtensions.ContextActions.Requires diff --git a/ContractExtensions/ContextActions/Requires/AddRequiresExecutor.cs b/ContractExtensions/ContextActions/Requires/AddRequiresExecutor.cs index 3086549..5941c4f 100644 --- a/ContractExtensions/ContextActions/Requires/AddRequiresExecutor.cs +++ b/ContractExtensions/ContextActions/Requires/AddRequiresExecutor.cs @@ -3,6 +3,8 @@ using System.Diagnostics.Contracts; using JetBrains.Annotations; using JetBrains.Application.Settings; +using JetBrains.Metadata.Reader.API; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; diff --git a/ContractExtensions/ContextActions/Requires/ComboMethodRequiresAvailability.cs b/ContractExtensions/ContextActions/Requires/ComboMethodRequiresAvailability.cs index 2167508..f56b54c 100644 --- a/ContractExtensions/ContextActions/Requires/ComboMethodRequiresAvailability.cs +++ b/ContractExtensions/ContextActions/Requires/ComboMethodRequiresAvailability.cs @@ -3,6 +3,8 @@ using System.Diagnostics.Contracts; using System.Linq; using JetBrains.Annotations; +using JetBrains.Metadata.Reader.API; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; diff --git a/ContractExtensions/ContextActions/Requires/ComboMethodRequiresContextAction.cs b/ContractExtensions/ContextActions/Requires/ComboMethodRequiresContextAction.cs index 0f30019..924a2be 100644 --- a/ContractExtensions/ContextActions/Requires/ComboMethodRequiresContextAction.cs +++ b/ContractExtensions/ContextActions/Requires/ComboMethodRequiresContextAction.cs @@ -5,12 +5,12 @@ using JetBrains.Application; using JetBrains.Application.Progress; using JetBrains.Application.Settings; +using JetBrains.Metadata.Reader.API; using JetBrains.ProjectModel; -using JetBrains.ReSharper.Daemon.Src.Bulbs.Resources; using JetBrains.ReSharper.Feature.Services.Bulbs; +using JetBrains.ReSharper.Feature.Services.ContextActions; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; -using JetBrains.ReSharper.Intentions.Extensibility; -using JetBrains.ReSharper.Intentions.Extensibility.Menu; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.ReSharper.Psi.Tree; diff --git a/ContractExtensions/ContextActions/Requires/ComboRequiresAvailability.cs b/ContractExtensions/ContextActions/Requires/ComboRequiresAvailability.cs index 4d92499..8c48f23 100644 --- a/ContractExtensions/ContextActions/Requires/ComboRequiresAvailability.cs +++ b/ContractExtensions/ContextActions/Requires/ComboRequiresAvailability.cs @@ -1,4 +1,6 @@ using System.Diagnostics.Contracts; +using JetBrains.Metadata.Reader.API; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; diff --git a/ContractExtensions/ContextActions/Requires/ComboRequiresContextAction.cs b/ContractExtensions/ContextActions/Requires/ComboRequiresContextAction.cs index 7c11c94..620ac4c 100644 --- a/ContractExtensions/ContextActions/Requires/ComboRequiresContextAction.cs +++ b/ContractExtensions/ContextActions/Requires/ComboRequiresContextAction.cs @@ -4,6 +4,8 @@ using JetBrains.Application.Progress; using JetBrains.ProjectModel; using JetBrains.ReSharper.Feature.Services.Bulbs; +using JetBrains.ReSharper.Feature.Services.ContextActions; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.TextControl; diff --git a/ContractExtensions/ContextActions/Requires/FunctionRequiresAvailability.cs b/ContractExtensions/ContextActions/Requires/FunctionRequiresAvailability.cs index b87c002..7def192 100644 --- a/ContractExtensions/ContextActions/Requires/FunctionRequiresAvailability.cs +++ b/ContractExtensions/ContextActions/Requires/FunctionRequiresAvailability.cs @@ -3,6 +3,7 @@ using System.Diagnostics.Contracts; using System.Linq; using JetBrains.Annotations; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.ReSharper.Psi.Tree; diff --git a/ContractExtensions/ContextActions/Requires/ParameterRequiresAvailability.cs b/ContractExtensions/ContextActions/Requires/ParameterRequiresAvailability.cs index 167c265..eb5f694 100644 --- a/ContractExtensions/ContextActions/Requires/ParameterRequiresAvailability.cs +++ b/ContractExtensions/ContextActions/Requires/ParameterRequiresAvailability.cs @@ -1,4 +1,6 @@ using System.Diagnostics.Contracts; +using JetBrains.Metadata.Reader.API; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp; diff --git a/ContractExtensions/ContextActions/Requires/PreconditionConverters/PreconditionConverterAvailability.cs b/ContractExtensions/ContextActions/Requires/PreconditionConverters/PreconditionConverterAvailability.cs index f6bfd38..013925a 100644 --- a/ContractExtensions/ContextActions/Requires/PreconditionConverters/PreconditionConverterAvailability.cs +++ b/ContractExtensions/ContextActions/Requires/PreconditionConverters/PreconditionConverterAvailability.cs @@ -1,5 +1,6 @@ using System.Diagnostics.Contracts; using JetBrains.Annotations; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; using JetBrains.ReSharper.Psi.CSharp.Tree; using ReSharper.ContractExtensions.ContextActions.Infrastructure; diff --git a/ContractExtensions/ContextActions/Requires/PreconditionConverters/PreconditionConverterContextAction.cs b/ContractExtensions/ContextActions/Requires/PreconditionConverters/PreconditionConverterContextAction.cs index 0e2dd89..df742f2 100644 --- a/ContractExtensions/ContextActions/Requires/PreconditionConverters/PreconditionConverterContextAction.cs +++ b/ContractExtensions/ContextActions/Requires/PreconditionConverters/PreconditionConverterContextAction.cs @@ -1,5 +1,7 @@ using System.Diagnostics.Contracts; using JetBrains.ReSharper.Feature.Services.Bulbs; +using JetBrains.ReSharper.Feature.Services.ContextActions; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; using ReSharper.ContractExtensions.ContractsEx.Assertions; diff --git a/ContractExtensions/ContextActions/Requires/PreconditionConverters/PreconditionConverterExecutor.cs b/ContractExtensions/ContextActions/Requires/PreconditionConverters/PreconditionConverterExecutor.cs index 8e6b159..cb4ea87 100644 --- a/ContractExtensions/ContextActions/Requires/PreconditionConverters/PreconditionConverterExecutor.cs +++ b/ContractExtensions/ContextActions/Requires/PreconditionConverters/PreconditionConverterExecutor.cs @@ -8,6 +8,8 @@ using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.ReSharper.Psi.CSharp.Util; using JetBrains.ReSharper.Psi.ExtensionsAPI.Tree; +using JetBrains.Metadata.Reader.API; +using JetBrains.ReSharper.Resources.Shell; using ReSharper.ContractExtensions.ContextActions.Infrastructure; using ReSharper.ContractExtensions.ContractsEx.Assertions; diff --git a/ContractExtensions/ContextActions/Requires/PropertySetterRequiresAvailability.cs b/ContractExtensions/ContextActions/Requires/PropertySetterRequiresAvailability.cs index 982e00d..7761dd5 100644 --- a/ContractExtensions/ContextActions/Requires/PropertySetterRequiresAvailability.cs +++ b/ContractExtensions/ContextActions/Requires/PropertySetterRequiresAvailability.cs @@ -3,6 +3,8 @@ using System.Diagnostics.Contracts; using System.Linq; using JetBrains.DataStructures; +using JetBrains.Metadata.Reader.API; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; diff --git a/ContractExtensions/ContextActions/Requires/RequiresContextActionBase.cs b/ContractExtensions/ContextActions/Requires/RequiresContextActionBase.cs index 32cfd24..231d72b 100644 --- a/ContractExtensions/ContextActions/Requires/RequiresContextActionBase.cs +++ b/ContractExtensions/ContextActions/Requires/RequiresContextActionBase.cs @@ -4,11 +4,12 @@ using System.Linq; using JetBrains.Application; using JetBrains.Application.Settings; -using JetBrains.ReSharper.Daemon.Src.Bulbs.Resources; +using JetBrains.ReSharper.Feature.Services.CSharp.Analyses.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; -using JetBrains.ReSharper.Intentions.Extensibility; -using JetBrains.ReSharper.Intentions.Extensibility.Menu; +using JetBrains.ReSharper.Feature.Services.Intentions; +using JetBrains.ReSharper.Feature.Services.Resources; using JetBrains.ReSharper.Psi; +using JetBrains.ReSharper.Resources.Shell; using JetBrains.UI.BulbMenu; using JetBrains.Util; using ReSharper.ContractExtensions.ContextActions.Infrastructure; diff --git a/ContractExtensions/ContractsEx/Assertions/PredicateChecks/EnumValidationPredicateCheck.cs b/ContractExtensions/ContractsEx/Assertions/PredicateChecks/EnumValidationPredicateCheck.cs index 6df7934..20d082e 100644 --- a/ContractExtensions/ContractsEx/Assertions/PredicateChecks/EnumValidationPredicateCheck.cs +++ b/ContractExtensions/ContractsEx/Assertions/PredicateChecks/EnumValidationPredicateCheck.cs @@ -1,5 +1,6 @@ using System.Diagnostics.Contracts; using JetBrains.Annotations; +using JetBrains.Metadata.Reader.API; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; using ReSharper.ContractExtensions.Utilities; diff --git a/ContractExtensions/ContractsEx/Assertions/PredicateChecks/MethodCallPredicateCheck.cs b/ContractExtensions/ContractsEx/Assertions/PredicateChecks/MethodCallPredicateCheck.cs index e4eb9ff..f659872 100644 --- a/ContractExtensions/ContractsEx/Assertions/PredicateChecks/MethodCallPredicateCheck.cs +++ b/ContractExtensions/ContractsEx/Assertions/PredicateChecks/MethodCallPredicateCheck.cs @@ -1,5 +1,6 @@ using System.Diagnostics.Contracts; using JetBrains.Annotations; +using JetBrains.Metadata.Reader.API; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; using ReSharper.ContractExtensions.Utilities; diff --git a/ContractExtensions/ContractsEx/Assertions/PredicateChecks/PredicateArgument.cs b/ContractExtensions/ContractsEx/Assertions/PredicateChecks/PredicateArgument.cs index 164da3b..bc4405c 100644 --- a/ContractExtensions/ContractsEx/Assertions/PredicateChecks/PredicateArgument.cs +++ b/ContractExtensions/ContractsEx/Assertions/PredicateChecks/PredicateArgument.cs @@ -1,5 +1,6 @@ using System.Diagnostics.Contracts; using System; +using JetBrains.Metadata.Reader.API; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.Util.Special; diff --git a/ContractExtensions/ContractsEx/Assertions/Statements/ContractEnsures.cs b/ContractExtensions/ContractsEx/Assertions/Statements/ContractEnsures.cs index a46f071..43bfd00 100644 --- a/ContractExtensions/ContractsEx/Assertions/Statements/ContractEnsures.cs +++ b/ContractExtensions/ContractsEx/Assertions/Statements/ContractEnsures.cs @@ -2,6 +2,7 @@ using System.Diagnostics.Contracts; using System.Linq; using JetBrains.Annotations; +using JetBrains.Metadata.Reader.API; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.ReSharper.Psi.Tree; diff --git a/ContractExtensions/ContractsEx/Assertions/Statements/ContractRequires.cs b/ContractExtensions/ContractsEx/Assertions/Statements/ContractRequires.cs index 62de49d..1348758 100644 --- a/ContractExtensions/ContractsEx/Assertions/Statements/ContractRequires.cs +++ b/ContractExtensions/ContractsEx/Assertions/Statements/ContractRequires.cs @@ -2,6 +2,8 @@ using System.Diagnostics.Contracts; using System.Linq; using JetBrains.Annotations; +using JetBrains.Metadata.Reader.API; +using JetBrains.Metadata.Reader.Impl; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; using ReSharper.ContractExtensions.Utilities; diff --git a/ContractExtensions/ContractsEx/Assertions/Statements/IfThrowPrecondition.cs b/ContractExtensions/ContractsEx/Assertions/Statements/IfThrowPrecondition.cs index 7b90573..535497b 100644 --- a/ContractExtensions/ContractsEx/Assertions/Statements/IfThrowPrecondition.cs +++ b/ContractExtensions/ContractsEx/Assertions/Statements/IfThrowPrecondition.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; +using JetBrains.Metadata.Reader.API; +using JetBrains.Metadata.Reader.Impl; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; using ReSharper.ContractExtensions.Utilities; diff --git a/ContractExtensions/ContractsEx/ContractExtensions.cs b/ContractExtensions/ContractsEx/ContractExtensions.cs index 500cfef..51e7e40 100644 --- a/ContractExtensions/ContractsEx/ContractExtensions.cs +++ b/ContractExtensions/ContractsEx/ContractExtensions.cs @@ -3,6 +3,7 @@ using System.Diagnostics.Contracts; using System.Linq; using JetBrains.Annotations; +using JetBrains.Metadata.Reader.Impl; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; using ReSharper.ContractExtensions.Utilities; diff --git a/ContractExtensions/ContractsEx/Validation/Statements/ContractStatementFactory.cs b/ContractExtensions/ContractsEx/Validation/Statements/ContractStatementFactory.cs index 6e8f1cf..6186b10 100644 --- a/ContractExtensions/ContractsEx/Validation/Statements/ContractStatementFactory.cs +++ b/ContractExtensions/ContractsEx/Validation/Statements/ContractStatementFactory.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; +using JetBrains.Metadata.Reader.Impl; using JetBrains.Annotations; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/ContractPublicPropertyNameChecker.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/ContractPublicPropertyNameChecker.cs index 2648941..539cca6 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/ContractPublicPropertyNameChecker.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/ContractPublicPropertyNameChecker.cs @@ -1,8 +1,10 @@ using System.Diagnostics.Contracts; using System.Linq; +using JetBrains.Metadata.Reader.Impl; using JetBrains.ReSharper.Daemon; using JetBrains.ReSharper.Daemon.Stages; using JetBrains.ReSharper.Daemon.Stages.Dispatcher; +using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.ReSharper.Psi.Tree; diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/ContractPublicPropertyNameHighlighing.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/ContractPublicPropertyNameHighlighing.cs index e4e1fb0..b7fbb31 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/ContractPublicPropertyNameHighlighing.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/ContractPublicPropertyNameHighlighing.cs @@ -1,6 +1,8 @@ using System.Diagnostics.Contracts; using JetBrains.Annotations; +using JetBrains.DocumentModel; using JetBrains.ReSharper.Daemon; +using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi.CSharp; using JetBrains.ReSharper.Psi.CSharp.Tree; using ReSharper.ContractExtensions.Utilities; @@ -13,6 +15,7 @@ public sealed class ContractPublicPropertyNameHighlighing : IHighlighting private readonly IFieldDeclaration _fieldDeclaration; [CanBeNull]private readonly ICSharpTypeMemberDeclaration _referingFieldOrProperty; + private readonly DocumentRange _range; internal ContractPublicPropertyNameHighlighing(IFieldDeclaration fieldDeclaration, string referingFieldOrPropertyName, @@ -21,6 +24,7 @@ internal ContractPublicPropertyNameHighlighing(IFieldDeclaration fieldDeclaratio Contract.Requires(fieldDeclaration != null); Contract.Requires(referingFieldOrPropertyName != null); + _range = fieldDeclaration.GetHighlightingRange(); _fieldDeclaration = fieldDeclaration; _referingFieldOrProperty = referingFieldOrProperty; @@ -47,6 +51,13 @@ public bool IsValid() return true; } + /// + /// Calculates range of a highlighting. + /// + public DocumentRange CalculateRange() + { + return _range; + } public string ToolTip { diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/ContractPublicPropertyNameQuickFix.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/ContractPublicPropertyNameQuickFix.cs index b738975..2d7e6de 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/ContractPublicPropertyNameQuickFix.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/ContractPublicPropertyNameQuickFix.cs @@ -3,7 +3,7 @@ using JetBrains.Application.Progress; using JetBrains.ProjectModel; using JetBrains.ReSharper.Feature.Services.Bulbs; -using JetBrains.ReSharper.Intentions.Extensibility; +using JetBrains.ReSharper.Feature.Services.QuickFixes; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp; using JetBrains.ReSharper.Psi.CSharp.Impl; diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/CodeContractErrorHighlighting.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/CodeContractErrorHighlighting.cs index 7fc2c61..1614636 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/CodeContractErrorHighlighting.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/CodeContractErrorHighlighting.cs @@ -1,6 +1,9 @@ using System.Diagnostics.Contracts; +using JetBrains.DocumentModel; using JetBrains.ReSharper.Daemon; +using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi.CSharp; +using JetBrains.ReSharper.Psi.CSharp.Tree; using ReSharper.ContractExtensions.ProblemAnalyzers.PreconditionAnalyzers.MalformContractAnalyzers; [assembly: RegisterConfigurableSeverity(CodeContractErrorHighlighting.Id, @@ -24,12 +27,15 @@ public sealed class CodeContractErrorHighlighting : IHighlighting, ICodeContract private readonly ValidatedContractBlock _contractBlock; public const string Id = "Malformed method contract error highlighting"; private readonly string _toolTip; + private readonly DocumentRange _range; - internal CodeContractErrorHighlighting(CodeContractErrorValidationResult error, ValidatedContractBlock contractBlock) + internal CodeContractErrorHighlighting(ICSharpStatement statement, CodeContractErrorValidationResult error, ValidatedContractBlock contractBlock) { Contract.Requires(error != null); Contract.Requires(contractBlock != null); + Contract.Requires(statement != null); + _range = statement.GetHighlightingRange(); _error = error; _contractBlock = contractBlock; _toolTip = error.GetErrorText(); @@ -40,6 +46,14 @@ public bool IsValid() return true; } + /// + /// Calculates range of a highlighting. + /// + public DocumentRange CalculateRange() + { + return _range; + } + public string ToolTip { get { return _toolTip; } diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/CodeContractWarningHighlighting.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/CodeContractWarningHighlighting.cs index 4f1278a..d1083e7 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/CodeContractWarningHighlighting.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/CodeContractWarningHighlighting.cs @@ -1,7 +1,9 @@ using System.Collections; using System.Collections.Generic; using System.Diagnostics.Contracts; +using JetBrains.DocumentModel; using JetBrains.ReSharper.Daemon; +using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi.CSharp; using JetBrains.ReSharper.Psi.CSharp.Tree; using ReSharper.ContractExtensions.ContractsEx.Assertions.Statements; @@ -28,15 +30,17 @@ public sealed class CodeContractWarningHighlighting : IHighlighting, ICodeContra private readonly ValidatedContractBlock _contractBlock; public const string Id = "MalformedMethodContractWarningHighlighting"; private string _toolTip; + private readonly DocumentRange _range; - internal CodeContractWarningHighlighting(CodeContractWarningValidationResult warning, ValidatedContractBlock contractBlock) + internal CodeContractWarningHighlighting(ICSharpStatement statement, CodeContractWarningValidationResult warning, ValidatedContractBlock contractBlock) { Contract.Requires(warning != null); Contract.Requires(contractBlock != null); + Contract.Requires(statement != null); _warning = warning; _contractBlock = contractBlock; - + _range = statement.GetHighlightingRange(); _toolTip = warning.GetErrorText(); } @@ -45,6 +49,14 @@ public bool IsValid() return true; } + /// + /// Calculates range of a highlighting. + /// + public DocumentRange CalculateRange() + { + return _range; + } + public string ToolTip { get { return _toolTip; } diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/CustomWarnings/ContractCustomWarningHighlighting.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/CustomWarnings/ContractCustomWarningHighlighting.cs index c55c59a..511672d 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/CustomWarnings/ContractCustomWarningHighlighting.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/CustomWarnings/ContractCustomWarningHighlighting.cs @@ -1,6 +1,9 @@ using System.Diagnostics.Contracts; +using JetBrains.DocumentModel; using JetBrains.ReSharper.Daemon; +using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi.CSharp; +using JetBrains.ReSharper.Psi.CSharp.Tree; using ReSharper.ContractExtensions.ProblemAnalyzers.PreconditionAnalyzers.MalformContractAnalyzers; [assembly: RegisterConfigurableSeverity(ContractCustomWarningHighlighting.Id, @@ -24,9 +27,9 @@ public class ContractCustomWarningHighlighting : IHighlighting, ICodeContractFix private readonly ValidatedContractBlock _contractBlock; public const string Id = "Custom Warning for contracts"; private readonly string _toolTip; + private readonly DocumentRange _range; - internal static ContractCustomWarningHighlighting Create(CustomWarningValidationResult warning, - ValidatedContractBlock contractBlock) + internal static ContractCustomWarningHighlighting Create(ICSharpStatement statement, CustomWarningValidationResult warning, ValidatedContractBlock contractBlock) { switch (warning.Warning) { @@ -34,15 +37,17 @@ internal static ContractCustomWarningHighlighting Create(CustomWarningValidation case MalformedContractCustomWarning.PreconditionInMethodWithIteratorBlock: return null; default: - return new ContractCustomWarningHighlighting(warning, contractBlock); + return new ContractCustomWarningHighlighting(statement, warning, contractBlock); } } - internal ContractCustomWarningHighlighting(CustomWarningValidationResult warning, ValidatedContractBlock contractBlock) + internal ContractCustomWarningHighlighting(ICSharpStatement statement, CustomWarningValidationResult warning, ValidatedContractBlock contractBlock) { Contract.Requires(warning != null); Contract.Requires(contractBlock != null); + Contract.Assert(_range != null); + _range = statement.GetHighlightingRange(); _toolTip = warning.GetErrorText(); _validationResult = warning; _contractBlock = contractBlock; @@ -55,6 +60,14 @@ public bool IsValid() return true; } + /// + /// Calculates range of a highlighting. + /// + public DocumentRange CalculateRange() + { + return _range; + } + public string ToolTip { get { return _toolTip; } diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/CustomWarnings/PreconditionInAsyncMethodHighlighing.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/CustomWarnings/PreconditionInAsyncMethodHighlighing.cs index 03bd9e1..943474f 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/CustomWarnings/PreconditionInAsyncMethodHighlighing.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/CustomWarnings/PreconditionInAsyncMethodHighlighing.cs @@ -1,5 +1,7 @@ using JetBrains.ReSharper.Daemon; +using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi.CSharp; +using JetBrains.ReSharper.Psi.CSharp.Tree; using ReSharper.ContractExtensions.ProblemAnalyzers.PreconditionAnalyzers.MalformContractAnalyzers; [assembly: RegisterConfigurableSeverity(PreconditionInAsyncMethodHighlighting.Id, @@ -22,9 +24,8 @@ public class PreconditionInAsyncMethodHighlighting : LegacyContractCustomWarning { public const string Id = "Preconditions in async method"; - internal PreconditionInAsyncMethodHighlighting(CustomWarningValidationResult warning, - ValidatedContractBlock contractBlock) - : base(warning, contractBlock) + internal PreconditionInAsyncMethodHighlighting(ICSharpFunctionDeclaration element, CustomWarningValidationResult warning, ValidatedContractBlock contractBlock) + : base(element, warning, contractBlock) {} } } \ No newline at end of file diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/CustomWarnings/PreconditionInMethodWithIteratorBlockHighlighing.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/CustomWarnings/PreconditionInMethodWithIteratorBlockHighlighing.cs index 769df5f..81b6b98 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/CustomWarnings/PreconditionInMethodWithIteratorBlockHighlighing.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/CustomWarnings/PreconditionInMethodWithIteratorBlockHighlighing.cs @@ -1,5 +1,7 @@ using JetBrains.ReSharper.Daemon; +using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi.CSharp; +using JetBrains.ReSharper.Psi.CSharp.Tree; using ReSharper.ContractExtensions.ProblemAnalyzers.PreconditionAnalyzers.MalformContractAnalyzers; [assembly: RegisterConfigurableSeverity(PreconditionInMethodWithIteratorBlockHighlighing.Id, @@ -22,8 +24,8 @@ public class PreconditionInMethodWithIteratorBlockHighlighing : LegacyContractCu { public const string Id = "Preconditions in method with iterator block"; - internal PreconditionInMethodWithIteratorBlockHighlighing(CustomWarningValidationResult warning, ValidatedContractBlock contractBlock) - : base(warning, contractBlock) + internal PreconditionInMethodWithIteratorBlockHighlighing(ICSharpFunctionDeclaration element, CustomWarningValidationResult warning, ValidatedContractBlock contractBlock) + : base(element, warning, contractBlock) {} } } \ No newline at end of file diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/MalformedContractErrorHighlighting.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/MalformedContractErrorHighlighting.cs index 4766ab6..9e3c026 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/MalformedContractErrorHighlighting.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/MalformedContractErrorHighlighting.cs @@ -1,7 +1,10 @@ using System.Diagnostics.Contracts; using System.Linq; +using JetBrains.DocumentModel; using JetBrains.ReSharper.Daemon; +using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi.CSharp; +using JetBrains.ReSharper.Psi.CSharp.Tree; using ReSharper.ContractExtensions.ContractsEx.Assertions.Statements; using ReSharper.ContractExtensions.ProblemAnalyzers.PreconditionAnalyzers.MalformContractAnalyzers; @@ -27,12 +30,14 @@ public sealed class MalformedContractErrorHighlighting : IHighlighting private readonly CodeContractStatement _validatedStatement; public const string Id = "Malformed contract statement error highlighting"; private readonly string _toolTip; + private readonly DocumentRange _range; - internal MalformedContractErrorHighlighting(CodeContractStatement validatedStatement, ValidationResult validationResult) + internal MalformedContractErrorHighlighting(ICSharpStatement statement, CodeContractStatement validatedStatement, ValidationResult validationResult) { Contract.Requires(validatedStatement != null); Contract.Requires(validationResult != null); + _range = statement.GetHighlightingRange(); _validatedStatement = validatedStatement; _validationResult = validationResult; _toolTip = _validationResult.GetErrorText(); @@ -43,6 +48,14 @@ public bool IsValid() return true; } + /// + /// Calculates range of a highlighting. + /// + public DocumentRange CalculateRange() + { + return _range; + } + public string ToolTip { get { return _toolTip; } diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/MalformedContractStatementChecker.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/MalformedContractStatementChecker.cs index 0610424..f0bc85b 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/MalformedContractStatementChecker.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/MalformedContractStatementChecker.cs @@ -1,5 +1,6 @@ using JetBrains.ReSharper.Daemon.Stages; using JetBrains.ReSharper.Daemon.Stages.Dispatcher; +using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.ReSharper.Psi.Tree; using ReSharper.ContractExtensions.ContractsEx.Assertions; @@ -29,7 +30,7 @@ protected override void Run(ICSharpStatement element, ElementProblemAnalyzerData return; consumer.AddHighlighting( - new MalformedContractErrorHighlighting(contractStatement, validationResult), + new MalformedContractErrorHighlighting(element, contractStatement, validationResult), validationResult.Statement.GetDocumentRange(), element.GetContainingFile()); } } diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/MalformedLegacyContractChecker.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/MalformedLegacyContractChecker.cs index 98efeef..a25e7eb 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/MalformedLegacyContractChecker.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/MalformedLegacyContractChecker.cs @@ -2,6 +2,7 @@ using JetBrains.ReSharper.Daemon; using JetBrains.ReSharper.Daemon.Stages; using JetBrains.ReSharper.Daemon.Stages.Dispatcher; +using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.ReSharper.Psi.Tree; using ReSharper.ContractExtensions.ContractsEx.Assertions.Statements; @@ -27,7 +28,7 @@ protected override void Run(ICSharpFunctionDeclaration element, ElementProblemAn var highlighting = vr.Match( error => (IHighlighting)null, warning => null, - customWarning => LegacyContractCustomWarningHighlighting.Create(customWarning, preconditions), + customWarning => LegacyContractCustomWarningHighlighting.Create(element, customWarning, preconditions), _ => null); if (highlighting != null) diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/MalformedMethodContractChecker.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/MalformedMethodContractChecker.cs index e20d639..65ba1ce 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/MalformedMethodContractChecker.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/MalformedMethodContractChecker.cs @@ -2,6 +2,7 @@ using JetBrains.ReSharper.Daemon; using JetBrains.ReSharper.Daemon.Stages; using JetBrains.ReSharper.Daemon.Stages.Dispatcher; +using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.ReSharper.Psi.Tree; using ReSharper.ContractExtensions.ContractsEx.Assertions.Statements; @@ -26,9 +27,9 @@ protected override void Run(ICSharpFunctionDeclaration element, ElementProblemAn foreach (var vr in validateContractBlock.ValidationResults) { var highlighting = vr.Match( - error => (IHighlighting)new CodeContractErrorHighlighting(error, validateContractBlock), - warning => new CodeContractWarningHighlighting(warning, validateContractBlock), - customWarning => ContractCustomWarningHighlighting.Create(customWarning, validateContractBlock), + error => (IHighlighting)new CodeContractErrorHighlighting(vr.Statement, error, validateContractBlock), + warning => new CodeContractWarningHighlighting(vr.Statement, warning, validateContractBlock), + customWarning => ContractCustomWarningHighlighting.Create(vr.Statement, customWarning, validateContractBlock), _ => null); if (highlighting != null) diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/QuickFixes/LegacyContractFix.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/QuickFixes/LegacyContractFix.cs index bebc32a..a5cc6bd 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/QuickFixes/LegacyContractFix.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/QuickFixes/LegacyContractFix.cs @@ -3,7 +3,7 @@ using JetBrains.Application.Progress; using JetBrains.ProjectModel; using JetBrains.ReSharper.Feature.Services.Bulbs; -using JetBrains.ReSharper.Intentions.Extensibility; +using JetBrains.ReSharper.Feature.Services.QuickFixes; using JetBrains.TextControl; using JetBrains.Util; diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/QuickFixes/MalformedContractStatementQuickFix.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/QuickFixes/MalformedContractStatementQuickFix.cs index 1cf3e5c..65cb0d2 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/QuickFixes/MalformedContractStatementQuickFix.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/QuickFixes/MalformedContractStatementQuickFix.cs @@ -5,7 +5,7 @@ using JetBrains.Application.Settings.Storage.Persistence; using JetBrains.ProjectModel; using JetBrains.ReSharper.Feature.Services.Bulbs; -using JetBrains.ReSharper.Intentions.Extensibility; +using JetBrains.ReSharper.Feature.Services.QuickFixes; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.ReSharper.Psi.ExtensionsAPI.Tree; using JetBrains.TextControl; diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/QuickFixes/MalformedMethodContractQuickFix.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/QuickFixes/MalformedMethodContractQuickFix.cs index 653ff19..44a35cb 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/QuickFixes/MalformedMethodContractQuickFix.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/MalformContractAnalyzers/QuickFixes/MalformedMethodContractQuickFix.cs @@ -4,7 +4,7 @@ using JetBrains.ProjectModel; using JetBrains.ReSharper.Feature.Services.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; -using JetBrains.ReSharper.Intentions.Extensibility; +using JetBrains.ReSharper.Feature.Services.QuickFixes; using JetBrains.TextControl; using JetBrains.Util; diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresExceptionChecker.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresExceptionChecker.cs index a05aa63..531fe41 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresExceptionChecker.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresExceptionChecker.cs @@ -5,6 +5,7 @@ using JetBrains.ReSharper.Daemon; using JetBrains.ReSharper.Daemon.Stages; using JetBrains.ReSharper.Daemon.Stages.Dispatcher; +using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.ReSharper.Psi.Tree; @@ -35,19 +36,19 @@ protected override IEnumerable DoRun(IInvocationExpression invoca if (ExceptionIsLessVisible(preconditionContainer, preconditionException)) { yield return - new RequiresExceptionInconsistentVisibiityHighlighting(preconditionException, + new RequiresExceptionInconsistentVisibiityHighlighting(invocationExpression, preconditionException, preconditionContainer); } if (DoesntHaveAppropriateConstructor(preconditionException)) { - yield return new RequiresExceptionValidityHighlighting(preconditionException, preconditionContainer); + yield return new RequiresExceptionValidityHighlighting(invocationExpression, preconditionException, preconditionContainer); } } if (!MessageIsAppropriateForContractRequires(contractAssertion.Message)) { - yield return new InvalidRequiresMessageHighlighting(contractAssertion.Message); + yield return new InvalidRequiresMessageHighlighting(invocationExpression, contractAssertion.Message); } } diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresExceptionInconsistentVisibiityHighlighting.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresExceptionInconsistentVisibiityHighlighting.cs index 80a0916..cb60ed4 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresExceptionInconsistentVisibiityHighlighting.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresExceptionInconsistentVisibiityHighlighting.cs @@ -1,5 +1,7 @@ using System.Diagnostics.Contracts; +using JetBrains.DocumentModel; using JetBrains.ReSharper.Daemon; +using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp; using JetBrains.ReSharper.Psi.CSharp.Tree; @@ -21,13 +23,15 @@ public sealed class RequiresExceptionInconsistentVisibiityHighlighting : IHighli { private readonly IClass _exceptionDeclaration; private readonly MemberWithAccess _preconditionContainer; + private readonly DocumentRange _range; - internal RequiresExceptionInconsistentVisibiityHighlighting( - IClass exceptionDeclaration, MemberWithAccess preconditionContainer) + internal RequiresExceptionInconsistentVisibiityHighlighting(IInvocationExpression invocationExpression, IClass exceptionDeclaration, MemberWithAccess preconditionContainer) { Contract.Requires(exceptionDeclaration != null); Contract.Requires(preconditionContainer != null); + Contract.Requires(invocationExpression != null); + _range = invocationExpression.GetHighlightingRange(); _exceptionDeclaration = exceptionDeclaration; _preconditionContainer = preconditionContainer; } @@ -41,6 +45,14 @@ public bool IsValid() return true; } + /// + /// Calculates range of a highlighting. + /// + public DocumentRange CalculateRange() + { + return _range; + } + public string ToolTip { get diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresExceptionInconsistentVisibilityQuickFix.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresExceptionInconsistentVisibilityQuickFix.cs index c49732c..ba29728 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresExceptionInconsistentVisibilityQuickFix.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresExceptionInconsistentVisibilityQuickFix.cs @@ -4,7 +4,7 @@ using JetBrains.Application.Progress; using JetBrains.ProjectModel; using JetBrains.ReSharper.Feature.Services.Bulbs; -using JetBrains.ReSharper.Intentions.Extensibility; +using JetBrains.ReSharper.Feature.Services.QuickFixes; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Impl; using JetBrains.ReSharper.Psi.Tree; diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresExceptionValidityHighlighting.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresExceptionValidityHighlighting.cs index 8380623..341cf04 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresExceptionValidityHighlighting.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresExceptionValidityHighlighting.cs @@ -1,6 +1,8 @@ using System; using System.Diagnostics.Contracts; +using JetBrains.DocumentModel; using JetBrains.ReSharper.Daemon; +using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp; using JetBrains.ReSharper.Psi.CSharp.Tree; @@ -21,14 +23,15 @@ public sealed class RequiresExceptionValidityHighlighting : IHighlighting { private readonly IClass _exceptionDeclaration; private readonly MemberWithAccess _preconditionContainer; + private readonly DocumentRange _range; - internal RequiresExceptionValidityHighlighting( - IClass exceptionDeclaration, - MemberWithAccess preconditionContainer) + internal RequiresExceptionValidityHighlighting(IInvocationExpression invocationExpression, IClass exceptionDeclaration, MemberWithAccess preconditionContainer) { Contract.Requires(exceptionDeclaration != null); Contract.Requires(preconditionContainer != null); + Contract.Requires(invocationExpression != null); + _range = invocationExpression.GetHighlightingRange(); _exceptionDeclaration = exceptionDeclaration; _preconditionContainer = preconditionContainer; } @@ -41,6 +44,14 @@ public bool IsValid() return true; } + /// + /// Calculates range of a highlighting. + /// + public DocumentRange CalculateRange() + { + return _range; + } + public string ToolTip { get diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresExceptionValidityQuickFix.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresExceptionValidityQuickFix.cs index 45a19f9..3128c36 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresExceptionValidityQuickFix.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresExceptionValidityQuickFix.cs @@ -5,7 +5,7 @@ using JetBrains.ProjectModel; using JetBrains.ReSharper.Feature.Services.Bulbs; using JetBrains.ReSharper.Feature.Services.Generate; -using JetBrains.ReSharper.Intentions.Extensibility; +using JetBrains.ReSharper.Feature.Services.QuickFixes; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.ReSharper.Psi.Tree; @@ -51,8 +51,8 @@ protected override Action ExecutePsiTransaction(ISolution solution workflow.Context.InputElements.Clear(); workflow.Context.InputElements.AddRange(ctors); - workflow.BuildInputOptions(); - workflow.GenerateAndFinish("Generate missing constructor", NullProgressIndicator.Instance); + workflow.BuildOptions(); + workflow.Generate("Generate missing constructor", NullProgressIndicator.Instance); } return null; diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresInconsistentVisibiityChecker.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresInconsistentVisibiityChecker.cs index 2d6d221..e85e6a3 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresInconsistentVisibiityChecker.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresInconsistentVisibiityChecker.cs @@ -2,8 +2,10 @@ using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; +using JetBrains.Metadata.Reader.Impl; using JetBrains.ReSharper.Daemon.Stages; using JetBrains.ReSharper.Daemon.Stages.Dispatcher; +using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.ReSharper.Psi.Tree; diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresInconsistentVisibiityHighlighting.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresInconsistentVisibiityHighlighting.cs index d5440a9..9862241 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresInconsistentVisibiityHighlighting.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresInconsistentVisibiityHighlighting.cs @@ -1,5 +1,7 @@ using System.Diagnostics.Contracts; +using JetBrains.DocumentModel; using JetBrains.ReSharper.Daemon; +using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi.CSharp; using JetBrains.ReSharper.Psi.CSharp.Tree; using ReSharper.ContractExtensions.ProblemAnalyzers.PreconditionAnalyzers; @@ -20,6 +22,7 @@ public sealed class RequiresInconsistentVisibiityHighlighting : IHighlighting { private readonly MemberWithAccess _preconditionContainer; private readonly MemberWithAccess _lessVisibleReferencedMember; + private readonly DocumentRange _range; internal RequiresInconsistentVisibiityHighlighting(ICSharpStatement preconditionStatement, MemberWithAccess preconditionContainer, MemberWithAccess lessVisibleReferencedMember) @@ -28,6 +31,7 @@ internal RequiresInconsistentVisibiityHighlighting(ICSharpStatement precondition Contract.Requires(preconditionContainer != null); Contract.Requires(lessVisibleReferencedMember != null); + _range = preconditionStatement.GetHighlightingRange(); _preconditionContainer = preconditionContainer; _lessVisibleReferencedMember = lessVisibleReferencedMember; } @@ -41,6 +45,14 @@ public bool IsValid() return true; } + /// + /// Calculates range of a highlighting. + /// + public DocumentRange CalculateRange() + { + return _range; + } + internal MemberWithAccess PreconditionContainer { get { return _preconditionContainer; } } internal MemberWithAccess LessVisibleReferencedMember { get { return _lessVisibleReferencedMember; } } diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresInconsistentVisibiityQuickFix.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresInconsistentVisibiityQuickFix.cs index 2d468fb..b926464 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresInconsistentVisibiityQuickFix.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionIncosistentVisibility/RequiresInconsistentVisibiityQuickFix.cs @@ -5,7 +5,7 @@ using JetBrains.Application.Progress; using JetBrains.ProjectModel; using JetBrains.ReSharper.Feature.Services.Bulbs; -using JetBrains.ReSharper.Intentions.Extensibility; +using JetBrains.ReSharper.Feature.Services.QuickFixes; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Impl; using JetBrains.ReSharper.Refactorings.Util; diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionProblemAnalyzer.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionProblemAnalyzer.cs index 4988044..34ecfbf 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionProblemAnalyzer.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionProblemAnalyzer.cs @@ -3,6 +3,7 @@ using JetBrains.ReSharper.Daemon; using JetBrains.ReSharper.Daemon.Stages; using JetBrains.ReSharper.Daemon.Stages.Dispatcher; +using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.ReSharper.Psi.Tree; using ReSharper.ContractExtensions.ContractsEx.Assertions; diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionProblemAnalyzerBase.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionProblemAnalyzerBase.cs index e681ddc..3e36035 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionProblemAnalyzerBase.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/PreconditionProblemAnalyzerBase.cs @@ -2,6 +2,7 @@ using JetBrains.ReSharper.Daemon; using JetBrains.ReSharper.Daemon.Stages; using JetBrains.ReSharper.Daemon.Stages.Dispatcher; +using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi.Tree; namespace ReSharper.ContractExtensions.ProblemAnalyzers.PreconditionAnalyzers diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/RedundantRequiresChecker.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/RedundantRequiresChecker.cs index e2784bd..07b8ad2 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/RedundantRequiresChecker.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/RedundantRequiresChecker.cs @@ -3,6 +3,7 @@ using JetBrains.Annotations; using JetBrains.ReSharper.Daemon.Stages; using JetBrains.ReSharper.Daemon.Stages.Dispatcher; +using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.ReSharper.Psi.Tree; diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/RedundantRequiresCheckerHighlighting.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/RedundantRequiresCheckerHighlighting.cs index 7ad9026..64b453d 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/RedundantRequiresCheckerHighlighting.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/RedundantRequiresCheckerHighlighting.cs @@ -1,5 +1,7 @@ using System.Diagnostics.Contracts; +using JetBrains.DocumentModel; using JetBrains.ReSharper.Daemon; +using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi.CSharp; using JetBrains.ReSharper.Psi.CSharp.Tree; using ReSharper.ContractExtensions.ProblemAnalyzers.PreconditionAnalyzers; @@ -37,6 +39,14 @@ public bool IsValid() return true; } + /// + /// Calculates range of a highlighting. + /// + public DocumentRange CalculateRange() + { + return _preconditionStatement.GetHighlightingRange(); + } + public string ToolTip { get { return string.Format("{0} '{1}'", ToolTipWarning, ArgumentName); } diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/RedundantRequiresQuickFix.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/RedundantRequiresQuickFix.cs index 5c55c29..3e5b8aa 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/RedundantRequiresQuickFix.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/RedundantRequiresQuickFix.cs @@ -4,7 +4,7 @@ using JetBrains.ProjectModel; using JetBrains.ReSharper.Feature.Services.Bulbs; using JetBrains.ReSharper.Feature.Services.CSharp.Bulbs; -using JetBrains.ReSharper.Intentions.Extensibility; +using JetBrains.ReSharper.Feature.Services.QuickFixes; using JetBrains.ReSharper.Psi.CSharp.Tree; using JetBrains.TextControl; using JetBrains.Util; diff --git a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/RequiresMessageAnalyzer/InvalidRequiresMessageHighlighting.cs b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/RequiresMessageAnalyzer/InvalidRequiresMessageHighlighting.cs index 7399ce1..5fcc7b6 100644 --- a/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/RequiresMessageAnalyzer/InvalidRequiresMessageHighlighting.cs +++ b/ContractExtensions/ProblemAnalyzers/PreconditionAnalyzers/RequiresMessageAnalyzer/InvalidRequiresMessageHighlighting.cs @@ -1,6 +1,9 @@ using System.Diagnostics.Contracts; +using JetBrains.DocumentModel; using JetBrains.ReSharper.Daemon; +using JetBrains.ReSharper.Feature.Services.Daemon; using JetBrains.ReSharper.Psi.CSharp; +using JetBrains.ReSharper.Psi.CSharp.Tree; using ReSharper.ContractExtensions.ContractsEx.Assertions; using ReSharper.ContractExtensions.ProblemAnalyzers.PreconditionAnalyzers; @@ -21,10 +24,14 @@ namespace ReSharper.ContractExtensions.ProblemAnalyzers.PreconditionAnalyzers public sealed class InvalidRequiresMessageHighlighting : IHighlighting { private readonly Message _contractMessage; + private readonly DocumentRange _range; - public InvalidRequiresMessageHighlighting(Message contractMessage) + public InvalidRequiresMessageHighlighting(IInvocationExpression invocationExpression, Message contractMessage) { Contract.Requires(contractMessage != null); + Contract.Requires(invocationExpression != null); + + _range = invocationExpression.GetHighlightingRange(); _contractMessage = contractMessage; } @@ -39,6 +46,14 @@ public bool IsValid() return true; } + /// + /// Calculates range of a highlighting. + /// + public DocumentRange CalculateRange() + { + return _range; + } + public string ToolTip { get { return ToolTipWarning; } diff --git a/ContractExtensions/Properties/AssemblyInfo.cs b/ContractExtensions/Properties/AssemblyInfo.cs index 14aa501..acb24a5 100644 --- a/ContractExtensions/Properties/AssemblyInfo.cs +++ b/ContractExtensions/Properties/AssemblyInfo.cs @@ -1,6 +1,5 @@ using System.Reflection; using System.Runtime.CompilerServices; -using JetBrains.Application.PluginSupport; [assembly: AssemblyTitle("ReSharper.ContractExtensions")] [assembly: AssemblyProduct("ReSharper.ContractExtensions")] @@ -9,8 +8,4 @@ [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] -[assembly: PluginTitle("ReSharper Code Contracts")] -[assembly: PluginDescription("Bring enhanced experience for Design by Contract development with .NET!")] -[assembly: PluginVendor("Sergey Teplyakov")] - [assembly: InternalsVisibleTo("ReSharper.ContractExtensions.Tests")] \ No newline at end of file diff --git a/ContractExtensions/ReSharper.ContractExtensions.R80.csproj b/ContractExtensions/ReSharper.ContractExtensions.R80.csproj deleted file mode 100644 index 741efad..0000000 --- a/ContractExtensions/ReSharper.ContractExtensions.R80.csproj +++ /dev/null @@ -1,289 +0,0 @@ - - - - - - Debug - AnyCPU - {E4AF008B-F55E-495A-8F54-AFFF5B43E500} - Library - Properties - ReSharper.ContractExtensions - ReSharper.ContractExtensions - v4.0 - 512 - - 0 - obj\R80\ - - - true - full - false - binR80\Debug\ - DEBUG;TRACE - prompt - 4 - True - False - True - False - False - False - True - True - False - False - False - True - True - False - False - False - True - False - True - True - False - False - - - - - - - - True - False - Full - %28none%29 - 0 - false - - - pdbonly - true - binR80\Release\ - TRACE - prompt - 4 - false - True - False - True - False - False - False - True - True - True - True - True - True - True - True - False - False - False - False - False - True - True - True - False - False - - - - - - - - True - False - True - Full - %28none%29 - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MSBuild:Compile - Designer - - - - - - \ No newline at end of file diff --git a/ContractExtensions/ReSharper.ContractExtensions.R81.csproj b/ContractExtensions/ReSharper.ContractExtensions.R81.csproj deleted file mode 100644 index f2cae6d..0000000 --- a/ContractExtensions/ReSharper.ContractExtensions.R81.csproj +++ /dev/null @@ -1,289 +0,0 @@ - - - - - - Debug - AnyCPU - {B0A3DCD3-5B44-4E3B-9208-42C9AD545D35} - Library - Properties - ReSharper.ContractExtensions - ReSharper.ContractExtensions - v4.0 - 512 - - 0 - obj\R81\ - - - true - full - false - binR81\Debug\ - DEBUG;TRACE - prompt - 4 - True - False - True - False - False - False - True - True - False - False - False - True - True - False - False - False - True - False - True - True - False - False - - - - - - - - True - False - Full - %28none%29 - 0 - false - - - pdbonly - true - binR81\Release\ - TRACE - prompt - 4 - false - True - False - True - False - False - False - True - True - True - True - True - True - True - True - False - False - False - False - False - True - True - True - False - False - - - - - - - - True - False - True - Full - %28none%29 - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MSBuild:Compile - Designer - - - - - - \ No newline at end of file diff --git a/ContractExtensions/ReSharper.ContractExtensions.csproj b/ContractExtensions/ReSharper.ContractExtensions.csproj index 3be44fe..67fc179 100644 --- a/ContractExtensions/ReSharper.ContractExtensions.csproj +++ b/ContractExtensions/ReSharper.ContractExtensions.csproj @@ -1,6 +1,5 @@  - Debug @@ -15,12 +14,14 @@ 0 obj\R82\ + + true full false - binR82\Debug\ + bin\Debug\ DEBUG;TRACE prompt 4 @@ -63,7 +64,7 @@ pdbonly true - binR82\Release\ + bin\Release\ TRACE prompt 4 @@ -107,19 +108,131 @@ 0 + + ..\packages\Antlr2.Runtime.2.7.7.02\lib\antlr.runtime.dll + True + + + ..\packages\xmlrpcnet.2.5.0\lib\net20\CookComputing.XmlRpcV2.dll + True + + + ..\packages\JetBrains.Platform.Lib.DevExpress.2.0.20150224.0\lib\Net\DevExpress.Data.v7.1.dll + True + + + ..\packages\JetBrains.Platform.Lib.DevExpress.2.0.20150224.0\lib\Net\DevExpress.Utils.v7.1.dll + True + + + ..\packages\JetBrains.Platform.Lib.DevExpress.2.0.20150224.0\lib\Net\DevExpress.XtraEditors.v7.1.dll + True + + + ..\packages\JetBrains.Platform.Lib.DevExpress.2.0.20150224.0\lib\Net\DevExpress.XtraTreeList.v7.1.dll + True + + + ..\packages\SharpZipLib.JetBrains.Stripped.0.86.20150204.1\lib\20\ICSharpCode.SharpZipLib.dll + True + + + ..\packages\DotNetZip.Reduced.1.9.1.8\lib\net20\Ionic.Zip.Reduced.dll + True + + + ..\packages\JetBrains.Unix.Utils.20150702.4\lib\net40\JbUnixUtils.dll + True + + + ..\packages\JetBrains.Annotations.9.2.0\lib\net20\JetBrains.Annotations.dll + True + + + ..\packages\JetBrains.Platform.Lib.Microsoft.Deployment.Compression.Cab.2.0.20140304.0\lib\Microsoft.Deployment.Compression.dll + True + + + ..\packages\JetBrains.Platform.Lib.Microsoft.Deployment.Compression.Cab.2.0.20140304.0\lib\Microsoft.Deployment.Compression.Cab.dll + True + + + ..\packages\JetBrains.Platform.Lib.Microsoft.Deployment.WindowsInstaller.2.0.20140821.0\lib\Microsoft.Deployment.WindowsInstaller.dll + True + + + ..\packages\JetBrains.Platform.Lib.VisualStudio.AnyVs.ShellInterop.PrivateBuild.2.0.20140304.0\lib\Microsoft.VisualStudio.Shell.Interop.dll + True + + + ..\packages\Microsoft.Web.Xdt.2.1.1\lib\net40\Microsoft.Web.XmlTransform.dll + True + + + ..\packages\Windows7APICodePack.JetBrains.Stripped.1.1.20150225.0\lib\Net\Microsoft.WindowsAPICodePack.dll + True + + + ..\packages\Windows7APICodePack.JetBrains.Stripped.1.1.20150225.0\lib\Net\Microsoft.WindowsAPICodePack.Shell.dll + True + + + ..\packages\Newtonsoft35.Json.7.0.1\lib\net35\Newtonsoft.Json.dll + True + + + ..\packages\NuGet.Core.2.8.6\lib\net40-Client\NuGet.Core.dll + True + + + ..\packages\NUnit.Core.2.6.4\lib\nunit.core.dll + True + + + ..\packages\NUnit.Core.2.6.4\lib\nunit.core.interfaces.dll + True + + + ..\packages\NUnit.2.6.4\lib\nunit.framework.dll + True + + + ..\packages\NUnit.Core.2.6.4\lib\nunit.util.dll + True + + + ..\packages\NVelocity.1.0.3\lib\NVelocity.dll + True + + + ..\packages\Sprache.JetBrains.2.0.0.44\lib\portable-net4+netcore45+win8+wp8+sl5+MonoAndroid1+MonoTouch1\Sprache.dll + True + + + ..\packages\JetBrains.Platform.Lib.System.Windows.Interactivity.2.0.20140318.0\lib\System.Windows.Interactivity.dll + True + + + ..\packages\Vestris.ResourceLib.JetBrains.1.4.20150303.0\lib\Net\Vestris.ResourceLib.dll + True + + + ..\packages\JetBrains.Platform.Lib.WpfContrib.2.0.20150225.0\lib\Net\WpfContrib.dll + True + @@ -267,9 +380,6 @@ - - - @@ -279,8 +389,60 @@ Designer + + + + + + + + + + - + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file diff --git a/ReSharper.ContractExtensions.Tests/ReSharper.ContractExtensions.Tests.R81.csproj b/ReSharper.ContractExtensions.Tests/ReSharper.ContractExtensions.Tests.R81.csproj deleted file mode 100644 index 0520133..0000000 --- a/ReSharper.ContractExtensions.Tests/ReSharper.ContractExtensions.Tests.R81.csproj +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - Debug - AnyCPU - {056D871D-0F3D-43C3-9EE3-FAD4B18BF3D9} - Library - Properties - ReSharper.ContractExtensions.Tests - ReSharper.ContractExtensions.Tests - v4.0 - 512 - - obj\R81\ - - - true - full - false - bin\DebugR81\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - bin\ReleaseR81\ - TRACE - prompt - 4 - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Designer - - - - - - - - {B0A3DCD3-5B44-4E3B-9208-42C9AD545D35} - ReSharper.ContractExtensions - - - - - - \ No newline at end of file diff --git a/ReSharper.ContractExtensions.Tests/ReSharper.ContractExtensions.Tests.csproj b/ReSharper.ContractExtensions.Tests/ReSharper.ContractExtensions.Tests.csproj index 725590f..402e858 100644 --- a/ReSharper.ContractExtensions.Tests/ReSharper.ContractExtensions.Tests.csproj +++ b/ReSharper.ContractExtensions.Tests/ReSharper.ContractExtensions.Tests.csproj @@ -1,8 +1,6 @@  - - - + Debug AnyCPU @@ -15,6 +13,8 @@ 512 obj\R82\ + + true @@ -36,13 +36,130 @@ false + + ..\packages\Antlr2.Runtime.2.7.7.02\lib\antlr.runtime.dll + True + + + ..\packages\xmlrpcnet.2.5.0\lib\net20\CookComputing.XmlRpcV2.dll + True + + + ..\packages\JetBrains.Platform.Lib.DevExpress.2.0.20150224.0\lib\Net\DevExpress.Data.v7.1.dll + True + + + ..\packages\JetBrains.Platform.Lib.DevExpress.2.0.20150224.0\lib\Net\DevExpress.Utils.v7.1.dll + True + + + ..\packages\JetBrains.Platform.Lib.DevExpress.2.0.20150224.0\lib\Net\DevExpress.XtraEditors.v7.1.dll + True + + + ..\packages\JetBrains.Platform.Lib.DevExpress.2.0.20150224.0\lib\Net\DevExpress.XtraTreeList.v7.1.dll + True + + + ..\packages\SharpZipLib.JetBrains.Stripped.0.86.20150204.1\lib\20\ICSharpCode.SharpZipLib.dll + True + + + ..\packages\DotNetZip.Reduced.1.9.1.8\lib\net20\Ionic.Zip.Reduced.dll + True + + + ..\packages\JetBrains.Unix.Utils.20150702.4\lib\net40\JbUnixUtils.dll + True + + + ..\packages\JetBrains.Annotations.9.2.0\lib\net20\JetBrains.Annotations.dll + True + + + + False + ..\packages\JetBrains.Psi.Features.test.Framework.103.0.20150819.145114\DotFiles\JetBrains.ReSharper.TestFramework.dll + + + ..\packages\JetBrains.Platform.Lib.Microsoft.Deployment.Compression.Cab.2.0.20140304.0\lib\Microsoft.Deployment.Compression.dll + True + + + ..\packages\JetBrains.Platform.Lib.Microsoft.Deployment.Compression.Cab.2.0.20140304.0\lib\Microsoft.Deployment.Compression.Cab.dll + True + + + ..\packages\JetBrains.Platform.Lib.Microsoft.Deployment.WindowsInstaller.2.0.20140821.0\lib\Microsoft.Deployment.WindowsInstaller.dll + True + + + ..\packages\JetBrains.Platform.Lib.VisualStudio.AnyVs.ShellInterop.PrivateBuild.2.0.20140304.0\lib\Microsoft.VisualStudio.Shell.Interop.dll + True + + + ..\packages\Microsoft.Web.Xdt.2.1.1\lib\net40\Microsoft.Web.XmlTransform.dll + True + + + ..\packages\Windows7APICodePack.JetBrains.Stripped.1.1.20150225.0\lib\Net\Microsoft.WindowsAPICodePack.dll + True + + + ..\packages\Windows7APICodePack.JetBrains.Stripped.1.1.20150225.0\lib\Net\Microsoft.WindowsAPICodePack.Shell.dll + True + + + ..\packages\Newtonsoft35.Json.7.0.1\lib\net35\Newtonsoft.Json.dll + True + + + ..\packages\NuGet.Core.2.8.6\lib\net40-Client\NuGet.Core.dll + True + + + ..\packages\NUnit.Core.2.6.4\lib\nunit.core.dll + True + + + ..\packages\NUnit.Core.2.6.4\lib\nunit.core.interfaces.dll + True + + + ..\packages\NUnit.2.6.4\lib\nunit.framework.dll + True + + + ..\packages\NUnit.Core.2.6.4\lib\nunit.util.dll + True + + + ..\packages\NVelocity.1.0.3\lib\NVelocity.dll + True + + + ..\packages\Sprache.JetBrains.2.0.0.44\lib\portable-net4+netcore45+win8+wp8+sl5+MonoAndroid1+MonoTouch1\Sprache.dll + True + + + ..\packages\JetBrains.Platform.Lib.System.Windows.Interactivity.2.0.20140318.0\lib\System.Windows.Interactivity.dll + True + + + ..\packages\Vestris.ResourceLib.JetBrains.1.4.20150303.0\lib\Net\Vestris.ResourceLib.dll + True + + + ..\packages\JetBrains.Platform.Lib.WpfContrib.2.0.20150225.0\lib\Net\WpfContrib.dll + True + @@ -101,11 +218,7 @@ - - - - Designer - + @@ -116,9 +229,61 @@ ReSharper.ContractExtensions - + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ReSharper.ContractExtensions.Tests/src/ContractFor/AddContractForContextActionAvailabilityTest.cs b/ReSharper.ContractExtensions.Tests/src/ContractFor/AddContractForContextActionAvailabilityTest.cs index 4b80cc6..9ff015d 100644 --- a/ReSharper.ContractExtensions.Tests/src/ContractFor/AddContractForContextActionAvailabilityTest.cs +++ b/ReSharper.ContractExtensions.Tests/src/ContractFor/AddContractForContextActionAvailabilityTest.cs @@ -1,4 +1,6 @@ -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; + + using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions; using ReSharper.ContractExtensions.ContextActions.ContractsFor; @@ -8,6 +10,11 @@ namespace ReSharper.ContractExtensions.Tests.ContractFor [TestFixture] public class AddContractForContextActionAvailabilityTest : CSharpContextActionAvailabilityTestBase { + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/ContractFor"; } + } + protected override string ExtraPath { get { return "ContractFor"; } diff --git a/ReSharper.ContractExtensions.Tests/src/ContractFor/AddContractForContextActionExecuteTest.cs b/ReSharper.ContractExtensions.Tests/src/ContractFor/AddContractForContextActionExecuteTest.cs index f3b3e5f..799970d 100644 --- a/ReSharper.ContractExtensions.Tests/src/ContractFor/AddContractForContextActionExecuteTest.cs +++ b/ReSharper.ContractExtensions.Tests/src/ContractFor/AddContractForContextActionExecuteTest.cs @@ -1,4 +1,4 @@ -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions; using ReSharper.ContractExtensions.ContextActions.ContractsFor; @@ -8,6 +8,10 @@ namespace ReSharper.ContractExtensions.Tests.ContractFor [TestFixture] public class AddContractForContextActionExecuteTest : CSharpContextActionExecuteTestBase { + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/ContractFor"; } + } protected override string ExtraPath { diff --git a/ReSharper.ContractExtensions.Tests/src/ContractFor/AddContractForWIthExcludeCodeCoverageTest.cs b/ReSharper.ContractExtensions.Tests/src/ContractFor/AddContractForWIthExcludeCodeCoverageTest.cs index a3f4881..5377527 100644 --- a/ReSharper.ContractExtensions.Tests/src/ContractFor/AddContractForWIthExcludeCodeCoverageTest.cs +++ b/ReSharper.ContractExtensions.Tests/src/ContractFor/AddContractForWIthExcludeCodeCoverageTest.cs @@ -3,7 +3,8 @@ using JetBrains.Application.Settings.Store.Implementation; using JetBrains.DataFlow; using JetBrains.ProjectModel; -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; +using JetBrains.ReSharper.Resources.Shell; using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions.ContractsFor; using ReSharper.ContractExtensions.Settings; @@ -14,6 +15,11 @@ namespace ReSharper.ContractExtensions.Tests.ContractFor [TestFixture] public class AddContractForWIthExcludeCodeCoverageTest : CSharpContextActionExecuteTestBase { + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/ContractFor"; } + } + protected override string ExtraPath { get { return "ContractFor"; } diff --git a/ReSharper.ContractExtensions.Tests/src/Ensures/ComboEnsuresContextActionAvailabilityTest.cs b/ReSharper.ContractExtensions.Tests/src/Ensures/ComboEnsuresContextActionAvailabilityTest.cs index 5a3cefd..90f3c10 100644 --- a/ReSharper.ContractExtensions.Tests/src/Ensures/ComboEnsuresContextActionAvailabilityTest.cs +++ b/ReSharper.ContractExtensions.Tests/src/Ensures/ComboEnsuresContextActionAvailabilityTest.cs @@ -1,4 +1,4 @@ -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions; using ReSharper.ContractExtensions.ContextActions.Ensures; @@ -8,6 +8,10 @@ namespace ReSharper.ContractExtensions.Tests.Postconditions [TestFixture] public class ComboEnsuresContextActionAvailabilityTest : CSharpContextActionAvailabilityTestBase { + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/ComboEnsures"; } + } protected override string ExtraPath { get { return "ComboEnsures"; } diff --git a/ReSharper.ContractExtensions.Tests/src/Ensures/ComboEnsuresContextActionExecuteTest.cs b/ReSharper.ContractExtensions.Tests/src/Ensures/ComboEnsuresContextActionExecuteTest.cs index 33b2062..09bb943 100644 --- a/ReSharper.ContractExtensions.Tests/src/Ensures/ComboEnsuresContextActionExecuteTest.cs +++ b/ReSharper.ContractExtensions.Tests/src/Ensures/ComboEnsuresContextActionExecuteTest.cs @@ -1,4 +1,4 @@ -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions.Ensures; @@ -7,6 +7,11 @@ namespace ReSharper.ContractExtensions.Tests.Postconditions [TestFixture] public class ComboEnsuresContextActionExecuteTest : CSharpContextActionExecuteTestBase { + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/ComboEnsures"; } + } + protected override string ExtraPath { get { return "ComboEnsures"; } diff --git a/ReSharper.ContractExtensions.Tests/src/Ensures/EnsuresContextActionAvailabilityTest.cs b/ReSharper.ContractExtensions.Tests/src/Ensures/EnsuresContextActionAvailabilityTest.cs index dac92e2..b96e320 100644 --- a/ReSharper.ContractExtensions.Tests/src/Ensures/EnsuresContextActionAvailabilityTest.cs +++ b/ReSharper.ContractExtensions.Tests/src/Ensures/EnsuresContextActionAvailabilityTest.cs @@ -1,5 +1,5 @@ using System.Diagnostics.Contracts; -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions; @@ -8,6 +8,10 @@ namespace ReSharper.ContractExtensions.Tests.Postconditions [TestFixture] public class EnsuresContextActionAvailabilityTest : CSharpContextActionAvailabilityTestBase { + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/Ensures"; } + } protected override string ExtraPath { get { return "Ensures"; } diff --git a/ReSharper.ContractExtensions.Tests/src/Ensures/EnsuresContextActionExecuteTest.cs b/ReSharper.ContractExtensions.Tests/src/Ensures/EnsuresContextActionExecuteTest.cs index 37358d4..9713090 100644 --- a/ReSharper.ContractExtensions.Tests/src/Ensures/EnsuresContextActionExecuteTest.cs +++ b/ReSharper.ContractExtensions.Tests/src/Ensures/EnsuresContextActionExecuteTest.cs @@ -1,4 +1,4 @@ -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions; @@ -7,6 +7,11 @@ namespace ReSharper.ContractExtensions.Tests.Postconditions [TestFixture] public class EnsuresContextActionExecuteForIndexersTest : CSharpContextActionExecuteTestBase { + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/Ensures/IndexerFixes"; } + } + protected override string ExtraPath { get { return "Ensures\\IndexerFixes"; } @@ -24,6 +29,11 @@ public void TestExecution(string testStr) [TestFixture] public class EnsuresContextActionExecuteTest : CSharpContextActionExecuteTestBase { + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/Ensures"; } + } + protected override string ExtraPath { get { return "Ensures"; } diff --git a/ReSharper.ContractExtensions.Tests/src/EnumChecks/EnumCheckEnsuresContextActionAvailabilityTest.cs b/ReSharper.ContractExtensions.Tests/src/EnumChecks/EnumCheckEnsuresContextActionAvailabilityTest.cs index 27bfeee..f232b48 100644 --- a/ReSharper.ContractExtensions.Tests/src/EnumChecks/EnumCheckEnsuresContextActionAvailabilityTest.cs +++ b/ReSharper.ContractExtensions.Tests/src/EnumChecks/EnumCheckEnsuresContextActionAvailabilityTest.cs @@ -1,6 +1,6 @@ using System.Diagnostics.Contracts; using System.Reflection; -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; using JetBrains.ReSharper.Psi.ExtensionsAPI.Caches2; using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions.EnumChecks; @@ -10,6 +10,11 @@ namespace ReSharper.ContractExtensions.Tests.Preconditions [TestFixture] public class EnumCheckEnsuresContextActionAvailabilityTest : CSharpContextActionAvailabilityTestBase { + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/EnumCheckEnsures"; } + } + protected override string ExtraPath { get { return "EnumCheckEnsures"; } diff --git a/ReSharper.ContractExtensions.Tests/src/EnumChecks/EnumCheckEnsuresContextActionExecutionTest.cs b/ReSharper.ContractExtensions.Tests/src/EnumChecks/EnumCheckEnsuresContextActionExecutionTest.cs index 749f444..1751fcd 100644 --- a/ReSharper.ContractExtensions.Tests/src/EnumChecks/EnumCheckEnsuresContextActionExecutionTest.cs +++ b/ReSharper.ContractExtensions.Tests/src/EnumChecks/EnumCheckEnsuresContextActionExecutionTest.cs @@ -1,4 +1,4 @@ -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions; using ReSharper.ContractExtensions.ContextActions.EnumChecks; @@ -9,6 +9,11 @@ namespace ReSharper.ContractExtensions.Tests.Preconditions [TestFixture] public class EnumCheckEnsuresContextActionExecutionTest : RequiresContextActionExecuteTestBase { + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/EnumCheckEnsures"; } + } + protected override string ExtraPath { get { return "EnumCheckEnsures"; } diff --git a/ReSharper.ContractExtensions.Tests/src/EnumChecks/EnumCheckRequiresContextActionAvailabilityTest.cs b/ReSharper.ContractExtensions.Tests/src/EnumChecks/EnumCheckRequiresContextActionAvailabilityTest.cs index da5d160..01b6761 100644 --- a/ReSharper.ContractExtensions.Tests/src/EnumChecks/EnumCheckRequiresContextActionAvailabilityTest.cs +++ b/ReSharper.ContractExtensions.Tests/src/EnumChecks/EnumCheckRequiresContextActionAvailabilityTest.cs @@ -1,6 +1,6 @@ using System.Diagnostics.Contracts; using System.Reflection; -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; using JetBrains.ReSharper.Psi.ExtensionsAPI.Caches2; using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions.EnumChecks; @@ -11,6 +11,10 @@ namespace ReSharper.ContractExtensions.Tests.Preconditions [TestFixture] public class EnumCheckRequiresContextActionAvailabilityTest : CSharpContextActionAvailabilityTestBase { + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/EnumCheckRequires"; } + } protected override string ExtraPath { get { return "EnumCheckRequires"; } diff --git a/ReSharper.ContractExtensions.Tests/src/EnumChecks/EnumCheckRequiresContextActionExecutionTest.cs b/ReSharper.ContractExtensions.Tests/src/EnumChecks/EnumCheckRequiresContextActionExecutionTest.cs index 6ba21c0..25c5f17 100644 --- a/ReSharper.ContractExtensions.Tests/src/EnumChecks/EnumCheckRequiresContextActionExecutionTest.cs +++ b/ReSharper.ContractExtensions.Tests/src/EnumChecks/EnumCheckRequiresContextActionExecutionTest.cs @@ -1,4 +1,4 @@ -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions; using ReSharper.ContractExtensions.ContextActions.EnumChecks; @@ -9,6 +9,11 @@ namespace ReSharper.ContractExtensions.Tests.Preconditions [TestFixture] public class EnumCheckRequiresContextActionExecutionTest : RequiresContextActionExecuteTestBase { + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/EnumCheckRequires"; } + } + protected override string ExtraPath { get { return "EnumCheckRequires"; } diff --git a/ReSharper.ContractExtensions.Tests/src/Invariants/InvariantActionAvailabilityTest.cs b/ReSharper.ContractExtensions.Tests/src/Invariants/InvariantActionAvailabilityTest.cs index dae7f0a..dea862b 100644 --- a/ReSharper.ContractExtensions.Tests/src/Invariants/InvariantActionAvailabilityTest.cs +++ b/ReSharper.ContractExtensions.Tests/src/Invariants/InvariantActionAvailabilityTest.cs @@ -1,4 +1,4 @@ -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions; using ReSharper.ContractExtensions.ContextActions.Invariants; @@ -8,6 +8,8 @@ namespace ReSharper.ContractExtensions.Tests.Invariants [TestFixture] public class AddObjectInvariantTest : CSharpContextActionAvailabilityTestBase { + protected override string RelativeTestDataPath { get { return "Intentions/ContextActions/Invariants"; } } + protected override string ExtraPath { get { return "Invariants"; } diff --git a/ReSharper.ContractExtensions.Tests/src/Invariants/InvariantContextActionExecuteTest.cs b/ReSharper.ContractExtensions.Tests/src/Invariants/InvariantContextActionExecuteTest.cs index ae55c3b..3581e92 100644 --- a/ReSharper.ContractExtensions.Tests/src/Invariants/InvariantContextActionExecuteTest.cs +++ b/ReSharper.ContractExtensions.Tests/src/Invariants/InvariantContextActionExecuteTest.cs @@ -1,4 +1,4 @@ -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions; using ReSharper.ContractExtensions.ContextActions.Invariants; @@ -8,6 +8,10 @@ namespace ReSharper.ContractExtensions.Tests.Invariants [TestFixture] public class InvariantContextActionExecuteTest : CSharpContextActionExecuteTestBase { + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/Invariants"; } + } protected override string ExtraPath { get { return "Invariants"; } diff --git a/ReSharper.ContractExtensions.Tests/src/ProblemAnalyzers/CSharpHighlightingTestBase.cs b/ReSharper.ContractExtensions.Tests/src/ProblemAnalyzers/CSharpHighlightingTestBase.cs index d4e5cf8..2dac9c9 100644 --- a/ReSharper.ContractExtensions.Tests/src/ProblemAnalyzers/CSharpHighlightingTestBase.cs +++ b/ReSharper.ContractExtensions.Tests/src/ProblemAnalyzers/CSharpHighlightingTestBase.cs @@ -1,6 +1,8 @@ using JetBrains.Application.Settings; using JetBrains.ReSharper.Daemon; using JetBrains.ReSharper.Daemon.CSharp; +using JetBrains.ReSharper.Feature.Services.Daemon; +using JetBrains.ReSharper.FeaturesTestFramework.Daemon; using JetBrains.ReSharper.TestFramework; namespace ReSharper.ContractExtensions.Tests.ProblemAnalyzers @@ -8,9 +10,10 @@ namespace ReSharper.ContractExtensions.Tests.ProblemAnalyzers [TestReferences(@"%PRODUCT%\JetBrains.Annotations.dll")] public abstract class CSharpHighlightingTestBase : CSharpHighlightingTestNet45Base where THighlighting : IHighlighting { - protected override bool HighlightingPredicate(IHighlighting highlighting, IContextBoundSettingsStore settingsstore) - { - return highlighting is THighlighting; - } + //protected override + //protected override bool HighlightingPredicate(IHighlighting highlighting, IContextBoundSettingsStore settingsstore) + //{ + // return highlighting is THighlighting; + //} } } \ No newline at end of file diff --git a/ReSharper.ContractExtensions.Tests/src/ProblemAnalyzers/PreconditionAnalyzers/RedundantRequiresQuickFixAvailabilityTests.cs b/ReSharper.ContractExtensions.Tests/src/ProblemAnalyzers/PreconditionAnalyzers/RedundantRequiresQuickFixAvailabilityTests.cs index 8754a3b..ac1ead7 100644 --- a/ReSharper.ContractExtensions.Tests/src/ProblemAnalyzers/PreconditionAnalyzers/RedundantRequiresQuickFixAvailabilityTests.cs +++ b/ReSharper.ContractExtensions.Tests/src/ProblemAnalyzers/PreconditionAnalyzers/RedundantRequiresQuickFixAvailabilityTests.cs @@ -1,5 +1,5 @@ using JetBrains.ReSharper.Daemon; -using JetBrains.ReSharper.Intentions.Test; +//using JetBrains.ReSharper.Intentions.Test; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.TestFramework; using NUnit.Framework; diff --git a/ReSharper.ContractExtensions.Tests/src/ProblemAnalyzers/PreconditionAnalyzers/RequiresMessageAnalyzer/RequiresMessageHighlightingTests.cs b/ReSharper.ContractExtensions.Tests/src/ProblemAnalyzers/PreconditionAnalyzers/RequiresMessageAnalyzer/RequiresMessageHighlightingTests.cs index 686d0f9..ab9fd81 100644 --- a/ReSharper.ContractExtensions.Tests/src/ProblemAnalyzers/PreconditionAnalyzers/RequiresMessageAnalyzer/RequiresMessageHighlightingTests.cs +++ b/ReSharper.ContractExtensions.Tests/src/ProblemAnalyzers/PreconditionAnalyzers/RequiresMessageAnalyzer/RequiresMessageHighlightingTests.cs @@ -1,4 +1,5 @@ -using NUnit.Framework; +using System.Diagnostics.Contracts; +using NUnit.Framework; using ReSharper.ContractExtensions.ProblemAnalyzers.PreconditionAnalyzers; namespace ReSharper.ContractExtensions.Tests.ProblemAnalyzers.PreconditionAnalyzers @@ -17,6 +18,7 @@ public void Debug(string testName) } [TestCase("NoWarningConstant.cs")] + [TestCase("NoWarningOnNameof.cs")] [TestCase("NoWarningStaticField.cs")] [TestCase("NoWarningStaticProperty.cs")] [TestCase("NoWarningStringLiteral.cs")] @@ -27,10 +29,8 @@ public void Debug(string testName) [TestCase("WarningOnPrivateStaticField.cs")] public void Test(string testName) { + Contract.Requires(testName != null); DoTestSolution(testName); } - - - } } \ No newline at end of file diff --git a/ReSharper.ContractExtensions.Tests/src/ProblemAnalyzers/QuickFixAvailabilityTestBase.cs b/ReSharper.ContractExtensions.Tests/src/ProblemAnalyzers/QuickFixAvailabilityTestBase.cs index cd7bb1a..4dad70e 100644 --- a/ReSharper.ContractExtensions.Tests/src/ProblemAnalyzers/QuickFixAvailabilityTestBase.cs +++ b/ReSharper.ContractExtensions.Tests/src/ProblemAnalyzers/QuickFixAvailabilityTestBase.cs @@ -1,5 +1,6 @@ using JetBrains.ReSharper.Daemon; -using JetBrains.ReSharper.Intentions.Test; +using JetBrains.ReSharper.Feature.Services.Daemon; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; using JetBrains.ReSharper.Psi; using JetBrains.ReSharper.TestFramework; using NUnit.Framework; diff --git a/ReSharper.ContractExtensions.Tests/src/ProblemAnalyzers/QuickFixNet45TestBase.cs b/ReSharper.ContractExtensions.Tests/src/ProblemAnalyzers/QuickFixNet45TestBase.cs index 3dc76a6..507e285 100644 --- a/ReSharper.ContractExtensions.Tests/src/ProblemAnalyzers/QuickFixNet45TestBase.cs +++ b/ReSharper.ContractExtensions.Tests/src/ProblemAnalyzers/QuickFixNet45TestBase.cs @@ -1,5 +1,7 @@ -using JetBrains.ReSharper.Intentions.Extensibility; -using JetBrains.ReSharper.IntentionsTests; +using JetBrains.ReSharper.Feature.Services.QuickFixes; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; +//using JetBrains.ReSharper.Intentions.Extensibility; +//using JetBrains.ReSharper.IntentionsTests; using JetBrains.ReSharper.TestFramework; namespace ReSharper.ContractExtensions.Tests.ProblemAnalyzers diff --git a/ReSharper.ContractExtensions.Tests/src/Requires/ComboMethodRequiresContextActionAvailabilityTest.cs b/ReSharper.ContractExtensions.Tests/src/Requires/ComboMethodRequiresContextActionAvailabilityTest.cs index 463b8a1..c98d85d 100644 --- a/ReSharper.ContractExtensions.Tests/src/Requires/ComboMethodRequiresContextActionAvailabilityTest.cs +++ b/ReSharper.ContractExtensions.Tests/src/Requires/ComboMethodRequiresContextActionAvailabilityTest.cs @@ -1,4 +1,4 @@ -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions.Requires; @@ -7,6 +7,11 @@ namespace ReSharper.ContractExtensions.Tests.Preconditions public class ComboMethodRequiresContextActionAvailabilityTest : CSharpContextActionAvailabilityTestBase { + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/ComboRequiresForMethod"; } + } + protected override string ExtraPath { get { return "ComboRequiresForMethod"; } diff --git a/ReSharper.ContractExtensions.Tests/src/Requires/ComboMethodRequiresContextActionExecuteTest.cs b/ReSharper.ContractExtensions.Tests/src/Requires/ComboMethodRequiresContextActionExecuteTest.cs index a0605df..3655656 100644 --- a/ReSharper.ContractExtensions.Tests/src/Requires/ComboMethodRequiresContextActionExecuteTest.cs +++ b/ReSharper.ContractExtensions.Tests/src/Requires/ComboMethodRequiresContextActionExecuteTest.cs @@ -1,5 +1,5 @@ using System.Diagnostics.Contracts; -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions.Requires; @@ -8,6 +8,11 @@ namespace ReSharper.ContractExtensions.Tests.Preconditions [TestFixture] public class ComboMethodRequiresContextActionExecuteTest : RequiresContextActionExecuteTestBase { + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/ComboRequiresForMethod"; } + } + protected override string ExtraPath { get { return "ComboRequiresForMethod"; } diff --git a/ReSharper.ContractExtensions.Tests/src/Requires/ComboRequiresContextActionAvailabilityTest.cs b/ReSharper.ContractExtensions.Tests/src/Requires/ComboRequiresContextActionAvailabilityTest.cs index 1b644b7..e4aca17 100644 --- a/ReSharper.ContractExtensions.Tests/src/Requires/ComboRequiresContextActionAvailabilityTest.cs +++ b/ReSharper.ContractExtensions.Tests/src/Requires/ComboRequiresContextActionAvailabilityTest.cs @@ -1,4 +1,4 @@ -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions.Requires; @@ -7,6 +7,10 @@ namespace ReSharper.ContractExtensions.Tests.Preconditions public class ComboRequiresContextActionAvailabilityTest : CSharpContextActionAvailabilityTestBase { + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/ComboRequires"; } + } protected override string ExtraPath { get { return "ComboRequires"; } diff --git a/ReSharper.ContractExtensions.Tests/src/Requires/ComboRequiresContextActionExecuteTest.cs b/ReSharper.ContractExtensions.Tests/src/Requires/ComboRequiresContextActionExecuteTest.cs index 048825f..d28c4c4 100644 --- a/ReSharper.ContractExtensions.Tests/src/Requires/ComboRequiresContextActionExecuteTest.cs +++ b/ReSharper.ContractExtensions.Tests/src/Requires/ComboRequiresContextActionExecuteTest.cs @@ -1,4 +1,4 @@ -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions.Requires; @@ -7,6 +7,10 @@ namespace ReSharper.ContractExtensions.Tests.Preconditions [TestFixture] public class ComboRequiresContextActionExecuteTest : RequiresContextActionExecuteTestBase { + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/ComboRequires"; } + } protected override string ExtraPath { get { return "ComboRequires"; } diff --git a/ReSharper.ContractExtensions.Tests/src/Requires/PreconditionConverters/ContractConverterContextActionAvailabilityTest.cs b/ReSharper.ContractExtensions.Tests/src/Requires/PreconditionConverters/ContractConverterContextActionAvailabilityTest.cs index f602481..dee3412 100644 --- a/ReSharper.ContractExtensions.Tests/src/Requires/PreconditionConverters/ContractConverterContextActionAvailabilityTest.cs +++ b/ReSharper.ContractExtensions.Tests/src/Requires/PreconditionConverters/ContractConverterContextActionAvailabilityTest.cs @@ -1,4 +1,4 @@ -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions.Requires; @@ -7,6 +7,11 @@ namespace ReSharper.ContractExtensions.Tests.Preconditions public class ContractConverterContextActionAvailabilityTest : CSharpContextActionAvailabilityTestBase { + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/PreconditionConverters"; } + } + protected override string ExtraPath { get { return "PreconditionConverters"; } diff --git a/ReSharper.ContractExtensions.Tests/src/Requires/PreconditionConverters/ContractRequiresToGenericContractRequiresContextActionExecutorTest.cs b/ReSharper.ContractExtensions.Tests/src/Requires/PreconditionConverters/ContractRequiresToGenericContractRequiresContextActionExecutorTest.cs index d07c28a..13bbed7 100644 --- a/ReSharper.ContractExtensions.Tests/src/Requires/PreconditionConverters/ContractRequiresToGenericContractRequiresContextActionExecutorTest.cs +++ b/ReSharper.ContractExtensions.Tests/src/Requires/PreconditionConverters/ContractRequiresToGenericContractRequiresContextActionExecutorTest.cs @@ -1,4 +1,4 @@ -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions.Requires; @@ -8,6 +8,11 @@ namespace ReSharper.ContractExtensions.Tests.Preconditions public class ContractRequiresToGenericContractRequiresContextActionExecutorTest : CSharpContextActionExecuteTestBase { + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/PreconditionConverters"; } + } + protected override string ExtraPath { get { return "PreconditionConverters"; } diff --git a/ReSharper.ContractExtensions.Tests/src/Requires/PreconditionConverters/GenericContractRequiresToContractRequiresContextActionExecutorTest.cs b/ReSharper.ContractExtensions.Tests/src/Requires/PreconditionConverters/GenericContractRequiresToContractRequiresContextActionExecutorTest.cs index c8c8f27..bae529c 100644 --- a/ReSharper.ContractExtensions.Tests/src/Requires/PreconditionConverters/GenericContractRequiresToContractRequiresContextActionExecutorTest.cs +++ b/ReSharper.ContractExtensions.Tests/src/Requires/PreconditionConverters/GenericContractRequiresToContractRequiresContextActionExecutorTest.cs @@ -1,4 +1,4 @@ -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions.Requires; @@ -8,6 +8,10 @@ namespace ReSharper.ContractExtensions.Tests.Preconditions public class GenericContractRequiresToContractRequiresContextActionExecutorTest : CSharpContextActionExecuteTestBase { + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/PreconditionConverters"; } + } protected override string ExtraPath { get { return "PreconditionConverters"; } diff --git a/ReSharper.ContractExtensions.Tests/src/Requires/PreconditionConverters/IfThrowToContractRequiresContextActionExecutorTest.cs b/ReSharper.ContractExtensions.Tests/src/Requires/PreconditionConverters/IfThrowToContractRequiresContextActionExecutorTest.cs index 534d3bc..7196844 100644 --- a/ReSharper.ContractExtensions.Tests/src/Requires/PreconditionConverters/IfThrowToContractRequiresContextActionExecutorTest.cs +++ b/ReSharper.ContractExtensions.Tests/src/Requires/PreconditionConverters/IfThrowToContractRequiresContextActionExecutorTest.cs @@ -2,7 +2,7 @@ using JetBrains.Application.Settings; using JetBrains.Application.Settings.Store.Implementation; using JetBrains.DataFlow; -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions.Requires; using ReSharper.ContractExtensions.Settings; @@ -15,6 +15,11 @@ public class IfThrowToContractRequiresContextActionExecutorTest { private bool _useGenericVersion = false; + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/PreconditionConverters"; } + } + protected override string ExtraPath { get { return "PreconditionConverters"; } diff --git a/ReSharper.ContractExtensions.Tests/src/Requires/RequiresContextActionAvailabilityTest.cs b/ReSharper.ContractExtensions.Tests/src/Requires/RequiresContextActionAvailabilityTest.cs index 1aeb04d..5c976ec 100644 --- a/ReSharper.ContractExtensions.Tests/src/Requires/RequiresContextActionAvailabilityTest.cs +++ b/ReSharper.ContractExtensions.Tests/src/Requires/RequiresContextActionAvailabilityTest.cs @@ -1,4 +1,4 @@ -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions; using ReSharper.ContractExtensions.ContextActions.Requires; @@ -9,11 +9,15 @@ namespace ReSharper.ContractExtensions.Tests.Preconditions public class RequiresContextActionAvailabilityTest : CSharpContextActionAvailabilityTestBase { + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/Requires"; } + } + protected override string ExtraPath { get { return "Requires"; } } - [TestCase("AvailabilityDebug")] public void TestSimpleAvailability(string testSrc) diff --git a/ReSharper.ContractExtensions.Tests/src/Requires/RequiresContextActionExecuteTest.cs b/ReSharper.ContractExtensions.Tests/src/Requires/RequiresContextActionExecuteTest.cs index 3dcc856..d699c5f 100644 --- a/ReSharper.ContractExtensions.Tests/src/Requires/RequiresContextActionExecuteTest.cs +++ b/ReSharper.ContractExtensions.Tests/src/Requires/RequiresContextActionExecuteTest.cs @@ -1,4 +1,4 @@ -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions.Requires; @@ -7,10 +7,14 @@ namespace ReSharper.ContractExtensions.Tests.Preconditions [TestFixture] public class RequiresContextActionExecuteForIndexerTest : RequiresContextActionExecuteTestBase { + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/Requires/IndexerFixes"; } + } protected override string ExtraPath { - get { return "Requires\\IndexerFixes"; } + get { return "Requires/IndexerFixes"; } } [TestCase("GetterAndSetter")] @@ -26,7 +30,10 @@ public void TestIndexerExecution(string test) [TestFixture] public class RequiresContextActionExecuteTest : RequiresContextActionExecuteTestBase { - + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/Requires"; } + } protected override string ExtraPath { get { return "Requires"; } diff --git a/ReSharper.ContractExtensions.Tests/src/Requires/RequiresContextActionExecuteTestBase.cs b/ReSharper.ContractExtensions.Tests/src/Requires/RequiresContextActionExecuteTestBase.cs index 8f3da25..c0ffc0e 100644 --- a/ReSharper.ContractExtensions.Tests/src/Requires/RequiresContextActionExecuteTestBase.cs +++ b/ReSharper.ContractExtensions.Tests/src/Requires/RequiresContextActionExecuteTestBase.cs @@ -3,8 +3,10 @@ using JetBrains.Application.Settings.Store.Implementation; using JetBrains.DataFlow; using JetBrains.ProjectModel; -using JetBrains.ReSharper.Intentions.CSharp.Test; -using JetBrains.ReSharper.Intentions.Extensibility; +using JetBrains.ReSharper.Feature.Services.ContextActions; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; +using JetBrains.ReSharper.Resources.Shell; +//using JetBrains.ReSharper.Intentions.Extensibility; using ReSharper.ContractExtensions.Settings; namespace ReSharper.ContractExtensions.Tests.Preconditions diff --git a/ReSharper.ContractExtensions.Tests/src/Requires/RequiresContextActionExecuteTestForStringArg.cs b/ReSharper.ContractExtensions.Tests/src/Requires/RequiresContextActionExecuteTestForStringArg.cs index dc247c8..186113d 100644 --- a/ReSharper.ContractExtensions.Tests/src/Requires/RequiresContextActionExecuteTestForStringArg.cs +++ b/ReSharper.ContractExtensions.Tests/src/Requires/RequiresContextActionExecuteTestForStringArg.cs @@ -3,7 +3,8 @@ using JetBrains.Application.Settings.Store.Implementation; using JetBrains.DataFlow; using JetBrains.ProjectModel; -using JetBrains.ReSharper.Intentions.CSharp.Test; +using JetBrains.ReSharper.FeaturesTestFramework.Intentions; +using JetBrains.ReSharper.Resources.Shell; using NUnit.Framework; using ReSharper.ContractExtensions.ContextActions.Requires; using ReSharper.ContractExtensions.Settings; @@ -30,6 +31,11 @@ protected override void DoTest(IProject testProject) }); } + protected override string RelativeTestDataPath + { + get { return "Intentions/ContextActions/RequiresWithString"; } + } + protected override string ExtraPath { get { return "RequiresWithString"; } diff --git a/ReSharper.ContractExtensions.Tests/src/ZoneMarker.cs b/ReSharper.ContractExtensions.Tests/src/ZoneMarker.cs new file mode 100644 index 0000000..4af31cd --- /dev/null +++ b/ReSharper.ContractExtensions.Tests/src/ZoneMarker.cs @@ -0,0 +1,11 @@ +using JetBrains.Application.BuildScript.Application.Zones; +using JetBrains.ReSharper.Feature.Services; +using JetBrains.ReSharper.Psi.CSharp; + +namespace ReSharper.ContractExtensions.Tests +{ + [ZoneMarker] + public class ZoneMarker : IRequire, IRequire, IRequire + { } + +} \ No newline at end of file diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/NoWarning.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/NoWarning.cs.gold index b115809..ee98698 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/NoWarning.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/NoWarning.cs.gold @@ -1,9 +1,11 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { [ContractPublicPropertyName("IsValid")] - private bool _isValid; - public bool IsValid {get; private set;} + private bool |_isValid|(0); + public bool IsValid {get; |private set;|(1)} } --------------------------------------------------------- +(0): ReSharper Warning [CS0169]: Field '_isValid' is never used +(1): ReSharper Warning: Auto-property accessor is never used diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/WarnForNonExistedProperty.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/WarnForNonExistedProperty.cs.gold index f62ff2d..c7b2a4f 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/WarnForNonExistedProperty.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/WarnForNonExistedProperty.cs.gold @@ -1,9 +1,10 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { [ContractPublicPropertyName("IsValid")] - private bool |_isValid|(0); + private bool ||_isValid|(0)|(1); } --------------------------------------------------------- (0): ReSharper Underlined Error Highlighting: Field '_isValid' is marked [ContractPublicPropertyName("IsValid")], but no public field/property named 'IsValid' with type 'bool' can be found +(1): ReSharper Warning [CS0169]: Field '_isValid' is never used diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/WarnForNonPublicField.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/WarnForNonPublicField.cs.gold index 82e3ce8..3afc5dc 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/WarnForNonPublicField.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/WarnForNonPublicField.cs.gold @@ -1,10 +1,12 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { [ContractPublicPropertyName("IsValid")] - private bool |_isValid|(0); - private bool IsValid; + private bool ||_isValid|(0)|(1); + private bool |IsValid|(2); } --------------------------------------------------------- (0): ReSharper Underlined Error Highlighting: Field '_isValid' is marked [ContractPublicPropertyName("IsValid")], but no public field/property named 'IsValid' with type 'bool' can be found +(1): ReSharper Warning [CS0169]: Field '_isValid' is never used +(2): ReSharper Warning [CS0169]: Field 'IsValid' is never used diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/WarnForNonPublicProperty.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/WarnForNonPublicProperty.cs.gold index 471b4e1..e76bdb0 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/WarnForNonPublicProperty.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/ContractPublicPropertyNameCheckers/WarnForNonPublicProperty.cs.gold @@ -1,10 +1,13 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { [ContractPublicPropertyName("IsValid")] - private bool |_isValid|(0); - private bool IsValid {get; private set;} + private bool ||_isValid|(0)|(1); + private bool |IsValid|(2) {get; |private|(3) set;} } --------------------------------------------------------- (0): ReSharper Underlined Error Highlighting: Field '_isValid' is marked [ContractPublicPropertyName("IsValid")], but no public field/property named 'IsValid' with type 'bool' can be found +(1): ReSharper Warning [CS0169]: Field '_isValid' is never used +(2): ReSharper Dead Code: Property 'IsValid' is never used +(3): ReSharper Underlined Error Highlighting: The accessibility modifier of the accessor must be more restrictive than the property 'A.IsValid' diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/NoWarning.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/NoWarning.cs index e236c70..fb71056 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/NoWarning.cs +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/NoWarning.cs @@ -1,3 +1,4 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/NoWarning.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/NoWarning.cs.gold index 8d81aa3..93149fc 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/NoWarning.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/NoWarning.cs.gold @@ -1,3 +1,4 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/NoWarningWithContractPublicPropertyName.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/NoWarningWithContractPublicPropertyName.cs.gold index 38acc01..fc6d028 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/NoWarningWithContractPublicPropertyName.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/NoWarningWithContractPublicPropertyName.cs.gold @@ -1,14 +1,18 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; public class PreconditionWithContractPublicPropertyName { [ContractPublicPropertyName("IsValid")] - private bool _isValid = false; - public bool IsValid { get; private set; } + private bool ||_isValid|(0)|(1) = false; + public bool IsValid { get; |private set;|(2) } public void Foo() { - Contract.Requires(_isValid); + |Contract.Requires(_isValid)|(3); } } --------------------------------------------------------- +(0): ReSharper Suggestion: Field can be made readonly +(1): ReSharper Hint: Convert to constant +(2): ReSharper Warning: Auto-property accessor is never used +(3): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/PublicInternalWarning.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/PublicInternalWarning.cs.gold index bf7590f..4490407 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/PublicInternalWarning.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/PublicInternalWarning.cs.gold @@ -1,12 +1,13 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { public void Foo(string s) { - |Contract.Requires(IsValid())|(0); + ||Contract.Requires(IsValid())|(0)|(1); } internal bool IsValid() {return true;} } --------------------------------------------------------- (0): ReSharper Underlined Error Highlighting: Member 'IsValid' has less visibility than the enclosing method 'Foo' +(1): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/PublicPrivateFieldWarning.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/PublicPrivateFieldWarning.cs.gold index 521f553..fe6c284 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/PublicPrivateFieldWarning.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/PublicPrivateFieldWarning.cs.gold @@ -1,12 +1,14 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { - private bool _isValid; + private bool |_isValid|(0); public void Foo() { - |Contract.Requires(_isValid)|(0); + ||Contract.Requires(_isValid)|(1)|(2); } } --------------------------------------------------------- -(0): ReSharper Underlined Error Highlighting: Member '_isValid' has less visibility than the enclosing method 'Foo' +(0): ReSharper Warning [CS0649]: Field '_isValid' is never assigned +(1): ReSharper Underlined Error Highlighting: Member '_isValid' has less visibility than the enclosing method 'Foo' +(2): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/PublicPrivatePropertyWarning.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/PublicPrivatePropertyWarning.cs.gold index 621e35d..1d53c84 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/PublicPrivatePropertyWarning.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/PublicPrivatePropertyWarning.cs.gold @@ -1,12 +1,14 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { public void Foo(string s) { - |Contract.Requires(IsValid)|(0); + ||Contract.Requires(IsValid)|(0)|(1); } - private bool IsValid {get; private set;} + private bool IsValid {get; |private|(2) set;} } --------------------------------------------------------- (0): ReSharper Underlined Error Highlighting: Member 'IsValid' has less visibility than the enclosing method 'Foo' +(1): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation +(2): ReSharper Underlined Error Highlighting: The accessibility modifier of the accessor must be more restrictive than the property 'A.IsValid' diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/PublicPrivateWarning.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/PublicPrivateWarning.cs.gold index 264ad20..ad89a13 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/PublicPrivateWarning.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/PublicPrivateWarning.cs.gold @@ -1,12 +1,15 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { public void Foo(string s) { - |Contract.Requires(IsValid(s))|(0); + ||Contract.Requires(IsValid(s))|(0)|(1); } - private bool IsValid(string s) {return true;} + private bool |IsValid|(2)(string |s|(3)) {return true;} } --------------------------------------------------------- (0): ReSharper Underlined Error Highlighting: Member 'IsValid' has less visibility than the enclosing method 'Foo' +(1): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation +(2): ReSharper Hint: Method 'IsValid' can be made static +(3): ReSharper Dead Code: Parameter 's' is never used diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/PublicProtectedWarning.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/PublicProtectedWarning.cs.gold index 2b2fc36..68c0998 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/PublicProtectedWarning.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/PublicProtectedWarning.cs.gold @@ -1,12 +1,13 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { public void Foo(string s) { - |Contract.Requires(IsValid(s))|(0); + ||Contract.Requires(IsValid(s))|(0)|(1); } protected bool IsValid(string s) {return true;} } --------------------------------------------------------- (0): ReSharper Underlined Error Highlighting: Member 'IsValid' has less visibility than the enclosing method 'Foo' +(1): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/WarningForDifferentTypeVisibility.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/WarningForDifferentTypeVisibility.cs.gold index 68419d3..2aaafd6 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/WarningForDifferentTypeVisibility.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/WarningForDifferentTypeVisibility.cs.gold @@ -1,10 +1,10 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; public class A { public void Foo(string s) { - |Contract.Requires(!s.IsNullOrEmpty())|(0); + ||Contract.Requires(!s.IsNullOrEmpty())|(0)|(1); } } @@ -17,3 +17,4 @@ static class StringExtensions } --------------------------------------------------------- (0): ReSharper Underlined Error Highlighting: Member 'StringExtensions.IsNullOrEmpty' has less visibility than the enclosing method 'A.Foo' +(1): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/WarningForPrivateInnerType.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/WarningForPrivateInnerType.cs.gold index 15fd7c3..0d82036 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/WarningForPrivateInnerType.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/WarningForPrivateInnerType.cs.gold @@ -1,13 +1,13 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; public class A { public void Foo(string s) { - |Contract.Requires(!Inner.IsValid(s))|(0); + ||Contract.Requires(!Inner.IsValid(s))|(0)|(1); } - private class Inner + private class |Inner|(2) { public static bool IsValid(string s) {return s != null;} } @@ -15,3 +15,5 @@ public class A --------------------------------------------------------- (0): ReSharper Underlined Error Highlighting: Member 'Inner.IsValid' has less visibility than the enclosing method 'A.Foo' +(1): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation +(2): ReSharper Suggestion: Class 'Inner' is never instantiated diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/WarningForUsingFieldLikeEvent.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/WarningForUsingFieldLikeEvent.cs index 5f9393a..c5261e3 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/WarningForUsingFieldLikeEvent.cs +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/WarningForUsingFieldLikeEvent.cs @@ -1,8 +1,9 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A { - public event EventHandler E; + public event System.EventHandler E; public void Foo() { diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/WarningForUsingFieldLikeEvent.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/WarningForUsingFieldLikeEvent.cs.gold index b1aa506..244b85a 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/WarningForUsingFieldLikeEvent.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/WarningForUsingFieldLikeEvent.cs.gold @@ -1,8 +1,9 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A { - public event EventHandler E; + public event System.EventHandler E; public void Foo() { diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/WarningFromPropertyPrecondition.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/WarningFromPropertyPrecondition.cs.gold index 903e46f..98e5b4b 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/WarningFromPropertyPrecondition.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/IncosistentVisibilityChecker/WarningFromPropertyPrecondition.cs.gold @@ -1,4 +1,4 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { @@ -6,7 +6,7 @@ class A { get { - |Contract.Requires(IsValid())|(0); + ||Contract.Requires(IsValid())|(0)|(1); return ""; } } @@ -14,3 +14,4 @@ class A } --------------------------------------------------------- (0): ReSharper Underlined Error Highlighting: Member 'IsValid' has less visibility than the enclosing property 'Foo' +(1): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningConstant.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningConstant.cs.gold index 7a05e67..2fa9e67 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningConstant.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningConstant.cs.gold @@ -1,11 +1,12 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { internal const string Message = "message"; public void Foo(string s) { - Contract.Requires(s != null, Message); + |Contract.Requires(s != null, Message)|(0); } } --------------------------------------------------------- +(0): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningOnNameof.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningOnNameof.cs new file mode 100644 index 0000000..64ae804 --- /dev/null +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningOnNameof.cs @@ -0,0 +1,10 @@ +#define CONTRACTS_FULL +using System.Diagnostics.Contracts; + +class A +{ + public void Foo(string s) + { + Contract.Requires(s != null, nameof(s)); + } +} \ No newline at end of file diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningOnNameof.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningOnNameof.cs.gold new file mode 100644 index 0000000..55bc812 --- /dev/null +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningOnNameof.cs.gold @@ -0,0 +1,11 @@ +#define CONTRACTS_FULL +using System.Diagnostics.Contracts; + +class A +{ + public void Foo(string s) + { + Contract.Requires(s != null, nameof(s)); + } +} +--------------------------------------------------------- diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningStaticField.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningStaticField.cs.gold index 0049d7b..fe984eb 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningStaticField.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningStaticField.cs.gold @@ -1,11 +1,12 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { internal static string Message = "message"; public void Foo(string s) { - Contract.Requires(s != null, Message); + |Contract.Requires(s != null, Message)|(0); } } --------------------------------------------------------- +(0): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningStaticProperty.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningStaticProperty.cs index 087f348..17ebab7 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningStaticProperty.cs +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningStaticProperty.cs @@ -1,3 +1,4 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningStaticProperty.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningStaticProperty.cs.gold index 0fa7c5f..cabcf55 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningStaticProperty.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningStaticProperty.cs.gold @@ -1,11 +1,13 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A { - internal static string Message {get {return "message";}} + internal static string Message {get {|return|(0) "message";}} public void Foo(string s) { Contract.Requires(s != null, Message); } } --------------------------------------------------------- +(0): ReSharper Suggestion: Use expression body diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningStringLiteral.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningStringLiteral.cs index 989a93c..2028657 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningStringLiteral.cs +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningStringLiteral.cs @@ -1,3 +1,4 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningStringLiteral.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningStringLiteral.cs.gold index 58b81d3..ba8c0da 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningStringLiteral.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/NoWarningStringLiteral.cs.gold @@ -1,3 +1,4 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/WarningOnInstanceField.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/WarningOnInstanceField.cs index 99a3e2a..8b6ee95 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/WarningOnInstanceField.cs +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/WarningOnInstanceField.cs @@ -1,3 +1,4 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/WarningOnInstanceField.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/WarningOnInstanceField.cs.gold index 6384bac..94d3120 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/WarningOnInstanceField.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/WarningOnInstanceField.cs.gold @@ -1,13 +1,16 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A { - string Message = "message"; + string ||Message|(0)|(1) = "message"; public void Foo(string s) { - |Contract.Requires(s != null, Message)|(0); + |Contract.Requires(s != null, Message)|(2); } } --------------------------------------------------------- -(0): ReSharper Underlined Error Highlighting: User message to contract call can only be string literal, or static field, +(0): ReSharper Suggestion: Field can be made readonly +(1): ReSharper Hint: Convert to constant +(2): ReSharper Underlined Error Highlighting: User message to contract call can only be string literal, or static field, or static property that is at least internally visible diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/WarningOnInstanceProperty.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/WarningOnInstanceProperty.cs.gold index bdc704d..a3f1103 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/WarningOnInstanceProperty.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/WarningOnInstanceProperty.cs.gold @@ -1,13 +1,15 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { - public string Message {get; private set;} + public string Message {get; |private set;|(0)} public void Foo(string s) { - |Contract.Requires(s != null, Message)|(0); + ||Contract.Requires(s != null, Message)|(1)|(2); } } --------------------------------------------------------- -(0): ReSharper Underlined Error Highlighting: User message to contract call can only be string literal, or static field, +(0): ReSharper Warning: Auto-property accessor is never used +(1): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation +(2): ReSharper Underlined Error Highlighting: User message to contract call can only be string literal, or static field, or static property that is at least internally visible diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/WarningOnMethodCall.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/WarningOnMethodCall.cs.gold index ac60f62..a632bb0 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/WarningOnMethodCall.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/WarningOnMethodCall.cs.gold @@ -1,14 +1,15 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { internal const string Message = "message"; public void Foo(string s) { - |Contract.Requires(s != null, GetMessage())|(0); + ||Contract.Requires(s != null, GetMessage())|(0)|(1); } public string GetMessage() {return Message;} } --------------------------------------------------------- -(0): ReSharper Underlined Error Highlighting: User message to contract call can only be string literal, or static field, +(0): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation +(1): ReSharper Underlined Error Highlighting: User message to contract call can only be string literal, or static field, or static property that is at least internally visible diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/WarningOnPrivateStaticField.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/WarningOnPrivateStaticField.cs.gold index 65ad3c1..e276817 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/WarningOnPrivateStaticField.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/InvalidRequiresMessageChecker/WarningOnPrivateStaticField.cs.gold @@ -1,13 +1,16 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { - private static string Message = "msg"; + private static string ||Message|(0)|(1) = "msg"; public void Foo(string s) { - |Contract.Requires(s != null, Message)|(0); + ||Contract.Requires(s != null, Message)|(2)|(3); } } --------------------------------------------------------- -(0): ReSharper Underlined Error Highlighting: User message to contract call can only be string literal, or static field, +(0): ReSharper Suggestion: Field can be made readonly +(1): ReSharper Hint: Convert to constant +(2): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation +(3): ReSharper Underlined Error Highlighting: User message to contract call can only be string literal, or static field, or static property that is at least internally visible diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContractStatements/WarningDebug.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContractStatements/WarningDebug.cs index 1dbc907..a499e3f 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContractStatements/WarningDebug.cs +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContractStatements/WarningDebug.cs @@ -1,4 +1,4 @@ -using System.Linq; +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContractStatements/WarningDebug.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContractStatements/WarningDebug.cs.gold index a2d8ff3..36e74c4 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContractStatements/WarningDebug.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContractStatements/WarningDebug.cs.gold @@ -1,4 +1,4 @@ -using System.Linq; +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A @@ -10,9 +10,10 @@ class A // This tool will show another warning for this case! |Contract.Requires(s != null);|(0) } - finally {} + |finally {}|(1) } } --------------------------------------------------------- (0): ReSharper Underlined Error Highlighting: Malformed contract. Contract section within try block in method 'WarningInTryBlock' +(1): ReSharper Dead Code: Redundant empty finally block diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContractStatements/WarningForContractInInnerStatement.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContractStatements/WarningForContractInInnerStatement.cs index b6b0622..bdcde6d 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContractStatements/WarningForContractInInnerStatement.cs +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContractStatements/WarningForContractInInnerStatement.cs @@ -1,4 +1,5 @@ -using System.Linq; +#define CONTRACTS_FULL + using System.Diagnostics.Contracts; class A diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContractStatements/WarningForContractInInnerStatement.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContractStatements/WarningForContractInInnerStatement.cs.gold index 8cd6e51..b3c7a5a 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContractStatements/WarningForContractInInnerStatement.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContractStatements/WarningForContractInInnerStatement.cs.gold @@ -1,4 +1,5 @@ -using System.Linq; +#define CONTRACTS_FULL + using System.Diagnostics.Contracts; class A @@ -18,33 +19,33 @@ class A public void InsideElse(string s) { if (s != null) - Console.WriteLine(); + |Console|(2).WriteLine(); else - |Contract.Requires(s != null);|(2) + |Contract.Requires(s != null);|(3) } public void InsideLoops() { - for(int n = 0; n < 10; n++) - |Contract.Requires(false);|(3) + for(|int|(4) |n|(5) = 0; n < 10; n++) + |Contract.Requires(false);|(6) - foreach(var n in Enumerable.Range(1, 10)) - |Contract.Ensures(false);|(4) + foreach(var ||n|(7)|(8) in |Enumerable|(9).Range(1, 10)) + |Contract.Ensures(false);|(10) - int n = 42; + |int|(11) |n|(12) = 42; while(n > 0) { - |Contract.EnsuresOnThrow(false);|(5) + |Contract.EnsuresOnThrow(false);|(13) n--; } } public void InsideSwitch(string s) { - switch(s) + |switch|(14)(s) { case "foo": - |Contract.Requires(s != null);|(6) + |Contract.Requires(s != null);|(15) break; } } @@ -54,13 +55,13 @@ class A try { } - catch(System.Exception e) + catch(System.Exception |e|(16)) { - |Contract.EndContractBlock();|(7) + |Contract.EndContractBlock();|(17) } finally { - |Contract.Requires(false);|(8) + |Contract.Requires(false);|(18) } } @@ -68,7 +69,7 @@ class A { using (new System.IO.MemoryStream()) { - |Contract.Requires(s != null);|(9) + |Contract.Requires(s != null);|(19) } } @@ -86,20 +87,31 @@ class A try { // This tool will show another warning for this case! - |Contract.Requires(s != null);|(10) + |Contract.Requires(s != null);|(20) } - finally {} + |finally {}|(21) } } --------------------------------------------------------- (0): ReSharper Underlined Error Highlighting: Contract statements in the middle of the method 'InsideIf' (1): ReSharper Underlined Error Highlighting: Contract statements in the middle of the method 'EndContractBlockInsideIf' -(2): ReSharper Underlined Error Highlighting: Contract statements in the middle of the method 'InsideElse' -(3): ReSharper Underlined Error Highlighting: Contract statements in the middle of the method 'InsideLoops' -(4): ReSharper Underlined Error Highlighting: Contract statements in the middle of the method 'InsideLoops' -(5): ReSharper Underlined Error Highlighting: Contract statements in the middle of the method 'InsideLoops' -(6): ReSharper Underlined Error Highlighting: Contract statements in the middle of the method 'InsideSwitch' -(7): ReSharper Underlined Error Highlighting: Contract statements in the middle of the method 'InTry' -(8): ReSharper Underlined Error Highlighting: Contract statements in the middle of the method 'InTry' -(9): ReSharper Underlined Error Highlighting: Contract statements in the middle of the method 'InUsing' -(10): ReSharper Underlined Error Highlighting: Malformed contract. Contract section within try block in method 'WarningInTryBlock' +(2): ReSharper Error Highlighting: Cannot resolve symbol 'Console' +(3): ReSharper Underlined Error Highlighting: Contract statements in the middle of the method 'InsideElse' +(4): ReSharper Hint: Use 'var' (built-in types) +(5): ReSharper Warning: Conflicting variable 'n' is defined below +(6): ReSharper Underlined Error Highlighting: Contract statements in the middle of the method 'InsideLoops' +(7): ReSharper Warning: Conflicting variable 'n' is defined below +(8): ReSharper Dead Code: Local variable 'n' is never used +(9): ReSharper Error Highlighting: Cannot resolve symbol 'Enumerable' +(10): ReSharper Underlined Error Highlighting: Contract statements in the middle of the method 'InsideLoops' +(11): ReSharper Hint: Use 'var' (built-in types) +(12): ReSharper Underlined Error Highlighting: A local variable named 'n' cannot be declared in this scope because it would give a different meaning to 'n', which is already used in a parent or current scope to denote something else +(13): ReSharper Underlined Error Highlighting: Contract statements in the middle of the method 'InsideLoops' +(14): ReSharper Hint: Some cases are not processed: default +(15): ReSharper Underlined Error Highlighting: Contract statements in the middle of the method 'InsideSwitch' +(16): ReSharper Dead Code: Local variable 'e' is never used +(17): ReSharper Underlined Error Highlighting: Contract statements in the middle of the method 'InTry' +(18): ReSharper Underlined Error Highlighting: Contract statements in the middle of the method 'InTry' +(19): ReSharper Underlined Error Highlighting: Contract statements in the middle of the method 'InUsing' +(20): ReSharper Underlined Error Highlighting: Malformed contract. Contract section within try block in method 'WarningInTryBlock' +(21): ReSharper Dead Code: Redundant empty finally block diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/NoWarning.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/NoWarning.cs index b7e4a24..576d88e 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/NoWarning.cs +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/NoWarning.cs @@ -1,10 +1,12 @@ +#define CONTRACTS_FULL + using System; using System.Diagnostics.Contracts; class Guard { [ContractArgumentValidator] - public void Validate() {} + public static void Validate() {} } class A diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/NoWarning.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/NoWarning.cs.gold index 58eb31e..deeb870 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/NoWarning.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/NoWarning.cs.gold @@ -1,10 +1,12 @@ +#define CONTRACTS_FULL + using System; using System.Diagnostics.Contracts; class Guard { [ContractArgumentValidator] - public void Validate() {} + public static void Validate() {} } class A diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/SeveralWarnings.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/SeveralWarnings.cs index 1796f6f..5f0b1bf 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/SeveralWarnings.cs +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/SeveralWarnings.cs @@ -1,3 +1,4 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/SeveralWarnings.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/SeveralWarnings.cs.gold index 394a804..a6f0656 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/SeveralWarnings.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/SeveralWarnings.cs.gold @@ -1,3 +1,4 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarnForAssertOrAssumeInContractBlock.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarnForAssertOrAssumeInContractBlock.cs.gold index d75cabc..f523431 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarnForAssertOrAssumeInContractBlock.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarnForAssertOrAssumeInContractBlock.cs.gold @@ -1,15 +1,19 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { public void Foo(string s) { - |Contract.Assert(false);|(0) - |Contract.Assume(false);|(1) - Contract.Requires(s != null); - Contract.Ensures(false); + ||Contract.Assert(false)|(1);|(0) + ||Contract.Assume(false)|(3);|(2) + |Contract.Requires(s != null)|(4); + |Contract.Ensures(false)|(5); } } --------------------------------------------------------- (0): ReSharper Underlined Error Highlighting: Contract.Assert/Contract.Assume cannot be used in contract section of method 'Foo'. Use only Requires and Ensures -(1): ReSharper Underlined Error Highlighting: Contract.Assert/Contract.Assume cannot be used in contract section of method 'Foo'. Use only Requires and Ensures +(1): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation +(2): ReSharper Underlined Error Highlighting: Contract.Assert/Contract.Assume cannot be used in contract section of method 'Foo'. Use only Requires and Ensures +(3): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation +(4): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation +(5): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForAssignmentInContractBlock.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForAssignmentInContractBlock.cs.gold index 867bcc5..86a507a 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForAssignmentInContractBlock.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForAssignmentInContractBlock.cs.gold @@ -1,13 +1,15 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { - private static string _foo; + private static string |_foo|(0); public void Foo(string s) { - |_foo = s;|(0) - Contract.Requires(s != null); + |_foo = s;|(1) + |Contract.Requires(s != null)|(2); } } --------------------------------------------------------- -(0): ReSharper Underlined Error Highlighting: Malformed contract. Assignment cannot be used in contract section of method 'Foo' +(0): ReSharper Dead Code: Field '_foo' is assigned but its value is never used +(1): ReSharper Underlined Error Highlighting: Malformed contract. Assignment cannot be used in contract section of method 'Foo' +(2): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForDuplicatedEndContractBlock.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForDuplicatedEndContractBlock.cs.gold index 9bba1fd..60807a0 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForDuplicatedEndContractBlock.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForDuplicatedEndContractBlock.cs.gold @@ -1,12 +1,14 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { public void Foo(string s) { - Contract.EndContractBlock(); - |Contract.EndContractBlock();|(0) + |Contract.EndContractBlock()|(0); + ||Contract.EndContractBlock()|(2);|(1) } } --------------------------------------------------------- -(0): ReSharper Underlined Error Highlighting: Malformed contract. Duplicated call of EndContractBlock in method 'Foo' +(0): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation +(1): ReSharper Underlined Error Highlighting: Malformed contract. Duplicated call of EndContractBlock in method 'Foo' +(2): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForEndContractBlockBeforeEnsures.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForEndContractBlockBeforeEnsures.cs.gold index 82c8d64..8563ebb 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForEndContractBlockBeforeEnsures.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForEndContractBlockBeforeEnsures.cs.gold @@ -1,12 +1,14 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { public void Foo(string s) { - Contract.EndContractBlock(); - |Contract.Ensures(s != null);|(0) + |Contract.EndContractBlock()|(0); + ||Contract.Ensures(s != null)|(2);|(1) } } --------------------------------------------------------- -(0): ReSharper Underlined Error Highlighting: Malformed contract. Contract call found after prior EndContractBlock in method 'Foo' +(0): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation +(1): ReSharper Underlined Error Highlighting: Malformed contract. Contract call found after prior EndContractBlock in method 'Foo' +(2): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForEndContractBlockBeforeRequires.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForEndContractBlockBeforeRequires.cs.gold index 79202e7..e579ed4 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForEndContractBlockBeforeRequires.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForEndContractBlockBeforeRequires.cs.gold @@ -1,12 +1,14 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { public void Foo(string s) { - Contract.EndContractBlock(); - |Contract.Requires(s != null);|(0) + |Contract.EndContractBlock()|(0); + ||Contract.Requires(s != null)|(2);|(1) } } --------------------------------------------------------- -(0): ReSharper Underlined Error Highlighting: Malformed contract. Contract call found after prior EndContractBlock in method 'Foo' +(0): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation +(1): ReSharper Underlined Error Highlighting: Malformed contract. Contract call found after prior EndContractBlock in method 'Foo' +(2): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForInstanceMethodAndContractInInnerBlock.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForInstanceMethodAndContractInInnerBlock.cs.gold index e04d713..7ececaf 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForInstanceMethodAndContractInInnerBlock.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForInstanceMethodAndContractInInnerBlock.cs.gold @@ -1,4 +1,4 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { @@ -6,10 +6,12 @@ class A { |InstanceMethod();|(0) {{ - Contract.Requires(false); + |Contract.Requires(false)|(1); }} } - private void InstanceMethod() {} + private void |InstanceMethod|(2)() {} } --------------------------------------------------------- (0): ReSharper Underlined Error Highlighting: Malformed contract. Detected expression statement evaluated for side-effect in contracts of method 'Foo' +(1): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation +(2): ReSharper Hint: Method 'InstanceMethod' can be made static diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForInstanceVoidMethod.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForInstanceVoidMethod.cs.gold index 2f820d3..fe6240d 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForInstanceVoidMethod.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForInstanceVoidMethod.cs.gold @@ -1,14 +1,17 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { public void Foo(string s) { |InstanceMethod();|(0) - Contract.Requires(s != null); - Contract.Ensures(false); + |Contract.Requires(s != null)|(1); + |Contract.Ensures(false)|(2); } - private void InstanceMethod() {} + private void |InstanceMethod|(3)() {} } --------------------------------------------------------- (0): ReSharper Underlined Error Highlighting: Malformed contract. Detected expression statement evaluated for side-effect in contracts of method 'Foo' +(1): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation +(2): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation +(3): ReSharper Hint: Method 'InstanceMethod' can be made static diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForInstanceVoidMethodBeforeEnsuresOnThrow.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForInstanceVoidMethodBeforeEnsuresOnThrow.cs.gold index 35d7284..c152582 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForInstanceVoidMethodBeforeEnsuresOnThrow.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForInstanceVoidMethodBeforeEnsuresOnThrow.cs.gold @@ -1,13 +1,16 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { public void Foo(string s) { |InstanceMethod();|(0) - Contract.EnsuresOnThrow(false); + |Contract.EnsuresOnThrow<|Exception|(2)>(false)|(1); } - private void InstanceMethod() {} + private void |InstanceMethod|(3)() {} } --------------------------------------------------------- (0): ReSharper Underlined Error Highlighting: Malformed contract. Detected expression statement evaluated for side-effect in contracts of method 'Foo' +(1): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation +(2): ReSharper Error Highlighting: Cannot resolve symbol 'Exception' +(3): ReSharper Hint: Method 'InstanceMethod' can be made static diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForNonVoidReturnMethod.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForNonVoidReturnMethod.cs.gold index 044e51e..1bfa56d 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForNonVoidReturnMethod.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForNonVoidReturnMethod.cs.gold @@ -1,14 +1,18 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { public void Foo(string s) { |InstanceMethod();|(0) - Contract.Requires(s != null); - Contract.Ensures(false); + |Contract.Requires(s != null)|(1); + |Contract.Ensures(false)|(2); } - private bool InstanceMethod() { return true; } + private |bool|(3) |InstanceMethod|(4)() { return true; } } --------------------------------------------------------- (0): ReSharper Warning: Detected expression statement evaluated for potential side-effect in contracts of method 'Foo' +(1): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation +(2): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation +(3): ReSharper Dead Code: Method return value is never used +(4): ReSharper Hint: Method 'InstanceMethod' can be made static diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForRequiresAfterEnsures.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForRequiresAfterEnsures.cs.gold index 784846d..a2cf03d 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForRequiresAfterEnsures.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForRequiresAfterEnsures.cs.gold @@ -1,13 +1,15 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { public void Foo(string s) { - |Contract.Ensures(false);|(0) - |Contract.Requires(s != null);|(1) + ||Contract.Ensures(false)|(1);|(0) + ||Contract.Requires(s != null)|(3);|(2) } } --------------------------------------------------------- (0): ReSharper Underlined Error Highlighting: Malformed contract. Precondition found after postcondition in contract section of method 'Foo' -(1): ReSharper Underlined Error Highlighting: Malformed contract. Precondition found after postcondition in contract section of method 'Foo' +(1): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation +(2): ReSharper Underlined Error Highlighting: Malformed contract. Precondition found after postcondition in contract section of method 'Foo' +(3): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForRequiresAfterEnsuresOnThrow.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForRequiresAfterEnsuresOnThrow.cs.gold index 32d3ae8..46fbfde 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForRequiresAfterEnsuresOnThrow.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForRequiresAfterEnsuresOnThrow.cs.gold @@ -1,13 +1,16 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { public void Foo(string s) { - |Contract.EnsuresOnThrow(false);|(0) - |Contract.Requires(s != null);|(1) + ||Contract.EnsuresOnThrow<|Exception|(2)>(false)|(1);|(0) + ||Contract.Requires(s != null)|(4);|(3) } } --------------------------------------------------------- (0): ReSharper Underlined Error Highlighting: Malformed contract. Precondition found after postcondition in contract section of method 'Foo' -(1): ReSharper Underlined Error Highlighting: Malformed contract. Precondition found after postcondition in contract section of method 'Foo' +(1): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation +(2): ReSharper Error Highlighting: Cannot resolve symbol 'Exception' +(3): ReSharper Underlined Error Highlighting: Malformed contract. Precondition found after postcondition in contract section of method 'Foo' +(4): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForStaticVoidMethodBeforeEnsures.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForStaticVoidMethodBeforeEnsures.cs.gold index dea0755..f9dcee6 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForStaticVoidMethodBeforeEnsures.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForStaticVoidMethodBeforeEnsures.cs.gold @@ -1,13 +1,14 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { public void Foo(string s) { |StaticMethod();|(0) - Contract.Ensures(false); + |Contract.Ensures(false)|(1); } private static void StaticMethod() {} } --------------------------------------------------------- (0): ReSharper Underlined Error Highlighting: Malformed contract. Detected expression statement evaluated for side-effect in contracts of method 'Foo' +(1): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForTwoInterplacedMethods.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForTwoInterplacedMethods.cs.gold index 8e2806d..6960eed 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForTwoInterplacedMethods.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForTwoInterplacedMethods.cs.gold @@ -1,19 +1,23 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { public void Foo(string s) { |InstanceMethod();|(0) - Contract.Requires(false); - |InstanceMethod();|(1) - |StaticMethod();|(2) - Contract.EndContractBlock(); + |Contract.Requires(false)|(1); + |InstanceMethod();|(2) + |StaticMethod();|(3) + |Contract.EndContractBlock()|(4); } - private void InstanceMethod() {} - private void StaticMethod() {} + private void |InstanceMethod|(5)() {} + private void |StaticMethod|(6)() {} } --------------------------------------------------------- (0): ReSharper Underlined Error Highlighting: Malformed contract. Detected expression statement evaluated for side-effect in contracts of method 'Foo' -(1): ReSharper Underlined Error Highlighting: Malformed contract. Detected expression statement evaluated for side-effect in contracts of method 'Foo' +(1): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation (2): ReSharper Underlined Error Highlighting: Malformed contract. Detected expression statement evaluated for side-effect in contracts of method 'Foo' +(3): ReSharper Underlined Error Highlighting: Malformed contract. Detected expression statement evaluated for side-effect in contracts of method 'Foo' +(4): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation +(5): ReSharper Hint: Method 'InstanceMethod' can be made static +(6): ReSharper Hint: Method 'StaticMethod' can be made static diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForTwoMethods.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForTwoMethods.cs.gold index d3a103d..8e3e389 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForTwoMethods.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningForTwoMethods.cs.gold @@ -1,4 +1,4 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; class A { @@ -6,12 +6,16 @@ class A { |InstanceMethod();|(0) |StaticMethod();|(1) - Contract.Requires(s != null); - Contract.Ensures(false); + |Contract.Requires(s != null)|(2); + |Contract.Ensures(false)|(3); } - private void InstanceMethod() {} - private void StaticMethod() {} + private void |InstanceMethod|(4)() {} + private void |StaticMethod|(5)() {} } --------------------------------------------------------- (0): ReSharper Underlined Error Highlighting: Malformed contract. Detected expression statement evaluated for side-effect in contracts of method 'Foo' (1): ReSharper Underlined Error Highlighting: Malformed contract. Detected expression statement evaluated for side-effect in contracts of method 'Foo' +(2): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation +(3): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation +(4): ReSharper Hint: Method 'InstanceMethod' can be made static +(5): ReSharper Hint: Method 'StaticMethod' can be made static diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningOnConsoleWriteLineBeforeEndContractBlock.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningOnConsoleWriteLineBeforeEndContractBlock.cs.gold index 106697d..3b9789f 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningOnConsoleWriteLineBeforeEndContractBlock.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/MalformedContracts/WarningOnConsoleWriteLineBeforeEndContractBlock.cs.gold @@ -1,4 +1,4 @@ -using System.Diagnostics.Contracts; +using System.Diagnostics.Contracts; using System; class A @@ -6,8 +6,9 @@ class A public void Foo(string s) { |Console.WriteLine("Hello");|(0) - Contract.EndContractBlock(); + |Contract.EndContractBlock()|(1); } } --------------------------------------------------------- (0): ReSharper Underlined Error Highlighting: Malformed contract. Detected expression statement evaluated for side-effect in contracts of method 'Foo' +(1): ReSharper Dead Code: Method invocation is skipped. Compiler will not generate method invocation because the method is conditional, or it is partial method without implementation diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/NoWarning.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/NoWarning.cs index e236c70..fb71056 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/NoWarning.cs +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/NoWarning.cs @@ -1,3 +1,4 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/NoWarning.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/NoWarning.cs.gold index 8d81aa3..93149fc 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/NoWarning.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/NoWarning.cs.gold @@ -1,3 +1,4 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/NoWarningForPartiallyDefinedDefault.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/NoWarningForPartiallyDefinedDefault.cs index 65d7180..8a0b4a8 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/NoWarningForPartiallyDefinedDefault.cs +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/NoWarningForPartiallyDefinedDefault.cs @@ -1,3 +1,4 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/NoWarningForPartiallyDefinedDefault.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/NoWarningForPartiallyDefinedDefault.cs.gold index 33e2ea0..f11c0f3 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/NoWarningForPartiallyDefinedDefault.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/NoWarningForPartiallyDefinedDefault.cs.gold @@ -1,10 +1,12 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A { - public void Foo(string s =) + public void Foo(string s |=)|(0) { Contract.Requires(s != null); } } --------------------------------------------------------- +(0): ReSharper Underlined Error Highlighting: Expression expected diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PostconditionAnalyzers/ContractResultAnalyzer.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PostconditionAnalyzers/ContractResultAnalyzer.cs index 616574a..6f3bd28 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PostconditionAnalyzers/ContractResultAnalyzer.cs +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PostconditionAnalyzers/ContractResultAnalyzer.cs @@ -1,3 +1,4 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; using System.Threading.Tasks; diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PostconditionAnalyzers/ContractResultAnalyzer.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PostconditionAnalyzers/ContractResultAnalyzer.cs.gold index 28c166a..040d222 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PostconditionAnalyzers/ContractResultAnalyzer.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PostconditionAnalyzers/ContractResultAnalyzer.cs.gold @@ -1,3 +1,4 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; using System.Threading.Tasks; @@ -7,63 +8,63 @@ class A { // error CC1002: In method A.PostconditionWithMismatchedTaskReturnType: Detected a call to Result with 'System.Threading.Tasks.Task`1', should be 'System.Threading.Tasks.Task`1'. |Contract.Ensures(Contract.Result>() != null);|(0) - throw new NotImplementedException(); + throw new |NotImplementedException|(1)(); } public Task PostconditionWithMismatchedTaskReturnType2() { // error CC1002: In method ConsoleApplication8.CDeleteCommandContract`1.PostconditionWithMismatchedTaskReturnType2: Detected a call to Result with 'System.String', should be 'System.Threading.Tasks.Task`1'. - |Contract.Ensures(Contract.Result() != null);|(1) - throw new NotImplementedException(); + |Contract.Ensures(Contract.Result() != null);|(2) + throw new |NotImplementedException|(3)(); } public void PostconditionInVoidMethod() { // error CC1002: In method CodeContractInvestigations.Postconditions.PostconditionInVoidMethod: Detected a call to Result with 'System.String', should be 'System.Void'. - |Contract.Ensures(Contract.Result() != null);|(2) + |Contract.Ensures(Contract.Result() != null);|(4) } public object PostconditionWithDerivedType() { // error CC1002: In method CodeContractInvestigations.Postconditions.PostconditionWithDerivedType: Detected a call to Result with 'System.String', should be 'System.Object'. - |Contract.Ensures(Contract.Result() != null);|(3) - throw new NotImplementedException(); + |Contract.Ensures(Contract.Result() != null);|(5) + throw new |NotImplementedException|(6)(); } public object PostconditionWithTwoDerivedTypes() { // error CC1002: In method CodeContractInvestigations.Postconditions.PostconditionWithDerivedType: Detected a call to Result with 'System.String', should be 'System.Object'. - |Contract.Ensures(Contract.Result() != null && Contract.Result().Length != 0);|(4) - throw new NotImplementedException(); + |Contract.Ensures(Contract.Result() != null && Contract.Result().Length != 0);|(7) + throw new |NotImplementedException|(8)(); } public object PostconditionWithOneWrongType() { // error CC1002: In method CodeContractInvestigations.Postconditions.PostconditionWithDerivedType: Detected a call to Result with 'System.String', should be 'System.Object'. - |Contract.Ensures(Contract.Result() != null && Contract.Result().Length != 0);|(5) - throw new NotImplementedException(); + |Contract.Ensures(Contract.Result() != null && Contract.Result().Length != 0);|(9) + throw new |NotImplementedException|(10)(); } public object PostconditionWithTwoDifferentTypes() { // error CC1002: In method CodeContractInvestigations.Postconditions.PostconditionWithDerivedType: Detected a call to Result with 'System.String', should be 'System.Object'. - |Contract.Ensures(Contract.Result() != null && Contract.Result() != null);|(6) - throw new NotImplementedException(); + |Contract.Ensures(Contract.Result() != null && Contract.Result() != null);|(11) + throw new |NotImplementedException|(12)(); } public int PostconditionWithUnrelatedType1() { // error CC1002: In method CodeContractInvestigations.Postconditions.PostconditionWithDerivedType: Detected a call to Result with 'System.String', should be 'System.Object'. - |Contract.Ensures(Contract.Result() != null);|(7) - throw new NotImplementedException(); + |Contract.Ensures(Contract.Result() != null);|(13) + throw new |NotImplementedException|(14)(); } - public System.StringBuilder PostconditionWithUnrelatedType2() + public System.|StringBuilder|(15) PostconditionWithUnrelatedType2() { // error CC1002: In method CodeContractInvestigations.Postconditions.PostconditionWithDerivedType: Detected a call to Result with 'System.String', should be 'System.Object'. - |Contract.Ensures(Contract.Result() != null);|(8) - throw new NotImplementedException(); + |Contract.Ensures(Contract.Result() != null);|(16) + throw new |NotImplementedException|(17)(); } public object PostconditionWithProperty @@ -71,8 +72,8 @@ class A get { // error CC1002: In method CodeContractInvestigations.Postconditions.PostconditionWithDerivedType: Detected a call to Result with 'System.String', should be 'System.Object'. - |Contract.Ensures(Contract.Result() != null);|(9) - throw new NotImplementedException(); + |Contract.Ensures(Contract.Result() != null);|(18) + throw new |NotImplementedException|(19)(); } } @@ -80,45 +81,62 @@ class A { // OK Contract.Ensures(Contract.Result() != null); - throw new NotImplementedException(); + throw new |NotImplementedException|(20)(); } public Task EnsuresOnTask2() { // OK Contract.Ensures(Contract.Result>() != null); - throw new NotImplementedException(); + throw new |NotImplementedException|(21)(); } public Task EnsuresOnTask() { // OK Contract.Ensures(Contract.Result() != null); - throw new NotImplementedException(); + throw new |NotImplementedException|(22)(); } - public async Task EnsuresOnAsyncTask() + public |async|(23) Task EnsuresOnAsyncTask() { // OK Contract.Ensures(Contract.Result() != null); - throw new NotImplementedException(); + throw new |NotImplementedException|(24)(); } public Task EnsuresOnTaskOfBool() { // OK - Contract.Ensures(Contract.Result() != null); - throw new NotImplementedException(); + Contract.Ensures(|Contract.Result() != null|(25)); + throw new |NotImplementedException|(26)(); } } --------------------------------------------------------- (0): ReSharper Underlined Error Highlighting: Detected a call to Result with 'Task' in method 'PostconditionWithMismatchedTaskReturnType', should be 'Task' -(1): ReSharper Underlined Error Highlighting: Detected a call to Result with 'string' in method 'PostconditionWithMismatchedTaskReturnType2', should be 'Task' -(2): ReSharper Underlined Error Highlighting: Detected a call to Result with 'string' in method 'PostconditionInVoidMethod', should be 'void' -(3): ReSharper Underlined Error Highlighting: Detected a call to Result with 'string' in method 'PostconditionWithDerivedType', should be 'object' -(4): ReSharper Underlined Error Highlighting: Detected a call to Result with 'string' in method 'PostconditionWithTwoDerivedTypes', should be 'object' -(5): ReSharper Underlined Error Highlighting: Detected a call to Result with 'object' in method 'PostconditionWithOneWrongType', should be 'object' -(6): ReSharper Underlined Error Highlighting: Detected a call to Result with 'string' in method 'PostconditionWithTwoDifferentTypes', should be 'object' -(7): ReSharper Underlined Error Highlighting: Detected a call to Result with 'string' in method 'PostconditionWithUnrelatedType1', should be 'int' -(8): ReSharper Underlined Error Highlighting: Detected a call to Result with 'string' in method 'PostconditionWithUnrelatedType2', should be 'StringBuilder' -(9): ReSharper Underlined Error Highlighting: Detected a call to Result with 'string' in property 'PostconditionWithProperty', should be 'object' +(1): ReSharper Error Highlighting: Cannot resolve symbol 'NotImplementedException' +(2): ReSharper Underlined Error Highlighting: Detected a call to Result with 'string' in method 'PostconditionWithMismatchedTaskReturnType2', should be 'Task' +(3): ReSharper Error Highlighting: Cannot resolve symbol 'NotImplementedException' +(4): ReSharper Underlined Error Highlighting: Detected a call to Result with 'string' in method 'PostconditionInVoidMethod', should be 'void' +(5): ReSharper Underlined Error Highlighting: Detected a call to Result with 'string' in method 'PostconditionWithDerivedType', should be 'object' +(6): ReSharper Error Highlighting: Cannot resolve symbol 'NotImplementedException' +(7): ReSharper Underlined Error Highlighting: Detected a call to Result with 'string' in method 'PostconditionWithTwoDerivedTypes', should be 'object' +(8): ReSharper Error Highlighting: Cannot resolve symbol 'NotImplementedException' +(9): ReSharper Underlined Error Highlighting: Detected a call to Result with 'object' in method 'PostconditionWithOneWrongType', should be 'object' +(10): ReSharper Error Highlighting: Cannot resolve symbol 'NotImplementedException' +(11): ReSharper Underlined Error Highlighting: Detected a call to Result with 'string' in method 'PostconditionWithTwoDifferentTypes', should be 'object' +(12): ReSharper Error Highlighting: Cannot resolve symbol 'NotImplementedException' +(13): ReSharper Underlined Error Highlighting: Detected a call to Result with 'string' in method 'PostconditionWithUnrelatedType1', should be 'int' +(14): ReSharper Error Highlighting: Cannot resolve symbol 'NotImplementedException' +(15): ReSharper Error Highlighting: Cannot resolve symbol 'StringBuilder' +(16): ReSharper Underlined Error Highlighting: Detected a call to Result with 'string' in method 'PostconditionWithUnrelatedType2', should be 'StringBuilder' +(17): ReSharper Error Highlighting: Cannot resolve symbol 'NotImplementedException' +(18): ReSharper Underlined Error Highlighting: Detected a call to Result with 'string' in property 'PostconditionWithProperty', should be 'object' +(19): ReSharper Error Highlighting: Cannot resolve symbol 'NotImplementedException' +(20): ReSharper Error Highlighting: Cannot resolve symbol 'NotImplementedException' +(21): ReSharper Error Highlighting: Cannot resolve symbol 'NotImplementedException' +(22): ReSharper Error Highlighting: Cannot resolve symbol 'NotImplementedException' +(23): ReSharper Warning [CS1998]: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await TaskEx.Run(...)' to do CPU-bound work on a background thread +(24): ReSharper Error Highlighting: Cannot resolve symbol 'NotImplementedException' +(25): ReSharper Warning: Expression is always true +(26): ReSharper Error Highlighting: Cannot resolve symbol 'NotImplementedException' diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInAsyncMethods/NoWarning.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInAsyncMethods/NoWarning.cs index e82e329..5e25016 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInAsyncMethods/NoWarning.cs +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInAsyncMethods/NoWarning.cs @@ -1,3 +1,4 @@ +#define CONTRACTS_FULL using System.Threading.Tasks; using System.Diagnostics.Contracts; diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInAsyncMethods/NoWarning.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInAsyncMethods/NoWarning.cs.gold index 4063282..ce7b4e8 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInAsyncMethods/NoWarning.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInAsyncMethods/NoWarning.cs.gold @@ -1,3 +1,4 @@ +#define CONTRACTS_FULL using System.Threading.Tasks; using System.Diagnostics.Contracts; @@ -9,9 +10,11 @@ class A return DoFoo(s); } - private async Task DoFoo(string s) + private async Task |DoFoo|(0)(string |s|(1)) { await Task.Delay(42); } } --------------------------------------------------------- +(0): ReSharper Hint: Method 'DoFoo' can be made static +(1): ReSharper Dead Code: Parameter 's' is never used diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInAsyncMethods/Warnings.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInAsyncMethods/Warnings.cs index 4fe6cad..a187dd1 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInAsyncMethods/Warnings.cs +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInAsyncMethods/Warnings.cs @@ -1,3 +1,4 @@ +#define CONTRACTS_FULL using System; using System.Threading.Tasks; using System.Diagnostics.Contracts; diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInAsyncMethods/Warnings.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInAsyncMethods/Warnings.cs.gold index 2a7aa33..132b92a 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInAsyncMethods/Warnings.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInAsyncMethods/Warnings.cs.gold @@ -1,30 +1,35 @@ +#define CONTRACTS_FULL using System; using System.Threading.Tasks; using System.Diagnostics.Contracts; class A { - public async Task FooIfThrow(string s) + public |async|(0) Task FooIfThrow(string s) { - |if (s == null) throw new ArgumentNullException("s");|(0) + |if (s == null) throw new ArgumentNullException("s");|(1) } - public async Task FooWithLegacyCheck(string s) + public |async|(2) Task FooWithLegacyCheck(string s) { if (s == null) throw new ArgumentNullException("s"); Contract.EndContractBlock(); } - public async Task FooWithRequires(string s) + public |async|(3) Task FooWithRequires(string s) { Contract.Requires(s != null); } - protected async Task FooIntWithRequires(string s) + protected |async|(4) Task FooIntWithRequires(string s) { Contract.Requires(s != null); return 42; } } --------------------------------------------------------- -(0): ReSharper Warning: Lecacy precondition in async method is asynchronous and will fail returning task +(0): ReSharper Warning [CS1998]: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await TaskEx.Run(...)' to do CPU-bound work on a background thread +(1): ReSharper Warning: Lecacy precondition in async method is asynchronous and will fail returning task +(2): ReSharper Warning [CS1998]: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await TaskEx.Run(...)' to do CPU-bound work on a background thread +(3): ReSharper Warning [CS1998]: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await TaskEx.Run(...)' to do CPU-bound work on a background thread +(4): ReSharper Warning [CS1998]: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await TaskEx.Run(...)' to do CPU-bound work on a background thread diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInMethodsWithIteratorBlock/NoWarning.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInMethodsWithIteratorBlock/NoWarning.cs index fdce5ea..34671be 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInMethodsWithIteratorBlock/NoWarning.cs +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInMethodsWithIteratorBlock/NoWarning.cs @@ -1,11 +1,12 @@ -using System; +#define CONTRACTS_FULL +using System.Collections.Generic; using System.Diagnostics.Contracts; class A { - private IEnumerable Foo(string s) - { - Contract.Requires(s != null); - return null; - } + private IEnumerable Foo(string s) + { + Contract.Requires(s != null); + return null; + } } \ No newline at end of file diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInMethodsWithIteratorBlock/NoWarning.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInMethodsWithIteratorBlock/NoWarning.cs.gold index 6b393b0..db8daf9 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInMethodsWithIteratorBlock/NoWarning.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInMethodsWithIteratorBlock/NoWarning.cs.gold @@ -1,12 +1,15 @@ -using System; +#define CONTRACTS_FULL +using System.Collections.Generic; using System.Diagnostics.Contracts; class A { - private IEnumerable Foo(string s) - { - Contract.Requires(s != null); - return null; - } + private IEnumerable |Foo|(0)(string |s|(1)) + { + Contract.Requires(s != null); + return null; + } } --------------------------------------------------------- +(0): ReSharper Dead Code: Method 'Foo' is never used +(1): ReSharper Dead Code: Parameter 's' is only used for precondition check(s) diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInMethodsWithIteratorBlock/Warnings.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInMethodsWithIteratorBlock/Warnings.cs index 0590ed7..7fd5850 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInMethodsWithIteratorBlock/Warnings.cs +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInMethodsWithIteratorBlock/Warnings.cs @@ -1,17 +1,18 @@ -using System; +#define CONTRACTS_FULL +using System.Collections.Generic; using System.Diagnostics.Contracts; class A { private IEnumerable FooWithArgCheck(string s) { - if (s == null) throw new ArgumentNullException("s"); + if (s == null) throw new System.ArgumentNullException("s"); yield break; } public IEnumerable FooWithLegacyContract(string s) { - if (s == null) throw new ArgumentNullException("s"); + if (s == null) throw new System.ArgumentNullException("s"); Contract.EndContractBlock(); yield break; } diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInMethodsWithIteratorBlock/Warnings.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInMethodsWithIteratorBlock/Warnings.cs.gold index 108ec5f..e9be897 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInMethodsWithIteratorBlock/Warnings.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/PreconditionsInMethodsWithIteratorBlock/Warnings.cs.gold @@ -1,17 +1,18 @@ -using System; +#define CONTRACTS_FULL +using System.Collections.Generic; using System.Diagnostics.Contracts; class A { - private IEnumerable FooWithArgCheck(string s) + private IEnumerable |FooWithArgCheck|(0)(string |s|(1)) { - |if (s == null) throw new ArgumentNullException("s");|(0) + |if (s == null) throw new System.ArgumentNullException("s");|(2) yield break; } public IEnumerable FooWithLegacyContract(string s) { - if (s == null) throw new ArgumentNullException("s"); + if (s == null) throw new System.ArgumentNullException("s"); Contract.EndContractBlock(); yield break; } @@ -23,4 +24,6 @@ class A } } --------------------------------------------------------- -(0): ReSharper Warning: Legacy precondition in iterator block will throw only on first MoveNext() call +(0): ReSharper Dead Code: Method 'FooWithArgCheck' is never used +(1): ReSharper Dead Code: Parameter 's' is only used for precondition check(s) +(2): ReSharper Warning: Legacy precondition in iterator block will throw only on first MoveNext() call diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresNoWarning.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresNoWarning.cs index e320f64..ec745ec 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresNoWarning.cs +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresNoWarning.cs @@ -1,3 +1,4 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; public class A @@ -8,7 +9,7 @@ public void Foo(string s) } } -public class CustomException : ArgumentException +public class CustomException : System.ArgumentException { public CustomException(string message, string paramName) : base(message, paramName) {} } \ No newline at end of file diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresNoWarning.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresNoWarning.cs.gold index 7655fbf..60f470e 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresNoWarning.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresNoWarning.cs.gold @@ -1,3 +1,4 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; public class A @@ -8,7 +9,7 @@ public class A } } -public class CustomException : ArgumentException +public class CustomException : System.ArgumentException { public CustomException(string message, string paramName) : base(message, paramName) {} } diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresNoWarningBuildInException.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresNoWarningBuildInException.cs index 186f27d..2e675d3 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresNoWarningBuildInException.cs +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresNoWarningBuildInException.cs @@ -4,6 +4,6 @@ public class A { public void Foo(string s) { - Contract.Requires(s != null); + Contract.Requires(s != null); } } \ No newline at end of file diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresNoWarningBuildInException.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresNoWarningBuildInException.cs.gold index 5cc4e93..fc1a657 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresNoWarningBuildInException.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresNoWarningBuildInException.cs.gold @@ -4,7 +4,7 @@ public class A { public void Foo(string s) { - Contract.Requires(s != null); + Contract.Requires(s != null); } } --------------------------------------------------------- diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresWarningForInnerException.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresWarningForInnerException.cs index 299c89e..2d157fe 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresWarningForInnerException.cs +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresWarningForInnerException.cs @@ -6,7 +6,7 @@ public void Foo(string s) { Contract.Requires(s != null); } - protected class CustomException : ArgumentException + protected class CustomException : System.ArgumentException { public CustomException(string message, string paramName) : base(message, paramName) {} } diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresWarningForInnerException.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresWarningForInnerException.cs.gold index edcbccf..82862e9 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresWarningForInnerException.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresWarningForInnerException.cs.gold @@ -6,7 +6,7 @@ class A { |Contract.Requires(s != null)|(0); } - protected class CustomException : ArgumentException + protected class CustomException : System.ArgumentException { public CustomException(string message, string paramName) : base(message, paramName) {} } diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresWarningForLessAccessibleException.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresWarningForLessAccessibleException.cs index 088e2b8..b64f5fe 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresWarningForLessAccessibleException.cs +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresWarningForLessAccessibleException.cs @@ -8,7 +8,7 @@ public void Foo(string s) } } -class CustomException : ArgumentException +class CustomException : System.ArgumentException { public CustomException(string message, string paramName) : base(message, paramName) {} } \ No newline at end of file diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresWarningForLessAccessibleException.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresWarningForLessAccessibleException.cs.gold index 8f00fec..83536b6 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresWarningForLessAccessibleException.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/RequiresExceptionVisibility/ContractRequiresWarningForLessAccessibleException.cs.gold @@ -8,7 +8,7 @@ public class A } } -class CustomException : ArgumentException +class CustomException : System.ArgumentException { public CustomException(string message, string paramName) : base(message, paramName) {} } diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForCanBeNullParam.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForCanBeNullParam.cs index 60c30a0..b3d425b 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForCanBeNullParam.cs +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForCanBeNullParam.cs @@ -1,3 +1,4 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForCanBeNullParam.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForCanBeNullParam.cs.gold index 89f746b..2a4a098 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForCanBeNullParam.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForCanBeNullParam.cs.gold @@ -1,11 +1,13 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A { - public void Foo([JetBrains.Annotations.CanBeNull]string s) + public void Foo([|JetBrains|(0).Annotations.CanBeNull]string s) { - |Contract.Requires(s != null)|(0); + |Contract.Requires(s != null)|(1); } } --------------------------------------------------------- -(0): ReSharper Warning: Suspicios requires for nullable argument 's' +(0): ReSharper Error Highlighting: Cannot resolve symbol 'JetBrains' +(1): ReSharper Warning: Suspicios requires for nullable argument 's' diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForNullableDefault.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForNullableDefault.cs index 70ca2f9..14b214a 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForNullableDefault.cs +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForNullableDefault.cs @@ -1,3 +1,4 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForNullableDefault.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForNullableDefault.cs.gold index 0e859c5..73fb0e0 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForNullableDefault.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForNullableDefault.cs.gold @@ -1,3 +1,4 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForNullableDefaultWithMethodCall.cs b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForNullableDefaultWithMethodCall.cs index 8cf50de..d902474 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForNullableDefaultWithMethodCall.cs +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForNullableDefaultWithMethodCall.cs @@ -1,3 +1,4 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A diff --git a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForNullableDefaultWithMethodCall.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForNullableDefaultWithMethodCall.cs.gold index 36bd7e2..48b3978 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForNullableDefaultWithMethodCall.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/Daemon/PreconditionAnalyzers/WarnForNullableDefaultWithMethodCall.cs.gold @@ -1,3 +1,4 @@ +#define CONTRACTS_FULL using System.Diagnostics.Contracts; class A diff --git a/ReSharper.ContractExtensions.Tests/test/data/QuickFixes/PreconditionAnalyzers/MalformedContractQuickFixes/FixIfThrowInAsyncMethod.cs.gold b/ReSharper.ContractExtensions.Tests/test/data/QuickFixes/PreconditionAnalyzers/MalformedContractQuickFixes/FixIfThrowInAsyncMethod.cs.gold index 872c233..7612e89 100644 --- a/ReSharper.ContractExtensions.Tests/test/data/QuickFixes/PreconditionAnalyzers/MalformedContractQuickFixes/FixIfThrowInAsyncMethod.cs.gold +++ b/ReSharper.ContractExtensions.Tests/test/data/QuickFixes/PreconditionAnalyzers/MalformedContractQuickFixes/FixIfThrowInAsyncMethod.cs.gold @@ -1,6 +1,6 @@ -using System.Diagnostics.Contracts; using System.Threading.Tasks; using System.Collections.Generic; +using System.Diagnostics.Contracts; class A { diff --git a/ReSharper.ContractExtensions.Tests/test/data/nuget.config b/ReSharper.ContractExtensions.Tests/test/data/nuget.config new file mode 100644 index 0000000..140ecf4 --- /dev/null +++ b/ReSharper.ContractExtensions.Tests/test/data/nuget.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/ReSharper.ContractExtensions.Tests/test/nuget.config b/ReSharper.ContractExtensions.Tests/test/nuget.config new file mode 100644 index 0000000..140ecf4 --- /dev/null +++ b/ReSharper.ContractExtensions.Tests/test/nuget.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..55c643a --- /dev/null +++ b/TODO.md @@ -0,0 +1,9 @@ +# What next? + +There is some issues with generating interfaces. + +Maybe JB did something, but right now instead of implicit interface implementation regular implementation is used. + +I'm leaving breaking tests to fix this in the future. + +And to run the tests you need to copy all the additional folders from the main bin folder (from ContractExtensions themselves). No idea why this needed! \ No newline at end of file diff --git a/package.bat b/package.bat new file mode 100644 index 0000000..996be00 --- /dev/null +++ b/package.bat @@ -0,0 +1 @@ +nuget.exe pack ContractExtensions.nuspec \ No newline at end of file