All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.cqfn.diktat.ruleset.utils.indentation.IndentationConfig.kt Maven / Gradle / Ivy

There is a newer version: 1.2.5
Show newest version
package org.cqfn.diktat.ruleset.utils.indentation

import org.cqfn.diktat.common.config.rules.RuleConfiguration
import org.cqfn.diktat.ruleset.rules.chapter3.files.IndentationRule

/**
 * [RuleConfiguration] for indentation logic
 */
internal class IndentationConfig(config: Map) : RuleConfiguration(config) {
    /**
     * Is newline at the end of a file needed
     */
    val newlineAtEnd = config["newlineAtEnd"]?.toBoolean() ?: true

    /**
     * If true, in parameter list when parameters are split by newline they are indented with two indentations instead of one
     */
    val extendedIndentOfParameters = config["extendedIndentOfParameters"]?.toBoolean() ?: true

    /**
     * If true, if first parameter in parameter list is on the same line as opening parenthesis, then other parameters
     * can be aligned with it
     */
    val alignedParameters = config["alignedParameters"]?.toBoolean() ?: true

    /**
     * If true, if expression is split by newline after operator like +/-/`*`, then the next line is indented with two indentations instead of one
     */
    val extendedIndentAfterOperators = config["extendedIndentAfterOperators"]?.toBoolean() ?: true

    /**
     * If true, when dot qualified expression starts on a new line, this line will be indented with
     * two indentations instead of one
     */
    val extendedIndentBeforeDot = config["extendedIndentBeforeDot"]?.toBoolean() ?: true

    /**
     * The indentation size for each file
     */
    val indentationSize = config["indentationSize"]?.toInt() ?: IndentationRule.INDENT_SIZE
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy