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

Commit 62d551d

Browse files
Merge branch 'master' into update-graphql-submodule
2 parents 1ce82b3 + f6ae030 commit 62d551d

File tree

14 files changed

+52
-29
lines changed

14 files changed

+52
-29
lines changed

src/GitHub.App/Services/PullRequestEditorService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,12 @@ await pullRequestService.ExtractToTempFile(
232232

233233
var leftText = diffViewer.LeftView.TextBuffer.CurrentSnapshot.GetText();
234234
var rightText = diffViewer.RightView.TextBuffer.CurrentSnapshot.GetText();
235-
if (leftText == string.Empty)
235+
if (leftText.Length == 0)
236236
{
237237
// Don't show LeftView when empty.
238238
diffViewer.ViewMode = DifferenceViewMode.RightViewOnly;
239239
}
240-
else if (rightText == string.Empty)
240+
else if (rightText.Length == 0)
241241
{
242242
// Don't show RightView when empty.
243243
diffViewer.ViewMode = DifferenceViewMode.LeftViewOnly;

src/GitHub.App/ViewModels/GitHubPane/GitHubPaneViewModel.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.ComponentModel.Composition;
33
using System.ComponentModel.Design;
4+
using System.Globalization;
45
using System.Linq;
56
using System.Reactive;
67
using System.Reactive.Linq;
@@ -253,29 +254,29 @@ public async Task NavigateTo(Uri uri)
253254
{
254255
var owner = match.Groups["owner"].Value;
255256
var repo = match.Groups["repo"].Value;
256-
var number = int.Parse(match.Groups["number"].Value);
257+
var number = int.Parse(match.Groups["number"].Value, CultureInfo.InvariantCulture);
257258
await ShowPullRequest(owner, repo, number);
258259
}
259260
else if ((match = pullNewReviewUri.Match(uri.AbsolutePath))?.Success == true)
260261
{
261262
var owner = match.Groups["owner"].Value;
262263
var repo = match.Groups["repo"].Value;
263-
var number = int.Parse(match.Groups["number"].Value);
264+
var number = int.Parse(match.Groups["number"].Value, CultureInfo.InvariantCulture);
264265
await ShowPullRequestReviewAuthoring(owner, repo, number);
265266
}
266267
else if ((match = pullUserReviewsUri.Match(uri.AbsolutePath))?.Success == true)
267268
{
268269
var owner = match.Groups["owner"].Value;
269270
var repo = match.Groups["repo"].Value;
270-
var number = int.Parse(match.Groups["number"].Value);
271+
var number = int.Parse(match.Groups["number"].Value, CultureInfo.InvariantCulture);
271272
var login = match.Groups["login"].Value;
272273
await ShowPullRequestReviews(owner, repo, number, login);
273274
}
274275
else if ((match = pullCheckRunsUri.Match(uri.AbsolutePath))?.Success == true)
275276
{
276277
var owner = match.Groups["owner"].Value;
277278
var repo = match.Groups["repo"].Value;
278-
var number = int.Parse(match.Groups["number"].Value);
279+
var number = int.Parse(match.Groups["number"].Value, CultureInfo.InvariantCulture);
279280
var id = match.Groups["id"].Value;
280281

281282
await ShowPullRequestCheckRun(owner, repo, number, id);

src/GitHub.App/ViewModels/GitHubPane/IssueListViewModelBase.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.ComponentModel;
4+
using System.Globalization;
45
using System.IO;
56
using System.Linq;
67
using System.Reactive;
@@ -252,7 +253,7 @@ void FilterChanged()
252253

253254
if (numberFilter == 0)
254255
{
255-
stringFilter = SearchQuery.ToUpper();
256+
stringFilter = SearchQuery.ToUpperInvariant();
256257
}
257258
}
258259
else
@@ -280,7 +281,7 @@ bool FilterItem(object o)
280281
}
281282
else
282283
{
283-
result = item.Title.ToUpper().Contains(stringFilter);
284+
result = item.Title.ToUpperInvariant().Contains(stringFilter);
284285
}
285286
}
286287
}

src/GitHub.App/ViewModels/GitHubPane/PullRequestDetailViewModel.cs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public PullRequestDetailViewModel(
131131
SubscribeOperationError(SyncSubmodules);
132132

133133
OpenOnGitHub = ReactiveCommand.Create(DoOpenDetailsUrl);
134-
134+
135135
ShowReview = ReactiveCommand.Create<IPullRequestReviewSummaryViewModel>(DoShowReview);
136136

137137
ShowAnnotations = ReactiveCommand.Create<IPullRequestCheckViewModel>(DoShowAnnotations);
@@ -350,7 +350,7 @@ public async Task Load(PullRequestDetailModel pullRequest)
350350
Body = !string.IsNullOrWhiteSpace(pullRequest.Body) ? pullRequest.Body : Resources.NoDescriptionProvidedMarkdown;
351351
Reviews = PullRequestReviewSummaryViewModel.BuildByUser(Session.User, pullRequest).ToList();
352352

353-
Checks = (IReadOnlyList<IPullRequestCheckViewModel>) PullRequestCheckViewModel.Build(viewViewModelFactory, pullRequest)?.ToList() ?? Array.Empty<IPullRequestCheckViewModel>();
353+
Checks = (IReadOnlyList<IPullRequestCheckViewModel>)PullRequestCheckViewModel.Build(viewViewModelFactory, pullRequest)?.ToList() ?? Array.Empty<IPullRequestCheckViewModel>();
354354

355355
await Files.InitializeAsync(Session);
356356

@@ -370,6 +370,7 @@ public async Task Load(PullRequestDetailModel pullRequest)
370370
if (pullEnabled)
371371
{
372372
pullToolTip = string.Format(
373+
CultureInfo.InvariantCulture,
373374
Resources.PullRequestDetailsPullToolTip,
374375
IsFromFork ? Resources.Fork : Resources.Remote,
375376
SourceBranchDisplayName);
@@ -382,6 +383,7 @@ public async Task Load(PullRequestDetailModel pullRequest)
382383
if (pushEnabled)
383384
{
384385
pushToolTip = string.Format(
386+
CultureInfo.InvariantCulture,
385387
Resources.PullRequestDetailsPushToolTip,
386388
IsFromFork ? Resources.Fork : Resources.Remote,
387389
SourceBranchDisplayName);
@@ -396,16 +398,22 @@ public async Task Load(PullRequestDetailModel pullRequest)
396398
}
397399

398400
var submodulesToSync = await pullRequestsService.CountSubmodulesToSync(LocalRepository);
399-
var syncSubmodulesToolTip = string.Format(Resources.SyncSubmodules, submodulesToSync);
401+
var syncSubmodulesToolTip = string.Format(CultureInfo.InvariantCulture, Resources.SyncSubmodules, submodulesToSync);
400402

401403
UpdateState = new UpdateCommandState(divergence, pullEnabled, pushEnabled, pullToolTip, pushToolTip, syncSubmodulesToolTip, submodulesToSync);
402404
CheckoutState = null;
403405
}
404406
else
405407
{
406408
var caption = localBranches.Count > 0 ?
407-
string.Format(Resources.PullRequestDetailsCheckout, localBranches.First().DisplayName) :
408-
string.Format(Resources.PullRequestDetailsCheckoutTo, await pullRequestsService.GetDefaultLocalBranchName(LocalRepository, Model.Number, Model.Title));
409+
string.Format(
410+
CultureInfo.InvariantCulture,
411+
Resources.PullRequestDetailsCheckout,
412+
localBranches.First().DisplayName) :
413+
string.Format(
414+
CultureInfo.InvariantCulture,
415+
Resources.PullRequestDetailsCheckoutTo,
416+
await pullRequestsService.GetDefaultLocalBranchName(LocalRepository, Model.Number, Model.Title));
409417
var clean = await pullRequestsService.IsWorkingDirectoryClean(LocalRepository);
410418
string disabled = null;
411419

src/GitHub.App/ViewModels/UserFilterViewModel.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ public int Compare(object x, object y)
146146
{
147147
if (x == owner.ersatzUser) return -1;
148148
if (y == owner.ersatzUser) return 1;
149-
return ((IActorViewModel)x).Login.CompareTo(((IActorViewModel)y).Login);
149+
return string.Compare(
150+
((IActorViewModel)x).Login,
151+
((IActorViewModel)y).Login,
152+
StringComparison.Ordinal);
150153
}
151154
}
152155
}

src/GitHub.Exports/Models/CommitMessage.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public bool Equals(CommitMessage other)
3939
return false;
4040
}
4141

42-
return string.Equals(Summary, other.Summary)
43-
&& string.Equals(Details, other.Details);
42+
return string.Equals(Summary, other.Summary, StringComparison.Ordinal)
43+
&& string.Equals(Details, other.Details, StringComparison.Ordinal);
4444
}
4545

4646
public override bool Equals(object obj)

src/GitHub.Exports/Models/DiffUtilities.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
using System;
22
using System.IO;
3+
using System.Globalization;
34
using System.Collections.Generic;
45
using System.Text.RegularExpressions;
56
using System.Diagnostics.CodeAnalysis;
67
using GitHub.Extensions;
78

89
#pragma warning disable CA1034 // Nested types should not be visible
910

11+
#pragma warning disable CA1034 // Nested types should not be visible
12+
1013
namespace GitHub.Models
1114
{
1215
public static class DiffUtilities
@@ -39,8 +42,8 @@ public static IEnumerable<DiffChunk> ParseFragment(string diff)
3942

4043
chunk = new DiffChunk
4144
{
42-
OldLineNumber = oldLine = int.Parse(headerMatch.Groups[1].Value),
43-
NewLineNumber = newLine = int.Parse(headerMatch.Groups[2].Value),
45+
OldLineNumber = oldLine = int.Parse(headerMatch.Groups[1].Value, CultureInfo.InvariantCulture),
46+
NewLineNumber = newLine = int.Parse(headerMatch.Groups[2].Value, CultureInfo.InvariantCulture),
4447
DiffLine = diffLine,
4548
};
4649
}

src/GitHub.Exports/Models/LocalRepositoryModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ public bool Equals(LocalRepositoryModel other)
5555
if (ReferenceEquals(this, other))
5656
return true;
5757
return other != null &&
58-
string.Equals(Name, other.Name) &&
59-
string.Equals(Owner, other.Owner) &&
60-
string.Equals(CloneUrl, other.CloneUrl) &&
58+
string.Equals(Name, other.Name, StringComparison.Ordinal) &&
59+
string.Equals(Owner, other.Owner, StringComparison.Ordinal) &&
60+
string.Equals(CloneUrl, other.CloneUrl, StringComparison.Ordinal) &&
6161
string.Equals(LocalPath?.TrimEnd('\\'), other.LocalPath?.TrimEnd('\\'), StringComparison.CurrentCultureIgnoreCase);
6262
}
6363

src/GitHub.InlineReviews/Services/PullRequestSessionManager.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
using ReactiveUI;
2020
using Serilog;
2121

22+
#pragma warning disable CA1308 // Normalize strings to uppercase
23+
2224
namespace GitHub.InlineReviews.Services
2325
{
2426
/// <summary>

src/GitHub.TeamFoundation.14/Base/EnsureLoggedInSection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ async Task CheckLogin()
5454
bool loggedIn = await ConnectionManager.IsLoggedIn(add);
5555
if (!loggedIn)
5656
{
57-
var msg = string.Format(CultureInfo.CurrentUICulture, Resources.NotLoggedInMessage, add.Title, add.Title);
57+
var msg = string.Format(CultureInfo.CurrentCulture, Resources.NotLoggedInMessage, add.Title, add.Title);
5858
teServices.ShowMessage(
5959
msg,
6060
new Primitives.RelayCommand(_ => dialogService.ShowLoginDialog())

0 commit comments

Comments
 (0)