Skip to content

Commit fbcce0d

Browse files
authored
Merge pull request #5330 from retailcoder/next
QuickFix xmldoc
2 parents 2640339 + 827c154 commit fbcce0d

File tree

60 files changed

+1740
-27
lines changed

Some content is hidden

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

60 files changed

+1740
-27
lines changed

Rubberduck.CodeAnalysis/Inspections/Concrete/BooleanAssignedInIfElseInspection.cs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,30 @@
1414
namespace Rubberduck.Inspections.Concrete
1515
{
1616
/// <summary>
17-
/// Identifies redundant Boolean expressions in conditionals.
17+
/// Identifies conditional assignments to mutually exclusive Boolean literal values in conditional branches.
1818
/// </summary>
1919
/// <why>
20-
/// A Boolean expression never needs to be compared to a Boolean literal in a conditional expression.
20+
/// The assignment could be made directly to the result of the conditional Boolean expression instead.
2121
/// </why>
2222
/// <example hasResults="true">
2323
/// <![CDATA[
24-
/// Public Sub DoSomething(ByVal foo As Boolean)
25-
/// If foo = True Then ' foo is known to already be a Boolean value.
26-
/// ' ...
24+
/// Public Sub DoSomething(ByVal value As Long)
25+
/// Dim result As Boolean
26+
/// If value > 10 Then
27+
/// result = True
28+
/// Else
29+
/// result = False
2730
/// End If
31+
/// Debug.Print result
2832
/// End Sub
2933
/// ]]>
3034
/// </example>
3135
/// <example hasResults="false">
3236
/// <![CDATA[
33-
/// Public Sub DoSomething(ByVal foo As Boolean)
34-
/// If foo Then
35-
/// ' ...
36-
/// End If
37+
/// Public Sub DoSomething(ByVal value As Long)
38+
/// Dim result As Boolean
39+
/// result = value > 10
40+
/// Debug.Print result
3741
/// End Sub
3842
/// ]]>
3943
/// </example>

Rubberduck.CodeAnalysis/Inspections/Concrete/EmptyIfBlockInspection.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,12 @@
33
using Rubberduck.Inspections.Abstract;
44
using Rubberduck.Inspections.Results;
55
using Rubberduck.Parsing;
6-
using Rubberduck.Parsing.Common;
76
using Rubberduck.Parsing.Grammar;
87
using Rubberduck.Parsing.Inspections.Abstract;
98
using Rubberduck.Resources.Inspections;
10-
using Rubberduck.Resources.Experimentals;
119
using Rubberduck.Parsing.VBA;
1210
using System.Collections.Generic;
1311
using System.Linq;
14-
using Rubberduck.Inspections.Inspections.Extensions;
1512

1613
namespace Rubberduck.Inspections.Concrete
1714
{
@@ -40,7 +37,6 @@ namespace Rubberduck.Inspections.Concrete
4037
/// End Sub
4138
/// ]]>
4239
/// </example>
43-
[Experimental(nameof(ExperimentalNames.EmptyBlockInspections))]
4440
internal class EmptyIfBlockInspection : ParseTreeInspectionBase
4541
{
4642
public EmptyIfBlockInspection(RubberduckParserState state)

Rubberduck.CodeAnalysis/QuickFixes/AccessSheetUsingCodeNameQuickFix.cs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,32 @@
1111

1212
namespace Rubberduck.Inspections.QuickFixes
1313
{
14-
public sealed class AccessSheetUsingCodeNameQuickFix : QuickFixBase
14+
/// <summary>
15+
/// Modifies a Workbook.Worksheets or Workbook.Sheets call accessing a sheet of ThisWorkbook that exists at compile-time.
16+
/// </summary>
17+
/// <inspections>
18+
/// <inspection name="SheetAccessedUsingStringInspection" />
19+
/// </inspections>
20+
/// <canfix procedure="true" module="true" project="true" />
21+
/// <example>
22+
/// <before>
23+
/// <![CDATA[
24+
/// Public Sub DoSomething()
25+
/// Dim sheet As Worksheet
26+
/// Set sheet = ThisWorkbook.Sheets("Sheet1")
27+
/// End Sub
28+
/// ]]>
29+
/// </before>
30+
/// <after>
31+
/// <![CDATA[
32+
/// Public Sub DoSomething()
33+
/// Dim sheet As Worksheet
34+
/// Set sheet = Sheet1 '<~ note: local variable becomes redundant
35+
/// End Sub
36+
/// ]]>
37+
/// </after>
38+
/// </example>
39+
public sealed class AccessSheetUsingCodeNameQuickFix : QuickFixBase // fixme: rename as per action(s), not the inspection that uses it
1540
{
1641
private readonly IDeclarationFinderProvider _declarationFinderProvider;
1742

Rubberduck.CodeAnalysis/QuickFixes/AddAttributeAnnotationQuickFix.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,42 @@
1010

1111
namespace Rubberduck.Inspections.QuickFixes
1212
{
13+
/// <summary>
14+
/// Adds an annotation comment to document the presence of a hidden module or member attribute.
15+
/// </summary>
16+
/// <inspections>
17+
/// <inspection name="MissingModuleAnnotationInspection" />
18+
/// <inspection name="MissingMemberAnnotationInspection" />
19+
/// </inspections>
20+
/// <canfix procedure="true" module="true" project="true" />
21+
/// <example>
22+
/// <before>
23+
/// <![CDATA[
24+
/// Attribute VB_PredeclaredId = True
25+
///
26+
/// Option Explicit
27+
///
28+
/// Public Sub DoSomething()
29+
/// Attribute VB_Description = "Does something."
30+
///
31+
/// End Sub
32+
/// ]]>
33+
/// </before>
34+
/// <after>
35+
/// <![CDATA[
36+
/// Attribute VB_PredeclaredId = True
37+
/// '@PredeclaredId
38+
///
39+
/// Option Explicit
40+
///
41+
/// '@Description("Does something.")
42+
/// Public Sub DoSomething()
43+
/// Attribute VB_Description = "Does something."
44+
///
45+
/// End Sub
46+
/// ]]>
47+
/// </after>
48+
/// </example>
1349
public class AddAttributeAnnotationQuickFix : QuickFixBase
1450
{
1551
private readonly IAnnotationUpdater _annotationUpdater;

Rubberduck.CodeAnalysis/QuickFixes/AddIdentifierToWhiteListQuickFix.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@
88

99
namespace Rubberduck.Inspections.QuickFixes
1010
{
11+
/// <summary>
12+
/// Adds an identifier or Hungarian Notation prefix to a list of white-listed identifiers and prefixes in Rubberduck's inspection settings.
13+
/// </summary>
14+
/// <inspections>
15+
/// <inspection name="HungarianNotationInspection" />
16+
/// <inspection name="UseMeaningfulNameInspection" />
17+
/// </inspections>
18+
/// <canfix procedure="false" module="false" project="false" />
1119
public sealed class AddIdentifierToWhiteListQuickFix : QuickFixBase
1220
{
1321
private readonly IConfigurationService<CodeInspectionSettings> _settings;

Rubberduck.CodeAnalysis/QuickFixes/AddMissingAttributeQuickFix.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,39 @@
99

1010
namespace Rubberduck.Inspections.QuickFixes
1111
{
12+
/// <summary>
13+
/// Exports the module, adds the hidden attributes as needed, re-imports the temporary file back into the project.
14+
/// </summary>
15+
/// <inspections>
16+
/// <inspection name="MissingAttributeInspection" />
17+
/// </inspections>
18+
/// <canfix procedure="true" module="true" project="true" />
19+
/// <example>
20+
/// <before>
21+
/// <![CDATA[
22+
/// '@ModuleDescription("Just a module.")
23+
/// Option Explicit
24+
///
25+
/// '@Description("Does something.")
26+
/// Public Sub DoSomething()
27+
///
28+
/// End Sub
29+
/// ]]>
30+
/// </before>
31+
/// <after>
32+
/// <![CDATA[
33+
/// Attribute VB_Description = "Just a module."
34+
/// '@ModuleDescription("Just a module.")
35+
/// Option Explicit
36+
///
37+
/// '@Description("Does something.")
38+
/// Public Sub DoSomething()
39+
/// Attribute VB_Description = "Does something."
40+
///
41+
/// End Sub
42+
/// ]]>
43+
/// </after>
44+
/// </example>
1245
public sealed class AddMissingAttributeQuickFix : QuickFixBase
1346
{
1447
private readonly IAttributesUpdater _attributesUpdater;

Rubberduck.CodeAnalysis/QuickFixes/AddStepOneQuickFix.cs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,35 @@
77

88
namespace Rubberduck.Inspections.QuickFixes
99
{
10+
/// <summary>
11+
/// Adds an explicit Step specifier to a For loop instruction.
12+
/// </summary>
13+
/// <inspections>
14+
/// <inspection name="StepIsNotSpecifiedInspection" />
15+
/// </inspections>
16+
/// <canfix procedure="true" module="true" project="true" />
17+
/// <example>
18+
/// <before>
19+
/// <![CDATA[
20+
/// Public Sub DoSomething()
21+
/// Dim i As Long
22+
/// For i = 1 To 10
23+
/// Debug.Print i
24+
/// Next
25+
/// End Sub
26+
/// ]]>
27+
/// </before>
28+
/// <after>
29+
/// <![CDATA[
30+
/// Public Sub DoSomething()
31+
/// Dim i As Long
32+
/// For i = 1 To 10 Step 1
33+
/// Debug.Print i
34+
/// Next
35+
/// End Sub
36+
/// ]]>
37+
/// </after>
38+
/// </example>
1039
public sealed class AddStepOneQuickFix : QuickFixBase
1140
{
1241
public AddStepOneQuickFix()

Rubberduck.CodeAnalysis/QuickFixes/AdjustAttributeAnnotationQuickFix.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,41 @@
1111

1212
namespace Rubberduck.Inspections.QuickFixes
1313
{
14+
/// <summary>
15+
/// Adjusts existing Rubberduck annotations to match the corresponding hidden attributes.
16+
/// </summary>
17+
/// <inspections>
18+
/// <inspection name="AttributeValueOutOfSyncInspection" />
19+
/// </inspections>
20+
/// <canfix procedure="true" module="true" project="true" />
21+
/// <example>
22+
/// <before>
23+
/// <![CDATA[
24+
/// Attribute VB_PredeclaredId = False
25+
/// '@PredeclaredId
26+
///
27+
/// Option Explicit
28+
///
29+
/// '@Description("Does something.")
30+
/// Public Sub DoSomething()
31+
/// Attribute VB_Description = "Does something else."
32+
///
33+
/// End Sub
34+
/// ]]>
35+
/// </before>
36+
/// <after>
37+
/// <![CDATA[
38+
///
39+
/// Option Explicit
40+
///
41+
/// '@Description("Does something else.")
42+
/// Public Sub DoSomething()
43+
/// Attribute VB_Description = "Does something else."
44+
///
45+
/// End Sub
46+
/// ]]>
47+
/// </after>
48+
/// </example>
1449
public class AdjustAttributeAnnotationQuickFix : QuickFixBase
1550
{
1651
private readonly IAnnotationUpdater _annotationUpdater;

Rubberduck.CodeAnalysis/QuickFixes/AdjustAttributeValuesQuickFix.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,43 @@
1212

1313
namespace Rubberduck.Inspections.QuickFixes
1414
{
15+
/// <summary>
16+
/// Adjusts existing hidden attributes to match the corresponding Rubberduck annotations.
17+
/// </summary>
18+
/// <inspections>
19+
/// <inspection name="AttributeValueOutOfSyncInspection" />
20+
/// </inspections>
21+
/// <canfix procedure="true" module="true" project="true" />
22+
/// <example>
23+
/// <before>
24+
/// <![CDATA[
25+
/// Attribute VB_PredeclaredId = False
26+
/// '@PredeclaredId
27+
///
28+
/// Option Explicit
29+
///
30+
/// '@Description("Does something.")
31+
/// Public Sub DoSomething()
32+
/// Attribute VB_Description = "Does something else."
33+
///
34+
/// End Sub
35+
/// ]]>
36+
/// </before>
37+
/// <after>
38+
/// <![CDATA[
39+
/// Attribute VB_PredeclaredId = True
40+
/// '@PredeclaredId
41+
///
42+
/// Option Explicit
43+
///
44+
/// '@Description("Does something.")
45+
/// Public Sub DoSomething()
46+
/// Attribute VB_Description = "Does something."
47+
///
48+
/// End Sub
49+
/// ]]>
50+
/// </after>
51+
/// </example>
1552
public class AdjustAttributeValuesQuickFix : QuickFixBase
1653
{
1754
private readonly IAttributesUpdater _attributesUpdater;

Rubberduck.CodeAnalysis/QuickFixes/ApplicationWorksheetFunctionQuickFix.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,29 @@
55

66
namespace Rubberduck.Inspections.QuickFixes
77
{
8+
/// <summary>
9+
/// Replaces a late-bound Application.{Member} call to the corresponding early-bound Application.WorksheetFunction.{Member} call.
10+
/// </summary>
11+
/// <inspections>
12+
/// <inspection name="ApplicationWorksheetFunctionInspection" />
13+
/// </inspections>
14+
/// <canfix procedure="true" module="true" project="true" />
15+
/// <example>
16+
/// <before>
17+
/// <![CDATA[
18+
/// Public Sub DoSomething()
19+
/// Debug.Print Application.Sum(Sheet1.Range("A1:A10"))
20+
/// End Sub
21+
/// ]]>
22+
/// </before>
23+
/// <after>
24+
/// <![CDATA[
25+
/// Public Sub DoSomething()
26+
/// Debug.Print Application.WorksheetFunction.Sum(Sheet1.Range("A1:A10"))
27+
/// End Sub
28+
/// ]]>
29+
/// </after>
30+
/// </example>
831
public sealed class ApplicationWorksheetFunctionQuickFix : QuickFixBase
932
{
1033
public ApplicationWorksheetFunctionQuickFix()

0 commit comments

Comments
 (0)