Merge pull request #1005 from octokit/code-cleanup

Code cleanup
This commit is contained in:
Brendan Forster
2015-12-15 06:57:43 +10:30
7 changed files with 15 additions and 32 deletions
@@ -22,7 +22,6 @@ namespace Octokit
/// Constructs an instance of ApiValidationException
/// </summary>
public InvalidGitIgnoreTemplateException()
: base()
{ }
/// <summary>
+4 -20
View File
@@ -16,34 +16,18 @@ namespace Octokit
public static IList<string> Clone(this IReadOnlyList<string> input)
{
List<string> output = null;
if (input == null)
return output;
return null;
output = new List<string>();
foreach (var item in input)
{
output.Add(new String(item.ToCharArray()));
}
return output;
return input.Select(item => new String(item.ToCharArray())).ToList();
}
public static IDictionary<string, Uri> Clone(this IReadOnlyDictionary<string, Uri> input)
{
Dictionary<string, Uri> output = null;
if (input == null)
return output;
return null;
output = new Dictionary<string, Uri>();
foreach (var item in input)
{
output.Add(new String(item.Key.ToCharArray()), new Uri(item.Value.ToString()));
}
return output;
return input.ToDictionary(item => new String(item.Key.ToCharArray()), item => new Uri(item.Value.ToString()));
}
}
}
+1 -1
View File
@@ -51,7 +51,7 @@ namespace Octokit
if (optionalQueryStringMatch.Success)
{
var expansion = string.Empty;
var parameters = optionalQueryStringMatch.Groups[1].Value.Split(new char[] { ',' });
var parameters = optionalQueryStringMatch.Groups[1].Value.Split(',');
foreach (var parameter in parameters)
{
+5 -5
View File
@@ -60,14 +60,14 @@ namespace Octokit
{
// Seem to have to do this to pass a whole bunch of tests (for example Octokit.Tests.Clients.EventsClientTests.DeserializesCommitCommentEventCorrectly)
// I believe this has something to do with the Mocking framework.
if (this.Links == null || this.OauthScopes == null || this.RateLimit == null || this.Etag == null)
if (Links == null || OauthScopes == null || RateLimit == null || Etag == null)
return null;
return new ApiInfo(this.Links.Clone(),
this.OauthScopes.Clone(),
this.AcceptedOauthScopes.Clone(),
return new ApiInfo(Links.Clone(),
OauthScopes.Clone(),
AcceptedOauthScopes.Clone(),
new String(this.Etag.ToCharArray()),
this.RateLimit.Clone());
RateLimit.Clone());
}
}
}
+1 -1
View File
@@ -230,7 +230,7 @@ namespace Octokit.Internal
{
newRequest.Headers.Authorization = null;
}
response = await this.SendAsync(newRequest, cancellationToken);
response = await SendAsync(newRequest, cancellationToken);
}
return response;
+3 -3
View File
@@ -108,9 +108,9 @@ namespace Octokit
{
return new RateLimit
{
Limit = this.Limit,
Remaining = this.Remaining,
ResetAsUtcEpochSeconds = this.ResetAsUtcEpochSeconds
Limit = Limit,
Remaining = Remaining,
ResetAsUtcEpochSeconds = ResetAsUtcEpochSeconds
};
}
}
@@ -10,7 +10,7 @@ namespace Octokit
internal string DebuggerDisplay
{
get { return this.Repository.FullName; }
get { return Repository.FullName; }
}
}
}