77namespace Rubberduck . Inspections
88{
99 [ ComVisible ( false ) ]
10- public class ObsoleteCommentSyntaxInspection : IInspection
10+ public class ObsoleteCommentSyntaxInspection : CodeInspection
1111 {
1212 /// <summary>
1313 /// Parameterless constructor required for discovery of implemented code inspections.
1414 /// </summary>
1515 public ObsoleteCommentSyntaxInspection ( )
16+ : base ( "Use of obsolete Rem comment syntax" ,
17+ "Replace Rem reserved keyword with single quote." ,
18+ CodeInspectionType . MaintainabilityAndReadabilityIssues ,
19+ CodeInspectionSeverity . Suggestion )
1620 {
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 ;
2121 }
2222
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 )
3824 {
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 ) ) ;
4228 }
4329 }
4430}
0 commit comments