diff --git a/Octokit.Reactive/Clients/ObservableIssueCommentReactionsClient.cs b/Octokit.Reactive/Clients/ObservableIssueCommentReactionsClient.cs index 36200a0a52..f668948282 100644 --- a/Octokit.Reactive/Clients/ObservableIssueCommentReactionsClient.cs +++ b/Octokit.Reactive/Clients/ObservableIssueCommentReactionsClient.cs @@ -107,7 +107,7 @@ public IObservable GetAll(long repositoryId, int number) public IObservable GetAll(long repositoryId, int number, ApiOptions options) { Ensure.ArgumentNotNull(options, nameof(options)); - + return _connection.GetAndFlattenAllPages(ApiUrls.IssueCommentReactions(repositoryId, number), null, AcceptHeaders.ReactionsPreview, options); } } diff --git a/Octokit.Reactive/Clients/ObservableIssueReactionsClient.cs b/Octokit.Reactive/Clients/ObservableIssueReactionsClient.cs index 3de52e7f8f..19de83a003 100644 --- a/Octokit.Reactive/Clients/ObservableIssueReactionsClient.cs +++ b/Octokit.Reactive/Clients/ObservableIssueReactionsClient.cs @@ -73,7 +73,7 @@ public IObservable GetAll(long repositoryId, int number) public IObservable GetAll(long repositoryId, int number, ApiOptions options) { Ensure.ArgumentNotNull(options, nameof(options)); - + return _connection.GetAndFlattenAllPages(ApiUrls.IssueReactions(repositoryId, number), null, AcceptHeaders.ReactionsPreview, options); } diff --git a/Octokit.Reactive/Clients/ObservableMigrationsClient.cs b/Octokit.Reactive/Clients/ObservableMigrationsClient.cs index 39ce9aecf5..fc247b09a0 100644 --- a/Octokit.Reactive/Clients/ObservableMigrationsClient.cs +++ b/Octokit.Reactive/Clients/ObservableMigrationsClient.cs @@ -61,7 +61,7 @@ public IObservable GetAll(string org) public IObservable GetAll(string org, ApiOptions options) { Ensure.ArgumentNotNull(options, nameof(options)); - + return _connection.GetAndFlattenAllPages(ApiUrls.EnterpriseMigrations(org), null, AcceptHeaders.MigrationsApiPreview, options); } diff --git a/Octokit.Reactive/Clients/ObservablePullRequestReviewCommentReactionsClient.cs b/Octokit.Reactive/Clients/ObservablePullRequestReviewCommentReactionsClient.cs index 4cd1f7f751..1be8335d2d 100644 --- a/Octokit.Reactive/Clients/ObservablePullRequestReviewCommentReactionsClient.cs +++ b/Octokit.Reactive/Clients/ObservablePullRequestReviewCommentReactionsClient.cs @@ -65,7 +65,7 @@ public IObservable GetAll(long repositoryId, int number) public IObservable GetAll(long repositoryId, int number, ApiOptions options) { Ensure.ArgumentNotNull(options, nameof(options)); - + return _connection.GetAndFlattenAllPages(ApiUrls.PullRequestReviewCommentReaction(repositoryId, number), null, AcceptHeaders.ReactionsPreview, options); } diff --git a/Octokit.Tests.Integration/Clients/CommitCommentReactionsClientTests.cs b/Octokit.Tests.Integration/Clients/CommitCommentReactionsClientTests.cs index 21a9ff7256..ebf204ca19 100644 --- a/Octokit.Tests.Integration/Clients/CommitCommentReactionsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/CommitCommentReactionsClientTests.cs @@ -93,7 +93,7 @@ public async Task ReturnsCorrectCountOfReactionsWithoutStart() var reactions = await _github.Reaction.CommitComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, result.Id, options); Assert.Equal(1, reactions.Count); - + Assert.Equal(reaction.Id, reactions[0].Id); Assert.Equal(reaction.Content, reactions[0].Content); } @@ -111,7 +111,7 @@ public async Task ReturnsCorrectCountOfReactionsWithStart() Assert.NotNull(result); var reactions = new List(); - var reactionsContent = new []{ ReactionType.Confused, ReactionType.Hooray }; + var reactionsContent = new[] { ReactionType.Confused, ReactionType.Hooray }; for (var i = 0; i < 2; i++) { var newReaction = new NewReaction(reactionsContent[i]); @@ -128,7 +128,7 @@ public async Task ReturnsCorrectCountOfReactionsWithStart() var reactionsInfo = await _github.Reaction.CommitComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, result.Id, options); Assert.Equal(1, reactionsInfo.Count); - + Assert.Equal(reactions.Last().Id, reactionsInfo[0].Id); Assert.Equal(reactions.Last().Content, reactionsInfo[0].Content); } @@ -145,7 +145,7 @@ public async Task ReturnsDistinctReactionsBasedOnStartPage() Assert.NotNull(result); - var reactionsContent = new []{ ReactionType.Confused, ReactionType.Hooray }; + var reactionsContent = new[] { ReactionType.Confused, ReactionType.Hooray }; for (var i = 0; i < 2; i++) { var newReaction = new NewReaction(reactionsContent[i]); @@ -159,7 +159,7 @@ public async Task ReturnsDistinctReactionsBasedOnStartPage() StartPage = 1 }; var firstPage = await _github.Reaction.CommitComment.GetAll(_context.RepositoryOwner, _context.RepositoryName, result.Id, startOptions); - + var skipStartOptions = new ApiOptions { PageSize = 1, @@ -221,7 +221,7 @@ public async Task ReturnsCorrectCountOfReactionsWithoutStartWithRepositoryId() var reactions = await _github.Reaction.CommitComment.GetAll(_context.Repository.Id, result.Id, options); Assert.Equal(1, reactions.Count); - + Assert.Equal(reaction.Id, reactions[0].Id); Assert.Equal(reaction.Content, reactions[0].Content); } @@ -239,7 +239,7 @@ public async Task ReturnsCorrectCountOfReactionsWithStartWithRepositoryId() Assert.NotNull(result); var reactions = new List(); - var reactionsContent = new []{ ReactionType.Confused, ReactionType.Hooray }; + var reactionsContent = new[] { ReactionType.Confused, ReactionType.Hooray }; for (var i = 0; i < 2; i++) { var newReaction = new NewReaction(reactionsContent[i]); @@ -256,7 +256,7 @@ public async Task ReturnsCorrectCountOfReactionsWithStartWithRepositoryId() var reactionsInfo = await _github.Reaction.CommitComment.GetAll(_context.Repository.Id, result.Id, options); Assert.Equal(1, reactionsInfo.Count); - + Assert.Equal(reactions.Last().Id, reactionsInfo[0].Id); Assert.Equal(reactions.Last().Content, reactionsInfo[0].Content); } @@ -273,7 +273,7 @@ public async Task ReturnsDistinctReactionsBasedOnStartPageWithRepositoryId() Assert.NotNull(result); - var reactionsContent = new []{ ReactionType.Confused, ReactionType.Hooray }; + var reactionsContent = new[] { ReactionType.Confused, ReactionType.Hooray }; for (var i = 0; i < 2; i++) { var newReaction = new NewReaction(reactionsContent[i]); @@ -287,7 +287,7 @@ public async Task ReturnsDistinctReactionsBasedOnStartPageWithRepositoryId() StartPage = 1 }; var firstPage = await _github.Reaction.CommitComment.GetAll(_context.Repository.Id, result.Id, startOptions); - + var skipStartOptions = new ApiOptions { PageSize = 1, @@ -300,7 +300,7 @@ public async Task ReturnsDistinctReactionsBasedOnStartPageWithRepositoryId() Assert.Equal(1, secondPage.Count); Assert.NotEqual(firstPage[0].Id, secondPage[0].Id); Assert.NotEqual(firstPage[0].Content, secondPage[0].Content); - } + } [IntegrationTest] public async Task CanCreateReaction() { diff --git a/Octokit.Tests.Integration/Clients/IssueReactionsClientTests.cs b/Octokit.Tests.Integration/Clients/IssueReactionsClientTests.cs index edba281bfa..9a396e879f 100644 --- a/Octokit.Tests.Integration/Clients/IssueReactionsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/IssueReactionsClientTests.cs @@ -58,7 +58,7 @@ public async Task ReturnsCorrectCountOfReactionsWithoutStart() PageSize = 1, PageCount = 1 }; - + var issueReactions = await _github.Reaction.Issue.GetAll(_context.RepositoryOwner, _context.RepositoryName, issue.Number, options); Assert.Equal(1, issueReactions.Count); @@ -89,7 +89,7 @@ public async Task ReturnsCorrectCountOfReactionsWithStart() PageCount = 1, StartPage = 2 }; - + var issueReactions = await _github.Reaction.Issue.GetAll(_context.RepositoryOwner, _context.RepositoryName, issue.Number, options); Assert.Equal(1, issueReactions.Count); @@ -121,7 +121,7 @@ public async Task ReturnsDistinctReactionsBasedOnStartPage() StartPage = 1 }; var firstPage = await _github.Reaction.Issue.GetAll(_context.RepositoryOwner, _context.RepositoryName, issue.Number, startOptions); - + var skipStartOptions = new ApiOptions { PageSize = 1, @@ -129,7 +129,7 @@ public async Task ReturnsDistinctReactionsBasedOnStartPage() StartPage = 2 }; var secondPage = await _github.Reaction.Issue.GetAll(_context.RepositoryOwner, _context.RepositoryName, issue.Number, skipStartOptions); - + Assert.Equal(1, firstPage.Count); Assert.Equal(1, secondPage.Count); Assert.NotEqual(firstPage[0].Id, secondPage[0].Id); @@ -169,7 +169,7 @@ public async Task ReturnsCorrectCountOfReactionsWithoutStartWithRepositoryId() PageSize = 1, PageCount = 1 }; - + var issueReactions = await _github.Reaction.Issue.GetAll(_context.Repository.Id, issue.Number, options); Assert.Equal(1, issueReactions.Count); @@ -200,7 +200,7 @@ public async Task ReturnsCorrectCountOfReactionsWithStartWithRepositoryId() PageCount = 1, StartPage = 2 }; - + var issueReactions = await _github.Reaction.Issue.GetAll(_context.Repository.Id, issue.Number, options); Assert.Equal(1, issueReactions.Count); @@ -232,7 +232,7 @@ public async Task ReturnsDistinctReactionsBasedOnStartPageWithRepositoryId() StartPage = 1 }; var firstPage = await _github.Reaction.Issue.GetAll(_context.Repository.Id, issue.Number, startOptions); - + var skipStartOptions = new ApiOptions { PageSize = 1, @@ -240,7 +240,7 @@ public async Task ReturnsDistinctReactionsBasedOnStartPageWithRepositoryId() StartPage = 2 }; var secondPage = await _github.Reaction.Issue.GetAll(_context.Repository.Id, issue.Number, skipStartOptions); - + Assert.Equal(1, firstPage.Count); Assert.Equal(1, secondPage.Count); Assert.NotEqual(firstPage[0].Id, secondPage[0].Id); diff --git a/Octokit.Tests.Integration/Clients/MigrationsClientTests.cs b/Octokit.Tests.Integration/Clients/MigrationsClientTests.cs index af28e60df8..4d1e93b07a 100644 --- a/Octokit.Tests.Integration/Clients/MigrationsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/MigrationsClientTests.cs @@ -75,12 +75,12 @@ public async Task ReturnsCorrectCountOfMigrationsWithoutStart() PageCount = 1, PageSize = 1 }; - + var migrations = await _gitHub.Migration.Migrations.GetAll(_orgName, options); Assert.Equal(1, migrations.Count); } - + [IntegrationTest] public async Task ReturnsCorrectCountOfMigrationsWithStart() { @@ -90,7 +90,7 @@ public async Task ReturnsCorrectCountOfMigrationsWithStart() PageSize = 1, StartPage = 2 }; - + var migrations = await _gitHub.Migration.Migrations.GetAll(_orgName, options); Assert.Equal(1, migrations.Count); @@ -105,7 +105,7 @@ public async Task ReturnsDistinctMigrationsBasedOnStartPage() PageSize = 1, StartPage = 1 }; - + var firstPage = await _gitHub.Migration.Migrations.GetAll(_orgName, startOptions); var skipStartOptions = new ApiOptions diff --git a/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs index 046c9734dc..c3f0ac4dcf 100644 --- a/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs @@ -42,7 +42,7 @@ public async Task CanCreate() public async Task CanCreateDraft() { await CreateTheWorld(); - + var newPullRequest = new NewPullRequest("a draft pull request", branchName, "master") { Draft = true }; var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); Assert.Equal("a draft pull request", result.Title); @@ -63,13 +63,13 @@ public async Task CanCreateWithRepositoryId() public async Task CanCreateDraftWithRepositoryId() { await CreateTheWorld(); - + var newPullRequest = new NewPullRequest("a draft pull request", branchName, "master") { Draft = true }; var result = await _fixture.Create(_context.Repository.Id, newPullRequest); Assert.Equal("a draft pull request", result.Title); Assert.True(result.Draft); } - + [IntegrationTest] public async Task CanGetForRepository() { diff --git a/Octokit.Tests.Integration/Helpers/GitHubAppsTestAttribute.cs b/Octokit.Tests.Integration/Helpers/GitHubAppsTestAttribute.cs index e644aa5ecc..9ae83eb9d1 100644 --- a/Octokit.Tests.Integration/Helpers/GitHubAppsTestAttribute.cs +++ b/Octokit.Tests.Integration/Helpers/GitHubAppsTestAttribute.cs @@ -35,7 +35,7 @@ public IEnumerable Discover(ITestFrameworkDiscoveryOptions disco return Enumerable.Empty(); } - return new[] { new XunitTestCase(diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), TestMethodDisplayOptions.None, testMethod) }; + return new[] { new XunitTestCase(diagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), TestMethodDisplayOptions.None, testMethod) }; } } diff --git a/Octokit.Tests.Integration/Helpers/MaintenanceModeContext.cs b/Octokit.Tests.Integration/Helpers/MaintenanceModeContext.cs index ccfc80ea0a..26c405356a 100644 --- a/Octokit.Tests.Integration/Helpers/MaintenanceModeContext.cs +++ b/Octokit.Tests.Integration/Helpers/MaintenanceModeContext.cs @@ -18,7 +18,7 @@ internal MaintenanceModeContext(IConnection connection, bool enabled) } private IConnection _connection; - + public void Dispose() { // Ensure maintenance mode is OFF diff --git a/Octokit.Tests/Clients/IssueCommentReactionsClientTests.cs b/Octokit.Tests/Clients/IssueCommentReactionsClientTests.cs index ef8ec78f57..ed64332c64 100644 --- a/Octokit.Tests/Clients/IssueCommentReactionsClientTests.cs +++ b/Octokit.Tests/Clients/IssueCommentReactionsClientTests.cs @@ -70,7 +70,7 @@ public async Task RequestsCorrectUrlWithRepositoryIdApiOptions() StartPage = 1, PageSize = 1 }; - + await client.GetAll(1, 42, options); connection.Received().GetAll(Arg.Is(u => u.ToString() == "repositories/1/issues/comments/42/reactions"), null, "application/vnd.github.squirrel-girl-preview", options); diff --git a/Octokit.Tests/Clients/IssueCommentsClientTests.cs b/Octokit.Tests/Clients/IssueCommentsClientTests.cs index 34801f2e34..884b22f191 100644 --- a/Octokit.Tests/Clients/IssueCommentsClientTests.cs +++ b/Octokit.Tests/Clients/IssueCommentsClientTests.cs @@ -190,7 +190,7 @@ public async Task RequestsCorrectUrlWithIssueCommentRequest() { Since = new DateTimeOffset(2016, 11, 23, 11, 11, 11, 00, new TimeSpan()), }; - + await client.GetAllForIssue("fake", "repo", 3, request); connection.Received().GetAll( diff --git a/Octokit.Tests/Clients/IssueReactionsClientTests.cs b/Octokit.Tests/Clients/IssueReactionsClientTests.cs index 915d919928..cbe9e390f8 100644 --- a/Octokit.Tests/Clients/IssueReactionsClientTests.cs +++ b/Octokit.Tests/Clients/IssueReactionsClientTests.cs @@ -28,7 +28,7 @@ public async Task RequestsCorrectUrl() connection.Received().GetAll(Arg.Is(u => u.ToString() == "repos/fake/repo/issues/42/reactions"), null, "application/vnd.github.squirrel-girl-preview", Args.ApiOptions); } - + [Fact] public async Task RequestsCorrectUrlApiOptions() { @@ -70,7 +70,7 @@ public async Task RequestsCorrectUrlWithRepositoryIdApiOptions() StartPage = 1, PageSize = 1 }; - + await client.GetAll(1, 42, options); connection.Received().GetAll(Arg.Is(u => u.ToString() == "repositories/1/issues/42/reactions"), null, "application/vnd.github.squirrel-girl-preview", options); diff --git a/Octokit.Tests/Reactive/ObservableIssueCommentsClientTests.cs b/Octokit.Tests/Reactive/ObservableIssueCommentsClientTests.cs index f59c8bf0ca..d5057064e8 100644 --- a/Octokit.Tests/Reactive/ObservableIssueCommentsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableIssueCommentsClientTests.cs @@ -201,7 +201,7 @@ public void RequestsCorrectUrlWithIssueCommentRequest() client.GetAllForIssue("fake", "repo", 3, request); gitHubClient.Connection.Received(1).Get>( - new Uri("repos/fake/repo/issues/3/comments", UriKind.Relative), + new Uri("repos/fake/repo/issues/3/comments", UriKind.Relative), Arg.Is>(d => d.Count == 3 && d["since"] == "2016-11-23T11:11:11Z"), "application/vnd.github.squirrel-girl-preview"); @@ -243,7 +243,7 @@ public void RequestsCorrectUrlWithApiOptions() client.GetAllForIssue("fake", "repo", 3, options); gitHubClient.Connection.Received(1).Get>( - new Uri("repos/fake/repo/issues/3/comments", UriKind.Relative), + new Uri("repos/fake/repo/issues/3/comments", UriKind.Relative), Arg.Is>(d => d.Count == 4), "application/vnd.github.squirrel-girl-preview"); } diff --git a/Octokit.Tests/Reactive/ObservableIssueReactionsClientTests.cs b/Octokit.Tests/Reactive/ObservableIssueReactionsClientTests.cs index 9fa39c9108..5e38f877e6 100644 --- a/Octokit.Tests/Reactive/ObservableIssueReactionsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableIssueReactionsClientTests.cs @@ -80,7 +80,7 @@ public void EnsuresNonNullArguments() Assert.Throws(() => client.GetAll(null, "name", 1)); Assert.Throws(() => client.GetAll("owner", null, 1)); - Assert.Throws(() => client.GetAll("owner", "name", 1, null)); + Assert.Throws(() => client.GetAll("owner", "name", 1, null)); Assert.Throws(() => client.GetAll("", "name", 1)); Assert.Throws(() => client.GetAll("owner", "", 1)); diff --git a/Octokit/Clients/IssueCommentReactionsClient.cs b/Octokit/Clients/IssueCommentReactionsClient.cs index 21ef4b5e1a..b8c552959d 100644 --- a/Octokit/Clients/IssueCommentReactionsClient.cs +++ b/Octokit/Clients/IssueCommentReactionsClient.cs @@ -97,7 +97,7 @@ public Task> GetAll(long repositoryId, int number) public Task> GetAll(long repositoryId, int number, ApiOptions options) { Ensure.ArgumentNotNull(options, nameof(options)); - + return ApiConnection.GetAll(ApiUrls.IssueCommentReactions(repositoryId, number), null, AcceptHeaders.ReactionsPreview, options); } } diff --git a/Octokit/Clients/IssueCommentsClient.cs b/Octokit/Clients/IssueCommentsClient.cs index 8f582cd3c9..41fda35ab9 100644 --- a/Octokit/Clients/IssueCommentsClient.cs +++ b/Octokit/Clients/IssueCommentsClient.cs @@ -263,7 +263,7 @@ public Task> GetAllForIssue(string owner, string nam Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); Ensure.ArgumentNotNull(request, nameof(request)); Ensure.ArgumentNotNull(options, nameof(options)); - + return ApiConnection.GetAll(ApiUrls.IssueComments(owner, name, number), request.ToParametersDictionary(), AcceptHeaders.ReactionsPreview, options); } @@ -279,7 +279,7 @@ public Task> GetAllForIssue(long repositoryId, int n { Ensure.ArgumentNotNull(request, nameof(request)); Ensure.ArgumentNotNull(options, nameof(options)); - + return ApiConnection.GetAll(ApiUrls.IssueComments(repositoryId, number), request.ToParametersDictionary(), AcceptHeaders.ReactionsPreview, options); } diff --git a/Octokit/Clients/PullRequestReviewCommentReactionsClient.cs b/Octokit/Clients/PullRequestReviewCommentReactionsClient.cs index 695b5f0e52..5af9c2ba0b 100644 --- a/Octokit/Clients/PullRequestReviewCommentReactionsClient.cs +++ b/Octokit/Clients/PullRequestReviewCommentReactionsClient.cs @@ -66,7 +66,7 @@ public Task> GetAll(long repositoryId, int number) public Task> GetAll(long repositoryId, int number, ApiOptions options) { Ensure.ArgumentNotNull(options, nameof(options)); - + return ApiConnection.GetAll(ApiUrls.PullRequestReviewCommentReaction(repositoryId, number), null, AcceptHeaders.ReactionsPreview, options); } diff --git a/Octokit/Clients/PullRequestsClient.cs b/Octokit/Clients/PullRequestsClient.cs index 8a75157f32..91c2b5ab38 100644 --- a/Octokit/Clients/PullRequestsClient.cs +++ b/Octokit/Clients/PullRequestsClient.cs @@ -46,7 +46,7 @@ public Task Get(string owner, string name, int number) Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); - return ApiConnection.Get(ApiUrls.PullRequest(owner, name, number), null,AcceptHeaders.DraftPullRequestApiPreview); + return ApiConnection.Get(ApiUrls.PullRequest(owner, name, number), null, AcceptHeaders.DraftPullRequestApiPreview); } /// diff --git a/Octokit/Models/Request/NewPullRequest.cs b/Octokit/Models/Request/NewPullRequest.cs index d3e5de07bd..d2dd58218b 100644 --- a/Octokit/Models/Request/NewPullRequest.cs +++ b/Octokit/Models/Request/NewPullRequest.cs @@ -50,7 +50,7 @@ public NewPullRequest(string title, string head, string baseRef) /// Body of the pull request (optional) /// public string Body { get; set; } - + /// /// Whether the pull request is in a draft state or not (optional) /// diff --git a/Octokit/Models/Request/SearchRepositoriesRequest.cs b/Octokit/Models/Request/SearchRepositoriesRequest.cs index 760a2a621f..3e88ab8bb7 100644 --- a/Octokit/Models/Request/SearchRepositoriesRequest.cs +++ b/Octokit/Models/Request/SearchRepositoriesRequest.cs @@ -331,7 +331,7 @@ public DateRange(DateTime date, SearchQualifierOperator op) /// Matches repositories with regards to both the and dates. /// [Obsolete("This ctor does not support the time component or timezone and will be removed in a future release. Please use the DateTimeOffset overload instead")] - public DateRange(DateTime from, DateTime to) + public DateRange(DateTime from, DateTime to) { query = $"{from.ToString(DatePattern, CultureInfo.InvariantCulture)}..{to.ToString(DatePattern, CultureInfo.InvariantCulture)}"; } diff --git a/Octokit/Models/Response/Milestone.cs b/Octokit/Models/Response/Milestone.cs index 4f149a2dea..aa67e362f8 100644 --- a/Octokit/Models/Response/Milestone.cs +++ b/Octokit/Models/Response/Milestone.cs @@ -42,7 +42,7 @@ public Milestone(string url, string htmlUrl, long id, int number, string nodeId, /// The Html page for this milestone. /// public string HtmlUrl { get; protected set; } - + /// /// The ID for this milestone. /// diff --git a/Octokit/Models/Response/PullRequest.cs b/Octokit/Models/Response/PullRequest.cs index 05eaecb546..eeef21d45a 100644 --- a/Octokit/Models/Response/PullRequest.cs +++ b/Octokit/Models/Response/PullRequest.cs @@ -170,7 +170,7 @@ public PullRequest(long id, string nodeId, string url, string htmlUrl, string di /// Whether or not the pull request is in a draft state, and cannot be merged. /// public bool Draft { get; protected set; } - + /// /// Whether or not the pull request has been merged. /// diff --git a/build/Context.cs b/build/Context.cs index f0d93e199a..520d46aab2 100644 --- a/build/Context.cs +++ b/build/Context.cs @@ -29,6 +29,7 @@ public class Context : FrostingContext public Project[] Projects { get; set; } + public FilePath DotNetFormatToolPath { get; set; } public FilePath GitVersionToolPath { get; set; } public DotNetCoreTestSettings GetTestSettings() diff --git a/build/Lifetime.cs b/build/Lifetime.cs index 47029d71ac..ff1f19f88f 100644 --- a/build/Lifetime.cs +++ b/build/Lifetime.cs @@ -56,18 +56,7 @@ public override void Setup(Context context) new Project { Name = "Octokit.Tests.Integration", Path = "./Octokit.Tests.Integration/Octokit.Tests.Integration.csproj", IntegrationTests = true } }; - // Install tools - if (context.CoreOnly) - { - context.Information("Skipping tool installation for core-only build"); - } - else - { - context.Information("Installing tools..."); - ToolInstaller.Install(context, "Octokit.CodeFormatter", "1.0.0-preview"); - } - - + context.DotNetFormatToolPath = ToolInstaller.DotNetCoreToolInstall(context, "dotnet-format", "3.1.37601", "dotnet-format"); context.GitVersionToolPath = ToolInstaller.DotNetCoreToolInstall(context, "GitVersion.Tool", "5.0.0", "dotnet-gitversion"); // Calculate semantic version. diff --git a/build/Tasks/Build.cs b/build/Tasks/Build.cs index 99f4d8b750..af1df81e34 100644 --- a/build/Tasks/Build.cs +++ b/build/Tasks/Build.cs @@ -4,6 +4,7 @@ using Cake.Frosting; [Dependency(typeof(Restore))] +[Dependency(typeof(FormatCode))] public class Build : FrostingTask { public override void Run(Context context) diff --git a/build/Tasks/FormatCode.cs b/build/Tasks/FormatCode.cs index 84f7528e9f..2057b34369 100644 --- a/build/Tasks/FormatCode.cs +++ b/build/Tasks/FormatCode.cs @@ -1,76 +1,15 @@ -using System; -using System.IO; -using System.Linq; -using Cake.Common; -using Cake.Common.Diagnostics; -using Cake.Core; -using Cake.Core.IO; +using Cake.Common.Tools.DotNetCore; using Cake.Frosting; public sealed class FormatCode : FrostingTask { public override void Run(Context context) { - var codeFormatterExe = context.FileSystem - .GetDirectory("tools") - .GetFiles("CodeFormatter.exe", SearchScope.Recursive) - .First() - .Path - .MakeAbsolute(context.Environment); - - foreach (var project in context.Projects) - { - context.Information("Formatting code of {0}", project.Name); - - var tempCsprojFile = CreateTempCsproj(context, project.Name); - context.Information("Generated temporary {0} file to run the formatter", new FilePath(tempCsprojFile).GetFilename()); - - var exitCode = context.StartProcess( - codeFormatterExe, - $"{tempCsprojFile} /nocopyright /nounicode"); - - if (exitCode != 0) - { - throw new CakeException($"An error occured while formatting code of {project.Name}"); - } - } - - context.Information("Successfully formatted code of all the projects"); + context.DotNetCoreTool("format"); } public override bool ShouldRun(Context context) { - // Core only builds do not download the formatter exe - // Only windows is guaranteed to be able to run exe files in the first place - return context.IsRunningOnWindows() && !context.CoreOnly; - } - - private static string CreateTempCsproj(Context context, string projectName) - { - DirectoryPath tempFolder = System.IO.Path.GetTempPath(); - var projectCsproj = tempFolder.CombineWithFilePath($"{projectName}.csproj").FullPath; - - var files = context.FileSystem - .GetDirectory(projectName) - .GetFiles("*.cs", SearchScope.Recursive) - .Select(x => x.Path.MakeAbsolute(context.Environment)) - .ToArray(); - - var compileElements = files - .Select(x => $"") - .ToArray(); - - var csprojContent = -$@" - - - {string.Join(Environment.NewLine, compileElements)} - - -"; - - File.WriteAllText(projectCsproj, csprojContent); - - return projectCsproj; + return context.IsLocalBuild; } }