Skip to content

Commit 499ad93

Browse files
committed
Rubberduck.Inspections
1 parent 26d3dfb commit 499ad93

File tree

3 files changed

+29
-9
lines changed

3 files changed

+29
-9
lines changed

Rubberduck.Inspections/Inspector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class Inspector : IInspector
2525

2626
private readonly IGeneralConfigService _configService;
2727
private readonly List<IInspection> _inspections;
28-
private readonly int AGGREGATION_THRESHOLD = 128;
28+
private const int AGGREGATION_THRESHOLD = 128;
2929

3030
public Inspector(IGeneralConfigService configService, IEnumerable<IInspection> inspections)
3131
{

Rubberduck.Inspections/QuickFixProvider.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ public IEnumerable<IQuickFix> QuickFixes(IInspectionResult result)
4141

4242
return _quickFixes[result.Inspection.GetType()].Where(fix =>
4343
{
44-
string value;
45-
if (!result.Properties.TryGetValue("DisableFixes", out value)) { return true; }
44+
if (!result.Properties.TryGetValue("DisableFixes", out var value))
45+
{
46+
return true;
47+
}
4648

4749
return !value.Split(',').Contains(fix.GetType().Name);
4850
})

Rubberduck.Inspections/VariableRequiresSetAssignmentEvaluator.cs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,22 @@ public static IEnumerable<Declaration> GetDeclarationsPotentiallyRequiringSetAss
2222
public static bool RequiresSetAssignment(IdentifierReference reference, RubberduckParserState state)
2323
{
2424
//Not an assignment...definitely does not require a 'Set' assignment
25-
if (!reference.IsAssignment) { return false; }
25+
if (!reference.IsAssignment)
26+
{
27+
return false;
28+
}
2629

2730
//We know for sure it DOES NOT use 'Set'
28-
if (!MayRequireAssignmentUsingSet(reference.Declaration)) { return false; }
31+
if (!MayRequireAssignmentUsingSet(reference.Declaration))
32+
{
33+
return false;
34+
}
2935

3036
//We know for sure that it DOES use 'Set'
31-
if (RequiresAssignmentUsingSet(reference.Declaration)) { return true; }
37+
if (RequiresAssignmentUsingSet(reference.Declaration))
38+
{
39+
return true;
40+
}
3241

3342
//We need to look everything to understand the RHS - the assigned reference is probably a Variant
3443
var allInterestingDeclarations = GetDeclarationsPotentiallyRequiringSetAssignment(state.AllUserDeclarations);
@@ -38,11 +47,20 @@ public static bool RequiresSetAssignment(IdentifierReference reference, Rubberdu
3847

3948
private static bool MayRequireAssignmentUsingSet(Declaration declaration)
4049
{
41-
if (declaration.DeclarationType == DeclarationType.PropertyLet) { return false; }
50+
if (declaration.DeclarationType == DeclarationType.PropertyLet)
51+
{
52+
return false;
53+
}
4254

43-
if (declaration.AsTypeName == Tokens.Variant) { return true; }
55+
if (declaration.AsTypeName == Tokens.Variant)
56+
{
57+
return true;
58+
}
4459

45-
if (declaration.IsArray) { return false; }
60+
if (declaration.IsArray)
61+
{
62+
return false;
63+
}
4664

4765
if (declaration.AsTypeDeclaration != null)
4866
{

0 commit comments

Comments
 (0)