Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 391151c

Browse files
committed
Merge pull request #30 from github/haacked/code-cleanup
A bit of tidying up
2 parents e021c32 + dcff058 commit 391151c

File tree

20 files changed

+32
-44
lines changed

20 files changed

+32
-44
lines changed

src/CredentialManagement/CredentialSet.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public CredentialSet()
1818
public CredentialSet(string target)
1919
: this()
2020
{
21-
Guard.ArgumentNotEmptyString(target, "target");
21+
Guard.ArgumentNotEmptyString(target, nameof(target));
2222

2323
Target = target;
2424
}

src/GitHub.App/Api/ApiClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public ApiClient(HostAddress hostAddress, IObservableGitHubClient gitHubClient)
4646

4747
public IObservable<Repository> CreateRepository(NewRepository repository, string login, bool isUser)
4848
{
49-
Guard.ArgumentNotEmptyString(login, "login");
49+
Guard.ArgumentNotEmptyString(login, nameof(login));
5050

5151
var client = gitHubClient.Repository;
5252

src/GitHub.App/Caches/ImageCache.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ void Dispose(bool disposing)
239239
public void Dispose()
240240
{
241241
Dispose(true);
242-
GC.SuppressFinalize(this);
243242
}
244243

245244
class UriComparer : IEqualityComparer<Uri>

src/GitHub.App/Caches/LoginCache.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public IObservable<LoginInfo> GetLoginAsync(HostAddress hostAddress)
3737

3838
public IObservable<Unit> SaveLogin(string user, string password, HostAddress hostAddress)
3939
{
40-
Guard.ArgumentNotEmptyString(user, "user");
41-
Guard.ArgumentNotEmptyString(password, "password");
40+
Guard.ArgumentNotEmptyString(user, nameof(user));
41+
Guard.ArgumentNotEmptyString(password, nameof(password));
4242

4343
return cache.Secure.SaveLogin(user, password, hostAddress.CredentialCacheKeyHost);
4444
}
@@ -78,7 +78,6 @@ void Dispose(bool disposing)
7878
public void Dispose()
7979
{
8080
Dispose(true);
81-
GC.SuppressFinalize(this);
8281
}
8382
}
8483
}

src/GitHub.App/Factories/SqlitePersistentBlobCacheFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class SqlitePersistentBlobCacheFactory : IBlobCacheFactory
1414

1515
public IBlobCache CreateBlobCache(string path)
1616
{
17-
Guard.ArgumentNotEmptyString(path, "path");
17+
Guard.ArgumentNotEmptyString(path, nameof(path));
1818

1919
try
2020
{

src/GitHub.App/Models/RepositoryHost.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class RepositoryHost : ReactiveObject, IRepositoryHost
2828
readonly ILoginCache loginCache;
2929

3030
bool isLoggedIn;
31-
bool isEnterprise;
31+
readonly bool isEnterprise;
3232

3333
public RepositoryHost(
3434
IApiClient apiClient,
@@ -86,8 +86,8 @@ public IObservable<AuthenticationResult> LogInFromCache()
8686

8787
public IObservable<AuthenticationResult> LogIn(string usernameOrEmail, string password)
8888
{
89-
Guard.ArgumentNotEmptyString(usernameOrEmail, "usernameOrEmail");
90-
Guard.ArgumentNotEmptyString(password, "password");
89+
Guard.ArgumentNotEmptyString(usernameOrEmail, nameof(usernameOrEmail));
90+
Guard.ArgumentNotEmptyString(password, nameof(password));
9191

9292
// If we need to retry on fallback, we'll store the 2FA token
9393
// from the first request to re-use:

src/GitHub.App/SampleData/SampleViewModels.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,6 @@ public string Title
300300

301301
public void Dispose()
302302
{
303-
GC.SuppressFinalize(this);
304303
}
305304

306305
public IObservable<AuthenticationResult> LogIn(string usernameOrEmail, string password)

src/GitHub.App/Services/GitClient.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ public class GitClient : IGitClient
1313
{
1414
public IObservable<Unit> Push(IRepository repository, string branchName, string remoteName)
1515
{
16-
Guard.ArgumentNotEmptyString(branchName, "branchName");
17-
Guard.ArgumentNotEmptyString(remoteName, "remoteName");
16+
Guard.ArgumentNotEmptyString(branchName, nameof(branchName));
17+
Guard.ArgumentNotEmptyString(remoteName, nameof(remoteName));
1818

1919
return Observable.Defer(() =>
2020
{
@@ -32,7 +32,7 @@ public IObservable<Unit> Push(IRepository repository, string branchName, string
3232

3333
public IObservable<Unit> Fetch(IRepository repository, string remoteName)
3434
{
35-
Guard.ArgumentNotEmptyString(remoteName, "remoteName");
35+
Guard.ArgumentNotEmptyString(remoteName, nameof(remoteName));
3636

3737
return Observable.Defer(() =>
3838
{
@@ -44,7 +44,7 @@ public IObservable<Unit> Fetch(IRepository repository, string remoteName)
4444

4545
public IObservable<Unit> SetRemote(IRepository repository, string remoteName, Uri url)
4646
{
47-
Guard.ArgumentNotEmptyString(remoteName, "remoteName");
47+
Guard.ArgumentNotEmptyString(remoteName, nameof(remoteName));
4848

4949
return Observable.Defer(() =>
5050
{
@@ -57,8 +57,8 @@ public IObservable<Unit> SetRemote(IRepository repository, string remoteName, Ur
5757

5858
public IObservable<Unit> SetTrackingBranch(IRepository repository, string branchName, string remoteName)
5959
{
60-
Guard.ArgumentNotEmptyString(branchName, "branchName");
61-
Guard.ArgumentNotEmptyString(remoteName, "remoteName");
60+
Guard.ArgumentNotEmptyString(branchName, nameof(branchName));
61+
Guard.ArgumentNotEmptyString(remoteName, nameof(remoteName));
6262

6363
return Observable.Defer(() =>
6464
{

src/GitHub.App/Services/ModelService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ IObservable<IEnumerable<AccountCacheItem>> GetUserOrganizations()
110110
// This could in theory happen if we try to call this before the user is logged in.
111111
e =>
112112
{
113-
log.Error("Retrieve user organizations failed because user is not stored in the cache.", e);
113+
log.Error("Retrieve user organizations failed because user is not stored in the cache.", (Exception)e);
114114
return Observable.Return(Enumerable.Empty<AccountCacheItem>());
115115
})
116116
.Catch<IEnumerable<AccountCacheItem>, Exception>(e =>

src/GitHub.App/Services/RepositoryCloneService.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ public RepositoryCloneService(IOperatingSystem operatingSystem, IVSServices vsse
3535

3636
public IObservable<Unit> CloneRepository(string cloneUrl, string repositoryName, string repositoryPath)
3737
{
38-
Guard.ArgumentNotEmptyString(cloneUrl, "cloneUrl");
39-
Guard.ArgumentNotEmptyString(repositoryName, "repositoryName");
40-
Guard.ArgumentNotEmptyString(repositoryPath, "repositoryPath");
38+
Guard.ArgumentNotEmptyString(cloneUrl, nameof(cloneUrl));
39+
Guard.ArgumentNotEmptyString(repositoryName, nameof(repositoryName));
40+
Guard.ArgumentNotEmptyString(repositoryPath, nameof(repositoryPath));
4141

4242
return Observable.Start(() =>
4343
{
@@ -53,7 +53,7 @@ public IObservable<Unit> CloneRepository(string cloneUrl, string repositoryName,
5353
catch (Exception ex)
5454
{
5555
log.Error("Could not clone {0} to {1}. {2}", cloneUrl, path, ex);
56-
throw ex;
56+
throw;
5757
}
5858

5959
return Unit.Default;

0 commit comments

Comments
 (0)