Skip to content

Commit 8ecfaa0

Browse files
committed
Run ReSharper code cleanup
1 parent 9afc81c commit 8ecfaa0

File tree

11 files changed

+29
-41
lines changed

11 files changed

+29
-41
lines changed

build/Build.cs

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
using Nuke.Common;
2-
using Nuke.Common.Execution;
3-
using Nuke.Common.IO;
4-
using Nuke.Common.ProjectModel;
5-
using Nuke.Common.Tools.DotNet;
6-
using Nuke.Common.Tools.OctoVersion;
7-
using Nuke.Common.Utilities.Collections;
8-
using static Nuke.Common.IO.FileSystemTasks;
9-
using static Nuke.Common.Tools.DotNet.DotNetTasks;
1+
using System;
102

113
[UnsetVisualStudioEnvironmentVariables]
124
class Build : NukeBuild
@@ -16,15 +8,14 @@ class Build : NukeBuild
168
[Solution] readonly Solution Solution;
179

1810
[Parameter("Branch name for OctoVersion to use to calculate the version number. Can be set via the environment variable OCTOVERSION_CurrentBranch.",
19-
Name = "OCTOVERSION_CurrentBranch")]
20-
readonly string BranchName;
11+
Name = "OCTOVERSION_CurrentBranch")]
12+
readonly string BranchName;
2113

22-
[Parameter("Whether to auto-detect the branch name - this is okay for a local build, but should not be used under CI.")]
23-
readonly bool AutoDetectBranch = IsLocalBuild;
14+
[Parameter("Whether to auto-detect the branch name - this is okay for a local build, but should not be used under CI.")] readonly bool AutoDetectBranch = IsLocalBuild;
2415

25-
[OctoVersion(UpdateBuildNumber = true, BranchParameter = nameof(BranchName),
26-
AutoDetectBranchParameter = nameof(AutoDetectBranch), Framework = "net6.0")]
27-
readonly OctoVersionInfo OctoVersionInfo;
16+
[OctoVersion(UpdateBuildNumber = true, BranchParameter = nameof(BranchName),
17+
AutoDetectBranchParameter = nameof(AutoDetectBranch), Framework = "net6.0")]
18+
readonly OctoVersionInfo OctoVersionInfo;
2819

2920
AbsolutePath SourceDirectory => RootDirectory / "source";
3021
AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts";

source/Tests/AssertionExtensions.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ namespace Tests
55
{
66
public static class AssertionExtensions
77
{
8-
public static OclBodyAssertions Should(this OclBody? subject)
9-
=> new OclBodyAssertions(subject);
8+
public static OclBodyAssertions Should(this OclBody? subject) => new(subject);
109
}
1110
}

source/Tests/Converters/DefaultCollectionOclConverterFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class DefaultCollectionOclConverterFixture
1111
{
1212
const string Value = "Daffy";
1313

14-
readonly OclConversionContext context = new OclConversionContext(new OclSerializerOptions());
14+
readonly OclConversionContext context = new(new OclSerializerOptions());
1515

1616
[Test]
1717
public void FromElement_IEnumerableTargetWithCurrentAsNullReturnsAList()

source/Tests/Converters/NameAttributeFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class DummyWithAttribute
4848
class DummyWithBlock
4949
{
5050
[OclName("AnotherName")]
51-
public DummyWithAttribute BlockProperty { get; set; } = new DummyWithAttribute();
51+
public DummyWithAttribute BlockProperty { get; set; } = new();
5252
}
5353
}
5454
}

source/Tests/FromOclDoc/FromOclDocumentDefaultBehaviourFixture.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ public void CollectionSingleItem()
210210
{
211211
Passengers = new List<Person>
212212
{
213-
new Person
213+
new()
214214
{ Name = "Bob" }
215215
}
216216
});
@@ -241,9 +241,9 @@ public void CollectionMultipleItems()
241241
{
242242
Passengers = new List<Person>
243243
{
244-
new Person
244+
new()
245245
{ Name = "Bob" },
246-
new Person
246+
new()
247247
{ Name = "George" }
248248
}
249249
});
@@ -257,7 +257,7 @@ public void ExceptionIsThrownIfPropertyDoesNotExist()
257257
new OclAttribute("Wings", 1)
258258
};
259259

260-
Action action = () =>
260+
var action = () =>
261261
{
262262
var context = new OclConversionContext(new OclSerializerOptions() ?? new OclSerializerOptions());
263263
var result = context.FromElement(typeof(Car), document, null);
@@ -278,7 +278,7 @@ public void ExceptionIsThrownIfPropertyCantBeSet()
278278
new OclAttribute("ReadOnly", 1)
279279
};
280280

281-
Action action = () =>
281+
var action = () =>
282282
{
283283
var context = new OclConversionContext(new OclSerializerOptions() ?? new OclSerializerOptions());
284284
var result = context.FromElement(typeof(Car), document, null);
@@ -322,7 +322,7 @@ class Car
322322
public int ReadOnly { get; } = 1;
323323
public Person? Driver { get; set; }
324324
public List<Person>? Passengers { get; set; }
325-
public List<Person> ReadOnlyPassengers { get; } = new List<Person>();
325+
public List<Person> ReadOnlyPassengers { get; } = new();
326326
public CarType Type { get; set; }
327327
public Dictionary<string, string>? StringDictionary { get; set; }
328328
public Dictionary<string, object?>? ObjectDictionary { get; set; }

source/Tests/RealLifeScenario/Entities/DeploymentAction.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,23 +40,23 @@ public DeploymentAction(string name, string actionType)
4040
public bool CanBeUsedForProjectVersioning => true;
4141

4242
[JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Reuse)]
43-
public ReferenceCollection<DeploymentEnvironmentIdOrName> Environments { get; } = new ReferenceCollection<DeploymentEnvironmentIdOrName>();
43+
public ReferenceCollection<DeploymentEnvironmentIdOrName> Environments { get; } = new();
4444

4545
[JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Reuse)]
46-
public ReferenceCollection<DeploymentEnvironmentIdOrName> ExcludedEnvironments { get; } = new ReferenceCollection<DeploymentEnvironmentIdOrName>();
46+
public ReferenceCollection<DeploymentEnvironmentIdOrName> ExcludedEnvironments { get; } = new();
4747

4848
[JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Reuse)]
49-
public ReferenceCollection<ChannelIdOrName> Channels { get; } = new ReferenceCollection<ChannelIdOrName>();
49+
public ReferenceCollection<ChannelIdOrName> Channels { get; } = new();
5050

5151
[JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Reuse)]
52-
public ReferenceCollection<TagCanonicalIdOrName> TenantTags { get; } = new ReferenceCollection<TagCanonicalIdOrName>();
52+
public ReferenceCollection<TagCanonicalIdOrName> TenantTags { get; } = new();
5353

5454
[JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Reuse)]
55-
public PackageReferenceCollection Packages { get; } = new PackageReferenceCollection();
55+
public PackageReferenceCollection Packages { get; } = new();
5656

5757
public DeploymentActionCondition Condition { get; set; }
5858

5959
[JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Reuse)]
60-
public PropertiesDictionary Properties { get; } = new PropertiesDictionary();
60+
public PropertiesDictionary Properties { get; } = new();
6161
}
6262
}

source/Tests/RealLifeScenario/Entities/DeploymentStep.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public DeploymentStep(string name)
2020
public DeploymentStepPackageRequirement PackageRequirement { get; set; }
2121

2222
[JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Reuse)]
23-
public List<DeploymentAction> Actions { get; } = new List<DeploymentAction>();
23+
public List<DeploymentAction> Actions { get; } = new();
2424

2525
[JsonIgnore]
2626
public IEnumerable<PropertiesDictionary> InheritedPropertiesForActions
@@ -29,6 +29,6 @@ public IEnumerable<PropertiesDictionary> InheritedPropertiesForActions
2929
}
3030

3131
[JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Reuse)]
32-
public PropertiesDictionary Properties { get; } = new PropertiesDictionary();
32+
public PropertiesDictionary Properties { get; } = new();
3333
}
3434
}

source/Tests/RealLifeScenario/Entities/VcsRunbook.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ public VcsRunbook(string name)
1616

1717
public TenantedDeploymentMode MultiTenancyMode { get; set; }
1818

19-
public ProjectConnectivityPolicy ConnectivityPolicy { get; set; } = new ProjectConnectivityPolicy
19+
public ProjectConnectivityPolicy ConnectivityPolicy { get; set; } = new()
2020
{
2121
AllowDeploymentsToNoTargets = true
2222
};
2323

2424
public RunbookEnvironmentScope EnvironmentScope { get; set; }
2525

26-
public ReferenceCollection Environments { get; } = new ReferenceCollection();
26+
public ReferenceCollection Environments { get; } = new();
2727

2828
public GuidedFailureMode DefaultGuidedFailureMode { get; set; }
2929
}

source/Tests/ToOclDoc/ToOclDocConverterFixture.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ public bool CanConvert(Type type)
6565
public IEnumerable<IOclElement> ToElements(OclConversionContext context, PropertyInfo? propertyInfo, object value)
6666
=> throw new NotImplementedException();
6767

68-
public OclDocument ToDocument(OclConversionContext context, object obj)
69-
=> new OclDocument(new[] { new OclAttribute("Fake", null) });
68+
public OclDocument ToDocument(OclConversionContext context, object obj) => new(new[] { new OclAttribute("Fake", null) });
7069

7170
public object? FromElement(OclConversionContext context, Type type, IOclElement element, object? currentValue)
7271
=> throw new NotImplementedException();

source/Tests/ToOclDoc/ToOclDocDefaultBehaviourFixture.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void ListOfComplexTypesProperty()
3232
var data = new
3333
{
3434
Cars = new List<Car>
35-
{ new Car(), new Car() }
35+
{ new(), new() }
3636
};
3737

3838
var result = new OclSerializer().ToOclDocument(data);

0 commit comments

Comments
 (0)