Skip to content

Commit

Permalink
Create config file for detekt-formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
BraisGabin committed Jan 22, 2022
1 parent 17085bb commit 6442700
Show file tree
Hide file tree
Showing 3 changed files with 147 additions and 1 deletion.
1 change: 0 additions & 1 deletion detekt-core/build.gradle.kts
Expand Up @@ -16,7 +16,6 @@ dependencies {
implementation(projects.detektUtils)

testRuntimeOnly(projects.detektRules)
testRuntimeOnly(projects.detektFormatting)
testRuntimeOnly(libs.spek.runner)
testImplementation(projects.detektTest)
testImplementation(testFixtures(projects.detektApi))
Expand Down
139 changes: 139 additions & 0 deletions detekt-formatting/src/main/resources/config/config.yml
@@ -0,0 +1,139 @@
formatting:
active: true
android: false
autoCorrect: true
AnnotationOnSeparateLine:
active: false
autoCorrect: true
AnnotationSpacing:
active: false
autoCorrect: true
ArgumentListWrapping:
active: false
autoCorrect: true
indentSize: 4
maxLineLength: 120
ChainWrapping:
active: true
autoCorrect: true
CommentSpacing:
active: true
autoCorrect: true
EnumEntryNameCase:
active: false
autoCorrect: true
Filename:
active: true
FinalNewline:
active: true
autoCorrect: true
insertFinalNewLine: true
ImportOrdering:
active: true
autoCorrect: true
layout: '*,java.**,javax.**,kotlin.**,^'
Indentation:
active: true
autoCorrect: true
indentSize: 4
continuationIndentSize: 4
MaximumLineLength:
active: true
maxLineLength: 120
ignoreBackTickedIdentifier: false
ModifierOrdering:
active: true
autoCorrect: true
MultiLineIfElse:
active: false
autoCorrect: true
NoBlankLineBeforeRbrace:
active: true
autoCorrect: true
NoConsecutiveBlankLines:
active: true
autoCorrect: true
NoEmptyClassBody:
active: true
autoCorrect: true
NoEmptyFirstLineInMethodBlock:
active: false
autoCorrect: true
NoLineBreakAfterElse:
active: true
autoCorrect: true
NoLineBreakBeforeAssignment:
active: true
autoCorrect: true
NoMultipleSpaces:
active: true
autoCorrect: true
NoSemicolons:
active: true
autoCorrect: true
NoTrailingSpaces:
active: true
autoCorrect: true
NoUnitReturn:
active: true
autoCorrect: true
NoUnusedImports:
active: true
autoCorrect: true
NoWildcardImports:
active: true
PackageName:
active: false
autoCorrect: true
ParameterListWrapping:
active: true
autoCorrect: true
indentSize: 4
maxLineLength: 120
SpacingAroundAngleBrackets:
active: false
autoCorrect: true
SpacingAroundColon:
active: true
autoCorrect: true
SpacingAroundComma:
active: true
autoCorrect: true
SpacingAroundCurly:
active: true
autoCorrect: true
SpacingAroundDot:
active: true
autoCorrect: true
SpacingAroundDoubleColon:
active: false
autoCorrect: true
SpacingAroundKeyword:
active: true
autoCorrect: true
SpacingAroundOperators:
active: true
autoCorrect: true
SpacingAroundParens:
active: true
autoCorrect: true
SpacingAroundRangeOperator:
active: true
autoCorrect: true
SpacingAroundUnaryOperator:
active: false
autoCorrect: true
SpacingBetweenDeclarationsWithAnnotations:
active: false
autoCorrect: true
SpacingBetweenDeclarationsWithComments:
active: false
autoCorrect: true
StringTemplate:
active: true
autoCorrect: true
TrailingComma:
active: false
autoCorrect: true
allowTrailingComma: false
allowTrailingCommaOnCallSite: false
Expand Up @@ -4,9 +4,12 @@ import io.gitlab.arturbosch.detekt.generator.collection.RuleSetPage
import io.gitlab.arturbosch.detekt.generator.out.MarkdownWriter
import io.gitlab.arturbosch.detekt.generator.out.PropertiesWriter
import io.gitlab.arturbosch.detekt.generator.out.YamlWriter
import io.gitlab.arturbosch.detekt.generator.out.yaml
import io.gitlab.arturbosch.detekt.generator.printer.DeprecatedPrinter
import io.gitlab.arturbosch.detekt.generator.printer.RuleSetPagePrinter
import io.gitlab.arturbosch.detekt.generator.printer.defaultconfig.ConfigPrinter
import io.gitlab.arturbosch.detekt.generator.printer.defaultconfig.printRuleSetPage
import java.nio.file.Paths

class DetektPrinter(private val arguments: GeneratorArgs) {

Expand All @@ -26,6 +29,11 @@ class DetektPrinter(private val arguments: GeneratorArgs) {
propertiesWriter.write(arguments.configPath, "deprecation") {
DeprecatedPrinter.print(pages.filterNot { it.ruleSet.name == "formatting" })
}
yamlWriter.write(Paths.get("../detekt-formatting/src/main/resources/config"), "config") {
yaml {
printRuleSetPage(pages.first { it.ruleSet.name == "formatting" })
}
}
}

private fun jekyllHeader(ruleSet: String): String {
Expand Down

0 comments on commit 6442700

Please sign in to comment.