Skip to content

Commit 5d3b03b

Browse files
committed
Add missing module elements to inspection xml-doc examples
Also makes this mandatory from now on.
1 parent 0745617 commit 5d3b03b

File tree

99 files changed

+491
-77
lines changed

Some content is hidden

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

99 files changed

+491
-77
lines changed

Rubberduck.CodeAnalysis/Inspections/Concrete/ArgumentWithIncompatibleObjectTypeInspection.cs

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,24 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete
1818
/// The VBA compiler does not check whether different object types are compatible. Instead there is a runtime error whenever the types are incompatible.
1919
/// </why>
2020
/// <example hasresult="true">
21+
/// <module name="Interface" type="Class Module">
2122
/// <![CDATA[
2223
/// IInterface:
2324
///
2425
/// Public Sub DoSomething()
2526
/// End Sub
26-
///
27-
/// ------------------------------
28-
/// Class1:
29-
///
30-
///'No Implements IInterface
27+
/// ]]>
28+
/// </module>
29+
/// <module name="Class1" type="Class Module">
30+
/// <![CDATA[
31+
/// 'No Implements IInterface
3132
///
3233
/// Public Sub DoSomething()
3334
/// End Sub
34-
///
35-
/// ------------------------------
36-
/// Module1:
37-
///
35+
/// ]]>
36+
/// </module>
37+
/// <module name="Module1" type="Standard Module">
38+
/// <![CDATA[
3839
/// Public Sub DoIt()
3940
/// Dim cls As Class1
4041
/// Set cls = New Class1
@@ -44,25 +45,27 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete
4445
/// Public Sub Foo(cls As IInterface)
4546
/// End Sub
4647
/// ]]>
48+
/// </module>
4749
/// </example>
4850
/// <example hasresult="false">
51+
/// <module name="Interface" type="Class Module">
4952
/// <![CDATA[
5053
/// IInterface:
5154
///
5255
/// Public Sub DoSomething()
5356
/// End Sub
54-
///
55-
/// ------------------------------
56-
/// Class1:
57-
///
57+
/// ]]>
58+
/// </module>
59+
/// <module name="Class1" type="Class Module">
60+
/// <![CDATA[
5861
/// Implements IInterface
5962
///
60-
/// Private Sub IInterface_DoSomething()
63+
/// Public Sub DoSomething()
6164
/// End Sub
62-
///
63-
/// ------------------------------
64-
/// Module1:
65-
///
65+
/// ]]>
66+
/// </module>
67+
/// <module name="Module1" type="Standard Module">
68+
/// <![CDATA[
6669
/// Public Sub DoIt()
6770
/// Dim cls As Class1
6871
/// Set cls = New Class1
@@ -72,6 +75,7 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete
7275
/// Public Sub Foo(cls As IInterface)
7376
/// End Sub
7477
/// ]]>
78+
/// </module>
7579
/// </example>
7680
internal class ArgumentWithIncompatibleObjectTypeInspection : ArgumentReferenceInspectionFromDeclarationsBase<string>
7781
{

Rubberduck.CodeAnalysis/Inspections/Concrete/AssignedByValParameterInspection.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,17 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete
1616
/// to be able to access the modified values, then the parameter should be passed ByRef; the ByVal modifier might be a bug.
1717
/// </why>
1818
/// <example hasResult="true">
19+
/// <module name="MyModule" type="Standard Module">
1920
/// <![CDATA[
2021
/// Public Sub DoSomething(ByVal foo As Long)
2122
/// foo = foo + 1 ' is the caller supposed to see the updated value?
2223
/// Debug.Print foo
2324
/// End Sub
2425
/// ]]>
26+
/// </module>
2527
/// </example>
2628
/// <example hasResult="false">
29+
/// <module name="MyModule" type="Standard Module">
2730
/// <![CDATA[
2831
/// Public Sub DoSomething(ByVal foo As Long)
2932
/// Dim bar As Long
@@ -32,6 +35,7 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete
3235
/// Debug.Print bar
3336
/// End Sub
3437
/// ]]>
38+
/// </module>
3539
/// </example>
3640
internal sealed class AssignedByValParameterInspection : DeclarationInspectionBase
3741
{

Rubberduck.CodeAnalysis/Inspections/Concrete/AssignmentNotUsedInspection.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,26 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete
2020
/// The first assignment is likely redundant, since it is being overwritten by the second.
2121
/// </why>
2222
/// <example hasResult="true">
23+
/// <module name="MyModule" type="Standard Module">
2324
/// <![CDATA[
2425
/// Public Sub DoSomething()
2526
/// Dim foo As Long
2627
/// foo = 12 ' assignment is redundant
2728
/// foo = 34
2829
/// End Sub
2930
/// ]]>
31+
/// </module>
3032
/// </example>
3133
/// <example hasResult="false">
34+
/// <module name="MyModule" type="Standard Module">
3235
/// <![CDATA[
3336
/// Public Sub DoSomething(ByVal foo As Long)
3437
/// Dim bar As Long
3538
/// bar = 12
3639
/// bar = bar + foo ' variable is re-assigned, but the prior assigned value is read at least once first.
3740
/// End Sub
3841
/// ]]>
42+
/// </module>
3943
/// </example>
4044
internal sealed class AssignmentNotUsedInspection : IdentifierReferenceInspectionBase
4145
{

Rubberduck.CodeAnalysis/Inspections/Concrete/AttributeValueOutOfSyncInspection.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,26 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete
1919
/// Rubberduck can rewrite the attributes to match the corresponding annotation comment.
2020
/// </why>
2121
/// <example hasResult="true">
22+
/// <module name="MyModule" type="Standard Module">
2223
/// <![CDATA[
2324
/// '@Description("foo")
2425
/// Public Sub DoSomething()
2526
/// Attribute VB_Description = "bar"
2627
/// ' ...
2728
/// End Sub
2829
/// ]]>
30+
/// </module>
2931
/// </example>
3032
/// <example hasResult="false">
33+
/// <module name="MyModule" type="Standard Module">
3134
/// <![CDATA[
3235
/// '@Description("foo")
3336
/// Public Sub DoSomething()
3437
/// Attribute VB_Description = "foo"
3538
/// ' ...
3639
/// End Sub
3740
/// ]]>
41+
/// </module>
3842
/// </example>
3943
[CannotAnnotate]
4044
internal sealed class AttributeValueOutOfSyncInspection : DeclarationInspectionMultiResultBase<(IParseTreeAnnotation Annotation, string AttributeName, IReadOnlyList<string> AttributeValues)>

Rubberduck.CodeAnalysis/Inspections/Concrete/BooleanAssignedInIfElseInspection.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete
1414
/// The assignment could be made directly to the result of the conditional Boolean expression instead.
1515
/// </why>
1616
/// <example hasResult="true">
17+
/// <module name="MyModule" type="Standard Module">
1718
/// <![CDATA[
1819
/// Public Sub DoSomething(ByVal value As Long)
1920
/// Dim result As Boolean
@@ -25,15 +26,18 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete
2526
/// Debug.Print result
2627
/// End Sub
2728
/// ]]>
29+
/// </module>
2830
/// </example>
2931
/// <example hasResult="false">
32+
/// <module name="MyModule" type="Standard Module">
3033
/// <![CDATA[
3134
/// Public Sub DoSomething(ByVal value As Long)
3235
/// Dim result As Boolean
3336
/// result = value > 10
3437
/// Debug.Print result
3538
/// End Sub
3639
/// ]]>
40+
/// </module>
3741
/// </example>
3842
internal sealed class BooleanAssignedInIfElseInspection : ParseTreeInspectionBase<VBAParser.IfStmtContext>
3943
{

Rubberduck.CodeAnalysis/Inspections/Concrete/ConstantNotUsedInspection.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,26 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete
1515
/// Declarations that are never used should be removed.
1616
/// </why>
1717
/// <example hasResult="true">
18+
/// <module name="MyModule" type="Standard Module">
1819
/// <![CDATA[
1920
/// Private Const foo As Long = 42
2021
///
2122
/// Public Sub DoSomething()
2223
/// ' no reference to 'foo' anywhere...
2324
/// End Sub
2425
/// ]]>
26+
/// </module>
2527
/// </example>
2628
/// <example hasResult="false">
29+
/// <module name="MyModule" type="Standard Module">
2730
/// <![CDATA[
2831
/// Private Const foo As Long = 42
2932
///
3033
/// Public Sub DoSomething()
3134
/// Debug.Print foo
3235
/// End Sub
3336
/// ]]>
37+
/// </module>
3438
/// </example>
3539
internal sealed class ConstantNotUsedInspection : DeclarationInspectionBase
3640
{

Rubberduck.CodeAnalysis/Inspections/Concrete/DefTypeStatementInspection.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete
1515
/// These declarative statements make the first letter of identifiers determine the data type.
1616
/// </why>
1717
/// <example hasResult="true">
18+
/// <module name="MyModule" type="Standard Module">
1819
/// <![CDATA[
1920
/// DefBool B
2021
/// DefDbl D
@@ -24,6 +25,7 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete
2425
/// ' ...
2526
/// End Sub
2627
/// ]]>
28+
/// </module>
2729
/// </example>
2830
internal sealed class DefTypeStatementInspection : ParseTreeInspectionBase<VBAParser.DefTypeContext>
2931
{

Rubberduck.CodeAnalysis/Inspections/Concrete/DefaultMemberRequiredInspection.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,42 +15,42 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete
1515
/// The VBA compiler does not check whether the necessary default member is present. Instead there is a runtime error whenever the runtime type fails to have the default member.
1616
/// </why>
1717
/// <example hasresult="true">
18+
/// <module name="Class1" type="Class Module">
1819
/// <![CDATA[
19-
/// Class1:
20-
///
2120
/// Public Function Foo(index As Long) As Long
2221
/// 'No default member attribute
2322
/// End Function
24-
///
25-
/// ------------------------------
26-
/// Module1:
27-
///
23+
/// ]]>
24+
/// </module>
25+
/// <module name="Module1" type="Standard Module">
26+
/// <![CDATA[
2827
/// Public Sub DoIt()
2928
/// Dim cls As Class1
3029
/// Dim bar As Variant
3130
/// Set cls = New Class1
3231
/// bar = cls(0)
3332
/// End Sub
3433
/// ]]>
34+
/// </module>
3535
/// </example>
3636
/// <example hasresult="false">
37+
/// <module name="Class1" type="Class Module">
3738
/// <![CDATA[
38-
/// Class1:
39-
///
4039
/// Public Function Foo(index As Long) As Long
4140
/// Attribute Foo.UserMemId = 0
4241
/// End Function
43-
///
44-
/// ------------------------------
45-
/// Module1:
46-
///
42+
/// ]]>
43+
/// </module>
44+
/// <module name="Module1" type="Standard Module">
45+
/// <![CDATA[
4746
/// Public Sub DoIt()
4847
/// Dim cls As Class1
4948
/// Dim bar As Variant
5049
/// Set cls = New Class1
5150
/// bar = cls(0)
5251
/// End Sub
5352
/// ]]>
53+
/// </module>
5454
/// </example>
5555
internal class DefaultMemberRequiredInspection : IdentifierReferenceInspectionBase
5656
{

Rubberduck.CodeAnalysis/Inspections/Concrete/DuplicatedAnnotationInspection.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete
1616
/// Rubberduck annotations should not be specified more than once for a given module, member, variable, or expression.
1717
/// </why>
1818
/// <example hasResult="true">
19+
/// <module name="MyModule" type="Standard Module">
1920
/// <![CDATA[
2021
/// '@Folder("Bar")
2122
/// '@Folder("Foo")
@@ -24,15 +25,18 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete
2425
/// ' ...
2526
/// End Sub
2627
/// ]]>
28+
/// </module>
2729
/// </example>
2830
/// <example hasResult="false">
31+
/// <module name="MyModule" type="Standard Module">
2932
/// <![CDATA[
3033
/// '@Folder("Foo.Bar")
3134
///
3235
/// Public Sub DoSomething()
3336
/// ' ...
3437
/// End Sub
3538
/// ]]>
39+
/// </module>
3640
/// </example>
3741
internal sealed class DuplicatedAnnotationInspection : DeclarationInspectionMultiResultBase<IAnnotation>
3842
{

Rubberduck.CodeAnalysis/Inspections/Concrete/EmptyBlock/EmptyCaseBlockInspection.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete.EmptyBlock
1414
/// Case blocks in VBA do not "fall through"; an empty 'Case' block might be hiding a bug.
1515
/// </why>
1616
/// <example hasResult="true">
17+
/// <module name="MyModule" type="Standard Module">
1718
/// <![CDATA[
1819
/// Public Sub DoSomething(ByVal foo As Long)
1920
/// Select Case foo
@@ -23,8 +24,10 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete.EmptyBlock
2324
/// End Select
2425
/// End Sub
2526
/// ]]>
27+
/// </module>
2628
/// </example>
2729
/// <example hasResult="false">
30+
/// <module name="MyModule" type="Standard Module">
2831
/// <![CDATA[
2932
/// Public Sub DoSomething(ByVal foo As Long)
3033
/// Select Case foo
@@ -35,6 +38,7 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete.EmptyBlock
3538
/// End Select
3639
/// End Sub
3740
/// ]]>
41+
/// </module>
3842
/// </example>
3943
internal sealed class EmptyCaseBlockInspection : EmptyBlockInspectionBase<VBAParser.CaseClauseContext>
4044
{

Rubberduck.CodeAnalysis/Inspections/Concrete/EmptyBlock/EmptyDoWhileBlockInspection.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,26 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete.EmptyBlock
1414
/// Dead code should be removed. A loop without a body is usually redundant.
1515
/// </why>
1616
/// <example hasResult="true">
17+
/// <module name="MyModule" type="Standard Module">
1718
/// <![CDATA[
1819
/// Public Sub DoSomething(ByVal foo As Long)
1920
/// Do
2021
/// ' no executable statement...
2122
/// Loop While foo < 100
2223
/// End Sub
2324
/// ]]>
25+
/// </module>
2426
/// </example>
2527
/// <example hasResult="false">
28+
/// <module name="MyModule" type="Standard Module">
2629
/// <![CDATA[
2730
/// Public Sub DoSomething(ByVal foo As Long)
2831
/// Do
2932
/// Debug.Print foo
3033
/// Loop While foo < 100
3134
/// End Sub
3235
/// ]]>
36+
/// </module>
3337
/// </example>
3438
internal sealed class EmptyDoWhileBlockInspection : EmptyBlockInspectionBase<VBAParser.DoLoopStmtContext>
3539
{

Rubberduck.CodeAnalysis/Inspections/Concrete/EmptyBlock/EmptyElseBlockInspection.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete.EmptyBlock
1515
/// an empty block may be signalling an unfinished thought or an oversight.
1616
/// </why>
1717
/// <example hasResult="true">
18+
/// <module name="MyModule" type="Standard Module">
1819
/// <![CDATA[
1920
/// Public Sub DoSomething(ByVal foo As Boolean)
2021
/// If foo Then
@@ -23,15 +24,18 @@ namespace Rubberduck.CodeAnalysis.Inspections.Concrete.EmptyBlock
2324
/// End If
2425
/// End Sub
2526
/// ]]>
27+
/// </module>
2628
/// </example>
2729
/// <example hasResult="false">
30+
/// <module name="MyModule" type="Standard Module">
2831
/// <![CDATA[
2932
/// Public Sub DoSomething(ByVal foo As Boolean)
3033
/// If foo Then
3134
/// ' ...
3235
/// End If
3336
/// End Sub
3437
/// ]]>
38+
/// </module>
3539
/// </example>
3640
internal sealed class EmptyElseBlockInspection : EmptyBlockInspectionBase<VBAParser.ElseBlockContext>
3741
{

0 commit comments

Comments
 (0)