Skip to content

Commit 960f264

Browse files
committed
Merge branch 'next' of https://github.com/rubberduck-vba/Rubberduck into next
2 parents a9fc925 + ee3f32b commit 960f264

Some content is hidden

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

46 files changed

+1903
-377
lines changed

RetailCoder.VBE/Inspections/InspectionsUI.Designer.cs

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RetailCoder.VBE/Inspections/InspectionsUI.de.resx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<root>
33
<!--
44
Microsoft ResX Schema
@@ -59,7 +59,7 @@
5959
: using a System.ComponentModel.TypeConverter
6060
: and then encoded with base64 encoding.
6161
-->
62-
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root">
62+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
6363
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
6464
<xsd:element name="root" msdata:IsDataSet="true">
6565
<xsd:complexType>
@@ -274,7 +274,7 @@
274274
<value>'Option Base 1' ist angegeben.</value>
275275
</data>
276276
<data name="OptionExplicitInspectionMeta" xml:space="preserve">
277-
<value>Rubberduck kann keine Variablen auswerten, die nicht deklariert wurden. Nutze am besten 'Option Explicit' um fehleranfällige Programme zu erstellen.</value>
277+
<value>Nutze am besten 'Option Explicit' um fehleranfällige Programme zu erstellen.</value>
278278
</data>
279279
<data name="OptionExplicitInspectionName" xml:space="preserve">
280280
<value>'Option Explicit' ist nicht angegeben.</value>
@@ -555,13 +555,13 @@ Falls der Parameter 'null' sein kann, bitte dieses Auftreten ignorieren. 'null'
555555
<data name="MultipleDeclarationsInspectionResultFormat" xml:space="preserve">
556556
<value>Instruktion enthält Mehrfachdeklaration</value>
557557
</data>
558-
<data name="MalformedAnnotationInspectionName">
558+
<data name="MalformedAnnotationInspectionName" xml:space="preserve">
559559
<value>Unlesbare Annotation</value>
560560
</data>
561-
<data name="MalformedAnnotationInspectionResultFormat">
561+
<data name="MalformedAnnotationInspectionResultFormat" xml:space="preserve">
562562
<value>Annotation '{0}' ist nicht lesbar</value>
563563
</data>
564-
<data name="MalformedAnnotationInspectionMeta">
564+
<data name="MalformedAnnotationInspectionMeta" xml:space="preserve">
565565
<value>Eine Annotation in einem Kommentar konnte nicht gelesen werden.</value>
566566
</data>
567-
</root>
567+
</root>

RetailCoder.VBE/Inspections/InspectionsUI.fr.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@
274274
<value>'Option Base 1' est spécifié</value>
275275
</data>
276276
<data name="OptionExplicitInspectionMeta" xml:space="preserve">
277-
<value>Rubberduck ne peut pas voir les variables qui ne sont pas déclarées, et VBA n'aura aucun problème à compiler une erreur typographique: utilisez 'Option Explicit' pour prévenir la compilation d'un programme erroné.</value>
277+
<value>VBA n'aura aucun problème à compiler une erreur typographique: utilisez 'Option Explicit' pour prévenir la compilation d'un programme erroné.</value>
278278
</data>
279279
<data name="OptionExplicitInspectionName" xml:space="preserve">
280280
<value>'Option Explicit' n'est pas spécifiée.</value>

RetailCoder.VBE/Inspections/InspectionsUI.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@
274274
<value>'Option Base 1' is specified</value>
275275
</data>
276276
<data name="OptionExplicitInspectionMeta" xml:space="preserve">
277-
<value>Rubberduck cannot see variables that aren't declared. VBA will happily compile a typo: use 'Option Explicit' to prevent successfully compiling an erroneous program.</value>
277+
<value>VBA will happily compile a typo: use 'Option Explicit' to prevent successfully compiling an erroneous program.</value>
278278
</data>
279279
<data name="OptionExplicitInspectionName" xml:space="preserve">
280280
<value>'Option Explicit' is not specified</value>

RetailCoder.VBE/Inspections/Inspector.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Threading;
66
using System.Threading.Tasks;
77
using Antlr4.Runtime.Tree;
8+
using NLog;
89
using Rubberduck.Parsing;
910
using Rubberduck.Parsing.Grammar;
1011
using Rubberduck.Parsing.VBA;
@@ -64,9 +65,9 @@ public async Task<IEnumerable<ICodeInspectionResult>> FindIssuesAsync(Rubberduck
6465

6566
// Prepare ParseTreeWalker based inspections
6667
var parseTreeWalkResults = GetParseTreeResults(config, state);
67-
foreach (var parseTreeInspection in _inspections.Where(inspection => inspection.Severity != CodeInspectionSeverity.DoNotShow && inspection is IParseTreeInspection))
68+
foreach (var parseTreeInspection in _inspections.OfType<IParseTreeInspection>().Where(inspection => inspection.Severity != CodeInspectionSeverity.DoNotShow))
6869
{
69-
(parseTreeInspection as IParseTreeInspection).ParseTreeResults = parseTreeWalkResults;
70+
parseTreeInspection.ParseTreeResults = parseTreeWalkResults;
7071
}
7172

7273
var inspections = _inspections.Where(inspection => inspection.Severity != CodeInspectionSeverity.DoNotShow)
@@ -82,7 +83,14 @@ public async Task<IEnumerable<ICodeInspectionResult>> FindIssuesAsync(Rubberduck
8283
}
8384
}, token)).ToList();
8485

85-
await Task.WhenAll(inspections);
86+
try
87+
{
88+
await Task.WhenAll(inspections);
89+
}
90+
catch (Exception e)
91+
{
92+
LogManager.GetCurrentClassLogger().Error(e);
93+
}
8694
state.OnStatusMessageUpdate(RubberduckUI.ResourceManager.GetString("ParserState_" + state.Status, UI.Settings.Settings.Culture)); // should be "Ready"
8795
return allIssues;
8896
}

RetailCoder.VBE/Inspections/ParameterCanBeByValInspection.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.Collections.Generic;
23
using System.Linq;
34
using Rubberduck.Common;
@@ -63,11 +64,12 @@ private IEnumerable<ParameterCanBeByValInspectionResult> GetResults(List<Declara
6364
{
6465
var declarationParameters =
6566
declarations.Where(d => d.DeclarationType == DeclarationType.Parameter &&
66-
d.ParentDeclaration == declaration)
67+
Equals(d.ParentDeclaration, declaration))
6768
.OrderBy(o => o.Selection.StartLine)
6869
.ThenBy(t => t.Selection.StartColumn)
6970
.ToList();
7071

72+
if (!declarationParameters.Any()) { continue; }
7173
var parametersAreByRef = declarationParameters.Select(s => true).ToList();
7274

7375
var members = declarationMembers.Any(a => a.DeclarationType == DeclarationType.Event)
@@ -78,16 +80,17 @@ private IEnumerable<ParameterCanBeByValInspectionResult> GetResults(List<Declara
7880
{
7981
var parameters =
8082
declarations.Where(d => d.DeclarationType == DeclarationType.Parameter &&
81-
d.ParentDeclaration == member)
83+
Equals(d.ParentDeclaration, member))
8284
.OrderBy(o => o.Selection.StartLine)
8385
.ThenBy(t => t.Selection.StartColumn)
8486
.ToList();
8587

8688
for (var i = 0; i < parameters.Count; i++)
8789
{
88-
parametersAreByRef[i] = parametersAreByRef[i] && !IsUsedAsByRefParam(declarations, parameters[i]) &&
89-
((VBAParser.ArgContext)parameters[i].Context).BYVAL() == null &&
90-
!parameters[i].References.Any(reference => reference.IsAssignment);
90+
parametersAreByRef[i] = parametersAreByRef[i] &&
91+
!IsUsedAsByRefParam(declarations, parameters[i]) &&
92+
((VBAParser.ArgContext) parameters[i].Context).BYVAL() == null &&
93+
!parameters[i].References.Any(reference => reference.IsAssignment);
9194
}
9295
}
9396

RetailCoder.VBE/Refactorings/EncapsulateField/EncapsulateFieldRefactoring.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ private string GetPropertyText()
231231
(_model.ImplementSetSetterType ? setterText : string.Empty)).TrimEnd() + Environment.NewLine;
232232

233233
var propertyTextLines = propertyText.Split(new[] {Environment.NewLine}, StringSplitOptions.None);
234-
return string.Join(Environment.NewLine, _indenter.Indent(propertyTextLines, "test", false));
234+
return string.Join(Environment.NewLine, _indenter.Indent(propertyTextLines, "test"));
235235
}
236236
}
237237
}

RetailCoder.VBE/Refactorings/ExtractMethod/ExtractMethodPresenter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private void GeneratePreview(IExtractMethodModel extractMethodModel,IExtractMeth
8585
*/
8686
var extractedMethod = extractMethodProc.createProc(extractMethodModel);
8787
var code = extractedMethod.Split(new[]{Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries);
88-
code = _indenter.Indent(code, "Preview", false).ToArray();
88+
code = _indenter.Indent(code, "Preview").ToArray();
8989
_view.Preview = string.Join(Environment.NewLine, code);
9090
}
9191
}

RetailCoder.VBE/Root/RubberduckModule.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ public override void Load()
6464
Bind<Sinks>().ToSelf().InSingletonScope();
6565
Bind<App>().ToSelf().InSingletonScope();
6666
Bind<RubberduckParserState>().ToSelf().InSingletonScope();
67-
Bind<GitProvider>().ToSelf().InSingletonScope();
67+
Bind<ISourceControlProvider>().To<GitProvider>();
68+
//Bind<GitProvider>().ToSelf().InSingletonScope();
6869
Bind<TestExplorerModel>().ToSelf().InSingletonScope();
6970
Bind<IOperatingSystem>().To<WindowsOperatingSystem>().InSingletonScope();
7071

RetailCoder.VBE/UI/Command/MenuItems/CodePaneRefactorRenameCommandMenuItem.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System.Windows.Input;
21
using Rubberduck.Parsing.VBA;
32
using Rubberduck.UI.Command.MenuItems.ParentMenus;
43

0 commit comments

Comments
 (0)