7
7
namespace Rubberduck . Inspections
8
8
{
9
9
[ ComVisible ( false ) ]
10
- public class ObsoleteCommentSyntaxInspection : IInspection
10
+ public class ObsoleteCommentSyntaxInspection : CodeInspection
11
11
{
12
12
/// <summary>
13
13
/// Parameterless constructor required for discovery of implemented code inspections.
14
14
/// </summary>
15
15
public ObsoleteCommentSyntaxInspection ( )
16
+ : base ( "Use of obsolete Rem comment syntax" ,
17
+ "Replace Rem reserved keyword with single quote." ,
18
+ CodeInspectionType . MaintainabilityAndReadabilityIssues ,
19
+ CodeInspectionSeverity . Suggestion )
16
20
{
17
- _name = "Use of obsolete Rem comment syntax" ;
18
- _quickFixMessage = "Replace Rem reserved keyword with single quote." ;
19
- _inspectionType = CodeInspectionType . MaintainabilityAndReadabilityIssues ;
20
- _severity = CodeInspectionSeverity . Suggestion ;
21
21
}
22
22
23
- private readonly string _name ;
24
- public string Name { get { return _name ; } }
25
-
26
- private readonly string _quickFixMessage ;
27
- public string QuickFixMessage { get { return _quickFixMessage ; } }
28
-
29
- private readonly CodeInspectionType _inspectionType ;
30
- public CodeInspectionType InspectionType { get { return _inspectionType ; } }
31
-
32
- private readonly CodeInspectionSeverity _severity ;
33
- public CodeInspectionSeverity Severity { get { return _severity ; } }
34
-
35
- public bool IsEnabled { get ; set ; }
36
-
37
- public IEnumerable < CodeInspectionResultBase > Inspect ( SyntaxTreeNode node )
23
+ public override IEnumerable < CodeInspectionResultBase > Inspect ( SyntaxTreeNode node )
38
24
{
39
- return node . FindAllComments ( )
40
- . Where ( instruction => instruction . Value == ReservedKeywords . Rem )
41
- . Select ( instruction => new ObsoleteCommentSyntaxInspectionResult ( instruction , _severity , _quickFixMessage ) ) ;
25
+ var comments = node . FindAllComments ( ) ;
26
+ var remComments = comments . Where ( instruction => instruction . Value . Trim ( ) . StartsWith ( ReservedKeywords . Rem ) ) ;
27
+ return remComments . Select ( instruction => new ObsoleteCommentSyntaxInspectionResult ( Name , instruction , Severity , QuickFixMessage ) ) ;
42
28
}
43
29
}
44
30
}
0 commit comments