Skip to content

Commit 08cd556

Browse files
committed
fixed/standardized inspection names, result descriptions and UI bottom panel; added ImplicitDefaultMemberAssignmentInspection
1 parent a34755e commit 08cd556

34 files changed

+168
-41
lines changed

RetailCoder.VBE/Inspections/EmptyStringLiteralInspection.cs

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

2222
public override string Meta { get { return InspectionsUI.EmptyStringLiteralInspectionMeta; } }
23-
public override string Description { get { return InspectionsUI.EmptyStringLiteralInspection; } }
23+
public override string Description { get { return InspectionsUI.EmptyStringLiteralInspectionName; } }
2424
public override CodeInspectionType InspectionType { get { return CodeInspectionType.LanguageOpportunities; } }
2525

2626
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

RetailCoder.VBE/Inspections/MultipleDeclarationsInspection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public MultipleDeclarationsInspection(RubberduckParserState state)
1818
}
1919

2020
public override string Meta { get { return InspectionsUI.MultipleDeclarationsInspectionMeta; } }
21-
public override string Description { get { return InspectionsUI.MultipleDeclarationsInspectionResultFormat; } }
21+
public override string Description { get { return InspectionsUI.MultipleDeclarationsInspectionName; } }
2222
public override CodeInspectionType InspectionType { get { return CodeInspectionType.MaintainabilityAndReadabilityIssues; } }
2323

2424
public override IEnumerable<InspectionResultBase> GetInspectionResults()

RetailCoder.VBE/Inspections/MultipleFolderAnnotationsInspection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public MultipleFolderAnnotationsInspection(RubberduckParserState state)
1717
}
1818

1919
public override string Meta { get { return InspectionsUI.MultipleFolderAnnotationsInspectionMeta; } }
20-
public override string Description { get { return InspectionsUI.MultipleFolderAnnotationsInspectionResultFormat; } }
20+
public override string Description { get { return InspectionsUI.MultipleFolderAnnotationsInspectionName; } }
2121
public override CodeInspectionType InspectionType { get { return CodeInspectionType.MaintainabilityAndReadabilityIssues; } }
2222

2323
public override IEnumerable<InspectionResultBase> GetInspectionResults()

RetailCoder.VBE/Inspections/ObjectVariableNotSetInspection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public ObjectVariableNotSetInspection(RubberduckParserState state)
1717
}
1818

1919
public override string Meta { get { return InspectionsUI.ObjectVariableNotSetInspectionMeta; } }
20-
public override string Description { get { return InspectionsUI.ObjectVariableNotSetInspectionResultFormat; } }
20+
public override string Description { get { return InspectionsUI.ObjectVariableNotSetInspectionName; } }
2121
public override CodeInspectionType InspectionType { get { return CodeInspectionType.CodeQualityIssues; } }
2222

2323
private static readonly IReadOnlyList<string> ValueTypes = new[]

RetailCoder.VBE/Inspections/ObsoleteCallStatementInspection.cs

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

2121
public override string Meta { get { return InspectionsUI.ObsoleteCallStatementInspectionMeta; } }
22-
public override string Description { get { return InspectionsUI.ObsoleteCallStatementInspectionResultFormat; } }
22+
public override string Description { get { return InspectionsUI.ObsoleteCallStatementInspectionName; } }
2323
public override CodeInspectionType InspectionType { get { return CodeInspectionType.LanguageOpportunities; } }
2424

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

RetailCoder.VBE/Inspections/ObsoleteCommentSyntaxInspection.cs

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

2121
public override string Meta { get { return InspectionsUI.ObsoleteCommentSyntaxInspectionMeta; } }
22-
public override string Description { get { return InspectionsUI.ObsoleteCommentSyntaxInspectionResultFormat; } }
22+
public override string Description { get { return InspectionsUI.ObsoleteCommentSyntaxInspectionName; } }
2323
public override CodeInspectionType InspectionType { get {return CodeInspectionType.LanguageOpportunities; } }
2424

2525
public override IEnumerable<InspectionResultBase> GetInspectionResults()

0 commit comments

Comments
 (0)