Skip to content

Commit

Permalink
Address @Vogel612's comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
IvenBach committed Nov 26, 2017
1 parent 8147beb commit 2a21d5c
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 21 deletions.
10 changes: 3 additions & 7 deletions RetailCoder.VBE/Navigation/CodeExplorer/CodeExplorerViewModel.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using NLog;
Expand All @@ -18,7 +17,6 @@
using Rubberduck.UI.Command.MenuItems;
using Rubberduck.VBEditor;
using Rubberduck.VBEditor.SafeComWrappers;
using Rubberduck.VBEditor.SafeComWrappers.Abstract;
using System.Windows;

// ReSharper disable CanBeReplacedWithTryCastAndCheckForNull
Expand Down Expand Up @@ -479,8 +477,7 @@ private void SetErrorState(CodeExplorerItemViewModel itemNode, QualifiedModuleNa

private void ExecuteCollapseNodes(object parameter)
{
var node = parameter as CodeExplorerItemViewModel;
if (node == null)
if (!(parameter is CodeExplorerItemViewModel node))
{
return;
}
Expand All @@ -490,8 +487,7 @@ private void ExecuteCollapseNodes(object parameter)

private void ExecuteExpandNodes(object parameter)
{
var node = parameter as CodeExplorerItemViewModel;
if (node == null)
if (!(parameter is CodeExplorerItemViewModel node))
{
return;
}
Expand Down Expand Up @@ -558,7 +554,7 @@ private void ExecuteRemoveComand(object param)

private bool CanExecuteExportAllCommand => ExportAllCommand.CanExecute(SelectedItem);

public Visibility ExportVisibility => CanExecuteExportAllCommand == false ? Visibility.Visible : Visibility.Collapsed;
public Visibility ExportVisibility => CanExecuteExportAllCommand ? Visibility.Collapsed : Visibility.Visible;

public Visibility ExportAllVisibility => CanExecuteExportAllCommand ? Visibility.Visible : Visibility.Collapsed;

Expand Down
Expand Up @@ -35,7 +35,9 @@ public RegexSearchReplace(IVBE vbe, IParseCoordinator parser)

public IEnumerable<RegexSearchResult> Search(string searchPattern, RegexSearchReplaceScope scope = RegexSearchReplaceScope.CurrentFile)
{
return _search.TryGetValue(scope, out var searchFunc) ? searchFunc.Invoke(searchPattern) : new List<RegexSearchResult>();
return _search.TryGetValue(scope, out var searchFunc)
? searchFunc.Invoke(searchPattern)
: new List<RegexSearchResult>();
}

public void Replace(string searchPattern, string replaceValue, RegexSearchReplaceScope scope)
Expand Down
Expand Up @@ -11,10 +11,8 @@ public class PropertyGenerator
public bool GenerateLetter { get; set; }
public bool GenerateSetter { get; set; }

public string AllPropertyCode => string.Format("{0}{1}{2}",
GetterCode,
(GenerateLetter ? LetterCode : string.Empty),
(GenerateSetter ? SetterCode : string.Empty));
public string AllPropertyCode =>
$"{GetterCode}{(GenerateLetter ? LetterCode : string.Empty)}{(GenerateSetter ? SetterCode : string.Empty)}";

public string GetterCode
{
Expand Down
Expand Up @@ -32,7 +32,9 @@ public ExtractInterfacePresenter Create()
}

var model = new ExtractInterfaceModel(_state, selection.Value);
return model.Members.Any() ? new ExtractInterfacePresenter(_view, model) : null;

// don't show the UI if there's no memeber to extract
return model.Members.Any() ? new ExtractInterfacePresenter(_view, model) : null;
}
}
}
Expand Up @@ -44,12 +44,7 @@ public string FullMemberSignature
{
get
{
//var signature = MemberType + " " + Member.IdentifierName + "(" +
// string.Join(", ", MemberParams) + ")";
var signature = string.Format("{0} {1}({2})",
MemberType,
Member.IdentifierName,
string.Join(", ", MemberParams));
var signature = $"{MemberType} {Member.IdentifierName}({string.Join(", ", MemberParams)})";

return Type == null ? signature : $"{signature} As {Type}";
}
Expand Down
Expand Up @@ -178,7 +178,7 @@ private void UpdateSignature(Declaration targetVariable)
.Where(item => item.ProjectId == interfaceImplementation.ProjectId
&&
item.IdentifierName ==
interfaceImplementation.ComponentName + "_" + interfaceImplementation.IdentifierName
$"{interfaceImplementation.ComponentName}_{interfaceImplementation.IdentifierName}"
&& !item.Equals(functionDeclaration));

foreach (var implementation in interfaceImplementations)
Expand All @@ -200,7 +200,7 @@ private void AddParameter(Declaration targetMethod, Declaration targetVariable,
_rewriters.Add(rewriter);

var argList = paramList.arg();
var newParameter = Tokens.ByVal + " " + targetVariable.IdentifierName + " " + Tokens.As + " " + targetVariable.AsTypeName;
var newParameter = $"{Tokens.ByVal} {targetVariable.IdentifierName} {Tokens.As} {targetVariable.AsTypeName}";

if (!argList.Any())
{
Expand Down

0 comments on commit 2a21d5c

Please sign in to comment.