Skip to content

Commit 7d8cfd9

Browse files
authored
Merge pull request #3573 from IvenBach/Rubberdeck.Inspections_C#6&7_Update
C#6/C#7 technical debt payment
2 parents 8657b1c + a60871b commit 7d8cfd9

File tree

105 files changed

+223
-422
lines changed

Some content is hidden

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

105 files changed

+223
-422
lines changed

Rubberduck.Inspections/Abstract/InspectionBase.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected InspectionBase(RubberduckParserState state, CodeInspectionSeverity def
3636
/// <summary>
3737
/// Gets a localized string representing a short name/description for the inspection.
3838
/// </summary>
39-
public virtual string Description => InspectionsUI.ResourceManager.GetString(Name + "Name", CultureInfo.CurrentUICulture);
39+
public virtual string Description => InspectionsUI.ResourceManager.GetString($"{Name}Name", CultureInfo.CurrentUICulture);
4040

4141
/// <summary>
4242
/// Gets the type of inspection; used for regrouping inspections.
@@ -56,13 +56,13 @@ protected InspectionBase(RubberduckParserState state, CodeInspectionSeverity def
5656
/// <summary>
5757
/// Meta-information about why an inspection exists.
5858
/// </summary>
59-
public virtual string Meta => InspectionsUI.ResourceManager.GetString(Name + "Meta", CultureInfo.CurrentUICulture);
59+
public virtual string Meta => InspectionsUI.ResourceManager.GetString($"{Name}Meta", CultureInfo.CurrentUICulture);
6060

6161
/// <summary>
6262
/// Gets a localized string representing the type of inspection.
6363
/// <see cref="InspectionType"/>
6464
/// </summary>
65-
public virtual string InspectionTypeName => InspectionsUI.ResourceManager.GetString("CodeInspectionSettings_" + InspectionType.ToString(), CultureInfo.CurrentUICulture);
65+
public virtual string InspectionTypeName => InspectionsUI.ResourceManager.GetString($"CodeInspectionSettings_{InspectionType.ToString()}", CultureInfo.CurrentUICulture);
6666

6767
/// <summary>
6868
/// Gets a string representing the text that must be present in an
@@ -112,9 +112,9 @@ protected bool IsIgnoringInspectionResultFor(QualifiedModuleName module, int lin
112112
return true;
113113
}
114114

115-
if (ignoreModuleAnnotation != null &&
116-
(ignoreModuleAnnotation.InspectionNames.Contains(AnnotationName) ||
117-
!ignoreModuleAnnotation.InspectionNames.Any()))
115+
if (ignoreModuleAnnotation != null
116+
&& (ignoreModuleAnnotation.InspectionNames.Contains(AnnotationName)
117+
|| !ignoreModuleAnnotation.InspectionNames.Any()))
118118
{
119119
return true;
120120
}

Rubberduck.Inspections/Abstract/InspectionResultBase.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,15 @@ public int CompareTo(IInspectionResult other)
5757
public string ToClipboardString()
5858
{
5959
var module = QualifiedSelection.QualifiedName;
60-
var documentName = Target != null ? Target.ProjectDisplayName : string.Empty;
60+
var documentName = Target != null
61+
? Target.ProjectDisplayName
62+
: string.Empty;
6163
if (string.IsNullOrEmpty(documentName))
6264
{
6365
var component = module.Component;
64-
documentName = component != null ? component.ParentProject.ProjectDisplayName : string.Empty;
66+
documentName = component != null
67+
? component.ParentProject.ProjectDisplayName
68+
: string.Empty;
6569
}
6670
if (string.IsNullOrEmpty(documentName))
6771
{
@@ -72,7 +76,7 @@ public string ToClipboardString()
7276
InspectionsUI.QualifiedSelectionInspection,
7377
Inspection.Severity,
7478
Description,
75-
"(" + documentName + ")",
79+
$"({documentName})",
7680
module.ProjectName,
7781
module.ComponentName,
7882
QualifiedSelection.Selection.StartLine);
@@ -81,7 +85,10 @@ public string ToClipboardString()
8185
private NavigateCodeEventArgs _navigationArgs;
8286
public NavigateCodeEventArgs GetNavigationArgs()
8387
{
84-
if (_navigationArgs != null) { return _navigationArgs; }
88+
if (_navigationArgs != null)
89+
{
90+
return _navigationArgs;
91+
}
8592

8693
_navigationArgs = new NavigateCodeEventArgs(QualifiedSelection);
8794
return _navigationArgs;

Rubberduck.Inspections/Concrete/ApplicationWorksheetFunctionInspection.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
1+
using System.Collections.Generic;
32
using System.Linq;
43
using Rubberduck.Inspections.Abstract;
54
using Rubberduck.Inspections.Results;

Rubberduck.Inspections/Concrete/AssignedByValParameterInspection.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.Collections.Generic;
32
using System.Linq;
43
using Rubberduck.Inspections.Abstract;

Rubberduck.Inspections/Concrete/BooleanAssignedInIfElseInspection.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
1+
using System.Collections.Generic;
32
using System.Linq;
43
using Antlr4.Runtime;
54
using Rubberduck.Inspections.Abstract;

Rubberduck.Inspections/Concrete/ConstantNotUsedInspection.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using System.Collections.Generic;
32
using System.Linq;
43
using Antlr4.Runtime;

Rubberduck.Inspections/Concrete/DefaultProjectNameInspection.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
1+
using System.Collections.Generic;
32
using System.Linq;
43
using Rubberduck.Inspections.Abstract;
54
using Rubberduck.Inspections.Results;

Rubberduck.Inspections/Concrete/EmptyBlockInspectionListenerBase.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,15 @@ public void AddResult(QualifiedContext<ParserRuleContext> qualifiedContext)
3535

3636
private bool BlockContainsExecutableStatements(VBAParser.BlockContext block)
3737
{
38-
return block != null && block.children != null && ContainsExecutableStatements(block);
38+
return block?.children != null && ContainsExecutableStatements(block);
3939
}
4040

4141
private bool ContainsExecutableStatements(VBAParser.BlockContext block)
4242
{
4343
foreach (var child in block.children)
4444
{
45-
if (child is VBAParser.BlockStmtContext)
45+
if (child is VBAParser.BlockStmtContext blockStmt)
4646
{
47-
var blockStmt = (VBAParser.BlockStmtContext)child;
4847
var mainBlockStmt = blockStmt.mainBlockStmt();
4948

5049
if (mainBlockStmt == null)

Rubberduck.Inspections/Concrete/EmptyCaseBlockInspection.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using Rubberduck.Parsing.Inspections.Abstract;
66
using Rubberduck.Parsing.Inspections.Resources;
77
using Rubberduck.Parsing.VBA;
8-
using System;
98
using System.Collections.Generic;
109
using System.Linq;
1110

Rubberduck.Inspections/Concrete/EmptyDoWhileBlockInspection.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using Rubberduck.Parsing.Inspections.Abstract;
66
using Rubberduck.Parsing.Inspections.Resources;
77
using Rubberduck.Parsing.VBA;
8-
using System;
98
using System.Collections.Generic;
109
using System.Linq;
1110

0 commit comments

Comments
 (0)