Skip to content
This repository was archived by the owner on Mar 8, 2026. It is now read-only.

Commit 20052b9

Browse files
authored
Merge pull request #2127 from rubberduck-vba/next
Release 2.0.7
2 parents 1d60053 + f2d2d67 commit 20052b9

147 files changed

Lines changed: 3755 additions & 1540 deletions

File tree

Some content is hidden

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

Installer Build Script.iss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ OutputDir={#OutputDirectory}
2727
OutputBaseFilename=Rubberduck.Setup.{#AppVersion}
2828
Compression=lzma
2929
SolidCompression=yes
30+
SignTool=RubberduckSignTool /d $qRubberduck Installer$q $f
3031

3132
ArchitecturesAllowed=x86 x64
3233
ArchitecturesInstallIn64BitMode=x64

RetailCoder.VBE/API/ParserState.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ public void Initialize(VBE vbe)
6363
throw new InvalidOperationException("ParserState is already initialized.");
6464
}
6565

66-
_state = new RubberduckParserState(vbe, new Sinks(vbe));
66+
_state = new RubberduckParserState(new Sinks(vbe));
6767
_state.StateChanged += _state_StateChanged;
6868

6969
Func<IVBAPreprocessor> preprocessorFactory = () => new VBAPreprocessor(double.Parse(vbe.Version, CultureInfo.InvariantCulture));
7070
_attributeParser = new AttributeParser(new ModuleExporter(), preprocessorFactory);
71-
_parser = new RubberduckParser(_state, _attributeParser, preprocessorFactory,
71+
_parser = new RubberduckParser(vbe, _state, _attributeParser, preprocessorFactory,
7272
new List<ICustomDeclarationLoader> { new DebugDeclarations(_state), new FormEventDeclarations(_state), new AliasDeclarations(_state) });
7373
}
7474

RetailCoder.VBE/Inspections/EncapsulatePublicFieldInspection.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@
55

66
namespace Rubberduck.Inspections
77
{
8+
using SmartIndenter;
9+
810
public sealed class EncapsulatePublicFieldInspection : InspectionBase
911
{
10-
public EncapsulatePublicFieldInspection(RubberduckParserState state)
12+
private readonly IIndenter _indenter;
13+
14+
public EncapsulatePublicFieldInspection(RubberduckParserState state, IIndenter indenter)
1115
: base(state, CodeInspectionSeverity.Suggestion)
1216
{
17+
_indenter = indenter;
1318
}
1419

1520
public override string Meta { get { return InspectionsUI.EncapsulatePublicFieldInspectionMeta; } }
@@ -21,7 +26,7 @@ public override IEnumerable<InspectionResultBase> GetInspectionResults()
2126
var issues = UserDeclarations
2227
.Where(declaration => declaration.DeclarationType == DeclarationType.Variable
2328
&& declaration.Accessibility == Accessibility.Public)
24-
.Select(issue => new EncapsulatePublicFieldInspectionResult(this, issue, State))
29+
.Select(issue => new EncapsulatePublicFieldInspectionResult(this, issue, State, _indenter))
2530
.ToList();
2631

2732
return issues;

RetailCoder.VBE/Inspections/EncapsulatePublicFieldInspectionResult.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,18 @@
99

1010
namespace Rubberduck.Inspections
1111
{
12+
using SmartIndenter;
13+
1214
public class EncapsulatePublicFieldInspectionResult : InspectionResultBase
1315
{
1416
private readonly IEnumerable<CodeInspectionQuickFix> _quickFixes;
1517

16-
public EncapsulatePublicFieldInspectionResult(IInspection inspection, Declaration target, RubberduckParserState state)
18+
public EncapsulatePublicFieldInspectionResult(IInspection inspection, Declaration target, RubberduckParserState state, IIndenter indenter)
1719
: base(inspection, target)
1820
{
1921
_quickFixes = new CodeInspectionQuickFix[]
2022
{
21-
new EncapsulateFieldQuickFix(target.Context, target.QualifiedSelection, target, state),
23+
new EncapsulateFieldQuickFix(target.Context, target.QualifiedSelection, target, state, indenter),
2224
new IgnoreOnceQuickFix(Context, QualifiedSelection, Inspection.AnnotationName)
2325
};
2426
}
@@ -38,22 +40,24 @@ public class EncapsulateFieldQuickFix : CodeInspectionQuickFix
3840
{
3941
private readonly Declaration _target;
4042
private readonly RubberduckParserState _state;
43+
private readonly IIndenter _indenter;
4144

42-
public EncapsulateFieldQuickFix(ParserRuleContext context, QualifiedSelection selection, Declaration target, RubberduckParserState state)
45+
public EncapsulateFieldQuickFix(ParserRuleContext context, QualifiedSelection selection, Declaration target, RubberduckParserState state, IIndenter indenter)
4346
: base(context, selection, string.Format(InspectionsUI.EncapsulatePublicFieldInspectionQuickFix, target.IdentifierName))
4447
{
4548
_target = target;
4649
_state = state;
50+
_indenter = indenter;
4751
}
4852

4953
public override void Fix()
5054
{
5155
var vbe = Selection.QualifiedName.Project.VBE;
5256

53-
using (var view = new EncapsulateFieldDialog())
57+
using (var view = new EncapsulateFieldDialog(_indenter))
5458
{
5559
var factory = new EncapsulateFieldPresenterFactory(vbe, _state, view);
56-
var refactoring = new EncapsulateFieldRefactoring(vbe, factory);
60+
var refactoring = new EncapsulateFieldRefactoring(vbe, _indenter, factory);
5761
refactoring.Refactor(_target);
5862
IsCancelled = view.DialogResult != DialogResult.OK;
5963
}

RetailCoder.VBE/Inspections/IParseTreeInspection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ public ParseTreeResults()
2525
public IEnumerable<QualifiedContext> ObsoleteLetContexts;
2626
public IEnumerable<QualifiedContext> ArgListsWithOneByRefParam;
2727
public IEnumerable<QualifiedContext> EmptyStringLiterals;
28-
public IEnumerable<QualifiedContext<VBAParser.AnnotationContext>> MalformedAnnotations;
28+
public IEnumerable<QualifiedContext> MalformedAnnotations;
2929
}
3030
}

RetailCoder.VBE/Inspections/InspectionsUI.Designer.cs

Lines changed: 1 addition & 1 deletion
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: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@
304304
<value>Variable wird genutzt ohne das ihr ein Wert zugewiesen wurde.</value>
305305
</data>
306306
<data name="UntypedFunctionUsageInspectionMeta" xml:space="preserve">
307-
<value>Eine gibt eine Funktion, die einen String Äquivalnet zurückgibt. Diese sollte bevorzugt genutzt werden, um implitizite Typumwandlungen zu vermeiden.</value>
307+
<value>Eine gibt eine Funktion, die einen String Äquivalent zurückgibt. Diese sollte bevorzugt genutzt werden, um implitizite Typumwandlungen zu vermeiden.
308+
Falls der Parameter 'null' sein kann, bitte dieses Auftreten ignorieren. 'null' an die Funktion zu übergeben, die einen String erwartet würde zu einem "Type Mismatch"-Laufzeitfehler führen.</value>
308309
</data>
309310
<data name="UntypedFunctionUsageInspectionName" xml:space="preserve">
310311
<value>Nutzung einer Funktion, die einen 'String Variant' zurückgibt.</value>
@@ -554,4 +555,13 @@
554555
<data name="MultipleDeclarationsInspectionResultFormat" xml:space="preserve">
555556
<value>Instruktion enthält Mehrfachdeklaration</value>
556557
</data>
558+
<data name="MalformedAnnotationInspectionName">
559+
<value>Unlesbare Annotation</value>
560+
</data>
561+
<data name="MalformedAnnotationInspectionResultFormat">
562+
<value>Annotation '{0}' ist nicht lesbar</value>
563+
</data>
564+
<data name="MalformedAnnotationInspectionMeta">
565+
<value>Eine Annotation in einem Kommentar konnte nicht gelesen werden.</value>
566+
</data>
557567
</root>

RetailCoder.VBE/Inspections/InspectionsUI.resx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@
304304
<value>Variable is used but not assigned</value>
305305
</data>
306306
<data name="UntypedFunctionUsageInspectionMeta" xml:space="preserve">
307-
<value>A string-returning equivalent function exists and should preferably be used to avoid implicit type conversions.</value>
307+
<value>A string-returning equivalent function exists and should preferably be used to avoid implicit type conversions.
308+
If the parameter can be null, ignore this inspection result; passing a null value to a function expecting a string would raise a type mismatch runtime error.</value>
308309
</data>
309310
<data name="UntypedFunctionUsageInspectionName" xml:space="preserve">
310311
<value>Use of variant-returning string function</value>
@@ -564,4 +565,4 @@
564565
<data name="MalformedAnnotationInspectionResultFormat" xml:space="preserve">
565566
<value>Malformed '{0}' annotation.</value>
566567
</data>
567-
</root>
568+
</root>

RetailCoder.VBE/Inspections/Inspector.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ public Inspector(IGeneralConfigService configService, IEnumerable<IInspection> i
2525
_inspections = inspections;
2626

2727
_configService = configService;
28-
configService.SettingsChanged += ConfigServiceLanguageChanged;
28+
configService.SettingsChanged += ConfigServiceSettingsChanged;
2929
}
3030

31-
private void ConfigServiceLanguageChanged(object sender, EventArgs e)
31+
private void ConfigServiceSettingsChanged(object sender, EventArgs e)
3232
{
3333
UpdateInspectionSeverity();
3434
}
@@ -125,7 +125,7 @@ public void Dispose()
125125
{
126126
if (_configService != null)
127127
{
128-
_configService.SettingsChanged -= ConfigServiceLanguageChanged;
128+
_configService.SettingsChanged -= ConfigServiceSettingsChanged;
129129
}
130130
}
131131
}

RetailCoder.VBE/Inspections/MalformedAnnotationInspection.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,18 @@ public override IEnumerable<InspectionResultBase> GetInspectionResults()
2727

2828
var results = new List<MalformedAnnotationInspectionResult>();
2929

30-
foreach (var context in ParseTreeResults.MalformedAnnotations)
30+
foreach (var result in ParseTreeResults.MalformedAnnotations)
3131
{
32-
if (context.Context.annotationName().GetText() == AnnotationType.Ignore.ToString() ||
33-
context.Context.annotationName().GetText() == AnnotationType.Folder.ToString())
32+
var context = (VBAParser.AnnotationContext)result.Context;
33+
34+
if (context.annotationName().GetText() == AnnotationType.Ignore.ToString() ||
35+
context.annotationName().GetText() == AnnotationType.Folder.ToString())
3436
{
35-
if (context.Context.annotationArgList() == null)
37+
if (context.annotationArgList() == null)
3638
{
3739
results.Add(new MalformedAnnotationInspectionResult(this,
38-
new QualifiedContext<VBAParser.AnnotationContext>(context.ModuleName,
39-
context.Context)));
40+
new QualifiedContext<VBAParser.AnnotationContext>(result.ModuleName,
41+
context)));
4042
}
4143
}
4244
}

0 commit comments

Comments
 (0)