Add null checks and fix CodeAnalysis errors.

I enabled code analysis to the Octokit.Reactive project and
needed to fix things up.
This commit is contained in:
Haacked
2013-01-29 14:36:24 -08:00
parent 997e955f38
commit e07b6d62c2
17 changed files with 87 additions and 3 deletions
@@ -28,11 +28,15 @@ namespace Octokit.Reactive.Clients
public IObservable<Authorization> Update(long id, AuthorizationUpdate authorization)
{
Ensure.ArgumentNotNull(authorization, "authorization");
return client.Update(id, authorization).ToObservable();
}
public IObservable<Authorization> Create(AuthorizationUpdate authorization)
{
Ensure.ArgumentNotNull(authorization, "authorization");
return client.Create(authorization).ToObservable();
}
@@ -17,6 +17,8 @@ namespace Octokit.Reactive.Clients
public IObservable<Organization> Get(string org)
{
Ensure.ArgumentNotNullOrEmptyString(org, "org");
return client.Get(org).ToObservable();
}
@@ -27,6 +29,8 @@ namespace Octokit.Reactive.Clients
public IObservable<IReadOnlyCollection<Organization>> GetAll(string user)
{
Ensure.ArgumentNotNullOrEmptyString(user, "user");
return client.GetAll(user).ToObservable();
}
}
@@ -17,6 +17,9 @@ namespace Octokit.Reactive.Clients
public IObservable<Repository> Get(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return client.Get(owner, name).ToObservable();
}
@@ -27,16 +30,23 @@ namespace Octokit.Reactive.Clients
public IObservable<IReadOnlyCollection<Repository>> GetAllForUser(string login)
{
Ensure.ArgumentNotNullOrEmptyString(login, "login");
return client.GetAllForUser(login).ToObservable();
}
public IObservable<IReadOnlyCollection<Repository>> GetAllForOrg(string organization)
{
Ensure.ArgumentNotNullOrEmptyString(organization, "organization");
return client.GetAllForOrg(organization).ToObservable();
}
public IObservable<Readme> GetReadme(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return client.GetReadme(owner, name).ToObservable();
}
}
@@ -23,6 +23,8 @@ namespace Octokit.Reactive.Clients
public IObservable<IReadOnlyCollection<SshKey>> GetAll(string user)
{
Ensure.ArgumentNotNullOrEmptyString(user, "user");
return client.GetAll(user).ToObservable();
}
@@ -33,11 +35,15 @@ namespace Octokit.Reactive.Clients
public IObservable<SshKey> Create(SshKeyUpdate key)
{
Ensure.ArgumentNotNull(key, "key");
return client.Create(key).ToObservable();
}
public IObservable<SshKey> Update(long id, SshKeyUpdate key)
{
Ensure.ArgumentNotNull(key, "key");
return client.Update(id, key).ToObservable();
}
@@ -16,6 +16,8 @@ namespace Octokit.Reactive.Clients
public IObservable<User> Get(string login)
{
Ensure.ArgumentNotNull(login, "login");
return client.Get(login).ToObservable();
}
@@ -26,6 +28,8 @@ namespace Octokit.Reactive.Clients
public IObservable<User> Update(UserUpdate user)
{
Ensure.ArgumentNotNull(user, "user");
return client.Update(user).ToObservable();
}
}
+4
View File
@@ -10,6 +10,10 @@ namespace Octokit.Reactive
string owner,
string name)
{
Ensure.ArgumentNotNull(client, "client");
Ensure.ArgumentNotNullOrEmptyString(owner, "owner");
Ensure.ArgumentNotNullOrEmptyString(name, "name");
return client.GetReadme(owner, name).SelectMany(r => r.GetHtmlContent().ToObservable());
}
}
+5
View File
@@ -83,6 +83,11 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<CodeAnalysisDictionary Include="..\CustomDictionary.xml">
<Link>CustomDictionary.xml</Link>
</CodeAnalysisDictionary>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.