Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PrettyBot] Merge prettybot/main to main #124

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 7 additions & 16 deletions build/Build.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
using Nuke.Common;
using Nuke.Common.Execution;
using Nuke.Common.IO;
using Nuke.Common.ProjectModel;
using Nuke.Common.Tools.DotNet;
using Nuke.Common.Tools.OctoVersion;
using Nuke.Common.Utilities.Collections;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.Tools.DotNet.DotNetTasks;
using System;

[UnsetVisualStudioEnvironmentVariables]
class Build : NukeBuild
Expand All @@ -16,15 +8,14 @@ class Build : NukeBuild
[Solution] readonly Solution Solution;

[Parameter("Branch name for OctoVersion to use to calculate the version number. Can be set via the environment variable OCTOVERSION_CurrentBranch.",
Name = "OCTOVERSION_CurrentBranch")]
readonly string BranchName;
Name = "OCTOVERSION_CurrentBranch")]
readonly string BranchName;

[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;
[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;

[OctoVersion(UpdateBuildNumber = true, BranchParameter = nameof(BranchName),
AutoDetectBranchParameter = nameof(AutoDetectBranch), Framework = "net6.0")]
readonly OctoVersionInfo OctoVersionInfo;
[OctoVersion(UpdateBuildNumber = true, BranchParameter = nameof(BranchName),
AutoDetectBranchParameter = nameof(AutoDetectBranch), Framework = "net6.0")]
readonly OctoVersionInfo OctoVersionInfo;

AbsolutePath SourceDirectory => RootDirectory / "source";
AbsolutePath ArtifactsDirectory => RootDirectory / "artifacts";
Expand Down
3 changes: 1 addition & 2 deletions source/Tests/AssertionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ namespace Tests
{
public static class AssertionExtensions
{
public static OclBodyAssertions Should(this OclBody? subject)
=> new OclBodyAssertions(subject);
public static OclBodyAssertions Should(this OclBody? subject) => new(subject);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class DefaultCollectionOclConverterFixture
{
const string Value = "Daffy";

readonly OclConversionContext context = new OclConversionContext(new OclSerializerOptions());
readonly OclConversionContext context = new(new OclSerializerOptions());

[Test]
public void FromElement_IEnumerableTargetWithCurrentAsNullReturnsAList()
Expand Down
2 changes: 1 addition & 1 deletion source/Tests/Converters/NameAttributeFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class DummyWithAttribute
class DummyWithBlock
{
[OclName("AnotherName")]
public DummyWithAttribute BlockProperty { get; set; } = new DummyWithAttribute();
public DummyWithAttribute BlockProperty { get; set; } = new();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public void CollectionSingleItem()
{
Passengers = new List<Person>
{
new Person
new()
{ Name = "Bob" }
}
});
Expand Down Expand Up @@ -241,9 +241,9 @@ public void CollectionMultipleItems()
{
Passengers = new List<Person>
{
new Person
new()
{ Name = "Bob" },
new Person
new()
{ Name = "George" }
}
});
Expand All @@ -257,7 +257,7 @@ public void ExceptionIsThrownIfPropertyDoesNotExist()
new OclAttribute("Wings", 1)
};

Action action = () =>
var action = () =>
{
var context = new OclConversionContext(new OclSerializerOptions() ?? new OclSerializerOptions());
var result = context.FromElement(typeof(Car), document, null);
Expand All @@ -278,7 +278,7 @@ public void ExceptionIsThrownIfPropertyCantBeSet()
new OclAttribute("ReadOnly", 1)
};

Action action = () =>
var action = () =>
{
var context = new OclConversionContext(new OclSerializerOptions() ?? new OclSerializerOptions());
var result = context.FromElement(typeof(Car), document, null);
Expand Down Expand Up @@ -322,7 +322,7 @@ class Car
public int ReadOnly { get; } = 1;
public Person? Driver { get; set; }
public List<Person>? Passengers { get; set; }
public List<Person> ReadOnlyPassengers { get; } = new List<Person>();
public List<Person> ReadOnlyPassengers { get; } = new();
public CarType Type { get; set; }
public Dictionary<string, string>? StringDictionary { get; set; }
public Dictionary<string, object?>? ObjectDictionary { get; set; }
Expand Down
12 changes: 6 additions & 6 deletions source/Tests/RealLifeScenario/Entities/DeploymentAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,23 @@ public DeploymentAction(string name, string actionType)
public bool CanBeUsedForProjectVersioning => true;

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

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

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

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

[JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Reuse)]
public PackageReferenceCollection Packages { get; } = new PackageReferenceCollection();
public PackageReferenceCollection Packages { get; } = new();

public DeploymentActionCondition Condition { get; set; }

[JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Reuse)]
public PropertiesDictionary Properties { get; } = new PropertiesDictionary();
public PropertiesDictionary Properties { get; } = new();
}
}
4 changes: 2 additions & 2 deletions source/Tests/RealLifeScenario/Entities/DeploymentStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public DeploymentStep(string name)
public DeploymentStepPackageRequirement PackageRequirement { get; set; }

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

[JsonIgnore]
public IEnumerable<PropertiesDictionary> InheritedPropertiesForActions
Expand All @@ -29,6 +29,6 @@ public IEnumerable<PropertiesDictionary> InheritedPropertiesForActions
}

[JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Reuse)]
public PropertiesDictionary Properties { get; } = new PropertiesDictionary();
public PropertiesDictionary Properties { get; } = new();
}
}
4 changes: 2 additions & 2 deletions source/Tests/RealLifeScenario/Entities/VcsRunbook.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ public VcsRunbook(string name)

public TenantedDeploymentMode MultiTenancyMode { get; set; }

public ProjectConnectivityPolicy ConnectivityPolicy { get; set; } = new ProjectConnectivityPolicy
public ProjectConnectivityPolicy ConnectivityPolicy { get; set; } = new()
{
AllowDeploymentsToNoTargets = true
};

public RunbookEnvironmentScope EnvironmentScope { get; set; }

public ReferenceCollection Environments { get; } = new ReferenceCollection();
public ReferenceCollection Environments { get; } = new();

public GuidedFailureMode DefaultGuidedFailureMode { get; set; }
}
Expand Down
3 changes: 1 addition & 2 deletions source/Tests/ToOclDoc/ToOclDocConverterFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ public bool CanConvert(Type type)
public IEnumerable<IOclElement> ToElements(OclConversionContext context, PropertyInfo? propertyInfo, object value)
=> throw new NotImplementedException();

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

public object? FromElement(OclConversionContext context, Type type, IOclElement element, object? currentValue)
=> throw new NotImplementedException();
Expand Down
2 changes: 1 addition & 1 deletion source/Tests/ToOclDoc/ToOclDocDefaultBehaviourFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void ListOfComplexTypesProperty()
var data = new
{
Cars = new List<Car>
{ new Car(), new Car() }
{ new(), new() }
};

var result = new OclSerializer().ToOclDocument(data);
Expand Down
3 changes: 1 addition & 2 deletions source/Tests/ToString/OclWriterFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ public class OclWriterFixture
{
static IEnumerable<TestCaseData> WriteAttributeDataSource()
{
TestCaseData CreateCase(string name, object? value, string expected)
=> new TestCaseData(value, expected) { TestName = "WriteAttribute value: " + name };
TestCaseData CreateCase(string name, object? value, string expected) => new(value, expected) { TestName = "WriteAttribute value: " + name };

yield return CreateCase("null", null, "null");
yield return CreateCase("bool", false, "false");
Expand Down