diff --git a/ktlint-ruleset-standard/src/main/kotlin/com/github/shyiko/ktlint/ruleset/standard/CommentSpacingRule.kt b/ktlint-ruleset-standard/src/main/kotlin/com/github/shyiko/ktlint/ruleset/standard/CommentSpacingRule.kt index 68ba62b0b5..a63763ab10 100644 --- a/ktlint-ruleset-standard/src/main/kotlin/com/github/shyiko/ktlint/ruleset/standard/CommentSpacingRule.kt +++ b/ktlint-ruleset-standard/src/main/kotlin/com/github/shyiko/ktlint/ruleset/standard/CommentSpacingRule.kt @@ -24,7 +24,7 @@ class CommentSpacingRule : Rule("comment-spacing") { } } val text = node.getText() - if (text.length != 2 && !text.startsWith("// ")) { + if (text.length != 2 && !text.startsWith("// ") && !text.startsWith("//noinspection")) { emit(node.startOffset, "Missing space after //", true) if (autoCorrect) { node.rawReplaceWithText("// " + text.removePrefix("//")) diff --git a/ktlint-ruleset-standard/src/test/kotlin/com/github/shyiko/ktlint/ruleset/standard/CommentSpacingRuleTest.kt b/ktlint-ruleset-standard/src/test/kotlin/com/github/shyiko/ktlint/ruleset/standard/CommentSpacingRuleTest.kt index 1b8894f762..dac8f6ef80 100644 --- a/ktlint-ruleset-standard/src/test/kotlin/com/github/shyiko/ktlint/ruleset/standard/CommentSpacingRuleTest.kt +++ b/ktlint-ruleset-standard/src/test/kotlin/com/github/shyiko/ktlint/ruleset/standard/CommentSpacingRuleTest.kt @@ -13,6 +13,7 @@ class CommentSpacingRuleTest { assertThat(CommentSpacingRule().lint( """ // + //noinspection AndroidLintRecycle // comment var debugging = false // comment var debugging = false // comment//word