diff options
| -rw-r--r-- | detekt/src/main/kotlin/formatting/CustomCommentSpacing.kt | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/detekt/src/main/kotlin/formatting/CustomCommentSpacing.kt b/detekt/src/main/kotlin/formatting/CustomCommentSpacing.kt index db9f2f8a7..bfb0b1a4b 100644 --- a/detekt/src/main/kotlin/formatting/CustomCommentSpacing.kt +++ b/detekt/src/main/kotlin/formatting/CustomCommentSpacing.kt @@ -21,12 +21,6 @@ class CustomCommentSpacing(config: Config) : Rule(config) { override fun visitComment(comment: PsiComment) { if (comment.text.containsPreprocessingPattern()) return - - /** - * REGEX-TEST: // Test comment - * REGEX-TEST: /* Test comment */ - */ - val commentRegex = Regex("""^(?:\/{2}|\/\*)(?:\s.*|$)""", RegexOption.DOT_MATCHES_ALL) if (!commentRegex.matches(comment.text)) { report( CodeSmell( @@ -40,4 +34,12 @@ class CustomCommentSpacing(config: Config) : Rule(config) { // Fallback to super (ostensibly a no-check) super.visitComment(comment) } + + companion object { + /** + * REGEX-TEST: // Test comment + * REGEX-TEST: /* Test comment */ + */ + val commentRegex = Regex("""^(?:\/{2}|\/\*)(?:\s.*|$)""", RegexOption.DOT_MATCHES_ALL) + } } |
