Skip to content

Commit

Permalink
changed wording of inspection results to include DeclarationType.
Browse files Browse the repository at this point in the history
  • Loading branch information
retailcoder committed Apr 9, 2015
1 parent 54b3b76 commit f8dd4e2
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
36 changes: 18 additions & 18 deletions RetailCoder.VBE/Inspections/InspectionNames.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions RetailCoder.VBE/Inspections/InspectionNames.resx
Expand Up @@ -156,9 +156,6 @@
<data name="ObsoleteLet" xml:space="preserve">
<value>Use of obsolete Let statement</value>
</data>
<data name="ObsoleteTypeHint_" xml:space="preserve">
<value>Use of obsolete type hints in identifier '{0}'</value>
</data>
<data name="OptionBase" xml:space="preserve">
<value>Potentially confusing implicit array lower bound</value>
</data>
Expand Down Expand Up @@ -186,7 +183,10 @@
<data name="VariableNotUsed_" xml:space="preserve">
<value>Variable '{0}' is never used</value>
</data>
<data name="VariableTypeNotDeclared_" xml:space="preserve">
<value>Variable '{0}' is implicitly Variant</value>
<data name="_ObsoleteTypeHint_" xml:space="preserve">
<value>Use of obsolete type hint in {0} '{1}'</value>
</data>
<data name="_TypeNotDeclared_" xml:space="preserve">
<value>{0} '{1}' is implicitly Variant</value>
</data>
</root>
6 changes: 3 additions & 3 deletions RetailCoder.VBE/Inspections/ObsoleteTypeHintInspection.cs
Expand Up @@ -11,19 +11,19 @@ public ObsoleteTypeHintInspection()
Severity = CodeInspectionSeverity.Hint;
}

public string Name { get { return InspectionNames.ObsoleteTypeHint_; } }
public string Name { get { return InspectionNames._ObsoleteTypeHint_; } }
public CodeInspectionType InspectionType { get { return CodeInspectionType.LanguageOpportunities; } }
public CodeInspectionSeverity Severity { get; set; }

public IEnumerable<CodeInspectionResultBase> GetInspectionResults(VBProjectParseResult parseResult)
{
var declarations = from item in parseResult.Declarations.Items
where item.HasTypeHint()
select new ObsoleteTypeHintInspectionResult(string.Format(Name, item.IdentifierName), Severity, new QualifiedContext(item.QualifiedName, item.Context));
select new ObsoleteTypeHintInspectionResult(string.Format(Name, item.DeclarationType, item.IdentifierName), Severity, new QualifiedContext(item.QualifiedName, item.Context), item);

var references = from item in parseResult.Declarations.Items.SelectMany(d => d.References)
where item.HasTypeHint()
select new ObsoleteTypeHintInspectionResult(string.Format(Name, item.IdentifierName), Severity, new QualifiedContext(item.QualifiedModuleName, item.Context));
select new ObsoleteTypeHintInspectionResult(string.Format(Name, "usage of " + item.Declaration.DeclarationType.ToString().ToLower(), item.IdentifierName), Severity, new QualifiedContext(item.QualifiedModuleName, item.Context), item.Declaration);

return declarations.Union(references);
}
Expand Down
Expand Up @@ -13,7 +13,7 @@ public VariableTypeNotDeclaredInspection()
Severity = CodeInspectionSeverity.Suggestion;
}

public string Name { get { return InspectionNames.VariableTypeNotDeclared_; } }
public string Name { get { return InspectionNames._TypeNotDeclared_; } }
public CodeInspectionType InspectionType { get { return CodeInspectionType.LanguageOpportunities; } }
public CodeInspectionSeverity Severity { get; set; }

Expand All @@ -23,7 +23,7 @@ public IEnumerable<CodeInspectionResultBase> GetInspectionResults(VBProjectParse
where (item.DeclarationType == DeclarationType.Variable
|| item.DeclarationType == DeclarationType.Constant)
&& !item.IsTypeSpecified()
select new VariableTypeNotDeclaredInspectionResult(string.Format(Name, item.IdentifierName), Severity, item.Context, item.QualifiedName.QualifiedModuleName);
select new VariableTypeNotDeclaredInspectionResult(string.Format(Name, item.DeclarationType, item.IdentifierName), Severity, item.Context, item.QualifiedName.QualifiedModuleName);

return issues;
}
Expand Down

0 comments on commit f8dd4e2

Please sign in to comment.