<commit_before>package mareklangiewicz.pl.uspek

import org.junit.runner.Description
import org.junit.runner.Runner
import org.junit.runner.notification.RunNotifier
import java.util.*

class USpekJUnitRunner(testClass: Class<Any>) : Runner() {

    private val rootDescription = Description.createSuiteDescription(testClass.simpleName, UUID.randomUUID().toString())

    private val treeCollectionLogger = TreeCollectionLogger()

    init {
        USpek.log = treeCollectionLogger
        val instance = testClass.newInstance()
        testClass.declaredMethods.forEach { it.invoke(instance) }
        rootDescription.addChild(createDescriptions(treeCollectionLogger.testTree!!, testClass.name))
    }

    override fun getDescription(): Description {
        return rootDescription
    }

    override fun run(notifier: RunNotifier) {
        println("USpek is running....")
    }

    private fun createDescriptions(testBranch: TestTree, testSuite: String): Description {
        val description = if (testBranch.subtests.isNotEmpty()) {
            Description.createSuiteDescription(testBranch.name, UUID.randomUUID().toString())
        } else {
            Description.createTestDescription(testSuite, testBranch.name)
        }
        testBranch.subtests.forEach {
            val child = createDescriptions(it, testSuite + "." + testBranch.name)
            description.addChild(child)
        }
        return description
    }

}<commit_msg>[refactoring] Convert function body to expression<commit_after>package mareklangiewicz.pl.uspek

import org.junit.runner.Description
import org.junit.runner.Runner
import org.junit.runner.notification.RunNotifier
import java.util.*

class USpekJUnitRunner(testClass: Class<Any>) : Runner() {

    private val rootDescription = Description.createSuiteDescription(testClass.simpleName, UUID.randomUUID().toString())

    private val treeCollectionLogger = TreeCollectionLogger()

    init {
        USpek.log = treeCollectionLogger
        val instance = testClass.newInstance()
        testClass.declaredMethods.forEach { it.invoke(instance) }
        rootDescription.addChild(createDescriptions(treeCollectionLogger.testTree!!, testClass.name))
    }

    override fun getDescription(): Description = rootDescription

    override fun run(notifier: RunNotifier) {
        println("USpek is running....")
    }

    private fun createDescriptions(testBranch: TestTree, testSuite: String): Description {
        val description = if (testBranch.subtests.isNotEmpty()) {
            Description.createSuiteDescription(testBranch.name, UUID.randomUUID().toString())
        } else {
            Description.createTestDescription(testSuite, testBranch.name)
        }
        testBranch.subtests.forEach {
            val child = createDescriptions(it, testSuite + "." + testBranch.name)
            description.addChild(child)
        }
        return description
    }

}
{'fraction_non_alphanumeric': 0.09483053748716193, 'fraction_numerical': 0.0, 'mean_word_length': 3.4272727272727272, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2014551', 'n_tokens_mistral': 766, 'n_tokens_neox': 761, 'n_words': 146}