Skip to content

Commit 794a0c2

Browse files
Merge branch 'feature/v3.6.2'
2 parents bec702e + f5a54bc commit 794a0c2

24 files changed

+67
-72
lines changed

Sources/.nuget/NuGet.exe

295 KB
Binary file not shown.

Sources/ReCommendedExtension.Deployment/ReCommendedExtension.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<copyright>{{AssemblyCopyright}}</copyright>
3232
<tags>recommended extension resharper plugin addin prodot</tags>
3333
<dependencies>
34-
<dependency id="Wave" version="[191.0,191.1)" />
34+
<dependency id="Wave" version="[192.0,192.1)" />
3535
</dependencies>
3636
</metadata>
3737
<files>

Sources/ReCommendedExtension.Tests/Analyzers/AnnotationAnalyzerTestsForTestProjectsWithFlavor.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Linq;
33
using System.Reflection;
44
using JetBrains.Application.Settings;
5+
using JetBrains.Lifetimes;
56
using JetBrains.ProjectModel;
67
using JetBrains.ProjectModel.Properties.Flavours;
78
using JetBrains.ReSharper.Feature.Services.Daemon;
@@ -21,7 +22,7 @@ protected override bool HighlightingPredicate(IHighlighting highlighting, IPsiSo
2122
=> highlighting is MissingSuppressionJustificationHighlighting;
2223

2324
[SuppressMessage("ReSharper", "PossibleNullReferenceException")]
24-
protected override void DoTest(IProject project)
25+
protected override void DoTest(Lifetime lifetime, IProject project)
2526
{
2627
// patch the project type guids (applying [TestFlavours("3AC096D0-A1C2-E12C-1390-A8335801FDAB")] doesn't work)
2728

@@ -35,7 +36,7 @@ protected override void DoTest(IProject project)
3536

3637
Assert.True(project.HasFlavour<MsTestProjectFlavor>());
3738

38-
base.DoTest(project);
39+
base.DoTest(lifetime, project);
3940
}
4041

4142
[Test]

Sources/ReCommendedExtension.Tests/ReCommendedExtension.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
</PropertyGroup>
1919

2020
<ItemGroup>
21-
<PackageReference Include="JetBrains.ReSharper.SDK.Tests" Version="2019.1.3">
21+
<PackageReference Include="JetBrains.ReSharper.SDK.Tests" Version="2019.2.0">
2222
<PrivateAssets>all</PrivateAssets>
2323
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
2424
</PackageReference>
25-
<PackageReference Include="NUnit" Version="2.6.4" />
25+
<PackageReference Include="NUnit" Version="3.10.1" />
2626
</ItemGroup>
2727

2828
<ItemGroup>

Sources/ReCommendedExtension.Tests/TestEnvironmentAssembly.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
using System.Diagnostics.CodeAnalysis;
2+
using System.Threading;
23
using JetBrains.TestFramework;
34
using NUnit.Framework;
45
using ReCommendedExtension.Tests;
56

6-
[assembly: RequiresSTA]
7+
[assembly: Apartment(ApartmentState.STA)]
78

89
[SetUpFixture]
910
[SuppressMessage("ReSharper", "CheckNamespace", Justification = "Must be in the global namespace.")]

Sources/ReCommendedExtension/Analyzers/Annotation/AnnotationAnalyzer.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static IEnumerable<AttributeMark> GetAttributeMarks(
121121
{
122122
var markFound = false;
123123

124-
foreach (var attribute in declaration.AttributesEnumerable)
124+
foreach (var attribute in declaration.Attributes)
125125
{
126126
Debug.Assert(attribute != null);
127127

@@ -301,7 +301,7 @@ static void AnalyzeNotAllowedItemNotNull(
301301
[NotNull] IHighlightingConsumer consumer,
302302
[NotNull] IAttributesOwnerDeclaration attributesOwnerDeclaration)
303303
{
304-
var itemNotNullAttribute = attributesOwnerDeclaration.AttributesEnumerable.FirstOrDefault(
304+
var itemNotNullAttribute = attributesOwnerDeclaration.Attributes.FirstOrDefault(
305305
attribute => attribute.AssertNotNull().GetAttributeInstance().GetAttributeType().GetClrName().ShortName ==
306306
ContainerElementNullnessProvider.ItemNotNullAttributeShortName);
307307
if (itemNotNullAttribute != null)
@@ -388,7 +388,7 @@ static void AnalyzeMissingSuppressionJustification(
388388
}
389389

390390
var suppressMessageAttributes =
391-
from attribute in attributesOwnerDeclaration.AttributesEnumerable
391+
from attribute in attributesOwnerDeclaration.Attributes
392392
let attributeInstance = attribute.GetAttributeInstance()
393393
where Equals(attributeInstance.GetClrName(), ClrTypeNames.SuppressMessageAttribute) && attributeInstance.PositionParameterCount == 2
394394
let categoryConstantValue = attributeInstance.PositionParameter(0).ConstantValue
@@ -423,7 +423,7 @@ static void AnalyzeConflictingPurityAnnotations(
423423
[NotNull] IAttributesOwnerDeclaration attributesOwnerDeclaration)
424424
{
425425
var groupings = (
426-
from attribute in attributesOwnerDeclaration.AttributesEnumerable
426+
from attribute in attributesOwnerDeclaration.Attributes
427427
let shortName = attribute.GetAttributeInstance().GetAttributeType().GetClrName().ShortName
428428
where shortName == PureAnnotationProvider.PureAttributeShortName ||
429429
shortName == MustUseReturnValueAnnotationProvider.MustUseReturnValueAttributeShortName
@@ -461,7 +461,7 @@ from attribute in attributesOwnerDeclaration.AttributesEnumerable
461461
static void AnalyzeConditional([NotNull] IHighlightingConsumer consumer, [NotNull] IAttributesOwnerDeclaration attributesOwnerDeclaration)
462462
{
463463
var conditionalAttributes =
464-
from attribute in attributesOwnerDeclaration.AttributesEnumerable
464+
from attribute in attributesOwnerDeclaration.Attributes
465465
let typeElement = attribute.GetAttributeInstance().GetAttributeType().GetTypeElement()
466466
where typeElement != null
467467
let conditions =

Sources/ReCommendedExtension/Analyzers/Await/AwaitAnalyzer.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4+
using System.Threading.Tasks;
45
using JetBrains.Annotations;
56
using JetBrains.Metadata.Reader.API;
67
using JetBrains.Metadata.Reader.Impl;
@@ -44,7 +45,7 @@ static void TryGetContainerTypeAndAsyncKeyword(
4445
{
4546
case IMethodDeclaration methodDeclaration:
4647
type = methodDeclaration.Type;
47-
asyncKeyword = methodDeclaration.ModifiersList?.ModifiersEnumerable.FirstOrDefault(
48+
asyncKeyword = methodDeclaration.ModifiersList?.Modifiers.FirstOrDefault(
4849
node => node?.GetTokenType() == CSharpTokenType.ASYNC_KEYWORD);
4950
removeAsync = () => methodDeclaration.SetAsync(false);
5051
attributesOwnerDeclaration = methodDeclaration;
@@ -66,7 +67,7 @@ static void TryGetContainerTypeAndAsyncKeyword(
6667

6768
case ILocalFunctionDeclaration localFunctionDeclaration:
6869
type = localFunctionDeclaration.Type;
69-
asyncKeyword = localFunctionDeclaration.ModifiersList?.ModifiersEnumerable.FirstOrDefault(
70+
asyncKeyword = localFunctionDeclaration.ModifiersList?.Modifiers.FirstOrDefault(
7071
node => node?.GetTokenType() == CSharpTokenType.ASYNC_KEYWORD);
7172
removeAsync = () => localFunctionDeclaration.SetAsync(false);
7273
attributesOwnerDeclaration = null;
@@ -170,7 +171,7 @@ static bool IsTestMethodOfOldMsTest(IMethodDeclaration methodDeclaration)
170171

171172
var testMethodAttributeTypes = null as IDeclaredType[];
172173

173-
return methodDeclaration.AttributesEnumerable.Any(
174+
return methodDeclaration.Attributes.Any(
174175
attribute =>
175176
{
176177
if (attribute == null)
@@ -212,7 +213,7 @@ static void AddRedundantAwaitHighlightings(
212213
var highlightConfigureAwait = configureAwaitNode != null && configureAwaitInvocationExpression.ArgumentList != null;
213214

214215
var highlighting = new RedundantAwaitHighlighting(
215-
$"Redundant 'await' (remove 'async'/'await'{(highlightConfigureAwait ? "/'" + ClrMethodsNames.ConfigureAwait + "(...)'" : "")})",
216+
$"Redundant 'await' (remove 'async'/'await'{(highlightConfigureAwait ? "/'" + nameof(Task.ConfigureAwait) + "(...)'" : "")})",
216217
removeAsync,
217218
awaitExpression,
218219
statementToBeReplacedWithReturnStatement,
@@ -296,7 +297,7 @@ static bool AnalyzeRedundantAwait(
296297
if (awaitExpression.Task is IInvocationExpression configureAwaitInvocationExpression)
297298
{
298299
var method = configureAwaitInvocationExpression.InvocationExpressionReference.Resolve().DeclaredElement as IMethod;
299-
if (method?.ShortName == ClrMethodsNames.ConfigureAwait)
300+
if (method?.ShortName == nameof(Task.ConfigureAwait))
300301
{
301302
var methodContainingTypeElement = method.GetContainingType();
302303
if (methodContainingTypeElement != null)
@@ -372,7 +373,7 @@ awaitExpression.Parent is IReturnStatement returnStatement &&
372373
{
373374
consumer.AddHighlighting(
374375
new RedundantCapturedContextHighlighting(
375-
$"Redundant captured context (add '.{ClrMethodsNames.ConfigureAwait}(false)')",
376+
$"Redundant captured context (add '.{nameof(Task.ConfigureAwait)}(false)')",
376377
awaitExpression));
377378
}
378379
}

Sources/ReCommendedExtension/Analyzers/Await/RedundantCapturedContextHighlighting.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
using JetBrains.Annotations;
1+
using System.Threading.Tasks;
2+
using JetBrains.Annotations;
23
using JetBrains.DocumentModel;
34
using JetBrains.ReSharper.Feature.Services.Daemon;
45
using JetBrains.ReSharper.Psi.CSharp;
56
using JetBrains.ReSharper.Psi.CSharp.Tree;
67
using JetBrains.ReSharper.Psi.Tree;
7-
using ReCommendedExtension;
88
using ReCommendedExtension.Analyzers.Await;
99
using ZoneMarker = ReCommendedExtension.ZoneMarker;
1010

@@ -13,7 +13,7 @@
1313
RedundantCapturedContextHighlighting.SeverityId,
1414
null,
1515
HighlightingGroupIds.BestPractice,
16-
"Redundant captured context (add '." + ClrMethodsNames.ConfigureAwait + "(false)')" + ZoneMarker.Suffix,
16+
"Redundant captured context (add '." + nameof(Task.ConfigureAwait) + "(false)')" + ZoneMarker.Suffix,
1717
"",
1818
Severity.SUGGESTION)]
1919

Sources/ReCommendedExtension/Analyzers/Await/RemoveAsyncAwaitFix.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Text;
3+
using System.Threading.Tasks;
34
using JetBrains.Annotations;
45
using JetBrains.Application.Progress;
56
using JetBrains.ProjectModel;
@@ -33,7 +34,9 @@ public override string Text
3334

3435
if (highlighting.QuickFixRemovesConfigureAwait)
3536
{
36-
builder.Append($"/'{ClrMethodsNames.ConfigureAwait}(...)'");
37+
builder.Append("/'");
38+
builder.Append(nameof(Task.ConfigureAwait));
39+
builder.Append("(...)'");
3740
}
3841

3942
return builder.ToString();
@@ -62,7 +65,7 @@ protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution
6265

6366
highlighting.AttributesOwnerDeclaration.AddAttributeAfter(
6467
attribute,
65-
highlighting.AttributesOwnerDeclaration.AttributesEnumerable.LastOrDefault());
68+
highlighting.AttributesOwnerDeclaration.Attributes.LastOrDefault());
6669
}
6770
}
6871

Sources/ReCommendedExtension/Analyzers/ControlFlow/AssertionStatement.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Diagnostics;
2-
using System.Linq;
32
using JetBrains.Annotations;
43
using JetBrains.ReSharper.Psi;
54
using JetBrains.ReSharper.Psi.CodeAnnotations;
@@ -30,7 +29,7 @@ public static AssertionStatement TryFromInvocationExpression(
3029

3130
if (parameterAssertionCondition != null)
3231
{
33-
var argument = invocationExpression.ArgumentList?.ArgumentsEnumerable.FirstOrDefault(
32+
var argument = invocationExpression.ArgumentList?.Arguments.FirstOrDefault(
3433
a =>
3534
{
3635
Debug.Assert(a != null);

0 commit comments

Comments
 (0)