diff --git a/Octokit.Reactive/IObservableGitHubClient.cs b/Octokit.Reactive/IObservableGitHubClient.cs index ddc42663..6f424072 100644 --- a/Octokit.Reactive/IObservableGitHubClient.cs +++ b/Octokit.Reactive/IObservableGitHubClient.cs @@ -19,7 +19,7 @@ namespace Octokit.Reactive IObservableReleasesClient Release { get; } IObservableSshKeysClient SshKey { get; } IObservableUsersClient User { get; } - [System.Obsolete("Notifications are now available under the Activities client. This will be removed in a future update.")] + [Obsolete("Notifications are now available under the Activities client. This will be removed in a future update.")] IObservableNotificationsClient Notification { get; } IObservableGitDatabaseClient Git { get; } [Obsolete("Use Git instead")] diff --git a/Octokit.Tests.Integration/Clients/BranchesClientTests.cs b/Octokit.Tests.Integration/Clients/BranchesClientTests.cs index bbc7cbe4..70217181 100644 --- a/Octokit.Tests.Integration/Clients/BranchesClientTests.cs +++ b/Octokit.Tests.Integration/Clients/BranchesClientTests.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading.Tasks; using Octokit; using Octokit.Tests.Integration; @@ -10,8 +9,6 @@ public class BranchesClientTests { public class TheGetBranchesMethod { - public TheGetBranchesMethod() { } - [IntegrationTest] public async Task ReturnsBranches() { diff --git a/Octokit.Tests.Integration/Clients/CommitsClientTests.cs b/Octokit.Tests.Integration/Clients/CommitsClientTests.cs index fa493b85..aa46429f 100644 --- a/Octokit.Tests.Integration/Clients/CommitsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/CommitsClientTests.cs @@ -1,5 +1,4 @@ -using System; -using System.Threading.Tasks; +using System.Threading.Tasks; using Octokit; using Octokit.Tests.Integration.Helpers; using Octokit.Tests.Integration; @@ -7,8 +6,6 @@ using Xunit; public class CommitsClientTests { - public CommitsClientTests() { } - [IntegrationTest] public async Task CanCreateAndRetrieveCommit() { diff --git a/Octokit.Tests.Integration/Clients/IssuesClientTests.cs b/Octokit.Tests.Integration/Clients/IssuesClientTests.cs index 73284093..bad72f76 100644 --- a/Octokit.Tests.Integration/Clients/IssuesClientTests.cs +++ b/Octokit.Tests.Integration/Clients/IssuesClientTests.cs @@ -4,7 +4,6 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using Octokit; -using Octokit.Tests.Helpers; using Octokit.Tests.Integration; using Xunit; using Octokit.Tests.Integration.Helpers; @@ -348,7 +347,7 @@ public class IssuesClientTests : IDisposable [IntegrationTest] public async Task CanAccessUrls() { - var expctedUri = "https://api.github.com/repos/{0}/{1}/issues/{2}/{3}"; + var expectedUri = "https://api.github.com/repos/{0}/{1}/issues/{2}/{3}"; var newIssue = new NewIssue("A test issue") { @@ -358,9 +357,9 @@ public class IssuesClientTests : IDisposable var issue = await _issuesClient.Create(_context.RepositoryOwner, _context.RepositoryName, newIssue); Assert.NotNull(issue.CommentsUrl); - Assert.Equal(new Uri(string.Format(expctedUri, _context.RepositoryOwner, _context.RepositoryName, issue.Number, "comments")), issue.CommentsUrl); + Assert.Equal(new Uri(string.Format(expectedUri, _context.RepositoryOwner, _context.RepositoryName, issue.Number, "comments")), issue.CommentsUrl); Assert.NotNull(issue.EventsUrl); - Assert.Equal(new Uri(string.Format(expctedUri, _context.RepositoryOwner, _context.RepositoryName, issue.Number, "events")), issue.EventsUrl); + Assert.Equal(new Uri(string.Format(expectedUri, _context.RepositoryOwner, _context.RepositoryName, issue.Number, "events")), issue.EventsUrl); } public void Dispose() diff --git a/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs b/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs index 301dbce2..d0cb22b9 100644 --- a/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs +++ b/Octokit.Tests.Integration/Clients/OrganizationMembersClientTests.cs @@ -1,10 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; +using System.Linq; using System.Threading.Tasks; -using Octokit; -using Octokit.Tests.Integration; -using Octokit.Tests.Integration.Helpers; using Xunit; namespace Octokit.Tests.Integration.Clients @@ -47,7 +42,7 @@ namespace Octokit.Tests.Integration.Clients // There shouldnt be any members that are in both groups if the role filter works correctly var membersInBoth = adminMembers.Select(a => a.Id).Intersect(normalMembers.Select(n => n.Id)); - Assert.True(membersInBoth.Count() == 0); + Assert.Empty(membersInBoth); } [IntegrationTest(Skip = "TwoFactor filter can't be used unless the requester is an organization owner")] diff --git a/Octokit.Tests/Authentication/CredentialsTests.cs b/Octokit.Tests/Authentication/CredentialsTests.cs index 2890fbbf..c4b8855c 100644 --- a/Octokit.Tests/Authentication/CredentialsTests.cs +++ b/Octokit.Tests/Authentication/CredentialsTests.cs @@ -1,5 +1,4 @@ using System; -using Octokit.Internal; using Xunit; namespace Octokit.Tests.Authentication @@ -23,7 +22,7 @@ namespace Octokit.Tests.Authentication } [Fact] - public void ReturnsOuthWhenProvidedToken() + public void ReturnsOAuthWhenProvidedToken() { var credentials = new Credentials("token"); Assert.Equal(AuthenticationType.Oauth, credentials.AuthenticationType); diff --git a/Octokit.Tests/Clients/MiscellaneousClientTests.cs b/Octokit.Tests/Clients/MiscellaneousClientTests.cs index 1d73f720..7b9a0f2b 100644 --- a/Octokit.Tests/Clients/MiscellaneousClientTests.cs +++ b/Octokit.Tests/Clients/MiscellaneousClientTests.cs @@ -31,7 +31,7 @@ namespace Octokit.Tests.Clients "text/plain"); } } - public class TheRenderArbitrryMarkdownMethod + public class TheRenderArbitraryMarkdownMethod { [Fact] public async Task RequestsTheEmojiEndpoint() diff --git a/Octokit.Tests/Clients/RepositoryContentsClientTests.cs b/Octokit.Tests/Clients/RepositoryContentsClientTests.cs index 5dea73d8..2f700c3b 100644 --- a/Octokit.Tests/Clients/RepositoryContentsClientTests.cs +++ b/Octokit.Tests/Clients/RepositoryContentsClientTests.cs @@ -2,7 +2,6 @@ using System.Text; using System.Threading.Tasks; using NSubstitute; -using Octokit.Tests.Helpers; using Xunit; using System.Collections.Generic; @@ -61,7 +60,7 @@ namespace Octokit.Tests.Clients [Fact] public async Task ReturnsContentsByRef() { - List result = new List() { new RepositoryContent() { } }; + List result = new List { new RepositoryContent() }; var connection = Substitute.For(); connection.GetAll(Args.Uri).Returns(Task.FromResult(result.AsReadOnly() as IReadOnlyList)); @@ -77,7 +76,7 @@ namespace Octokit.Tests.Clients [Fact] public async Task ReturnsContents() { - List result = new List() { new RepositoryContent() { } }; + List result = new List { new RepositoryContent() }; var connection = Substitute.For(); connection.GetAll(Args.Uri).Returns(Task.FromResult(result.AsReadOnly() as IReadOnlyList)); diff --git a/Octokit.Tests/Clients/StarredClientTests.cs b/Octokit.Tests/Clients/StarredClientTests.cs index e8ee43f9..97add0e4 100644 --- a/Octokit.Tests/Clients/StarredClientTests.cs +++ b/Octokit.Tests/Clients/StarredClientTests.cs @@ -5,7 +5,6 @@ using System.Net; using System.Threading.Tasks; using NSubstitute; using Xunit; -using Xunit.Extensions; namespace Octokit.Tests.Clients { @@ -111,7 +110,7 @@ namespace Octokit.Tests.Clients [InlineData(HttpStatusCode.OK, false)] public async Task ReturnsCorrectResultBasedOnStatus(HttpStatusCode status, bool expected) { - var response = Task.Factory.StartNew(() => status); + var response = Task.Factory.StartNew(() => status); var connection = Substitute.For(); connection.Delete(Arg.Is(u => u.ToString() == "user/starred/yes/no")) diff --git a/Octokit.Tests/Clients/UserAdministrationClientTests.cs b/Octokit.Tests/Clients/UserAdministrationClientTests.cs index 4712b24b..5e700df3 100644 --- a/Octokit.Tests/Clients/UserAdministrationClientTests.cs +++ b/Octokit.Tests/Clients/UserAdministrationClientTests.cs @@ -1,9 +1,7 @@ using System; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using NSubstitute; -using Octokit.Tests.Helpers; using Xunit; namespace Octokit.Tests.Clients @@ -141,7 +139,7 @@ namespace Octokit.Tests.Clients connection.Received().Post( Arg.Any(), Arg.Is(a => - a.Scopes.Count() == scopes.Count() && + a.Scopes.Count() == scopes.Length && a.Scopes.ToList().All(s => scopes.Contains(s)) && scopes.ToList().All(s => a.Scopes.Contains(s)))); } diff --git a/Octokit.Tests/Exceptions/ForbiddenExceptionTests.cs b/Octokit.Tests/Exceptions/ForbiddenExceptionTests.cs index bfc3773b..909cbd9a 100644 --- a/Octokit.Tests/Exceptions/ForbiddenExceptionTests.cs +++ b/Octokit.Tests/Exceptions/ForbiddenExceptionTests.cs @@ -10,7 +10,7 @@ namespace Octokit.Tests.Exceptions public class TheConstructor { [Fact] - public void IdentifiesMaxLoginAttepmtsExceededReason() + public void IdentifiesMaxLoginAttemptsExceededReason() { const string responseBody = "{\"message\":\"YOU SHALL NOT PASS!\"," + "\"documentation_url\":\"http://developer.github.com/v3\"}"; diff --git a/Octokit.Tests/Http/RedirectHandlerTests.cs b/Octokit.Tests/Http/RedirectHandlerTests.cs index 845067e2..14e46e96 100644 --- a/Octokit.Tests/Http/RedirectHandlerTests.cs +++ b/Octokit.Tests/Http/RedirectHandlerTests.cs @@ -1,10 +1,7 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Net; using System.Net.Http; using System.Net.Http.Headers; -using System.Text; using System.Threading; using System.Threading.Tasks; using Octokit.Internal; @@ -181,7 +178,7 @@ namespace Octokit.Tests.Http { readonly HttpResponseMessage _response1; readonly HttpResponseMessage _response2; - private bool _Response1Sent = false; + private bool _Response1Sent; public MockRedirectHandler(HttpResponseMessage response1, HttpResponseMessage response2 = null) { diff --git a/Octokit.Tests/Reactive/AuthorizationExtensionsTests.cs b/Octokit.Tests/Reactive/AuthorizationExtensionsTests.cs index 4812828b..77871409 100644 --- a/Octokit.Tests/Reactive/AuthorizationExtensionsTests.cs +++ b/Octokit.Tests/Reactive/AuthorizationExtensionsTests.cs @@ -12,7 +12,7 @@ namespace Octokit.Tests.Reactive public class TheGetOrCreateApplicationAuthenticationMethod { [Fact] - public async Task UsesCallbackToRetrievTwoFactorCode() + public async Task UsesCallbackToRetrieveTwoFactorCode() { var firstResponse = new TwoFactorRequiredException(TwoFactorType.AuthenticatorApp); var twoFactorChallengeResult = new TwoFactorChallengeResult("two-factor-code"); diff --git a/Octokit.Tests/Reactive/Enterprise/ObservableEnterpriseSearchIndexingClientTests.cs b/Octokit.Tests/Reactive/Enterprise/ObservableEnterpriseSearchIndexingClientTests.cs index e185081f..02f29b0c 100644 --- a/Octokit.Tests/Reactive/Enterprise/ObservableEnterpriseSearchIndexingClientTests.cs +++ b/Octokit.Tests/Reactive/Enterprise/ObservableEnterpriseSearchIndexingClientTests.cs @@ -1,5 +1,4 @@ -using System; -using NSubstitute; +using NSubstitute; using Octokit.Reactive; using Xunit; @@ -17,12 +16,12 @@ namespace Octokit.Tests client.Queue("org"); github.Enterprise.SearchIndexing.Received(1). - Queue(Arg.Is("org")); + Queue(Arg.Is("org")); client.Queue("org", "repo"); github.Enterprise.SearchIndexing.Received(1). - Queue(Arg.Is("org"), - Arg.Is("repo")); + Queue(Arg.Is("org"), + Arg.Is("repo")); } } @@ -36,7 +35,7 @@ namespace Octokit.Tests client.QueueAll("org"); github.Enterprise.SearchIndexing.Received(1). - QueueAll(Arg.Is("org")); + QueueAll(Arg.Is("org")); } } @@ -50,12 +49,12 @@ namespace Octokit.Tests client.QueueAllCode("org"); github.Enterprise.SearchIndexing.Received(1). - QueueAllCode(Arg.Is("org")); + QueueAllCode(Arg.Is("org")); client.QueueAllCode("org", "repo"); github.Enterprise.SearchIndexing.Received(1). - QueueAllCode(Arg.Is("org"), - Arg.Is("repo")); + QueueAllCode(Arg.Is("org"), + Arg.Is("repo")); } } @@ -69,12 +68,12 @@ namespace Octokit.Tests client.QueueAllIssues("org"); github.Enterprise.SearchIndexing.Received(1). - QueueAllIssues(Arg.Is("org")); + QueueAllIssues(Arg.Is("org")); client.QueueAllIssues("org", "repo"); github.Enterprise.SearchIndexing.Received(1). - QueueAllIssues(Arg.Is("org"), - Arg.Is("repo")); + QueueAllIssues(Arg.Is("org"), + Arg.Is("repo")); } } } diff --git a/Octokit.Tests/Reactive/ObservableCommitsClientTests.cs b/Octokit.Tests/Reactive/ObservableCommitsClientTests.cs index 335918c8..a662a70a 100644 --- a/Octokit.Tests/Reactive/ObservableCommitsClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableCommitsClientTests.cs @@ -1,11 +1,8 @@ using System; -using System.Collections.Generic; -using System.Reactive.Linq; using System.Reactive.Threading.Tasks; using System.Threading.Tasks; using NSubstitute; using Octokit.Reactive; -using Octokit.Tests.Helpers; using Xunit; namespace Octokit.Tests.Reactive @@ -15,7 +12,7 @@ namespace Octokit.Tests.Reactive public class TheCtorMethod { [Fact] - public void EnsuresArgumentIsNotNulll() + public void EnsuresArgumentIsNotNull() { Assert.Throws(() => new ObservableCommitsClient(null)); } diff --git a/Octokit.Tests/Reactive/ObservableUserAdministrationClientTests.cs b/Octokit.Tests/Reactive/ObservableUserAdministrationClientTests.cs index 682a09b6..d6a1fab9 100644 --- a/Octokit.Tests/Reactive/ObservableUserAdministrationClientTests.cs +++ b/Octokit.Tests/Reactive/ObservableUserAdministrationClientTests.cs @@ -50,7 +50,7 @@ namespace Octokit.Tests.Reactive var gitHubClient = Substitute.For(); var client = new ObservableUserAdministrationClient(gitHubClient); - client.CreateImpersonationToken("auser", new NewImpersonationToken(new string[] { "public_repo" })); + client.CreateImpersonationToken("auser", new NewImpersonationToken(new[] { "public_repo" })); gitHubClient.User.Administration.Received().CreateImpersonationToken( "auser", diff --git a/Octokit/Clients/IRepositoriesClient.cs b/Octokit/Clients/IRepositoriesClient.cs index b5db4ad6..098e03d0 100644 --- a/Octokit/Clients/IRepositoriesClient.cs +++ b/Octokit/Clients/IRepositoriesClient.cs @@ -29,7 +29,7 @@ namespace Octokit /// /// See the Repository Comments API documentation for more information. /// - [System.Obsolete("Comment information is now available under the Comment property. This will be removed in a future update.")] + [Obsolete("Comment information is now available under the Comment property. This will be removed in a future update.")] IRepositoryCommentsClient RepositoryComments { get; } /// @@ -226,7 +226,7 @@ namespace Octokit /// /// See the Collaborators API documentation for more details /// - [System.Obsolete("Collaborator information is now available under the Collaborator property. This will be removed in a future update.")] + [Obsolete("Collaborator information is now available under the Collaborator property. This will be removed in a future update.")] IRepoCollaboratorsClient RepoCollaborators { get; } /// @@ -259,7 +259,7 @@ namespace Octokit /// /// See the Commits API documentation for more details /// - [System.Obsolete("Commit information is now available under the Commit property. This will be removed in a future update.")] + [Obsolete("Commit information is now available under the Commit property. This will be removed in a future update.")] IRepositoryCommitsClient Commits { get; } /// diff --git a/Octokit/Clients/RepositoriesClient.cs b/Octokit/Clients/RepositoriesClient.cs index 590637d0..9f14ac78 100644 --- a/Octokit/Clients/RepositoriesClient.cs +++ b/Octokit/Clients/RepositoriesClient.cs @@ -348,7 +348,7 @@ namespace Octokit /// /// See the Collaborators API documentation for more details /// - [System.Obsolete("Collaborator information is now available under the Collaborator property. This will be removed in a future update.")] + [Obsolete("Collaborator information is now available under the Collaborator property. This will be removed in a future update.")] public IRepoCollaboratorsClient RepoCollaborators { get; private set; } /// diff --git a/Octokit/IGitHubClient.cs b/Octokit/IGitHubClient.cs index d39eeb03..29dd910c 100644 --- a/Octokit/IGitHubClient.cs +++ b/Octokit/IGitHubClient.cs @@ -119,7 +119,7 @@ namespace Octokit /// /// Refer to the API documentation for more information: https://developer.github.com/v3/activity/notifications/ /// - [System.Obsolete("Notifications are now available under the Activities client. This will be removed in a future update.")] + [Obsolete("Notifications are now available under the Activities client. This will be removed in a future update.")] INotificationsClient Notification { get; } /// diff --git a/Octokit/Models/Request/SearchIssuesRequest.cs b/Octokit/Models/Request/SearchIssuesRequest.cs index 77057c2f..68699d77 100644 --- a/Octokit/Models/Request/SearchIssuesRequest.cs +++ b/Octokit/Models/Request/SearchIssuesRequest.cs @@ -203,7 +203,7 @@ namespace Octokit [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")] public RepositoryCollection Repos { get; set; } - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] + [SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] public override IReadOnlyList MergedQualifiers() { var parameters = new List(); diff --git a/Octokit/Models/Response/CodeFrequency.cs b/Octokit/Models/Response/CodeFrequency.cs index b72361b6..bd8572c5 100644 --- a/Octokit/Models/Response/CodeFrequency.cs +++ b/Octokit/Models/Response/CodeFrequency.cs @@ -42,7 +42,7 @@ namespace Octokit get { return string.Format(CultureInfo.InvariantCulture, - "Number of weeks: {0}", AdditionsAndDeletionsByWeek.Count()); + "Number of weeks: {0}", AdditionsAndDeletionsByWeek.Count); } } } diff --git a/Octokit/Models/Response/CommitActivity.cs b/Octokit/Models/Response/CommitActivity.cs index aafef951..0916bcb9 100644 --- a/Octokit/Models/Response/CommitActivity.cs +++ b/Octokit/Models/Response/CommitActivity.cs @@ -1,4 +1,3 @@ -using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; @@ -29,7 +28,7 @@ namespace Octokit get { return string.Format(CultureInfo.InvariantCulture, - "Weeks of activity: {0}", Activity.Count()); + "Weeks of activity: {0}", Activity.Count); } } }