Fixed code analysis errors

This commit is contained in:
Kristian Hellang
2013-11-25 00:20:22 +01:00
parent df0963c848
commit 25308e5f5e
6 changed files with 48 additions and 14 deletions
+7 -2
View File
@@ -1,17 +1,22 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
namespace Octokit
{
public interface IReferencesClient
{
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "Get",
Justification = "Method makes a network request")]
Task<Reference> Get(string owner, string name, string reference);
Task<IReadOnlyList<Reference>> GetAll(string owner, string name, string subNamespace = null);
Task<IReadOnlyList<Reference>> GetAll(string owner, string name);
Task<IReadOnlyList<Reference>> GetAll(string owner, string name, string subNamespace);
Task<Reference> Create(string owner, string name, NewReference reference);
Task<Reference> Update(string owner, string name, string reference, ReferenceUpdate update);
Task<Reference> Update(string owner, string name, string reference, ReferenceUpdate referenceUpdate);
Task Delete(string owner, string name, string reference);
}
+13 -4
View File
@@ -19,11 +19,20 @@ namespace Octokit
return ApiConnection.Get<Reference>(ApiUrls.Reference(owner, name, reference));
}
public Task<IReadOnlyList<Reference>> GetAll(string owner, string name, string subNamespace = null)
public Task<IReadOnlyList<Reference>> GetAll(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return ApiConnection.GetAll<Reference>(ApiUrls.Reference(owner, name));
}
public Task<IReadOnlyList<Reference>> GetAll(string owner, string name, string subNamespace)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNullOrEmptyString(subNamespace, "subNamespace");
return ApiConnection.GetAll<Reference>(ApiUrls.Reference(owner, name, subNamespace));
}
@@ -36,14 +45,14 @@ namespace Octokit
return ApiConnection.Post<Reference>(ApiUrls.Reference(owner, name), reference);
}
public Task<Reference> Update(string owner, string name, string reference, ReferenceUpdate update)
public Task<Reference> Update(string owner, string name, string reference, ReferenceUpdate referenceUpdate)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
Ensure.ArgumentNotNullOrEmptyString(reference, "reference");
Ensure.ArgumentNotNull(update, "update");
Ensure.ArgumentNotNull(referenceUpdate, "update");
return ApiConnection.Patch<Reference>(ApiUrls.Reference(owner, name, reference), update);
return ApiConnection.Patch<Reference>(ApiUrls.Reference(owner, name, reference), referenceUpdate);
}
public Task Delete(string owner, string name, string reference)
+13 -7
View File
@@ -474,16 +474,22 @@ namespace Octokit
/// </summary>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="reference">The reference name</param>
/// <returns></returns>
public static Uri Reference(string owner, string name, string reference = null)
public static Uri Reference(string owner, string name)
{
if (string.IsNullOrEmpty(reference))
{
return "repos/{0}/{1}/git/refs".FormatUri(owner, name);
}
return "repos/{0}/{1}/git/refs".FormatUri(owner, name);
}
return "repos/{0}/{1}/git/refs/{2}".FormatUri(owner, name, reference);
/// <summary>
/// Returns the <see cref="Uri"/> for the specified reference.
/// </summary>
/// <param name="owner">The owner of the repository</param>
/// <param name="name">The name of the repository</param>
/// <param name="referenceName">The reference name</param>
/// <returns></returns>
public static Uri Reference(string owner, string name, string referenceName)
{
return "repos/{0}/{1}/git/refs/{2}".FormatUri(owner, name, referenceName);
}
/// <summary>
+5 -1
View File
@@ -2,7 +2,11 @@
{
public class ReferenceUpdate
{
public ReferenceUpdate(string sha, bool force = false)
public ReferenceUpdate(string sha) : this(sha, false)
{
}
public ReferenceUpdate(string sha, bool force)
{
Ensure.ArgumentNotNullOrEmptyString(sha, "sha");
+5
View File
@@ -234,6 +234,11 @@
<Compile Include="Models\Response\GistFile.cs" />
<Compile Include="Models\Response\GistFork.cs" />
<Compile Include="Models\Response\GistHistory.cs" />
<Compile Include="Clients\IReferencesClient.cs" />
<Compile Include="Clients\ReferencesClient.cs" />
<Compile Include="Models\Request\NewReference.cs" />
<Compile Include="Models\Request\ReferenceUpdate.cs" />
<Compile Include="Models\Response\Reference.cs" />
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" />
</Project>
+5
View File
@@ -229,6 +229,11 @@
<Compile Include="Models\Response\GistFile.cs" />
<Compile Include="Models\Response\GistFork.cs" />
<Compile Include="Models\Response\GistHistory.cs" />
<Compile Include="Clients\IReferencesClient.cs" />
<Compile Include="Clients\ReferencesClient.cs" />
<Compile Include="Models\Request\NewReference.cs" />
<Compile Include="Models\Request\ReferenceUpdate.cs" />
<Compile Include="Models\Response\Reference.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>