<commit_before>package io.gitlab.arturbosch.detekt.rules.formatting

import com.intellij.lang.ASTNode
import com.intellij.psi.PsiWhiteSpace
import com.intellij.psi.impl.source.tree.LeafPsiElement
import io.gitlab.arturbosch.detekt.api.CodeSmell
import io.gitlab.arturbosch.detekt.api.Config
import io.gitlab.arturbosch.detekt.api.Entity
import io.gitlab.arturbosch.detekt.api.TokenRule

/**
 * Based on KtLint.
 *
 * @author Shyiko
 */
class ConsecutiveBlankLines(config: Config) : TokenRule("ConsecutiveBlankLines", Severity.Style, config) {

	override fun procedure(node: ASTNode) {
		if (node is PsiWhiteSpace) {
			val split = node.getText().split("\n")
			println(split)
			if (split.size > 3) {
				addFindings(CodeSmell(id, Entity.from(node), "Needless blank line(s)"))
				withAutoCorrect {
					(node as LeafPsiElement).replaceWithText("${split.first()}\n\n${split.last()}")
				}
			}
		}
	}

}<commit_msg>Remove sout - #41<commit_after>package io.gitlab.arturbosch.detekt.rules.formatting

import com.intellij.lang.ASTNode
import com.intellij.psi.PsiWhiteSpace
import com.intellij.psi.impl.source.tree.LeafPsiElement
import io.gitlab.arturbosch.detekt.api.CodeSmell
import io.gitlab.arturbosch.detekt.api.Config
import io.gitlab.arturbosch.detekt.api.Entity
import io.gitlab.arturbosch.detekt.api.TokenRule

/**
 * Based on KtLint.
 *
 * @author Shyiko
 */
class ConsecutiveBlankLines(config: Config) : TokenRule("ConsecutiveBlankLines", Severity.Style, config) {

	override fun procedure(node: ASTNode) {
		if (node is PsiWhiteSpace) {
			val split = node.getText().split("\n")
			if (split.size > 3) {
				addFindings(CodeSmell(id, Entity.from(node), "Needless blank line(s)"))
				withAutoCorrect {
					(node as LeafPsiElement).replaceWithText("${split.first()}\n\n${split.last()}")
				}
			}
		}
	}

}
{'fraction_non_alphanumeric': 0.13861386138613863, 'fraction_numerical': 0.0022002200220022, 'mean_word_length': 4.596923076923077, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6546389', 'n_tokens_mistral': 718, 'n_tokens_neox': 673, 'n_words': 103}