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

Make properties init-only #392

Merged
Merged
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace Cake.AzureDevOps.Pipelines
// ReSharper disable UnusedAutoPropertyAccessor.Global
namespace Cake.AzureDevOps.Pipelines
{
using System.Collections.Generic;
using Cake.Common.Build.AzurePipelines.Data;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace Cake.AzureDevOps.Pipelines
// ReSharper disable UnusedAutoPropertyAccessor.Global
namespace Cake.AzureDevOps.Pipelines
{
/// <summary>
/// Represents an artifact associated with a build.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace Cake.AzureDevOps.Pipelines
// ReSharper disable UnusedAutoPropertyAccessor.Global
namespace Cake.AzureDevOps.Pipelines
{
/// <summary>
/// Representation of a build definition.
Expand Down
31 changes: 16 additions & 15 deletions src/Cake.AzureDevOps/Pipelines/AzureDevOpsBuildsSettings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace Cake.AzureDevOps.Pipelines
// ReSharper disable UnusedAutoPropertyAccessor.Global
namespace Cake.AzureDevOps.Pipelines
{
using System;
using Cake.AzureDevOps.Authentication;
Expand Down Expand Up @@ -53,41 +54,41 @@ public AzureDevOpsBuildsSettings(IAzureDevOpsCredentials credentials)
}

/// <summary>
/// Gets or sets the name of the build definition.
/// Gets the name of the build definition.
/// Can be <c>null</c> or <see cref="string.Empty"/>.
/// </summary>
public string BuildDefinitionName { get; set; }
public string BuildDefinitionName { get; init; }

/// <summary>
/// Gets or sets the name of the branch.
/// Gets the name of the branch.
/// Can be <c>null</c> or <see cref="string.Empty"/>.
/// </summary>
public string BranchName { get; set; }
public string BranchName { get; init; }

/// <summary>
/// Gets or sets the build status.
/// Gets the build status.
/// </summary>
public AzureDevOpsBuildStatus? BuildStatus { get; set; }
public AzureDevOpsBuildStatus? BuildStatus { get; init; }

/// <summary>
/// Gets or sets the build result.
/// Gets the build result.
/// </summary>
public AzureDevOpsBuildResult? BuildResult { get; set; }
public AzureDevOpsBuildResult? BuildResult { get; init; }

/// <summary>
/// Gets or sets the build query order.
/// Gets the build query order.
/// </summary>
public AzureDevOpsBuildQueryOrder? BuildQueryOrder { get; set; }
public AzureDevOpsBuildQueryOrder? BuildQueryOrder { get; init; }

/// <summary>
/// Gets or sets the maximum number of builds per definition.
/// Gets the maximum number of builds per definition.
/// </summary>
public int? MaxBuildsPerDefinition { get; set; }
public int? MaxBuildsPerDefinition { get; init; }

/// <summary>
/// Gets or sets the maximum number of builds.
/// Gets the maximum number of builds.
/// </summary>
public int? Top { get; set; }
public int? Top { get; init; }

/// <summary>
/// Constructs the settings object using the access token provided by Azure Pipelines.
Expand Down
3 changes: 2 additions & 1 deletion src/Cake.AzureDevOps/Pipelines/AzureDevOpsChange.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace Cake.AzureDevOps.Pipelines
// ReSharper disable UnusedAutoPropertyAccessor.Global
namespace Cake.AzureDevOps.Pipelines
{
using System;

Expand Down
3 changes: 2 additions & 1 deletion src/Cake.AzureDevOps/Pipelines/AzureDevOpsTestResult.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace Cake.AzureDevOps.Pipelines
// ReSharper disable UnusedAutoPropertyAccessor.Global
namespace Cake.AzureDevOps.Pipelines
{
/// <summary>
/// Represents a test result associated with a <see cref="AzureDevOpsTestRun" />.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace Cake.AzureDevOps.Pipelines
// ReSharper disable UnusedAutoPropertyAccessor.Global
namespace Cake.AzureDevOps.Pipelines
{
using System;

Expand Down
3 changes: 2 additions & 1 deletion src/Cake.AzureDevOps/Repos/AzureDevOpsCommit.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace Cake.AzureDevOps.Repos
// ReSharper disable UnusedAutoPropertyAccessor.Global
namespace Cake.AzureDevOps.Repos
{
using System.Collections.Generic;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@
public class AzureDevOpsPullRequestIterationChange
{
/// <summary>
/// Gets or sets the file path the iteration change is associated with.
/// Gets the file path the iteration change is associated with.
/// </summary>
public FilePath ItemPath { get; set; }
public FilePath ItemPath { get; init; }

/// <summary>
/// Gets or sets the id of the iteration change.
/// Gets the id of the iteration change.
/// </summary>
public int ChangeId { get; set; }
public int ChangeId { get; init; }

/// <summary>
/// Gets or sets the tracking id of the iteration change.
/// Gets the tracking id of the iteration change.
/// </summary>
public int ChangeTrackingId { get; set; }
public int ChangeTrackingId { get; init; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public AzureDevOpsPullRequestSettings(IAzureDevOpsCredentials credentials)
/// <summary>
/// Gets the ID of the pull request.
/// </summary>
public int? PullRequestId { get; private set; }
public int? PullRequestId { get; }

/// <summary>
/// Gets or sets a value indicating whether an exception should be thrown if
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace Cake.AzureDevOps.Repos.PullRequest
// ReSharper disable UnusedAutoPropertyAccessor.Global
namespace Cake.AzureDevOps.Repos.PullRequest
{
using System;

Expand All @@ -24,23 +25,23 @@ public AzureDevOpsPullRequestStatus(string name)
public string Name { get; }

/// <summary>
/// Gets or sets the genre of the status.
/// Gets the genre of the status.
/// </summary>
public string Genre { get; set; }
public string Genre { get; init; }

/// <summary>
/// Gets or sets the state of the pull request.
/// Gets the state of the pull request.
/// </summary>
public AzureDevOpsPullRequestStatusState State { get; set; }
public AzureDevOpsPullRequestStatusState State { get; init; }

/// <summary>
/// Gets or sets the description of the status.
/// Gets the description of the status.
/// </summary>
public string Description { get; set; }
public string Description { get; init; }

/// <summary>
/// Gets or sets the URL of the status.
/// Gets the URL of the status.
/// </summary>
public Uri TargetUrl { get; set; }
public Uri TargetUrl { get; init; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected BaseAzureDevOpsPullRequestSettings(IAzureDevOpsCredentials credentials
/// <summary>
/// Gets the full URL of the Git repository, eg. <code>http://myserver:8080/defaultcollection/myproject/_git/myrepository</code>.
/// </summary>
public Uri RepositoryUrl { get; private set; }
public Uri RepositoryUrl { get; }

/// <summary>
/// Gets the branch for which the pull request is made.
Expand All @@ -90,6 +90,6 @@ protected BaseAzureDevOpsPullRequestSettings(IAzureDevOpsCredentials credentials
/// <summary>
/// Gets the branch for which the pull request is made.
/// </summary>
public string SourceRefName { get; private set; }
public string SourceRefName { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,30 +53,30 @@ internal AzureDevOpsComment(Comment comment, int threadId)
public int ThreadId { get; }

/// <summary>
/// Gets or sets the content of the pull request comment.
/// Gets the content of the pull request comment.
/// </summary>
public string Content
{
get => this.Comment.Content;
set => this.Comment.Content = value;
init => this.Comment.Content = value;
}

/// <summary>
/// Gets or sets a value indicating whether the comment is deleted.
/// Gets a value indicating whether the comment is deleted.
/// </summary>
public bool IsDeleted
{
get => this.Comment.IsDeleted;
set => this.Comment.IsDeleted = value;
init => this.Comment.IsDeleted = value;
}

/// <summary>
/// Gets or sets the comment type.
/// Gets the comment type.
/// </summary>
public AzureDevOpsCommentType CommentType
{
get => (AzureDevOpsCommentType)this.Comment.CommentType;
set => this.Comment.CommentType = (CommentType)value;
init => this.Comment.CommentType = (CommentType)value;
}

/// <summary>
Expand Down
Loading