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

Prefer using nameof(x) over literal "x" #1781

Merged
merged 2 commits into from
Mar 7, 2018
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
Expand Up @@ -15,7 +15,7 @@ public class ObservableEnterpriseAdminStatsClient : IObservableEnterpriseAdminSt

public ObservableEnterpriseAdminStatsClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
Ensure.ArgumentNotNull(client, nameof(client));

_client = client.Enterprise.AdminStats;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class ObservableEnterpriseClient : IObservableEnterpriseClient
{
public ObservableEnterpriseClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
Ensure.ArgumentNotNull(client, nameof(client));

AdminStats = new ObservableEnterpriseAdminStatsClient(client);
Ldap = new ObservableEnterpriseLdapClient(client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class ObservableEnterpriseLdapClient : IObservableEnterpriseLdapClient

public ObservableEnterpriseLdapClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
Ensure.ArgumentNotNull(client, nameof(client));

_client = client.Enterprise.Ldap;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class ObservableEnterpriseLicenseClient : IObservableEnterpriseLicenseCli

public ObservableEnterpriseLicenseClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
Ensure.ArgumentNotNull(client, nameof(client));

_client = client.Enterprise.License;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class ObservableEnterpriseOrganizationClient : IObservableEnterpriseOrgan

public ObservableEnterpriseOrganizationClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
Ensure.ArgumentNotNull(client, nameof(client));

_client = client.Enterprise.Organization;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class ObservableEnterpriseSearchIndexingClient : IObservableEnterpriseSea

public ObservableEnterpriseSearchIndexingClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
Ensure.ArgumentNotNull(client, nameof(client));

_client = client.Enterprise.SearchIndexing;
}
Expand Down
2 changes: 1 addition & 1 deletion Octokit.Reactive/Clients/ObservableActivitiesClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public class ObservableActivitiesClient : IObservableActivitiesClient
{
public ObservableActivitiesClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
Ensure.ArgumentNotNull(client, nameof(client));

Events = new ObservableEventsClient(client);
Watching = new ObservableWatchedClient(client);
Expand Down
34 changes: 17 additions & 17 deletions Octokit.Reactive/Clients/ObservableAssigneesClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class ObservableAssigneesClient : IObservableAssigneesClient

public ObservableAssigneesClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
Ensure.ArgumentNotNull(client, nameof(client));

_client = client.Issue.Assignee;
_connection = client.Connection;
Expand All @@ -30,8 +30,8 @@ public ObservableAssigneesClient(IGitHubClient client)
/// <param name="name">The name of the repository</param>
public IObservable<User> GetAllForRepository(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));

return GetAllForRepository(owner, name, ApiOptions.None);
}
Expand All @@ -53,9 +53,9 @@ public IObservable<User> GetAllForRepository(long repositoryId)
/// <param name="options">The options to change API's behaviour.</param>
public IObservable<User> GetAllForRepository(string owner, string name, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(options, "options");
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(options, nameof(options));

return _connection.GetAndFlattenAllPages<User>(ApiUrls.Assignees(owner, name), options);
}
Expand All @@ -67,7 +67,7 @@ public IObservable<User> GetAllForRepository(string owner, string name, ApiOptio
/// <param name="options">The options to change API's behaviour.</param>
public IObservable<User> GetAllForRepository(long repositoryId, ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");
Ensure.ArgumentNotNull(options, nameof(options));

return _connection.GetAndFlattenAllPages<User>(ApiUrls.Assignees(repositoryId), options);
}
Expand All @@ -80,9 +80,9 @@ public IObservable<User> GetAllForRepository(long repositoryId, ApiOptions optio
/// <param name="assignee">Username of the prospective assignee</param>
public IObservable<bool> CheckAssignee(string owner, string name, string assignee)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNullOrEmptyString(assignee, "assignee");
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(assignee, nameof(assignee));

return _client.CheckAssignee(owner, name, assignee).ToObservable();
}
Expand All @@ -96,9 +96,9 @@ public IObservable<bool> CheckAssignee(string owner, string name, string assigne
/// <param name="assignees">List of names of assignees to add</param>
public IObservable<Issue> AddAssignees(string owner, string name, int number, AssigneesUpdate assignees)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(assignees, "assignees");
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(assignees, nameof(assignees));

return _client.AddAssignees(owner, name, number, assignees).ToObservable();
}
Expand All @@ -113,9 +113,9 @@ public IObservable<Issue> AddAssignees(string owner, string name, int number, As
/// <returns></returns>
public IObservable<Issue> RemoveAssignees(string owner, string name, int number, AssigneesUpdate assignees)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(assignees, "assignees");
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(assignees, nameof(assignees));

return _client.RemoveAssignees(owner, name, number, assignees).ToObservable();
}
Expand All @@ -127,7 +127,7 @@ public IObservable<Issue> RemoveAssignees(string owner, string name, int number,
/// <param name="assignee">Username of the prospective assignee</param>
public IObservable<bool> CheckAssignee(long repositoryId, string assignee)
{
Ensure.ArgumentNotNullOrEmptyString(assignee, "assignee");
Ensure.ArgumentNotNullOrEmptyString(assignee, nameof(assignee));

return _client.CheckAssignee(repositoryId, assignee).ToObservable();
}
Expand Down
40 changes: 20 additions & 20 deletions Octokit.Reactive/Clients/ObservableAuthorizationsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ObservableAuthorizationsClient : IObservableAuthorizationsClient

public ObservableAuthorizationsClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
Ensure.ArgumentNotNull(client, nameof(client));

_client = client.Authorization;
_connection = client.Connection;
Expand Down Expand Up @@ -42,7 +42,7 @@ public IObservable<Authorization> GetAll()
/// <returns>A list of <see cref="Authorization"/>s for the authenticated user.</returns>
public IObservable<Authorization> GetAll(ApiOptions options)
{
Ensure.ArgumentNotNull(options, "options");
Ensure.ArgumentNotNull(options, nameof(options));

return _connection.GetAndFlattenAllPages<Authorization>(ApiUrls.Authorizations(), options);
}
Expand Down Expand Up @@ -79,7 +79,7 @@ public IObservable<Authorization> Get(int id)
/// <returns>The created <see cref="Authorization"/>.</returns>
public IObservable<ApplicationAuthorization> Create(NewAuthorization newAuthorization)
{
Ensure.ArgumentNotNull(newAuthorization, "newAuthorization");
Ensure.ArgumentNotNull(newAuthorization, nameof(newAuthorization));

return _client.Create(newAuthorization).ToObservable();
}
Expand All @@ -105,8 +105,8 @@ public IObservable<ApplicationAuthorization> Create(
NewAuthorization newAuthorization,
string twoFactorAuthenticationCode)
{
Ensure.ArgumentNotNull(newAuthorization, "newAuthorization");
Ensure.ArgumentNotNullOrEmptyString(twoFactorAuthenticationCode, "twoFactorAuthenticationCode");
Ensure.ArgumentNotNull(newAuthorization, nameof(newAuthorization));
Ensure.ArgumentNotNullOrEmptyString(twoFactorAuthenticationCode, nameof(twoFactorAuthenticationCode));

return _client.Create(newAuthorization, twoFactorAuthenticationCode).ToObservable();
}
Expand Down Expand Up @@ -135,9 +135,9 @@ public IObservable<ApplicationAuthorization> Create(
string clientSecret,
NewAuthorization newAuthorization)
{
Ensure.ArgumentNotNullOrEmptyString(clientId, "clientId");
Ensure.ArgumentNotNullOrEmptyString(clientSecret, "clientSecret");
Ensure.ArgumentNotNull(newAuthorization, "newAuthorization");
Ensure.ArgumentNotNullOrEmptyString(clientId, nameof(clientId));
Ensure.ArgumentNotNullOrEmptyString(clientSecret, nameof(clientSecret));
Ensure.ArgumentNotNull(newAuthorization, nameof(newAuthorization));

return _client.Create(clientId, clientSecret, newAuthorization).ToObservable();
}
Expand Down Expand Up @@ -168,10 +168,10 @@ public IObservable<ApplicationAuthorization> Create(
NewAuthorization newAuthorization,
string twoFactorAuthenticationCode)
{
Ensure.ArgumentNotNullOrEmptyString(clientId, "clientId");
Ensure.ArgumentNotNullOrEmptyString(clientSecret, "clientSecret");
Ensure.ArgumentNotNull(newAuthorization, "newAuthorization");
Ensure.ArgumentNotNullOrEmptyString(twoFactorAuthenticationCode, "twoFactorAuthenticationCode");
Ensure.ArgumentNotNullOrEmptyString(clientId, nameof(clientId));
Ensure.ArgumentNotNullOrEmptyString(clientSecret, nameof(clientSecret));
Ensure.ArgumentNotNull(newAuthorization, nameof(newAuthorization));
Ensure.ArgumentNotNullOrEmptyString(twoFactorAuthenticationCode, nameof(twoFactorAuthenticationCode));

return _client.Create(clientId, clientSecret, newAuthorization, twoFactorAuthenticationCode).ToObservable();
}
Expand All @@ -198,9 +198,9 @@ public IObservable<ApplicationAuthorization> GetOrCreateApplicationAuthenticatio
string clientSecret,
NewAuthorization newAuthorization)
{
Ensure.ArgumentNotNullOrEmptyString(clientId, "clientId");
Ensure.ArgumentNotNullOrEmptyString(clientSecret, "clientSecret");
Ensure.ArgumentNotNull(newAuthorization, "newAuthorization");
Ensure.ArgumentNotNullOrEmptyString(clientId, nameof(clientId));
Ensure.ArgumentNotNullOrEmptyString(clientSecret, nameof(clientSecret));
Ensure.ArgumentNotNull(newAuthorization, nameof(newAuthorization));

return _client.GetOrCreateApplicationAuthentication(clientId, clientSecret, newAuthorization)
.ToObservable();
Expand Down Expand Up @@ -230,10 +230,10 @@ public IObservable<ApplicationAuthorization> GetOrCreateApplicationAuthenticatio
NewAuthorization newAuthorization,
string twoFactorAuthenticationCode)
{
Ensure.ArgumentNotNullOrEmptyString(clientId, "clientId");
Ensure.ArgumentNotNullOrEmptyString(clientSecret, "clientSecret");
Ensure.ArgumentNotNull(newAuthorization, "newAuthorization");
Ensure.ArgumentNotNullOrEmptyString(twoFactorAuthenticationCode, "twoFactorAuthenticationCode");
Ensure.ArgumentNotNullOrEmptyString(clientId, nameof(clientId));
Ensure.ArgumentNotNullOrEmptyString(clientSecret, nameof(clientSecret));
Ensure.ArgumentNotNull(newAuthorization, nameof(newAuthorization));
Ensure.ArgumentNotNullOrEmptyString(twoFactorAuthenticationCode, nameof(twoFactorAuthenticationCode));

return _client.GetOrCreateApplicationAuthentication(
clientId,
Expand Down Expand Up @@ -309,7 +309,7 @@ public IObservable<Unit> RevokeApplicationAuthentication(string clientId, string
/// <returns></returns>
public IObservable<Authorization> Update(int id, AuthorizationUpdate authorizationUpdate)
{
Ensure.ArgumentNotNull(authorizationUpdate, "authorizationUpdate");
Ensure.ArgumentNotNull(authorizationUpdate, nameof(authorizationUpdate));

return _client.Update(id, authorizationUpdate).ToObservable();
}
Expand Down
18 changes: 9 additions & 9 deletions Octokit.Reactive/Clients/ObservableBlobClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class ObservableBlobClient : IObservableBlobsClient

public ObservableBlobClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
Ensure.ArgumentNotNull(client, nameof(client));

_client = client.Git.Blob;
}
Expand All @@ -31,9 +31,9 @@ public ObservableBlobClient(IGitHubClient client)
/// <param name="reference">The SHA of the blob</param>
public IObservable<Blob> Get(string owner, string name, string reference)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNullOrEmptyString(reference, nameof(reference));

return _client.Get(owner, name, reference).ToObservable();
}
Expand All @@ -48,7 +48,7 @@ public IObservable<Blob> Get(string owner, string name, string reference)
/// <param name="reference">The SHA of the blob</param>
public IObservable<Blob> Get(long repositoryId, string reference)
{
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
Ensure.ArgumentNotNullOrEmptyString(reference, nameof(reference));

return _client.Get(repositoryId, reference).ToObservable();
}
Expand All @@ -64,9 +64,9 @@ public IObservable<Blob> Get(long repositoryId, string reference)
/// <param name="newBlob">The new Blob</param>
public IObservable<BlobReference> Create(string owner, string name, NewBlob newBlob)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(newBlob, "newBlob");
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(newBlob, nameof(newBlob));

return _client.Create(owner, name, newBlob).ToObservable();
}
Expand All @@ -81,7 +81,7 @@ public IObservable<BlobReference> Create(string owner, string name, NewBlob newB
/// <param name="newBlob">The new Blob</param>
public IObservable<BlobReference> Create(long repositoryId, NewBlob newBlob)
{
Ensure.ArgumentNotNull(newBlob, "newBlob");
Ensure.ArgumentNotNull(newBlob, nameof(newBlob));

return _client.Create(repositoryId, newBlob).ToObservable();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class ObservableCommitCommentReactionsClient : IObservableCommitCommentRe

public ObservableCommitCommentReactionsClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, "client");
Ensure.ArgumentNotNull(client, nameof(client));

_client = client.Reaction.CommitComment;
_connection = client.Connection;
Expand All @@ -34,9 +34,9 @@ public ObservableCommitCommentReactionsClient(IGitHubClient client)
/// <returns></returns>
public IObservable<Reaction> Create(string owner, string name, int number, NewReaction reaction)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNull(reaction, "reaction");
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(reaction, nameof(reaction));

return _client.Create(owner, name, number, reaction).ToObservable();
}
Expand All @@ -51,7 +51,7 @@ public IObservable<Reaction> Create(string owner, string name, int number, NewRe
/// <returns></returns>
public IObservable<Reaction> Create(long repositoryId, int number, NewReaction reaction)
{
Ensure.ArgumentNotNull(reaction, "reaction");
Ensure.ArgumentNotNull(reaction, nameof(reaction));

return _client.Create(repositoryId, number, reaction).ToObservable();
}
Expand All @@ -66,8 +66,8 @@ public IObservable<Reaction> Create(long repositoryId, int number, NewReaction r
/// <returns></returns>
public IObservable<Reaction> GetAll(string owner, string name, int number)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));

return _connection.GetAndFlattenAllPages<Reaction>(ApiUrls.CommitCommentReactions(owner, name, number), null, AcceptHeaders.ReactionsPreview);
}
Expand Down
Loading