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

Commit 16b5bb8

Browse files
author
Meaghan Lewis
authored
Merge branch 'master' into donokuda/tall-orgs
2 parents f83ffda + 29c95b8 commit 16b5bb8

File tree

117 files changed

+404
-191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+404
-191
lines changed

Directory.Build.Props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22
<PropertyGroup>
33
<Product>GitHub Extension for Visual Studio</Product>
4-
<Version>2.6.1.0</Version>
4+
<Version>2.7.0.0</Version>
55
<Copyright>Copyright © GitHub, Inc. 2014-2018</Copyright>
66
<LangVersion>7.3</LangVersion>
77
</PropertyGroup>

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,22 @@ Logs can be viewed at the following location:
9292

9393
`%LOCALAPPDATA%\GitHubVisualStudio\extension.log`
9494

95+
## Troubleshooting
96+
97+
If you have issues building with failures similar to:
98+
99+
> "The type or namespace name does not exist..."
100+
101+
or
102+
103+
> "Unable to find project... Check that the project reference is valid and that the project file exists."*
104+
105+
Close Visual Studio and run the following command to update submodules and clean your environment.
106+
107+
```txt
108+
clean.cmd
109+
```
110+
95111
## More information
96112
- Andreia Gaita's [presentation](https://www.youtube.com/watch?v=hz2hCO8e_8w) at Codemania 2016 about this extension.
97113

@@ -104,4 +120,3 @@ Visit the [Contributor Guidelines](CONTRIBUTING.md) for details on how to contri
104120
Copyright 2015 - 2018 GitHub, Inc.
105121

106122
Licensed under the [MIT License](LICENSE.md)
107-

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
os: Visual Studio 2017
2-
version: '2.6.1.{build}'
2+
version: '2.7.0.{build}'
33
skip_tags: true
44
install:
55
- ps: |

clean.cmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
git submodule update --init
2+
git clean -xdff
3+
git submodule foreach git clean -xdff

src/CredentialManagement/NativeMethods.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
using System.Text;
55
using Microsoft.Win32.SafeHandles;
66

7+
#pragma warning disable CA1034 // Nested types should not be visible
8+
#pragma warning disable CA1051 // Do not declare visible instance fields
9+
#pragma warning disable CA1707 // Identifiers should not contain underscores
10+
711
namespace GitHub.Authentication.CredentialManagement
812
{
913
public static class NativeMethods

src/GitHub.Api/GlobalSuppressions.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// This file is used by Code Analysis to maintain SuppressMessage
2+
// attributes that are applied to this project.
3+
// Project-level suppressions either have no target or are given
4+
// a specific target and scoped to a namespace, type, member, etc.
5+
6+
using System.Diagnostics.CodeAnalysis;
7+
8+
[assembly: SuppressMessage("Reliability", "CA2007:Do not directly await a Task", Justification = "Discouraged for VSSDK projects.")]
9+

src/GitHub.Api/LoginManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ async Task<ApplicationAuthorization> HandleTwoFactorAuthorization(
289289
}
290290
}
291291

292-
ApplicationAuthorization EnsureNonNullAuthorization(ApplicationAuthorization auth)
292+
static ApplicationAuthorization EnsureNonNullAuthorization(ApplicationAuthorization auth)
293293
{
294294
// If a mock IGitHubClient is not set up correctly, it can return null from
295295
// IGutHubClient.Authorization.Create - this will cause an infinite loop in Login()

src/GitHub.App/Api/ApiClient.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ namespace GitHub.Api
1818
{
1919
public partial class ApiClient : IApiClient
2020
{
21-
const string ScopesHeader = "X-OAuth-Scopes";
2221
const string ProductName = Info.ApplicationInfo.ApplicationDescription;
2322
static readonly ILogger log = LogManager.ForContext<ApiClient>();
2423

src/GitHub.App/Collections/VirtualizingList.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
using GitHub.Logging;
1313
using Serilog;
1414

15+
#pragma warning disable CA1010 // Collections should implement generic interface
16+
#pragma warning disable CA1033 // Interface methods should be callable by child types
17+
#pragma warning disable CA1710 // Identifiers should have correct suffix
18+
1519
namespace GitHub.Collections
1620
{
1721
/// <summary>

src/GitHub.App/Collections/VirtualizingListCollectionView.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
using System.Collections.Specialized;
55
using System.Windows.Data;
66

7+
#pragma warning disable CA1010 // Collections should implement generic interface
8+
#pragma warning disable CA1033 // Interface methods should be callable by child types
9+
#pragma warning disable CA1710 // Identifiers should have correct suffix
10+
711
namespace GitHub.Collections
812
{
913
/// <summary>

src/GitHub.App/GlobalSuppressions.cs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
using System.Diagnostics.CodeAnalysis;
2-
3-
[assembly: SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "GitHub.ViewModels.CreateRepoViewModel.#ResetState()")]
4-
[assembly: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", MessageId = "Git", Scope = "resource", Target = "GitHub.Resources.resources")]
5-
[assembly: SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily", Scope = "member", Target = "GitHub.Caches.CredentialCache.#InsertObject`1(System.String,!!0,System.Nullable`1<System.DateTimeOffset>)")]
6-
[assembly: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", MessageId = "Git", Scope = "resource", Target = "GitHub.App.Resources.resources")]
7-
[assembly: SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object,System.Object,System.Object)", Scope = "member", Target = "GitHub.Services.PullRequestService.#CreateTempFile(System.String,System.String,System.String)")]
8-
[assembly: SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object,System.Object,System.Object)", Scope = "member", Target = "GitHub.Services.PullRequestService.#CreateTempFile(System.String,System.String,System.String,System.Text.Encoding)")]
9-
101
// This file is used by Code Analysis to maintain SuppressMessage
112
// attributes that are applied to this project.
123
// Project-level suppressions either have no target or are given
@@ -16,3 +7,15 @@
167
// Code Analysis results, point to "Suppress Message", and click
178
// "In Suppression File".
189
// You do not need to add suppressions to this file manually.
10+
11+
using System.Diagnostics.CodeAnalysis;
12+
13+
[assembly: SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Scope = "member", Target = "GitHub.ViewModels.CreateRepoViewModel.#ResetState()")]
14+
[assembly: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", MessageId = "Git", Scope = "resource", Target = "GitHub.Resources.resources")]
15+
[assembly: SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily", Scope = "member", Target = "GitHub.Caches.CredentialCache.#InsertObject`1(System.String,!!0,System.Nullable`1<System.DateTimeOffset>)")]
16+
[assembly: SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", MessageId = "Git", Scope = "resource", Target = "GitHub.App.Resources.resources")]
17+
[assembly: SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object,System.Object,System.Object)", Scope = "member", Target = "GitHub.Services.PullRequestService.#CreateTempFile(System.String,System.String,System.String)")]
18+
[assembly: SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", MessageId = "System.String.Format(System.String,System.Object,System.Object,System.Object)", Scope = "member", Target = "GitHub.Services.PullRequestService.#CreateTempFile(System.String,System.String,System.String,System.Text.Encoding)")]
19+
[assembly: SuppressMessage("Design", "CA1056:Uri properties should not be strings")]
20+
[assembly: SuppressMessage("Design", "CA1054:Uri parameters should not be strings")]
21+
[assembly: SuppressMessage("Reliability", "CA2007:Do not directly await a Task", Justification = "Discouraged for VSSDK projects.")]

src/GitHub.App/Services/EnterpriseCapabilitiesService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public async Task<EnterpriseLoginMethods> ProbeLoginMethods(Uri enterpriseBaseUr
5555
}
5656
}
5757

58-
private async Task<EnterpriseMeta> GetMetadata(IConnection connection)
58+
private static async Task<EnterpriseMeta> GetMetadata(IConnection connection)
5959
{
6060
var endpoint = new Uri("meta", UriKind.Relative);
6161
var response = await connection.Get<EnterpriseMeta>(endpoint, null, null).ConfigureAwait(false);

src/GitHub.App/Services/ErrorMessageTranslator.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using ReactiveUI.Legacy;
88

99
#pragma warning disable CS0618 // Type or member is obsolete
10+
#pragma warning disable CA1034 // Nested types should not be visible
1011

1112
namespace GitHub.Services
1213
{

src/GitHub.App/Services/ModelService.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
using Serilog;
2323
using static Octokit.GraphQL.Variable;
2424

25+
#pragma warning disable CA1034 // Nested types should not be visible
26+
2527
namespace GitHub.Services
2628
{
2729
[Export(typeof(IModelService))]
@@ -365,7 +367,7 @@ RemoteRepositoryModel Create(RepositoryCacheItem item)
365367
};
366368
}
367369

368-
GitReferenceModel Create(GitReferenceCacheItem item)
370+
static GitReferenceModel Create(GitReferenceCacheItem item)
369371
{
370372
return new GitReferenceModel(item.Ref, item.Label, item.Sha, item.RepositoryCloneUrl);
371373
}

src/GitHub.App/Services/PullRequestEditorService.cs

Lines changed: 3 additions & 3 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;
@@ -436,7 +436,7 @@ public int FindMatchingLine(IList<string> fromLines, IList<string> toLines, int
436436
/// <param name="line">The 0-based line we're navigating from.</param>
437437
/// <param name="matchedLines">The number of similar matched lines in <see cref="toLines"/></param>
438438
/// <returns>Find the nearest matching line in <see cref="toLines"/>.</returns>
439-
public int FindNearestMatchingLine(IList<string> fromLines, IList<string> toLines, int line, out int matchedLines)
439+
public static int FindNearestMatchingLine(IList<string> fromLines, IList<string> toLines, int line, out int matchedLines)
440440
{
441441
line = line < fromLines.Count ? line : fromLines.Count - 1; // VS shows one extra line at end
442442
var fromLine = fromLines[line];

src/GitHub.App/ViewModels/CommentThreadViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ protected IDisposable AddPlaceholder(ICommentViewModel placeholder)
8585
x => x.EditState,
8686
x => x.Body,
8787
(state, body) => (state, body))
88-
.Subscribe(x => PlaceholderChanged(placeholder, x.state, x.body));
88+
.Subscribe(x => PlaceholderChanged(placeholder, x.state));
8989
}
9090

9191
/// <summary>
@@ -120,7 +120,7 @@ protected async Task DeleteDraft(ICommentViewModel comment)
120120

121121
protected abstract (string key, string secondaryKey) GetDraftKeys(ICommentViewModel comment);
122122

123-
void PlaceholderChanged(ICommentViewModel placeholder, CommentEditState state, string body)
123+
void PlaceholderChanged(ICommentViewModel placeholder, CommentEditState state)
124124
{
125125
if (state == CommentEditState.Editing)
126126
{

src/GitHub.App/ViewModels/Dialog/GitHubDialogWindowViewModel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public async Task StartWithConnection<T>(T viewModel)
8181
}
8282
}
8383

84-
public async Task StartWithLogout<T>(T viewModel, IConnection connection)
84+
public Task StartWithLogout<T>(T viewModel, IConnection connection)
8585
where T : IDialogContentViewModel, IConnectionInitializedViewModel
8686
{
8787
var logout = factory.CreateViewModel<ILogOutRequiredViewModel>();
@@ -101,6 +101,7 @@ public async Task StartWithLogout<T>(T viewModel, IConnection connection)
101101
});
102102

103103
Content = logout;
104+
return Task.CompletedTask;
104105
}
105106

106107
async Task<IConnection> ShowLogin()

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/PullRequestCheckViewModel.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ namespace GitHub.ViewModels.GitHubPane
1818
[PartCreationPolicy(CreationPolicy.NonShared)]
1919
public class PullRequestCheckViewModel: ViewModelBase, IPullRequestCheckViewModel
2020
{
21-
const string DefaultAvatar = "pack://application:,,,/GitHub.App;component/Images/default_user_avatar.png";
22-
2321
private readonly IUsageTracker usageTracker;
2422

2523
/// <summary>

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
}

0 commit comments

Comments
 (0)