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

Commit 7b838d2

Browse files
committed
Disable warnings for known obsolete calls
1 parent 566a7d2 commit 7b838d2

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

src/GitHub.App/Api/ApiClient.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,8 @@ public IObservable<PullRequest> GetPullRequestsForRepository(string owner, strin
242242
Guard.ArgumentNotEmptyString(name, nameof(name));
243243

244244
return gitHubClient.PullRequest.GetAllForRepository(owner, name,
245-
new PullRequestRequest {
245+
new PullRequestRequest
246+
{
246247
State = ItemStateFilter.All,
247248
SortProperty = PullRequestSort.Updated,
248249
SortDirection = SortDirection.Descending
@@ -268,7 +269,7 @@ public IObservable<Branch> GetBranches(string owner, string repo)
268269
Guard.ArgumentNotEmptyString(owner, nameof(owner));
269270
Guard.ArgumentNotEmptyString(repo, nameof(repo));
270271

271-
#pragma warning disable CS0618
272+
#pragma warning disable 618
272273
// GetAllBranches is obsolete, but don't want to introduce the change to fix the
273274
// warning in the PR, so disabling for now.
274275
return gitHubClient.Repository.GetAllBranches(owner, repo);

test/GitHub.InlineReviews.UnitTests/TestDoubles/FakeDiffService.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ public string AddFile(string path, string contents)
3939
var directory = Path.GetDirectoryName(fullPath);
4040
Directory.CreateDirectory(directory);
4141
File.WriteAllText(fullPath, contents);
42+
#pragma warning disable 618 // Type or member is obsolete
4243
repository.Stage(path);
44+
#pragma warning restore 618 // Type or member is obsolete
4345
repository.Commit("Added " + path, signature, signature);
4446
return repository.Head.Tip.Sha;
4547
}
@@ -106,7 +108,9 @@ static IRepository CreateRepository()
106108
var signature = new Signature("user", "user@user", DateTimeOffset.Now);
107109

108110
File.WriteAllText(Path.Combine(tempPath, ".gitattributes"), "* text=auto");
111+
#pragma warning disable 618 // Type or member is obsolete
109112
result.Stage("*");
113+
#pragma warning restore 618 // Type or member is obsolete
110114
result.Commit("Initial commit", signature, signature);
111115

112116
return result;

test/UnitTests/GitHub.App/Services/GitClientTests.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,9 @@ public async Task LocalBaseHeadAndMergeBase_DontFetch()
250250

251251
var mergeBaseSha = await gitClient.GetPullRequestMergeBase(repo, targetCloneUrl, baseSha, headSha, baseRef, pullNumber);
252252

253+
#pragma warning disable 618 // Type or member is obsolete
253254
repo.Network.DidNotReceiveWithAnyArgs().Fetch(null as Remote, null, null as FetchOptions);
255+
#pragma warning restore 618 // Type or member is obsolete
254256
Assert.That(expectMergeBaseSha, Is.EqualTo(mergeBaseSha));
255257
}
256258

@@ -274,7 +276,9 @@ public async Task WhenToFetch(string baseSha, string headSha, string mergeBaseSh
274276
}
275277
catch (NotFoundException) { /* We're interested in calls to Fetch even if it throws */ }
276278

279+
#pragma warning disable 618 // Type or member is obsolete
277280
repo.Network.Received(receivedFetch).Fetch(Arg.Any<Remote>(), Arg.Any<string[]>(), Arg.Any<FetchOptions>());
281+
#pragma warning restore 618 // Type or member is obsolete
278282
}
279283

280284
[TestCase("baseSha", null, "mergeBaseSha", "baseRef", 777, "refs/pull/777/head")]
@@ -295,7 +299,9 @@ public async Task WhatToFetch(string baseSha, string headSha, string mergeBaseSh
295299
}
296300
catch (NotFoundException) { /* We're interested in calls to Fetch even if it throws */ }
297301

302+
#pragma warning disable 618 // Type or member is obsolete
298303
repo.Network.Received(1).Fetch(Arg.Any<Remote>(), Arg.Is<IEnumerable<string>>(x => x.Contains(expectRefSpec)), Arg.Any<FetchOptions>());
304+
#pragma warning restore 618 // Type or member is obsolete
299305
}
300306

301307
static IRepository MockRepo(string baseSha, string headSha, string mergeBaseSha)

test/UnitTests/TestDoubles/FakeCommitLog.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ public ICommitLog QueryBy(CommitFilter filter)
3232
throw new NotImplementedException();
3333
}
3434

35+
#pragma warning disable 618 // Type or member is obsolete
3536
public IEnumerable<LogEntry> QueryBy(string path, FollowFilter filter)
3637
{
3738
throw new NotImplementedException();
3839
}
40+
#pragma warning restore 618 // Type or member is obsolete
3941

4042
public IEnumerable<LogEntry> QueryBy(string path, CommitFilter filter)
4143
{

0 commit comments

Comments
 (0)