Skip to content

Commit 2054248

Browse files
committed
started updating examples to use CDATA, and formalized examples/example/text/code structure.
1 parent d036718 commit 2054248

16 files changed

+117
-64
lines changed

Rubberduck.CodeAnalysis/Inspections/Concrete/AssignedByValParameterInspection.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,30 @@ namespace Rubberduck.Inspections.Concrete
1818
/// Mutating the inputs destroys the initial state, and makes the intent ambiguous: if the calling code is meant
1919
/// to be able to access the modified values, then the parameter should be passed ByRef; the ByVal modifier might be a bug.
2020
/// </why>
21+
/// <examples>
2122
/// <example>
22-
/// This inspection means to flag the following examples:
23+
/// <text>This inspection means to flag the following examples:</text>
2324
/// <code>
25+
/// <![CDATA[
2426
/// Public Sub DoSomething(ByVal foo As Long)
2527
/// foo = foo + 1 ' is the caller supposed to see the updated value?
2628
/// Debug.Print foo
27-
/// End Sub
29+
/// End Sub]]>
2830
/// </code>
29-
/// The following code should not trip this inspection:
31+
/// </example>
32+
/// <example>
33+
/// <text>The following code should not trip this inspection:</text>
3034
/// <code>
35+
/// <![CDATA[
3136
/// Public Sub DoSomething(ByVal foo As Long)
3237
/// Dim bar As Long
3338
/// bar = foo
3439
/// bar = bar + 1 ' clearly a local copy of the original value.
3540
/// Debug.Print bar
36-
/// End Sub
41+
/// End Sub]]>
3742
/// </code>
3843
/// </example>
44+
/// </examples>
3945
public sealed class AssignedByValParameterInspection : InspectionBase
4046
{
4147
public AssignedByValParameterInspection(RubberduckParserState state)

Rubberduck.CodeAnalysis/Inspections/Concrete/AssignmentNotUsedInspection.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,30 @@ namespace Rubberduck.Inspections.Concrete
1818
/// <why>
1919
/// The first assignment is likely redundant, since it is being overwritten by the second.
2020
/// </why>
21+
/// <examples>
2122
/// <example>
22-
/// This inspection means to flag the following examples:
23+
/// <text>This inspection means to flag the following examples:</text>
2324
/// <code>
25+
/// <![CDATA[
2426
/// Public Sub DoSomething()
2527
/// Dim foo As Long
2628
/// foo = 12 ' assignment is redundant
2729
/// foo = 34
28-
/// End Sub
30+
/// End Sub]]>
2931
/// </code>
30-
/// The following code should not trip this inspection:
32+
/// </example>
33+
/// <example>
34+
/// <text>The following code should not trip this inspection:</text>
3135
/// <code>
36+
/// <![CDATA[
3237
/// Public Sub DoSomething(ByVal foo As Long)
3338
/// Dim bar As Long
3439
/// bar = 12
3540
/// bar = bar + foo ' variable is re-assigned, but the prior assigned value is read at least once first.
36-
/// End Sub
41+
/// End Sub]]>
3742
/// </code>
3843
/// </example>
44+
/// </examples>
3945
public sealed class AssignmentNotUsedInspection : InspectionBase
4046
{
4147
private readonly Walker _walker;

Rubberduck.CodeAnalysis/Inspections/Concrete/AttributeValueOutOfSyncInspection.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,30 @@ namespace Rubberduck.Inspections.Concrete
2020
/// Keeping Rubberduck annotation comments in sync with the hidden VB attribute values, surfaces these hidden attributes in the VBE code panes;
2121
/// Rubberduck can rewrite the attributes to match the corresponding annotation comment.
2222
/// </why>
23+
/// <examples>
2324
/// <example>
24-
/// This inspection means to flag the following examples (code from an exported module):
25+
/// <text>This inspection means to flag the following examples (code from an exported module):</text>
2526
/// <code>
27+
/// <![CDATA[
2628
/// '@Description("foo")
2729
/// Public Sub DoSomething()
2830
/// Attribute VB_Description = "bar"
2931
/// ' ...
30-
/// End Sub
32+
/// End Sub]]>
3133
/// </code>
32-
/// The following code should not trip this inspection:
34+
/// </example>
35+
/// <example>
36+
/// <text>The following code should not trip this inspection:</text>
3337
/// <code>
38+
/// <![CDATA[
3439
/// '@Description("foo")
3540
/// Public Sub DoSomething()
3641
/// Attribute VB_Description = "foo"
3742
/// ' ...
38-
/// End Sub
43+
/// End Sub]]>
3944
/// </code>
4045
/// </example>
46+
/// </examples>
4147
[CannotAnnotate]
4248
public sealed class AttributeValueOutOfSyncInspection : InspectionBase
4349
{

Rubberduck.CodeAnalysis/Inspections/Concrete/BooleanAssignedInIfElseInspection.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,24 +19,30 @@ namespace Rubberduck.Inspections.Concrete
1919
/// <why>
2020
/// A Boolean expression never needs to be compared to a Boolean literal in a conditional expression.
2121
/// </why>
22+
/// <examples>
2223
/// <example>
23-
/// This inspection means to flag the following examples:
24+
/// <text>This inspection means to flag the following examples:</text>
2425
/// <code>
26+
/// <![CDATA[
2527
/// Public Sub DoSomething(ByVal foo As Boolean)
2628
/// If foo = True Then ' foo is known to already be a Boolean value.
2729
/// ' ...
2830
/// End If
29-
/// End Sub
31+
/// End Sub]]>
3032
/// </code>
31-
/// The following code should not trip this inspection:
33+
/// </example>
34+
/// <example>
35+
/// <text>The following code should not trip this inspection:</text>
3236
/// <code>
37+
/// <![CDATA[
3338
/// Public Sub DoSomething(ByVal foo As Boolean)
3439
/// If foo Then
3540
/// ' ...
3641
/// End If
37-
/// End Sub
42+
/// End Sub]]>
3843
/// </code>
3944
/// </example>
45+
/// </examples>
4046
public sealed class BooleanAssignedInIfElseInspection : ParseTreeInspectionBase
4147
{
4248
public BooleanAssignedInIfElseInspection(RubberduckParserState state)

Rubberduck.CodeAnalysis/Inspections/Concrete/Excel/ApplicationWorksheetFunctionInspection.cs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ namespace Rubberduck.Inspections.Concrete
2727
/// Trying to compare or assign a <c>Variant/Error</c> to another data type will throw error 13 "type mismatch" at run-time.
2828
/// Consider using the early-bound equivalent function instead.
2929
/// </why>
30+
/// <examples>
3031
/// <example>
31-
/// This inspection means to flag the following example late-bound WorksheetFunction calls:
32-
/// <code>
32+
/// <text>This inspection means to flag the following example late-bound WorksheetFunction calls:</text>
33+
/// <code><![CDATA[
3334
/// Private Sub Example()
3435
/// Debug.Print Application.Sum(Array(1, 2, 3), 4, 5, "ABC") ' outputs "Error 2015"
3536
///
@@ -39,10 +40,11 @@ namespace Rubberduck.Inspections.Concrete
3940
/// If Application.Sum(Array(1, 2, 3), 4, 5, "ABC") > 15 Then
4041
/// ' won't run, error 13 "type mismatch" will be thrown when Variant/Error is compared to an Integer.
4142
/// End If
42-
/// End Sub
43-
/// </code>
44-
/// The following early-bound WorksheetFunction calls should not trip this inspection. Note the consistent error, thrown at the same point every time:
45-
/// <code>
43+
/// End Sub]]></code>
44+
/// </example>
45+
/// <example>
46+
/// <text>The following early-bound WorksheetFunction calls should not trip this inspection. Note the consistent error, thrown at the same point every time:</text>
47+
/// <code><![CDATA[
4648
/// Private Sub Example()
4749
/// Debug.Print Application.WorksheetFunction.Sum(Array(1, 2, 3), 4, 5, "ABC") ' throws error 1004
4850
///
@@ -52,9 +54,9 @@ namespace Rubberduck.Inspections.Concrete
5254
/// If Application.WorksheetFunction.Sum(Array(1, 2, 3), 4, 5, "ABC") > 15 Then ' throws error 1004
5355
/// ' won't run, error 1004 is thrown when "ABC" is processed by WorksheetFunction.Sum, before it returns.
5456
/// End If
55-
/// End Sub
56-
/// </code>
57+
/// End Sub]]></code>
5758
/// </example>
59+
/// </examples>
5860
[RequiredLibrary("Excel")]
5961
public class ApplicationWorksheetFunctionInspection : InspectionBase
6062
{

Rubberduck.CodeAnalysis/Inspections/Concrete/Excel/ExcelMemberMayReturnNothingInspection.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,33 @@ namespace Rubberduck.Inspections.Concrete
1919
/// Range.Find methods return a Range object reference that refers to the cell containing the search string;
2020
/// this object reference will be Nothing if the search didn't turn up any results, and a member call against Nothing will raise run-time error 91.
2121
/// </why>
22+
/// <examples>
2223
/// <example>
23-
/// This inspection means to flag the following example Range.Find member calls:
24-
/// <code>
24+
/// <text>This inspection means to flag the following example Range.Find member calls:</text>
25+
/// <code><![CDATA[
2526
/// Private Sub Example()
2627
/// Dim foo As Range
2728
/// Set foo = Sheet1.Range("A:A").Find("Test") ' foo is Nothing if there are no results
2829
/// MsgBox foo.Address ' Range.Address member call should be flagged.
2930
///
3031
/// Dim rowIndex As Range
3132
/// rowIndex = Sheet1.Range("A:A").Find("Test").Row ' Range.Row member call should be flagged.
32-
/// End Sub
33+
/// End Sub]]>
3334
/// </code>
34-
/// The following Range.Find calls should not trip this inspection.
35-
/// <code>
35+
/// </example>
36+
/// <example>
37+
/// <text>The following Range.Find calls should not trip this inspection.</text>
38+
/// <code><![CDATA[
3639
/// Private Sub Example()
3740
/// Dim foo As Range
3841
/// Set foo = Sheet1.Range("A:A").Find("Test")
3942
/// If Not foo Is Nothing Then
4043
/// MsgBox foo.Address ' Range.Address member call is safe.
4144
/// End If
42-
/// End Sub
45+
/// End Sub]]>
4346
/// </code>
4447
/// </example>
48+
/// </examples>
4549
[RequiredLibrary("Excel")]
4650
public class ExcelMemberMayReturnNothingInspection : MemberAccessMayReturnNothingInspectionBase
4751
{

Rubberduck.CodeAnalysis/Inspections/Concrete/Excel/ExcelUdfNameIsValidCellReferenceInspection.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,20 @@ namespace Rubberduck.Inspections.Inspections.Concrete
2323
/// Another good reason to avoid numeric suffixes: if the function is meant to be used as a UDF in a cell formula,
2424
/// the worksheet cell by the same name takes precedence and gets the reference, and the function is never invoked.
2525
/// </why>
26+
/// <examples>
2627
/// <example>
27-
/// This inspection will flag the following function name as a valid cell address:
28-
/// <code>
28+
/// <text>This inspection will flag the following function name as a valid cell address:</text>
29+
/// <code><![CDATA[
2930
/// Public Function FOO1234()
30-
/// End Sub
31+
/// End Sub]]>
3132
/// </code>
32-
/// The following funcrtion name should not trip this inspection.
33-
/// <code>
33+
/// <text>The following function name should not trip this inspection:</text>
34+
/// <code><![CDATA[
3435
/// Public Function Foo()
35-
/// End Sub
36+
/// End Sub]]>
3637
/// </code>
3738
/// </example>
39+
/// </examples>
3840

3941
[RequiredLibrary("Excel")]
4042
public class ExcelUdfNameIsValidCellReferenceInspection : InspectionBase

Rubberduck.CodeAnalysis/Inspections/Concrete/Excel/ImplicitActiveSheetReferenceInspection.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,30 @@ namespace Rubberduck.Inspections.Concrete
2222
/// is more robust, and will be less likely to throw run-time error 1004 or produce unexpected results
2323
/// when the active sheet isn't the expected one.
2424
/// </why>
25+
/// <examples>
2526
/// <example>
26-
/// This inspection means to flag the following example unqualified Worksheet.Cells member calls:
27+
/// <text>This inspection means to flag the following example unqualified Worksheet.Cells member calls:</text>
2728
/// <code>
29+
/// <![CDATA[
2830
/// Private Sub Example()
2931
/// Dim foo As Range
3032
/// Set foo = Sheet1.Range(Cells(1, 1), Cells(1, 10)) ' Worksheet.Cells implicitly from ActiveSheet; error 1004 if that isn't Sheet1.
31-
/// End Sub
33+
/// End Sub]]>
3234
/// </code>
33-
/// The following qualified Worksheet.Cells member calls should not trip this inspection.
35+
/// </example>
36+
/// <example>
37+
/// <text>The following qualified Worksheet.Cells member calls should not trip this inspection.</text>
3438
/// <code>
39+
/// <![CDATA[
3540
/// Private Sub Example()
3641
/// Dim foo As Range
3742
/// With Sheet1
3843
/// Set foo = .Range(.Cells(1, 1), .Cells(1, 10)) ' all member calls are made against the With block object
3944
/// End With
40-
/// End Sub
45+
/// End Sub]]>
4146
/// </code>
4247
/// </example>
48+
/// </examples>
4349
[RequiredLibrary("Excel")]
4450
public sealed class ImplicitActiveSheetReferenceInspection : InspectionBase
4551
{

Rubberduck.CodeAnalysis/Inspections/Concrete/Excel/ImplicitActiveWorkbookReferenceInspection.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,28 @@ namespace Rubberduck.Inspections.Concrete
2323
/// is more robust, and will be less likely to throw run-time error 1004 or produce unexpected results
2424
/// when the active workbook isn't the expected one.
2525
/// </why>
26+
/// <examples>
2627
/// <example>
27-
/// This inspection means to flag the following example unqualified Workbook.Worksheets member calls:
28+
/// <text>This inspection means to flag the following example unqualified Workbook.Worksheets member calls:</text>
2829
/// <code>
30+
/// <![CDATA[
2931
/// Private Sub Example()
3032
/// Dim summarySheet As Worksheet
3133
/// Set summarySheet = Worksheets("Summary") ' unqualified Worksheets is implicitly querying the active workbook's Worksheets collection.
32-
/// End Sub
34+
/// End Sub]]>
3335
/// </code>
34-
/// The following qualified Workbook.Worksheets member calls should not trip this inspection.
36+
/// </example>
37+
/// <example>
38+
/// <text>The following qualified Workbook.Worksheets member calls should not trip this inspection.</text>
3539
/// <code>
40+
/// <![CDATA[
3641
/// Private Sub Example(ByVal book As Workbook)
3742
/// Dim summarySheet As Worksheet
3843
/// Set summarySheet = book.Worksheets("Summary")
39-
/// End Sub
44+
/// End Sub]]>
4045
/// </code>
4146
/// </example>
47+
/// </examples>
4248
[RequiredLibrary("Excel")]
4349
public sealed class ImplicitActiveWorkbookReferenceInspection : InspectionBase
4450
{

Rubberduck.CodeAnalysis/Inspections/Concrete/Excel/SheetAccessedUsingStringInspection.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,28 @@ namespace Rubberduck.Inspections.Concrete
2828
/// <remarks>
2929
/// Inspection only evaluates hard-coded string literals; string-valued expressions evaluating into a sheet name are ignored.
3030
/// </remarks>
31+
/// <examples>
3132
/// <example>
32-
/// This inspection means to flag the following:
33+
/// <text>This inspection means to flag the following:</text>
3334
/// <code>
35+
/// <![CDATA[
3436
/// Public Sub DoSomething()
3537
/// Dim sheet As Worksheet
3638
/// Set sheet = ThisWorkbook.Worksheets("Sheet1") ' Sheet "Sheet1" exists at compile-time
3739
/// sheet.Range("A1").Value = 42
38-
/// End Sub
40+
/// End Sub]]>
3941
/// </code>
40-
/// The following code should not trip this inspection:
42+
/// </example>
43+
/// <example>
44+
/// <text>The following code should not trip this inspection:</text>
4145
/// <code>
46+
/// <![CDATA[
4247
/// Public Sub DoSomething()
4348
/// Sheet1.Range("A1").Value = 42 ' TODO rename Sheet1 to meaningful name
44-
/// End Sub
49+
/// End Sub]]>
4550
/// </code>
4651
/// </example>
52+
/// </examples>
4753
[RequiredHost("EXCEL.EXE")]
4854
[RequiredLibrary("Excel")]
4955
public class SheetAccessedUsingStringInspection : InspectionBase

0 commit comments

Comments
 (0)