Skip to content

Commit

Permalink
Correctred NAME_ID (#1306)
Browse files Browse the repository at this point in the history
### Whats added:
- corrected NAME_ID
  • Loading branch information
Arrgentum authored May 27, 2022
1 parent a96e615 commit 4fa6af5
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ class DiktatRuleSetProvider(private var diktatConfigFile: String = DIKTAT_ANALYS
::SingleInitRule,
::RangeConventionalRule,
::CustomLabel,
::ParameterNameInOuterLambdaRule,
::VariableGenericTypeDeclarationRule,
::LongNumericalValuesSeparatedRule,
::NestedFunctionBlock,
Expand Down Expand Up @@ -213,6 +212,7 @@ class DiktatRuleSetProvider(private var diktatConfigFile: String = DIKTAT_ANALYS
::ExtensionFunctionsSameNameRule,
::LambdaLengthRule,
::BooleanExpressionsRule,
::ParameterNameInOuterLambdaRule,
// formatting: moving blocks, adding line breaks, indentations etc.
::BlockStructureBraces,
::ConsecutiveSpacesRule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ class HeaderCommentRule(configRules: List<RulesConfig>) : DiktatRule(
companion object {
private val log = LoggerFactory.getLogger(HeaderCommentRule::class.java)
const val CURR_YEAR_PATTERN = ";@currYear;"
const val NAME_ID = "acp-header-comment"
const val NAME_ID = "zcp-header-comment"
val hyphenRegex = Regex("""\d+-\d+""")
val afterCopyrightRegex = Regex("""((©|\([cC]\))+ *\d+)""")
val curYear = LocalDate.now().year
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,6 @@ class BlockStructureBraces(configRules: List<RulesConfig>) : DiktatRule(
}

companion object {
const val NAME_ID = "acn-block-structure"
const val NAME_ID = "zcn-block-structure"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ class ConsecutiveSpacesRule(configRules: List<RulesConfig>) : DiktatRule(

companion object {
private const val MAX_SPACES = 1
const val NAME_ID = "aco-too-many-spaces"
const val NAME_ID = "zco-too-many-spaces"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,6 @@ class FileStructureRule(configRules: List<RulesConfig>) : DiktatRule(
}

companion object {
const val NAME_ID = "acq-file-structure"
const val NAME_ID = "zcq-file-structure"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ class IndentationRule(configRules: List<RulesConfig>) : DiktatRule(
companion object {
private val log = LoggerFactory.getLogger(IndentationRule::class.java)
const val INDENT_SIZE = 4
const val NAME_ID = "act-indentation"
const val NAME_ID = "zct-indentation"
private val increasingTokens = listOf(LPAR, LBRACE, LBRACKET, LONG_TEMPLATE_ENTRY_START)
private val decreasingTokens = listOf(RPAR, RBRACE, RBRACKET, LONG_TEMPLATE_ENTRY_END)
private val matchingTokens = increasingTokens.zip(decreasingTokens)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ class NewlinesRule(configRules: List<RulesConfig>) : DiktatRule(
companion object {
private val log = LoggerFactory.getLogger(NewlinesRule::class.java)
const val MAX_CALLS_IN_ONE_LINE = 3
const val NAME_ID = "acr-newlines"
const val NAME_ID = "zcr-newlines"

// fixme: these token sets can be not full, need to add new once as corresponding cases are discovered.
// error is raised if these operators are prepended by newline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ class WhiteSpaceRule(configRules: List<RulesConfig>) : DiktatRule(

companion object {
private val log = LoggerFactory.getLogger(CompactInitialization::class.java)
const val NAME_ID = "acs-horizontal-whitespace"
const val NAME_ID = "zcs-horizontal-whitespace"

private const val NUM_PARENTS_FOR_LAMBDA = 3 // this is the number of parent nodes needed to check if this node is lambda from argument list
private val keywordsWithSpaceAfter = TokenSet.create(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ class ImmutableValNoVarRule(configRules: List<RulesConfig>) : DiktatRule(
}
}
companion object {
const val NAME_ID = "abt-accurate-calculations"
const val NAME_ID = "aci-no-var-rule"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import org.jetbrains.kotlin.com.intellij.lang.ASTNode
* Rule 5.2.7 check parameter name in outer lambda
*/
class ParameterNameInOuterLambdaRule(configRules: List<RulesConfig>) : DiktatRule(
"parameter-name-in-outer-lambda",
NAME_ID,
configRules,
listOf(PARAMETER_NAME_IN_OUTER_LAMBDA)
) {
Expand All @@ -35,4 +35,7 @@ class ParameterNameInOuterLambdaRule(configRules: List<RulesConfig>) : DiktatRul
)
}
}
companion object {
const val NAME_ID = "acn-parameter-name-in-outer-lambda"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,6 @@ class StatelessClassesRule(configRules: List<RulesConfig>) : DiktatRule(
}

companion object {
const val NAME_ID = "abi-multiple-init-block"
const val NAME_ID = "aaz-stateless-class"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import org.cqfn.diktat.common.config.rules.RulesConfig
import org.cqfn.diktat.ruleset.constants.Warnings
import org.cqfn.diktat.ruleset.rules.DIKTAT_RULE_SET_ID
import org.cqfn.diktat.ruleset.rules.chapter5.ParameterNameInOuterLambdaRule
import org.cqfn.diktat.ruleset.rules.chapter6.classes.AbstractClassesRule
import org.cqfn.diktat.util.LintTestBase

import com.pinterest.ktlint.core.LintError
Expand All @@ -12,7 +13,7 @@ import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test

class ParameterNameInOuterLambdaRuleWarnTest : LintTestBase(::ParameterNameInOuterLambdaRule) {
private val ruleId = "$DIKTAT_RULE_SET_ID:parameter-name-in-outer-lambda"
private val ruleId = "$DIKTAT_RULE_SET_ID:${ParameterNameInOuterLambdaRule.NAME_ID}"
private val rulesConfigList: List<RulesConfig> = listOf(
RulesConfig(Warnings.PARAMETER_NAME_IN_OUTER_LAMBDA.name, true)
)
Expand Down

0 comments on commit 4fa6af5

Please sign in to comment.