Skip to content

Commit 8c562cf

Browse files
authored
Merge pull request #2441 from comintern/next
Add test for borked resolver, fix #2440
2 parents a2580e1 + 3e5f0f4 commit 8c562cf

File tree

178 files changed

+501
-368
lines changed

Some content is hidden

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

178 files changed

+501
-368
lines changed

RetailCoder.VBE/API/ParserState.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
using Rubberduck.Parsing.Preprocessing;
1010
using System.Globalization;
1111
using Rubberduck.Parsing.Symbols;
12-
using Rubberduck.VBEditor;
13-
using Rubberduck.VBEditor.Events;
1412
using Rubberduck.VBEditor.SafeComWrappers.VBA;
1513

1614
namespace Rubberduck.API

RetailCoder.VBE/Common/Hotkeys/Hotkey.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Windows.Forms;
4-
using System.Windows.Input;
54
using Rubberduck.Common.WinAPI;
65
using NLog;
76
using Rubberduck.UI;

RetailCoder.VBE/Common/Hotkeys/IHotkey.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System.Windows.Forms;
2-
using System.Windows.Input;
32
using Rubberduck.UI.Command;
43

54
namespace Rubberduck.Common.Hotkeys

RetailCoder.VBE/Common/StringExtensions.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
using System;
2-
using System.Collections.Generic;
32
using System.Globalization;
4-
using System.Linq;
5-
using System.Text;
6-
using System.Threading.Tasks;
73

84
namespace Rubberduck.Common
95
{

RetailCoder.VBE/Inspections/Concrete/Inspector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private void UpdateInspectionSeverity(Configuration config)
4343
{
4444
foreach (var setting in config.UserSettings.CodeInspectionSettings.CodeInspections)
4545
{
46-
if (inspection.Description == setting.Description)
46+
if (inspection.Name == setting.Name)
4747
{
4848
inspection.Severity = setting.Severity;
4949
}

RetailCoder.VBE/Inspections/EmptyStringLiteralInspection.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Collections.Generic;
22
using System.Linq;
3-
using Antlr4.Runtime;
43
using Rubberduck.Inspections.Abstract;
54
using Rubberduck.Inspections.Resources;
65
using Rubberduck.Inspections.Results;
@@ -20,7 +19,7 @@ public EmptyStringLiteralInspection(RubberduckParserState state)
2019
}
2120

2221
public override string Meta { get { return InspectionsUI.EmptyStringLiteralInspectionMeta; } }
23-
public override string Description { get { return InspectionsUI.EmptyStringLiteralInspection; } }
22+
public override string Description { get { return InspectionsUI.EmptyStringLiteralInspectionName; } }
2423
public override CodeInspectionType InspectionType { get { return CodeInspectionType.LanguageOpportunities; } }
2524

2625
public IEnumerable<QualifiedContext<VBAParser.LiteralExpressionContext>> ParseTreeResults { get { return _parseTreeResults.OfType<QualifiedContext<VBAParser.LiteralExpressionContext>>(); } }

RetailCoder.VBE/Inspections/ImplicitActiveSheetReferenceInspection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public ImplicitActiveSheetReferenceInspection(IVBE vbe, RubberduckParserState st
2121
}
2222

2323
public override string Meta { get { return InspectionsUI.ImplicitActiveSheetReferenceInspectionMeta; } }
24-
public override string Description { get { return InspectionsUI.ImplicitActiveSheetReferenceInspectionResultFormat; } }
24+
public override string Description { get { return InspectionsUI.ImplicitActiveSheetReferenceInspectionName; } }
2525
public override CodeInspectionType InspectionType { get { return CodeInspectionType.MaintainabilityAndReadabilityIssues; } }
2626

2727
private static readonly string[] Targets =

RetailCoder.VBE/Inspections/ImplicitActiveWorkbookReferenceInspection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public ImplicitActiveWorkbookReferenceInspection(IVBE vbe, RubberduckParserState
2121
}
2222

2323
public override string Meta { get { return InspectionsUI.ImplicitActiveWorkbookReferenceInspectionMeta; } }
24-
public override string Description { get { return InspectionsUI.ImplicitActiveWorkbookReferenceInspectionResultFormat; } }
24+
public override string Description { get { return InspectionsUI.ImplicitActiveWorkbookReferenceInspectionName; } }
2525
public override CodeInspectionType InspectionType { get { return CodeInspectionType.MaintainabilityAndReadabilityIssues; } }
2626

2727
private static readonly string[] Targets =
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using System.Collections.Generic;
2+
using System.Linq;
3+
using Rubberduck.Inspections.Abstract;
4+
using Rubberduck.Inspections.Resources;
5+
using Rubberduck.Inspections.Results;
6+
using Rubberduck.Parsing.Grammar;
7+
using Rubberduck.Parsing.Symbols;
8+
using Rubberduck.Parsing.VBA;
9+
10+
namespace Rubberduck.Inspections
11+
{
12+
public sealed class ImplicitDefaultMemberAssignmentInspection : InspectionBase
13+
{
14+
public ImplicitDefaultMemberAssignmentInspection(RubberduckParserState state)
15+
: base(state, CodeInspectionSeverity.Suggestion)
16+
{
17+
}
18+
19+
public override IEnumerable<InspectionResultBase> GetInspectionResults()
20+
{
21+
var interestingDeclarations =
22+
State.AllDeclarations.Where(item =>
23+
item.AsTypeDeclaration != null
24+
&& ClassModuleDeclaration.HasDefaultMember(item.AsTypeDeclaration));
25+
26+
var interestingReferences = interestingDeclarations
27+
.SelectMany(declaration => declaration.References)
28+
.Where(reference =>
29+
{
30+
var letStmtContext = ParserRuleContextHelper.GetParent<VBAParser.LetStmtContext>(reference.Context);
31+
return reference.IsAssignment && letStmtContext != null && letStmtContext.LET() == null;
32+
});
33+
34+
return interestingReferences.Select(reference => new ImplicitDefaultMemberAssignmentInspectionResult(this, reference));
35+
}
36+
37+
public override string Meta { get { return InspectionsUI.ImplicitDefaultMemberAssignmentInspectionMeta; } }
38+
public override string Description { get { return InspectionsUI.ImplicitDefaultMemberAssignmentInspectionName; } }
39+
public override CodeInspectionType InspectionType { get { return CodeInspectionType.MaintainabilityAndReadabilityIssues; } }
40+
}
41+
}

RetailCoder.VBE/Inspections/MissingAnnotationArgumentInspection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public MissingAnnotationArgumentInspection(RubberduckParserState state)
2020
}
2121

2222
public override string Meta { get { return InspectionsUI.MissingAnnotationArgumentInspectionMeta; } }
23-
public override string Description { get { return InspectionsUI.MissingAnnotationArgumentInspectionResultFormat; } }
23+
public override string Description { get { return InspectionsUI.MissingAnnotationArgumentInspectionName; } }
2424
public override CodeInspectionType InspectionType { get { return CodeInspectionType.CodeQualityIssues; } }
2525
public IEnumerable<QualifiedContext<VBAParser.AnnotationContext>> ParseTreeResults { get { return _parseTreeResults.OfType<QualifiedContext<VBAParser.AnnotationContext>>(); } }
2626

0 commit comments

Comments
 (0)