Full Code of saveourtool/diktat for AI

master cd77a0b839e1 cached
967 files
3.2 MB
910.7k tokens
1 requests
Download .txt
Showing preview only (3,655K chars total). Download the full file or copy to clipboard to get everything.
Repository: saveourtool/diktat
Branch: master
Commit: cd77a0b839e1
Files: 967
Total size: 3.2 MB

Directory structure:
gitextract_zjq19om1/

├── .editorconfig
├── .git-hooks/
│   ├── commit-msg.sh
│   └── pre-commit.sh
├── .gitattributes
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.md
│   │   └── config.yml
│   ├── codecov.yml
│   ├── pull_request_template.md
│   └── workflows/
│       ├── build_and_test.yml
│       ├── codeql-analysis.yml
│       ├── dependencies.yml
│       ├── detekt.yml
│       ├── diktat.yml
│       ├── diktat_snapshot.yml
│       └── release.yml
├── .gitignore
├── CNAME
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── RELEASING.md
├── _config.yml
├── build.gradle.kts
├── detekt-config.yml
├── diktat-analysis.yml
├── diktat-api/
│   ├── build.gradle.kts
│   └── src/
│       └── main/
│           └── kotlin/
│               └── com/
│                   └── saveourtool/
│                       └── diktat/
│                           ├── Constants.kt
│                           ├── DiktatProcessor.kt
│                           ├── DiktatProcessorFactory.kt
│                           ├── DiktatRunner.kt
│                           ├── DiktatRunnerArguments.kt
│                           ├── DiktatRunnerFactory.kt
│                           ├── api/
│                           │   ├── DiktatBaseline.kt
│                           │   ├── DiktatBaselineFactory.kt
│                           │   ├── DiktatCallback.kt
│                           │   ├── DiktatError.kt
│                           │   ├── DiktatErrorEmitter.kt
│                           │   ├── DiktatProcessorListener.kt
│                           │   ├── DiktatReporterCreationArguments.kt
│                           │   ├── DiktatReporterFactory.kt
│                           │   ├── DiktatReporterType.kt
│                           │   ├── DiktatRule.kt
│                           │   ├── DiktatRuleConfig.kt
│                           │   ├── DiktatRuleConfigReader.kt
│                           │   ├── DiktatRuleNameAware.kt
│                           │   ├── DiktatRuleSet.kt
│                           │   └── DiktatRuleSetFactory.kt
│                           ├── common/
│                           │   └── config/
│                           │       └── rules/
│                           │           └── LegacyAliases.kt
│                           └── util/
│                               ├── DiktatProcessorListenerWrapper.kt
│                               └── FileUtils.kt
├── diktat-cli/
│   ├── README.md
│   ├── build.gradle.kts
│   └── src/
│       ├── main/
│       │   ├── kotlin/
│       │   │   └── com/
│       │   │       └── saveourtool/
│       │   │           └── diktat/
│       │   │               ├── DiktatMain.kt
│       │   │               ├── cli/
│       │   │               │   ├── DiktatMode.kt
│       │   │               │   └── DiktatProperties.kt
│       │   │               └── util/
│       │   │                   └── CliUtils.kt
│       │   └── script/
│       │       ├── diktat.cmd
│       │       └── header-diktat.sh
│       └── test/
│           ├── kotlin/
│           │   └── com/
│           │       └── saveourtool/
│           │           └── diktat/
│           │               ├── smoke/
│           │               │   ├── DiktatCliTest.kt
│           │               │   ├── DiktatSaveSmokeTest.kt
│           │               │   ├── DiktatSmokeTest.kt
│           │               │   ├── DiktatSmokeTestBase.kt
│           │               │   └── DiktatSmokeTestUtils.kt
│           │               └── util/
│           │                   └── CliUtilsKtTest.kt
│           └── resources/
│               └── test/
│                   └── smoke/
│                       ├── .editorconfig
│                       ├── .gitignore
│                       ├── build.gradle.kts_
│                       ├── save.toml
│                       └── src/
│                           ├── jsMain/
│                           │   └── kotlin/
│                           │       └── com/
│                           │           └── saveourtool/
│                           │               └── diktat/
│                           │                   └── scripts/
│                           │                       ├── ScriptExpected.kt
│                           │                       └── ScriptTest.kt
│                           └── main/
│                               └── kotlin/
│                                   ├── Bug1Expected.kt
│                                   ├── Bug1Test.kt
│                                   ├── DefaultPackageExpected.kt
│                                   ├── DefaultPackageTest.kt
│                                   ├── Example1-2Expected.kt
│                                   ├── Example1Expected.kt
│                                   ├── Example1Test.kt
│                                   ├── Example2Expected.kt
│                                   ├── Example2Test.kt
│                                   ├── Example3Expected.kt
│                                   ├── Example3Test.kt
│                                   ├── Example4Expected.kt
│                                   ├── Example4Test.kt
│                                   ├── Example5Expected.kt
│                                   ├── Example5Test.kt
│                                   ├── Example6Expected.kt
│                                   ├── Example6Test.kt
│                                   ├── Example7Expected.kt
│                                   ├── Example7Test.kt
│                                   ├── Example8Expected.kt
│                                   ├── Example8Test.kt
│                                   ├── KdocFormattingMultilineTagsExpected.kt
│                                   ├── KdocFormattingMultilineTagsTest.kt
│                                   ├── LocalVariableWithOffsetExpected.kt
│                                   ├── LocalVariableWithOffsetTest.kt
│                                   ├── ManyLineTransformInLongLineExpected.kt
│                                   ├── ManyLineTransformInLongLineTest.kt
│                                   ├── NewlinesAfterInterfacesExpected.kt
│                                   ├── NewlinesAfterInterfacesTest.kt
│                                   ├── SemicolonsExpected.kt
│                                   ├── SemicolonsTest.kt
│                                   ├── kotlin-library-expected.gradle.kts
│                                   ├── kotlin-library.gradle.kts
│                                   ├── save.toml
│                                   └── script/
│                                       ├── PackageInScriptExpected.kts
│                                       ├── PackageInScriptTest.kts
│                                       ├── SimpleRunInScriptExpected.kts
│                                       └── SimpleRunInScriptTest.kts
├── diktat-common-test/
│   ├── build.gradle.kts
│   └── src/
│       └── main/
│           └── kotlin/
│               └── com/
│                   └── saveourtool/
│                       └── diktat/
│                           └── test/
│                               └── framework/
│                                   ├── processing/
│                                   │   ├── ResourceReader.kt
│                                   │   ├── TestComparatorUnit.kt
│                                   │   └── TestFileContent.kt
│                                   └── util/
│                                       └── TestUtils.kt
├── diktat-dev-ksp/
│   ├── build.gradle.kts
│   └── src/
│       └── main/
│           ├── kotlin/
│           │   └── com/
│           │       └── saveourtool/
│           │           └── diktat/
│           │               └── ruleset/
│           │                   └── generation/
│           │                       ├── EnumNames.kt
│           │                       ├── EnumNamesSymbolProcessor.kt
│           │                       └── EnumNamesSymbolProcessorProvider.kt
│           └── resources/
│               └── META-INF/
│                   └── services/
│                       └── com.google.devtools.ksp.processing.SymbolProcessorProvider
├── diktat-gradle-plugin/
│   ├── README.md
│   ├── build.gradle.kts
│   └── src/
│       ├── functionalTest/
│       │   └── kotlin/
│       │       └── com/
│       │           └── saveourtool/
│       │               └── diktat/
│       │                   └── plugin/
│       │                       └── gradle/
│       │                           ├── DiktatGradlePluginFunctionalTest.kt
│       │                           ├── DiktatGradlePluginGroovyFunctionalTest.kt
│       │                           ├── DiktatGradlePluginMultiprojectFunctionalTest.kt
│       │                           └── Utils.kt
│       ├── main/
│       │   └── kotlin/
│       │       └── com/
│       │           └── saveourtool/
│       │               └── diktat/
│       │                   └── plugin/
│       │                       └── gradle/
│       │                           ├── DiktatExtension.kt
│       │                           ├── DiktatGradlePlugin.kt
│       │                           ├── Utils.kt
│       │                           ├── extension/
│       │                           │   ├── DefaultReporter.kt
│       │                           │   ├── Reporter.kt
│       │                           │   └── Reporters.kt
│       │                           └── tasks/
│       │                               ├── DiktatCheckTask.kt
│       │                               ├── DiktatFixTask.kt
│       │                               ├── DiktatTaskBase.kt
│       │                               └── SarifReportMergeTask.kt
│       └── test/
│           └── kotlin/
│               └── com/
│                   └── saveourtool/
│                       └── diktat/
│                           └── plugin/
│                               └── gradle/
│                                   ├── DiktatGradlePluginTest.kt
│                                   └── DiktatJavaExecTaskTest.kt
├── diktat-ktlint-engine/
│   ├── build.gradle.kts
│   └── src/
│       ├── main/
│       │   └── kotlin/
│       │       └── com/
│       │           ├── pinterest/
│       │           │   └── ktlint/
│       │           │       └── rule/
│       │           │           └── engine/
│       │           │               └── api/
│       │           │                   └── Code.kt
│       │           └── saveourtool/
│       │               └── diktat/
│       │                   └── ktlint/
│       │                       ├── DiktatBaselineFactoryImpl.kt
│       │                       ├── DiktatProcessorFactoryImpl.kt
│       │                       ├── DiktatReporterFactoryImpl.kt
│       │                       ├── DiktatReporterImpl.kt
│       │                       ├── KtLintRuleWrapper.kt
│       │                       ├── KtLintUtils.kt
│       │                       └── ReporterV2Wrapper.kt
│       └── test/
│           └── kotlin/
│               └── com/
│                   └── saveourtool/
│                       └── diktat/
│                           └── ktlint/
│                               └── KtLintRuleWrapperTest.kt
├── diktat-maven-plugin/
│   ├── README.md
│   ├── build.gradle.kts
│   └── src/
│       ├── main/
│       │   └── kotlin/
│       │       └── com/
│       │           └── saveourtool/
│       │               └── diktat/
│       │                   └── plugin/
│       │                       └── maven/
│       │                           ├── DiktatBaseMojo.kt
│       │                           ├── DiktatMojo.kt
│       │                           ├── Utils.kt
│       │                           └── reporters/
│       │                               ├── DefaultReporter.kt
│       │                               ├── GitHubActionsReporter.kt
│       │                               ├── Reporter.kt
│       │                               └── Reporters.kt
│       └── test/
│           ├── kotlin/
│           │   └── com/
│           │       └── saveourtool/
│           │           └── diktat/
│           │               └── plugin/
│           │                   └── maven/
│           │                       ├── DiktatBaseMojoTest.kt
│           │                       └── DiktatMavenPluginIntegrationTest.kt
│           └── resources/
│               └── .mvn/
│                   ├── jvm.config
│                   └── maven.config
├── diktat-rules/
│   ├── build.gradle.kts
│   └── src/
│       ├── main/
│       │   ├── kotlin/
│       │   │   └── com/
│       │   │       └── saveourtool/
│       │   │           └── diktat/
│       │   │               ├── common/
│       │   │               │   └── config/
│       │   │               │       └── rules/
│       │   │               │           └── LegacyUtils.kt
│       │   │               └── ruleset/
│       │   │                   ├── config/
│       │   │                   │   ├── AbstractDiktatRuleConfigReader.kt
│       │   │                   │   ├── CommonConfiguration.kt
│       │   │                   │   ├── DiktatRuleConfigYamlReader.kt
│       │   │                   │   └── RuleConfiguration.kt
│       │   │                   ├── constants/
│       │   │                   │   ├── Chapters.kt
│       │   │                   │   └── Warnings.kt
│       │   │                   ├── rules/
│       │   │                   │   ├── DiktatRule.kt
│       │   │                   │   ├── DiktatRuleSetFactoryImpl.kt
│       │   │                   │   ├── chapter1/
│       │   │                   │   │   ├── FileNaming.kt
│       │   │                   │   │   ├── IdentifierNaming.kt
│       │   │                   │   │   └── PackageNaming.kt
│       │   │                   │   ├── chapter2/
│       │   │                   │   │   ├── comments/
│       │   │                   │   │   │   ├── CommentsRule.kt
│       │   │                   │   │   │   └── HeaderCommentRule.kt
│       │   │                   │   │   └── kdoc/
│       │   │                   │   │       ├── CommentsFormatting.kt
│       │   │                   │   │       ├── KdocComments.kt
│       │   │                   │   │       ├── KdocFormatting.kt
│       │   │                   │   │       └── KdocMethods.kt
│       │   │                   │   ├── chapter3/
│       │   │                   │   │   ├── AnnotationNewLineRule.kt
│       │   │                   │   │   ├── BlockStructureBraces.kt
│       │   │                   │   │   ├── BooleanExpressionsRule.kt
│       │   │                   │   │   ├── BracesInConditionalsAndLoopsRule.kt
│       │   │                   │   │   ├── ClassLikeStructuresOrderRule.kt
│       │   │                   │   │   ├── CollapseIfStatementsRule.kt
│       │   │                   │   │   ├── ConsecutiveSpacesRule.kt
│       │   │                   │   │   ├── DebugPrintRule.kt
│       │   │                   │   │   ├── EmptyBlock.kt
│       │   │                   │   │   ├── EnumsSeparated.kt
│       │   │                   │   │   ├── LineLength.kt
│       │   │                   │   │   ├── LongNumericalValuesSeparatedRule.kt
│       │   │                   │   │   ├── MagicNumberRule.kt
│       │   │                   │   │   ├── MultipleModifiersSequence.kt
│       │   │                   │   │   ├── NullableTypeRule.kt
│       │   │                   │   │   ├── PreviewAnnotationRule.kt
│       │   │                   │   │   ├── RangeConventionalRule.kt
│       │   │                   │   │   ├── SingleLineStatementsRule.kt
│       │   │                   │   │   ├── SortRule.kt
│       │   │                   │   │   ├── StringConcatenationRule.kt
│       │   │                   │   │   ├── StringTemplateFormatRule.kt
│       │   │                   │   │   ├── TrailingCommaRule.kt
│       │   │                   │   │   ├── WhenMustHaveElseRule.kt
│       │   │                   │   │   ├── files/
│       │   │                   │   │   │   ├── BlankLinesRule.kt
│       │   │                   │   │   │   ├── FileSize.kt
│       │   │                   │   │   │   ├── FileStructureRule.kt
│       │   │                   │   │   │   ├── IndentationAmount.kt
│       │   │                   │   │   │   ├── IndentationAware.kt
│       │   │                   │   │   │   ├── IndentationConfigAware.kt
│       │   │                   │   │   │   ├── IndentationError.kt
│       │   │                   │   │   │   ├── IndentationRule.kt
│       │   │                   │   │   │   ├── IndentedElementType.kt
│       │   │                   │   │   │   ├── NewlinesRule.kt
│       │   │                   │   │   │   ├── SemicolonsRule.kt
│       │   │                   │   │   │   ├── TopLevelOrderRule.kt
│       │   │                   │   │   │   └── WhiteSpaceRule.kt
│       │   │                   │   │   └── identifiers/
│       │   │                   │   │       └── LocalVariablesRule.kt
│       │   │                   │   ├── chapter4/
│       │   │                   │   │   ├── ImmutableValNoVarRule.kt
│       │   │                   │   │   ├── NullChecksRule.kt
│       │   │                   │   │   ├── SmartCastRule.kt
│       │   │                   │   │   ├── TypeAliasRule.kt
│       │   │                   │   │   ├── VariableGenericTypeDeclarationRule.kt
│       │   │                   │   │   └── calculations/
│       │   │                   │   │       └── AccurateCalculationsRule.kt
│       │   │                   │   ├── chapter5/
│       │   │                   │   │   ├── AsyncAndSyncRule.kt
│       │   │                   │   │   ├── AvoidNestedFunctionsRule.kt
│       │   │                   │   │   ├── CheckInverseMethodRule.kt
│       │   │                   │   │   ├── CustomLabel.kt
│       │   │                   │   │   ├── FunctionArgumentsSize.kt
│       │   │                   │   │   ├── FunctionLength.kt
│       │   │                   │   │   ├── LambdaLengthRule.kt
│       │   │                   │   │   ├── LambdaParameterOrder.kt
│       │   │                   │   │   ├── NestedFunctionBlock.kt
│       │   │                   │   │   ├── OverloadingArgumentsFunction.kt
│       │   │                   │   │   └── ParameterNameInOuterLambdaRule.kt
│       │   │                   │   └── chapter6/
│       │   │                   │       ├── AvoidEmptyPrimaryConstructor.kt
│       │   │                   │       ├── AvoidUtilityClass.kt
│       │   │                   │       ├── CustomGetterSetterRule.kt
│       │   │                   │       ├── ExtensionFunctionsInFileRule.kt
│       │   │                   │       ├── ExtensionFunctionsSameNameRule.kt
│       │   │                   │       ├── ImplicitBackingPropertyRule.kt
│       │   │                   │       ├── PropertyAccessorFields.kt
│       │   │                   │       ├── RunInScript.kt
│       │   │                   │       ├── TrivialPropertyAccessors.kt
│       │   │                   │       ├── UseLastIndex.kt
│       │   │                   │       ├── UselessSupertype.kt
│       │   │                   │       └── classes/
│       │   │                   │           ├── AbstractClassesRule.kt
│       │   │                   │           ├── CompactInitialization.kt
│       │   │                   │           ├── DataClassesRule.kt
│       │   │                   │           ├── InlineClassesRule.kt
│       │   │                   │           ├── SingleConstructorRule.kt
│       │   │                   │           ├── SingleInitRule.kt
│       │   │                   │           └── StatelessClassesRule.kt
│       │   │                   └── utils/
│       │   │                       ├── AstConstants.kt
│       │   │                       ├── AstNodeUtils.kt
│       │   │                       ├── AstNodeUtilsFromKtLint.kt
│       │   │                       ├── FileUtils.kt
│       │   │                       ├── FunctionAstNodeUtils.kt
│       │   │                       ├── KdocUtils.kt
│       │   │                       ├── KotlinParseException.kt
│       │   │                       ├── KotlinParser.kt
│       │   │                       ├── PositionInTextLocator.kt
│       │   │                       ├── PsiUtils.kt
│       │   │                       ├── StringCaseUtils.kt
│       │   │                       ├── StringUtils.kt
│       │   │                       ├── indentation/
│       │   │                       │   ├── Checkers.kt
│       │   │                       │   ├── CustomIndentationChecker.kt
│       │   │                       │   └── IndentationConfig.kt
│       │   │                       └── search/
│       │   │                           ├── VariablesSearch.kt
│       │   │                           ├── VariablesWithAssignmentSearch.kt
│       │   │                           └── VariablesWithUsagesSearch.kt
│       │   └── resources/
│       │       ├── diktat-analysis-huawei.yml
│       │       └── diktat-analysis.yml
│       └── test/
│           ├── kotlin/
│           │   └── com/
│           │       └── saveourtool/
│           │           └── diktat/
│           │               ├── ruleset/
│           │               │   ├── chapter1/
│           │               │   │   ├── EnumValueCaseTest.kt
│           │               │   │   ├── IdentifierNamingFixTest.kt
│           │               │   │   ├── IdentifierNamingWarnTest.kt
│           │               │   │   ├── MethodNamingWarnTest.kt
│           │               │   │   ├── PackageNamingFixTest.kt
│           │               │   │   ├── PackageNamingWarnTest.kt
│           │               │   │   └── PackagePathFixTest.kt
│           │               │   ├── chapter2/
│           │               │   │   ├── CommentsFormattingFixTest.kt
│           │               │   │   ├── CommentsFormattingTest.kt
│           │               │   │   ├── HeaderCommentRuleFixTest.kt
│           │               │   │   ├── HeaderCommentRuleTest.kt
│           │               │   │   ├── KdocCommentsFixTest.kt
│           │               │   │   ├── KdocCommentsWarnTest.kt
│           │               │   │   ├── KdocFormattingFixTest.kt
│           │               │   │   ├── KdocFormattingTest.kt
│           │               │   │   ├── KdocMethodsFixTest.kt
│           │               │   │   ├── KdocMethodsTest.kt
│           │               │   │   ├── KdocParamPresentWarnTest.kt
│           │               │   │   └── comments/
│           │               │   │       └── CommentedCodeTest.kt
│           │               │   ├── chapter3/
│           │               │   │   ├── AnnotationNewLineRuleFixTest.kt
│           │               │   │   ├── AnnotationNewLineRuleWarnTest.kt
│           │               │   │   ├── BlockStructureBracesFixTest.kt
│           │               │   │   ├── BlockStructureBracesWarnTest.kt
│           │               │   │   ├── BooleanExpressionsRuleFixTest.kt
│           │               │   │   ├── BooleanExpressionsRuleWarnTest.kt
│           │               │   │   ├── BracesRuleFixTest.kt
│           │               │   │   ├── BracesRuleWarnTest.kt
│           │               │   │   ├── ClassLikeStructuresOrderFixTest.kt
│           │               │   │   ├── ClassLikeStructuresOrderRuleWarnTest.kt
│           │               │   │   ├── CollapseIfStatementsRuleFixTest.kt
│           │               │   │   ├── CollapseIfStatementsRuleWarnTest.kt
│           │               │   │   ├── ConsecutiveSpacesRuleFixTest.kt
│           │               │   │   ├── ConsecutiveSpacesRuleWarnTest.kt
│           │               │   │   ├── DebugPrintRuleWarnTest.kt
│           │               │   │   ├── EmptyBlockFixTest.kt
│           │               │   │   ├── EmptyBlockWarnTest.kt
│           │               │   │   ├── EnumsSeparatedFixTest.kt
│           │               │   │   ├── EnumsSeparatedWarnTest.kt
│           │               │   │   ├── FileSizeWarnTest.kt
│           │               │   │   ├── FileStructureRuleFixTest.kt
│           │               │   │   ├── FileStructureRuleTest.kt
│           │               │   │   ├── LineLengthFixTest.kt
│           │               │   │   ├── LineLengthWarnTest.kt
│           │               │   │   ├── LocalVariablesWarnTest.kt
│           │               │   │   ├── LongNumericalValuesSeparatedFixTest.kt
│           │               │   │   ├── LongNumericalValuesSeparatedWarnTest.kt
│           │               │   │   ├── MagicNumberRuleWarnTest.kt
│           │               │   │   ├── MultipleModifiersSequenceFixTest.kt
│           │               │   │   ├── MultipleModifiersSequenceWarnTest.kt
│           │               │   │   ├── NullableTypeRuleFixTest.kt
│           │               │   │   ├── NullableTypeRuleWarnTest.kt
│           │               │   │   ├── PreviewAnnotationFixTest.kt
│           │               │   │   ├── PreviewAnnotationWarnTest.kt
│           │               │   │   ├── RangeConventionalRuleFixTest.kt
│           │               │   │   ├── RangeConventionalRuleWarnTest.kt
│           │               │   │   ├── SingleLineStatementsRuleFixTest.kt
│           │               │   │   ├── SingleLineStatementsRuleWarnTest.kt
│           │               │   │   ├── SortRuleFixTest.kt
│           │               │   │   ├── SortRuleWarnTest.kt
│           │               │   │   ├── StringConcatenationRuleFixTest.kt
│           │               │   │   ├── StringConcatenationWarnTest.kt
│           │               │   │   ├── StringTemplateRuleFixTest.kt
│           │               │   │   ├── StringTemplateRuleWarnTest.kt
│           │               │   │   ├── SuperClassListWarnTest.kt
│           │               │   │   ├── TrailingCommaFixTest.kt
│           │               │   │   ├── TrailingCommaWarnTest.kt
│           │               │   │   ├── WhenMustHaveElseFixTest.kt
│           │               │   │   ├── WhenMustHaveElseWarnTest.kt
│           │               │   │   ├── files/
│           │               │   │   │   ├── BlankLinesFixTest.kt
│           │               │   │   │   ├── BlankLinesWarnTest.kt
│           │               │   │   │   ├── NewlinesRuleFixTest.kt
│           │               │   │   │   ├── NewlinesRuleWarnTest.kt
│           │               │   │   │   ├── SemicolonsRuleFixTest.kt
│           │               │   │   │   ├── SemicolonsRuleWarnTest.kt
│           │               │   │   │   ├── TopLevelOrderRuleFixTest.kt
│           │               │   │   │   └── TopLevelOrderRuleWarnTest.kt
│           │               │   │   └── spaces/
│           │               │   │       ├── ExpectedIndentationError.kt
│           │               │   │       ├── IndentationConfigAwareTest.kt
│           │               │   │       ├── IndentationConfigFactory.kt
│           │               │   │       ├── IndentationRuleFixTest.kt
│           │               │   │       ├── IndentationRuleTest.kt
│           │               │   │       ├── IndentationRuleTestSuite.kt
│           │               │   │       ├── IndentationRuleTestUtils.kt
│           │               │   │       ├── IndentationRuleWarnTest.kt
│           │               │   │       ├── WhiteSpaceRuleFixTest.kt
│           │               │   │       ├── WhiteSpaceRuleWarnTest.kt
│           │               │   │       └── junit/
│           │               │   │           ├── IndentationTest.kt
│           │               │   │           ├── IndentationTestExtension.kt
│           │               │   │           ├── IndentationTestFixExtension.kt
│           │               │   │           ├── IndentationTestFixInvocationContext.kt
│           │               │   │           ├── IndentationTestInput.kt
│           │               │   │           ├── IndentationTestInvocationContext.kt
│           │               │   │           ├── IndentationTestInvocationContextProvider.kt
│           │               │   │           ├── IndentationTestWarnExtension.kt
│           │               │   │           ├── IndentationTestWarnInvocationContext.kt
│           │               │   │           └── IndentedSourceCode.kt
│           │               │   ├── chapter4/
│           │               │   │   ├── AccurateCalculationsWarnTest.kt
│           │               │   │   ├── NoVarRuleWarnTest.kt
│           │               │   │   ├── NullChecksRuleFixTest.kt
│           │               │   │   ├── NullChecksRuleWarnTest.kt
│           │               │   │   ├── SmartCastRuleFixTest.kt
│           │               │   │   ├── SmartCastRuleWarnTest.kt
│           │               │   │   ├── TypeAliasRuleWarnTest.kt
│           │               │   │   ├── VariableGenericTypeDeclarationRuleFixTest.kt
│           │               │   │   └── VariableGenericTypeDeclarationRuleWarnTest.kt
│           │               │   ├── chapter5/
│           │               │   │   ├── AsyncAndSyncRuleTest.kt
│           │               │   │   ├── AvoidNestedFunctionsFixTest.kt
│           │               │   │   ├── AvoidNestedFunctionsWarnTest.kt
│           │               │   │   ├── CheckInverseMethodRuleFixTest.kt
│           │               │   │   ├── CheckInverseMethodRuleWarnTest.kt
│           │               │   │   ├── CustomLabelsTest.kt
│           │               │   │   ├── FunctionArgumentsSizeWarnTest.kt
│           │               │   │   ├── FunctionLengthWarnTest.kt
│           │               │   │   ├── LambdaLengthWarnTest.kt
│           │               │   │   ├── LambdaParameterOrderWarnTest.kt
│           │               │   │   ├── NestedFunctionBlockWarnTest.kt
│           │               │   │   ├── OverloadingArgumentsFunctionWarnTest.kt
│           │               │   │   └── ParameterNameInOuterLambdaRuleWarnTest.kt
│           │               │   ├── chapter6/
│           │               │   │   ├── AbstractClassesFixTest.kt
│           │               │   │   ├── AbstractClassesWarnTest.kt
│           │               │   │   ├── AvoidUtilityClassWarnTest.kt
│           │               │   │   ├── CompactInitializationFixTest.kt
│           │               │   │   ├── CompactInitializationWarnTest.kt
│           │               │   │   ├── CustomGetterSetterWarnTest.kt
│           │               │   │   ├── DataClassesRuleWarnTest.kt
│           │               │   │   ├── EmptyPrimaryConstructorFixTest.kt
│           │               │   │   ├── EmptyPrimaryConstructorWarnTest.kt
│           │               │   │   ├── ExtensionFunctionsInFileWarnTest.kt
│           │               │   │   ├── ExtensionFunctionsSameNameWarnTest.kt
│           │               │   │   ├── ImplicitBackingPropertyWarnTest.kt
│           │               │   │   ├── InlineClassesWarnTest.kt
│           │               │   │   ├── PropertyAccessorFieldsWarnTest.kt
│           │               │   │   ├── RunInScriptFixTest.kt
│           │               │   │   ├── RunInScriptWarnTest.kt
│           │               │   │   ├── SingleConstructorRuleFixTest.kt
│           │               │   │   ├── SingleConstructorRuleWarnTest.kt
│           │               │   │   ├── SingleInitRuleFixTest.kt
│           │               │   │   ├── SingleInitRuleWarnTest.kt
│           │               │   │   ├── StatelessClassesRuleFixTest.kt
│           │               │   │   ├── StatelessClassesRuleWarnTest.kt
│           │               │   │   ├── TrivialPropertyAccessorsFixTest.kt
│           │               │   │   ├── TrivialPropertyAccessorsWarnTest.kt
│           │               │   │   ├── UseLastIndexFixTest.kt
│           │               │   │   ├── UseLastIndexWarnTest.kt
│           │               │   │   ├── UselessSupertypeFixTest.kt
│           │               │   │   └── UselessSupertypeWarnTest.kt
│           │               │   ├── config/
│           │               │   │   └── DiktatRuleConfigYamlReaderTest.kt
│           │               │   ├── junit/
│           │               │   │   ├── BooleanOrDefault.kt
│           │               │   │   ├── CloseablePath.kt
│           │               │   │   ├── ExpectedLintError.kt
│           │               │   │   ├── ExpectedLintErrors.kt
│           │               │   │   ├── NaturalDisplayName.kt
│           │               │   │   └── RuleInvocationContextProvider.kt
│           │               │   ├── smoke/
│           │               │   │   └── RulesConfigValidationTest.kt
│           │               │   └── utils/
│           │               │       ├── AstNodeUtilsTest.kt
│           │               │       ├── AvailableRulesDocTest.kt
│           │               │       ├── FunctionAstNodeUtilsTest.kt
│           │               │       ├── KotlinParserTest.kt
│           │               │       ├── RulesConfigYamlTest.kt
│           │               │       ├── StringCaseUtilsTest.kt
│           │               │       ├── SuppressAnnotatedExpressionTest.kt
│           │               │       ├── SuppressTest.kt
│           │               │       ├── VariablesSearchTest.kt
│           │               │       ├── VariablesWithAssignmentsSearchTest.kt
│           │               │       ├── VariablesWithUsagesSearchTest.kt
│           │               │       └── WarningsGenerationTest.kt
│           │               └── util/
│           │                   ├── DiktatRuleSetFactoryImplTest.kt
│           │                   ├── DiktatRuleTest.kt
│           │                   ├── FixTestBase.kt
│           │                   ├── LintTestBase.kt
│           │                   ├── SuppressingTest.kt
│           │                   └── TestUtils.kt
│           └── resources/
│               ├── log4j2.properties
│               ├── test/
│               │   ├── chapter6/
│               │   │   ├── abstract_classes/
│               │   │   │   ├── ShouldReplaceAbstractKeywordExpected.kt
│               │   │   │   └── ShouldReplaceAbstractKeywordTest.kt
│               │   │   ├── classes/
│               │   │   │   ├── AssignmentWithLocalPropertyExpected.kt
│               │   │   │   ├── AssignmentWithLocalPropertyTest.kt
│               │   │   │   ├── ConstructorShouldKeepExpressionsOrderExpected.kt
│               │   │   │   ├── ConstructorShouldKeepExpressionsOrderTest.kt
│               │   │   │   ├── ConstructorWithCommentsExpected.kt
│               │   │   │   ├── ConstructorWithCommentsTest.kt
│               │   │   │   ├── ConstructorWithComplexAssignmentsExpected.kt
│               │   │   │   ├── ConstructorWithComplexAssignmentsTest.kt
│               │   │   │   ├── ConstructorWithCustomAssignmentsExpected.kt
│               │   │   │   ├── ConstructorWithCustomAssignmentsTest.kt
│               │   │   │   ├── ConstructorWithInitExpected.kt
│               │   │   │   ├── ConstructorWithInitTest.kt
│               │   │   │   ├── ConstructorWithModifiersExpected.kt
│               │   │   │   ├── ConstructorWithModifiersTest.kt
│               │   │   │   ├── SimpleConstructorExpected.kt
│               │   │   │   └── SimpleConstructorTest.kt
│               │   │   ├── compact_initialization/
│               │   │   │   ├── ApplyOnStatementsWithThisKeywordExpected.kt
│               │   │   │   ├── ApplyOnStatementsWithThisKeywordTest.kt
│               │   │   │   ├── ApplyWithValueArgumentExpected.kt
│               │   │   │   ├── ApplyWithValueArgumentTest.kt
│               │   │   │   ├── ExampleWithCommentsExpected.kt
│               │   │   │   ├── ExampleWithCommentsTest.kt
│               │   │   │   ├── ParenthesizedReceiverExpected.kt
│               │   │   │   ├── ParenthesizedReceiverTest.kt
│               │   │   │   ├── SimpleExampleExpected.kt
│               │   │   │   ├── SimpleExampleTest.kt
│               │   │   │   ├── StatementUseFieldMultipleTimesExpected.kt
│               │   │   │   └── StatementUseFieldMultipleTimesTest.kt
│               │   │   ├── init_blocks/
│               │   │   │   ├── InitBlockWithAssignmentsExpected.kt
│               │   │   │   ├── InitBlockWithAssignmentsTest.kt
│               │   │   │   ├── InitBlocksExpected.kt
│               │   │   │   ├── InitBlocksTest.kt
│               │   │   │   ├── InitBlocksWithAssignmentsExpected.kt
│               │   │   │   └── InitBlocksWithAssignmentsTest.kt
│               │   │   ├── lastIndex_change/
│               │   │   │   ├── IncorrectUseLengthMinusOneExpected.kt
│               │   │   │   ├── IncorrectUseLengthMinusOneTest.kt
│               │   │   │   ├── UseAnyWhiteSpacesExpected.kt
│               │   │   │   └── UseAnyWhiteSpacesTest.kt
│               │   │   ├── primary_constructor/
│               │   │   │   ├── EmptyPCExpected.kt
│               │   │   │   └── EmptyPCTest.kt
│               │   │   ├── properties/
│               │   │   │   ├── TrivialPropertyAccessorsExpected.kt
│               │   │   │   └── TrivialPropertyAccessorsTest.kt
│               │   │   ├── script/
│               │   │   │   ├── SimpleRunInScriptExpected.kts
│               │   │   │   └── SimpleRunInScriptTest.kts
│               │   │   └── stateless_classes/
│               │   │       ├── StatelessClassExpected.kt
│               │   │       └── StatelessClassTest.kt
│               │   ├── paragraph1/
│               │   │   └── naming/
│               │   │       ├── class_/
│               │   │       │   ├── IncorrectClassNameExpected.kt
│               │   │       │   └── IncorrectClassNameTest.kt
│               │   │       ├── enum_/
│               │   │       │   ├── EnumValuePascalCaseExpected.kt
│               │   │       │   ├── EnumValuePascalCaseTest.kt
│               │   │       │   ├── EnumValueSnakeCaseExpected.kt
│               │   │       │   └── EnumValueSnakeCaseTest.kt
│               │   │       ├── file/
│               │   │       │   ├── fileNameTest.kt
│               │   │       │   └── file_nameTest.kt
│               │   │       ├── function/
│               │   │       │   ├── FunctionNameExpected.kt
│               │   │       │   └── FunctionNameTest.kt
│               │   │       ├── generic/
│               │   │       │   ├── GenericFunctionExpected.kt
│               │   │       │   └── GenericFunctionTest.kt
│               │   │       ├── identifiers/
│               │   │       │   ├── ConstantValNameExpected.kt
│               │   │       │   ├── ConstantValNameTest.kt
│               │   │       │   ├── IdentifierNameRegressionExpected.kt
│               │   │       │   ├── IdentifierNameRegressionTest.kt
│               │   │       │   ├── LambdaArgExpected.kt
│               │   │       │   ├── LambdaArgTest.kt
│               │   │       │   ├── PrefixInNameExpected.kt
│               │   │       │   ├── PrefixInNameTest.kt
│               │   │       │   ├── PropertyInKdocExpected.kt
│               │   │       │   ├── PropertyInKdocTest.kt
│               │   │       │   ├── TypeAliasNameExpected.kt
│               │   │       │   ├── TypeAliasNameTest.kt
│               │   │       │   ├── VariableNamingExpected.kt
│               │   │       │   └── VariableNamingTest.kt
│               │   │       ├── object_/
│               │   │       │   ├── IncorrectObjectNameExpected.kt
│               │   │       │   └── IncorrectObjectNameTest.kt
│               │   │       └── package/
│               │   │           ├── FixUnderscoreExpected.kt
│               │   │           ├── FixUnderscoreTest.kt
│               │   │           ├── FixUpperExpected.kt
│               │   │           ├── FixUpperTest.kt
│               │   │           ├── MissingDomainNameExpected.kt
│               │   │           ├── MissingDomainNameTest.kt
│               │   │           └── src/
│               │   │               └── main/
│               │   │                   └── kotlin/
│               │   │                       ├── com/
│               │   │                       │   └── saveourtool/
│               │   │                       │       └── diktat/
│               │   │                       │           └── some/
│               │   │                       │               └── name/
│               │   │                       │                   ├── FixIncorrectExpected.kt
│               │   │                       │                   ├── FixIncorrectTest.kt
│               │   │                       │                   ├── FixMissingExpected.kt
│               │   │                       │                   ├── FixMissingTest.kt
│               │   │                       │                   ├── FixMissingWithAnnotationExpected.kt
│               │   │                       │                   ├── FixMissingWithAnnotationExpected2.kt
│               │   │                       │                   ├── FixMissingWithAnnotationExpected3.kt
│               │   │                       │                   ├── FixMissingWithAnnotationTest.kt
│               │   │                       │                   ├── FixMissingWithAnnotationTest2.kt
│               │   │                       │                   ├── FixMissingWithAnnotationTest3.kt
│               │   │                       │                   ├── FixMissingWithoutImportExpected.kt
│               │   │                       │                   ├── FixMissingWithoutImportTest.kt
│               │   │                       │                   ├── FixPackageRegressionExpected.kt
│               │   │                       │                   └── FixPackageRegressionTest.kt
│               │   │                       └── some/
│               │   │                           ├── FixIncorrectExpected.kt
│               │   │                           ├── FixIncorrectTest.kt
│               │   │                           ├── FixMissingExpected.kt
│               │   │                           └── FixMissingTest.kt
│               │   ├── paragraph2/
│               │   │   ├── header/
│               │   │   │   ├── AutoCopyrightApplyPatternExpected.kt
│               │   │   │   ├── AutoCopyrightApplyPatternTest.kt
│               │   │   │   ├── AutoCopyrightExpected.kt
│               │   │   │   ├── AutoCopyrightTest.kt
│               │   │   │   ├── CopyrightAbsentInvalidPatternExpected.kt
│               │   │   │   ├── CopyrightAbsentInvalidPatternTest.kt
│               │   │   │   ├── CopyrightDifferentYearExpected.kt
│               │   │   │   ├── CopyrightDifferentYearExpected2.kt
│               │   │   │   ├── CopyrightDifferentYearTest.kt
│               │   │   │   ├── CopyrightDifferentYearTest2.kt
│               │   │   │   ├── CopyrightInvalidPatternValidCodeExpected.kt
│               │   │   │   ├── CopyrightInvalidPatternValidCodeTest.kt
│               │   │   │   ├── CopyrightShouldNotTriggerNPEExpected.kt
│               │   │   │   ├── CopyrightShouldNotTriggerNPETest.kt
│               │   │   │   ├── MisplacedHeaderKdocAppendedCopyrightExpected.kt
│               │   │   │   ├── MisplacedHeaderKdocAppendedCopyrightTest.kt
│               │   │   │   ├── MisplacedHeaderKdocExpected.kt
│               │   │   │   ├── MisplacedHeaderKdocNoCopyrightExpected.kt
│               │   │   │   ├── MisplacedHeaderKdocNoCopyrightTest.kt
│               │   │   │   ├── MisplacedHeaderKdocTest.kt
│               │   │   │   ├── MultilineCopyrightExample.kt
│               │   │   │   ├── MultilineCopyrightNotTriggerExample.kt
│               │   │   │   ├── MultilineCopyrightNotTriggerTest.kt
│               │   │   │   ├── MultilineCopyrightTest.kt
│               │   │   │   ├── NewlineAfterHeaderKdocExpected.kt
│               │   │   │   └── NewlineAfterHeaderKdocTest.kt
│               │   │   └── kdoc/
│               │   │       ├── BasicTagsEmptyLineBeforeExpected.kt
│               │   │       ├── BasicTagsEmptyLineBeforeTest.kt
│               │   │       ├── BasicTagsEmptyLinesExpected.kt
│               │   │       ├── BasicTagsEmptyLinesTest.kt
│               │   │       ├── ConstructorCommentExpected.kt
│               │   │       ├── ConstructorCommentNewlineExpected.kt
│               │   │       ├── ConstructorCommentNewlineTest.kt
│               │   │       ├── ConstructorCommentNoKDocExpected.kt
│               │   │       ├── ConstructorCommentNoKDocTest.kt
│               │   │       ├── ConstructorCommentPropertiesExpected.kt
│               │   │       ├── ConstructorCommentPropertiesTest.kt
│               │   │       ├── ConstructorCommentTest.kt
│               │   │       ├── DeprecatedTagExpected.kt
│               │   │       ├── DeprecatedTagTest.kt
│               │   │       ├── KdocBlockCommentExpected.kt
│               │   │       ├── KdocBlockCommentTest.kt
│               │   │       ├── KdocCodeBlockFormattingExampleExpected.kt
│               │   │       ├── KdocCodeBlockFormattingExampleTest.kt
│               │   │       ├── KdocCodeBlocksFormattingExpected.kt
│               │   │       ├── KdocCodeBlocksFormattingTest.kt
│               │   │       ├── KdocEmptyLineExpected.kt
│               │   │       ├── KdocEmptyLineTest.kt
│               │   │       ├── KdocFormattingFullExpected.kt
│               │   │       ├── KdocFormattingFullTest.kt
│               │   │       ├── KdocFormattingOrderExpected.kt
│               │   │       ├── KdocFormattingOrderTest.kt
│               │   │       ├── NoPackageNoImportExpected.kt
│               │   │       ├── NoPackageNoImportTest.kt
│               │   │       ├── OrderedTagsAssertionExpected.kt
│               │   │       ├── OrderedTagsAssertionTest.kt
│               │   │       ├── OrderedTagsExpected.kt
│               │   │       ├── OrderedTagsTest.kt
│               │   │       ├── SpacesAfterTagExpected.kt
│               │   │       ├── SpacesAfterTagTest.kt
│               │   │       ├── SpecialTagsInKdocExpected.kt
│               │   │       ├── SpecialTagsInKdocTest.kt
│               │   │       └── package/
│               │   │           └── src/
│               │   │               └── main/
│               │   │                   └── kotlin/
│               │   │                       └── com/
│               │   │                           └── saveourtool/
│               │   │                               └── diktat/
│               │   │                                   └── kdoc/
│               │   │                                       └── methods/
│               │   │                                           ├── EmptyKdocExpected.kt
│               │   │                                           ├── EmptyKdocTested.kt
│               │   │                                           ├── KdocMethodsFullExpected.kt
│               │   │                                           ├── KdocMethodsFullTested.kt
│               │   │                                           ├── KdocWithoutThrowsTagExpected.kt
│               │   │                                           ├── KdocWithoutThrowsTagTested.kt
│               │   │                                           ├── MissingKdocExpected.kt
│               │   │                                           ├── MissingKdocOnFunctionExpected.kt
│               │   │                                           ├── MissingKdocOnFunctionTest.kt
│               │   │                                           ├── MissingKdocTested.kt
│               │   │                                           ├── MissingKdocWithModifiersExpected.kt
│               │   │                                           ├── MissingKdocWithModifiersTest.kt
│               │   │                                           ├── ParamTagInsertionExpected.kt
│               │   │                                           ├── ParamTagInsertionTested.kt
│               │   │                                           ├── ReturnTagInsertionExpected.kt
│               │   │                                           ├── ReturnTagInsertionTested.kt
│               │   │                                           ├── ThrowsTagInsertionExpected.kt
│               │   │                                           └── ThrowsTagInsertionTested.kt
│               │   ├── paragraph3/
│               │   │   ├── annotations/
│               │   │   │   ├── AnnotationCommentExpected.kt
│               │   │   │   ├── AnnotationCommentTest.kt
│               │   │   │   ├── AnnotationConstructorSingleLineExpected.kt
│               │   │   │   ├── AnnotationConstructorSingleLineTest.kt
│               │   │   │   ├── AnnotationSingleLineExpected.kt
│               │   │   │   └── AnnotationSingleLineTest.kt
│               │   │   ├── blank_lines/
│               │   │   │   ├── CodeBlockWithBlankLinesExpected.kt
│               │   │   │   ├── CodeBlockWithBlankLinesTest.kt
│               │   │   │   ├── RedundantBlankLinesAtTheEndOfBlockExpected.kt
│               │   │   │   ├── RedundantBlankLinesAtTheEndOfBlockTest.kt
│               │   │   │   ├── RedundantBlankLinesExpected.kt
│               │   │   │   └── RedundantBlankLinesTest.kt
│               │   │   ├── block_brace/
│               │   │   │   ├── ClassBracesExpected.kt
│               │   │   │   ├── ClassBracesTest.kt
│               │   │   │   ├── DoWhileBracesExpected.kt
│               │   │   │   ├── DoWhileBracesTest.kt
│               │   │   │   ├── IfElseBracesExpected.kt
│               │   │   │   ├── IfElseBracesTest.kt
│               │   │   │   ├── LoopsBracesExpected.kt
│               │   │   │   ├── LoopsBracesTest.kt
│               │   │   │   ├── TryBraceExpected.kt
│               │   │   │   ├── TryBraceTest.kt
│               │   │   │   ├── WhenBranchesExpected.kt
│               │   │   │   └── WhenBranchesTest.kt
│               │   │   ├── boolean_expressions/
│               │   │   │   ├── BooleanExpressionsExpected.kt
│               │   │   │   ├── BooleanExpressionsTest.kt
│               │   │   │   ├── DistributiveLawExpected.kt
│               │   │   │   ├── DistributiveLawTest.kt
│               │   │   │   ├── ExpressionSimplificationExpected.kt
│               │   │   │   ├── ExpressionSimplificationTest.kt
│               │   │   │   ├── NegativeExpressionExpected.kt
│               │   │   │   ├── NegativeExpressionTest.kt
│               │   │   │   ├── OrderIssueExpected.kt
│               │   │   │   ├── OrderIssueTest.kt
│               │   │   │   ├── SameExpressionsInConditionExpected.kt
│               │   │   │   ├── SameExpressionsInConditionTest.kt
│               │   │   │   ├── SubstitutionIssueExpected.kt
│               │   │   │   └── SubstitutionIssueTest.kt
│               │   │   ├── braces/
│               │   │   │   ├── DoWhileBracesExpected.kt
│               │   │   │   ├── DoWhileBracesTest.kt
│               │   │   │   ├── IfElseBraces1Expected.kt
│               │   │   │   ├── IfElseBraces1Test.kt
│               │   │   │   ├── IfElseBracesInsideScopeFunctionsExpected.kt
│               │   │   │   ├── IfElseBracesInsideScopeFunctionsTest.kt
│               │   │   │   ├── LoopsBracesExpected.kt
│               │   │   │   ├── LoopsBracesInsideScopeFunctionsExpected.kt
│               │   │   │   ├── LoopsBracesInsideScopeFunctionsTest.kt
│               │   │   │   ├── LoopsBracesTest.kt
│               │   │   │   ├── WhenBranchesExpected.kt
│               │   │   │   └── WhenBranchesTest.kt
│               │   │   ├── collapse_if/
│               │   │   │   ├── CollapseIfStatementsExpected.kt
│               │   │   │   └── CollapseIfStatementsTest.kt
│               │   │   ├── else_expected/
│               │   │   │   ├── ElseInWhenExpected.kt
│               │   │   │   └── ElseInWhenTest.kt
│               │   │   ├── empty_block/
│               │   │   │   ├── EmptyBlockExpected.kt
│               │   │   │   └── EmptyBlockTest.kt
│               │   │   ├── enum_separated/
│               │   │   │   ├── EnumSeparatedExpected.kt
│               │   │   │   ├── EnumSeparatedTest.kt
│               │   │   │   ├── LastElementCommentExpected.kt
│               │   │   │   └── LastElementCommentTest.kt
│               │   │   ├── file_structure/
│               │   │   │   ├── BlankLinesBetweenBlocksExpected.kt
│               │   │   │   ├── CompanionObjectWithCommentExpected.kt
│               │   │   │   ├── CompanionObjectWithCommentTest.kt
│               │   │   │   ├── CopyrightCommentPositionExpected.kt
│               │   │   │   ├── CopyrightCommentPositionTest.kt
│               │   │   │   ├── DeclarationsInClassOrderExpected.kt
│               │   │   │   ├── DeclarationsInClassOrderTest.kt
│               │   │   │   ├── DefaultPackageWithImportsExpected.kt
│               │   │   │   ├── DefaultPackageWithImportsTest.kt
│               │   │   │   ├── FileAnnotationExpected.kt
│               │   │   │   ├── FileAnnotationTest.kt
│               │   │   │   ├── HeaderKdocAfterPackageExpected.kt
│               │   │   │   ├── HeaderKdocAfterPackageTest.kt
│               │   │   │   ├── LoggerOrderExpected.kt
│               │   │   │   ├── LoggerOrderTest.kt
│               │   │   │   ├── MissingBlankLinesBetweenBlocksTest.kt
│               │   │   │   ├── NoImportNoPackageExpected.kt
│               │   │   │   ├── NoImportNoPackageTest.kt
│               │   │   │   ├── OrderWithCommentExpected.kt
│               │   │   │   ├── OrderWithCommentTest.kt
│               │   │   │   ├── OrderWithEnumsExpected.kt
│               │   │   │   ├── OrderWithEnumsTest.kt
│               │   │   │   ├── OtherCommentsExpected.kt
│               │   │   │   ├── OtherCommentsTest.kt
│               │   │   │   ├── RedundantBlankLinesBetweenBlocksTest.kt
│               │   │   │   ├── ReorderingImportsExpected.kt
│               │   │   │   ├── ReorderingImportsRecommendedExpected.kt
│               │   │   │   ├── ReorderingImportsRecommendedTest.kt
│               │   │   │   ├── ReorderingImportsTest.kt
│               │   │   │   ├── ScriptPackageDirectiveExpected.kts
│               │   │   │   └── ScriptPackageDirectiveTest.kts
│               │   │   ├── indentation/
│               │   │   │   ├── ConstructorExpected.kt
│               │   │   │   ├── ConstructorTest.kt
│               │   │   │   ├── IndentFullExpected.kt
│               │   │   │   ├── IndentFullTest.kt
│               │   │   │   ├── IndentationFull1Expected.kt
│               │   │   │   ├── IndentationFull1Test.kt
│               │   │   │   ├── IndentationParametersExpected.kt
│               │   │   │   └── IndentationParametersTest.kt
│               │   │   ├── long_line/
│               │   │   │   ├── LongBinaryExpressionExpected.kt
│               │   │   │   ├── LongBinaryExpressionLastWordExpected.kt
│               │   │   │   ├── LongBinaryExpressionLastWordTest.kt
│               │   │   │   ├── LongBinaryExpressionTest.kt
│               │   │   │   ├── LongComplexExpressionExpected.kt
│               │   │   │   ├── LongComplexExpressionTest.kt
│               │   │   │   ├── LongConditionInSmallFunctionExpected.kt
│               │   │   │   ├── LongConditionInSmallFunctionTest.kt
│               │   │   │   ├── LongDotQualifiedExpressionExpected.kt
│               │   │   │   ├── LongDotQualifiedExpressionTest.kt
│               │   │   │   ├── LongExpressionInConditionExpected.kt
│               │   │   │   ├── LongExpressionInConditionTest.kt
│               │   │   │   ├── LongExpressionNoFixExpected.kt
│               │   │   │   ├── LongExpressionNoFixTest.kt
│               │   │   │   ├── LongInlineCommentsExpected.kt
│               │   │   │   ├── LongInlineCommentsTest.kt
│               │   │   │   ├── LongLineAnnotationExpected.kt
│               │   │   │   ├── LongLineAnnotationTest.kt
│               │   │   │   ├── LongLineCommentExpected.kt
│               │   │   │   ├── LongLineCommentExpected2.kt
│               │   │   │   ├── LongLineCommentTest.kt
│               │   │   │   ├── LongLineCommentTest2.kt
│               │   │   │   ├── LongLineExpressionExpected.kt
│               │   │   │   ├── LongLineExpressionTest.kt
│               │   │   │   ├── LongLineFunExpected.kt
│               │   │   │   ├── LongLineFunTest.kt
│               │   │   │   ├── LongLineRValueExpected.kt
│               │   │   │   ├── LongLineRValueTest.kt
│               │   │   │   ├── LongShortRValueExpected.kt
│               │   │   │   ├── LongShortRValueTest.kt
│               │   │   │   ├── LongStringTemplateExpected.kt
│               │   │   │   ├── LongStringTemplateTest.kt
│               │   │   │   ├── LongValueArgumentsListExpected.kt
│               │   │   │   └── LongValueArgumentsListTest.kt
│               │   │   ├── long_numbers/
│               │   │   │   ├── LongNumericalValuesExpected.kt
│               │   │   │   └── LongNumericalValuesTest.kt
│               │   │   ├── multiple_modifiers/
│               │   │   │   ├── AnnotationExpected.kt
│               │   │   │   ├── AnnotationTest.kt
│               │   │   │   ├── ModifierExpected.kt
│               │   │   │   └── ModifierTest.kt
│               │   │   ├── newlines/
│               │   │   │   ├── ColonExpected.kt
│               │   │   │   ├── ColonTest.kt
│               │   │   │   ├── CommaExpected.kt
│               │   │   │   ├── CommaTest.kt
│               │   │   │   ├── ExpressionBodyExpected.kt
│               │   │   │   ├── ExpressionBodyTest.kt
│               │   │   │   ├── FunctionalStyleExpected.kt
│               │   │   │   ├── FunctionalStyleTest.kt
│               │   │   │   ├── LParExpected.kt
│               │   │   │   ├── LParTest.kt
│               │   │   │   ├── LambdaExpected.kt
│               │   │   │   ├── LambdaTest.kt
│               │   │   │   ├── ListArgumentLambdaExpected.kt
│               │   │   │   ├── ListArgumentLambdaTest.kt
│               │   │   │   ├── LongDotQualifiedExpressionExpected.kt
│               │   │   │   ├── LongDotQualifiedExpressionTest.kt
│               │   │   │   ├── OneLineFunctionExpected.kt
│               │   │   │   ├── OneLineFunctionTest.kt
│               │   │   │   ├── OperatorsExpected.kt
│               │   │   │   ├── OperatorsTest.kt
│               │   │   │   ├── ParameterListExpected.kt
│               │   │   │   ├── ParameterListTest.kt
│               │   │   │   ├── SizeParameterListExpected.kt
│               │   │   │   ├── SizeParameterListTest.kt
│               │   │   │   ├── SuperClassListOnTheSameLineExpected.kt
│               │   │   │   └── SuperClassListOnTheSameLineTest.kt
│               │   │   ├── nullable/
│               │   │   │   ├── CollectionExpected.kt
│               │   │   │   ├── CollectionTest.kt
│               │   │   │   ├── NullPrimitiveExpected.kt
│               │   │   │   └── NullPrimitiveTest.kt
│               │   │   ├── preview_annotation/
│               │   │   │   ├── PreviewAnnotationMethodNameExpected.kt
│               │   │   │   ├── PreviewAnnotationMethodNameTest.kt
│               │   │   │   ├── PreviewAnnotationPrivateModifierExpected.kt
│               │   │   │   └── PreviewAnnotationPrivateModifierTest.kt
│               │   │   ├── range/
│               │   │   │   ├── RangeToExpected.kt
│               │   │   │   ├── RangeToTest.kt
│               │   │   │   ├── RangeToUntilExpected.kt
│               │   │   │   └── RangeToUntilTest.kt
│               │   │   ├── semicolons/
│               │   │   │   ├── SemicolonsExpected.kt
│               │   │   │   └── SemicolonsTest.kt
│               │   │   ├── sort_error/
│               │   │   │   ├── ConstantsExpected.kt
│               │   │   │   ├── ConstantsTest.kt
│               │   │   │   ├── EnumSortExpected.kt
│               │   │   │   └── EnumSortTest.kt
│               │   │   ├── spaces/
│               │   │   │   ├── AnnotationExpected.kt
│               │   │   │   ├── AnnotationTest.kt
│               │   │   │   ├── BinaryOpExpected.kt
│               │   │   │   ├── BinaryOpTest.kt
│               │   │   │   ├── BracesLambdaSpacesExpected.kt
│               │   │   │   ├── BracesLambdaSpacesTest.kt
│               │   │   │   ├── EolSpacesExpected.kt
│               │   │   │   ├── EolSpacesTest.kt
│               │   │   │   ├── EqualsExpected.kt
│               │   │   │   ├── EqualsTest.kt
│               │   │   │   ├── LBraceAfterKeywordExpected.kt
│               │   │   │   ├── LBraceAfterKeywordTest.kt
│               │   │   │   ├── LambdaAsArgumentExpected.kt
│               │   │   │   ├── LambdaAsArgumentTest.kt
│               │   │   │   ├── LbraceExpected.kt
│               │   │   │   ├── LbraceTest.kt
│               │   │   │   ├── TooManySpacesEnumExpected.kt
│               │   │   │   ├── TooManySpacesEnumTest.kt
│               │   │   │   ├── TooManySpacesExpected.kt
│               │   │   │   ├── TooManySpacesTest.kt
│               │   │   │   ├── WhiteSpaceBeforeLBraceExpected.kt
│               │   │   │   ├── WhiteSpaceBeforeLBraceTest.kt
│               │   │   │   ├── WhiteSpaceBeforeLParExpected.kt
│               │   │   │   └── WhiteSpaceBeforeLParTest.kt
│               │   │   ├── src/
│               │   │   │   └── main/
│               │   │   │       ├── A/
│               │   │   │       │   ├── FileSize2000.kt
│               │   │   │       │   └── FileSizeA.kt
│               │   │   │       ├── B/
│               │   │   │       │   └── FileSizeB.kt
│               │   │   │       ├── C/
│               │   │   │       │   └── FileSizeC.kt
│               │   │   │       └── FileSizeLarger.kt
│               │   │   ├── statement/
│               │   │   │   ├── StatementExpected.kt
│               │   │   │   └── StatementTest.kt
│               │   │   ├── string_concatenation/
│               │   │   │   ├── StringConcatenationExpected.kt
│               │   │   │   └── StringConcatenationTest.kt
│               │   │   ├── string_template/
│               │   │   │   ├── StringTemplateExpected.kt
│               │   │   │   └── StringTemplateTest.kt
│               │   │   ├── top_level/
│               │   │   │   ├── TopLevelSortExpected.kt
│               │   │   │   ├── TopLevelSortTest.kt
│               │   │   │   ├── TopLevelWithCommentExpected.kt
│               │   │   │   └── TopLevelWithCommentTest.kt
│               │   │   └── trailing_comma/
│               │   │       ├── TrailingCommaExpected.kt
│               │   │       └── TrailingCommaTest.kt
│               │   ├── paragraph4/
│               │   │   ├── generics/
│               │   │   │   ├── VariableGenericTypeDeclarationExpected.kt
│               │   │   │   └── VariableGenericTypeDeclarationTest.kt
│               │   │   ├── null_checks/
│               │   │   │   ├── IfConditionAssignCheckExpected.kt
│               │   │   │   ├── IfConditionAssignCheckTest.kt
│               │   │   │   ├── IfConditionBreakCheckExpected.kt
│               │   │   │   ├── IfConditionBreakCheckTest.kt
│               │   │   │   ├── IfConditionNullCheckExpected.kt
│               │   │   │   ├── IfConditionNullCheckTest.kt
│               │   │   │   ├── RequireFunctionExpected.kt
│               │   │   │   └── RequireFunctionTest.kt
│               │   │   └── smart_cast/
│               │   │       ├── SmartCastExpected.kt
│               │   │       └── SmartCastTest.kt
│               │   ├── paragraph5/
│               │   │   ├── method_call_names/
│               │   │   │   ├── ReplaceMethodCallNamesExpected.kt
│               │   │   │   └── ReplaceMethodCallNamesTest.kt
│               │   │   └── nested_functions/
│               │   │       ├── AvoidNestedFunctionsExample.kt
│               │   │       ├── AvoidNestedFunctionsNoTriggerExample.kt
│               │   │       ├── AvoidNestedFunctionsNoTriggerTest.kt
│               │   │       ├── AvoidNestedFunctionsSeveralExample.kt
│               │   │       ├── AvoidNestedFunctionsSeveralTest.kt
│               │   │       └── AvoidNestedFunctionsTest.kt
│               │   └── paragraph6/
│               │       └── useless-override/
│               │           ├── SeveralSuperTypesExpected.kt
│               │           ├── SeveralSuperTypesTest.kt
│               │           ├── UselessOverrideExpected.kt
│               │           └── UselessOverrideTest.kt
│               └── test-rules-config.yml
├── diktat-ruleset/
│   ├── build.gradle.kts
│   └── src/
│       └── main/
│           ├── kotlin/
│           │   └── com/
│           │       └── saveourtool/
│           │           └── diktat/
│           │               └── ruleset/
│           │                   └── rules/
│           │                       └── DiktatRuleSetProviderV3Spi.kt
│           └── resources/
│               └── META-INF/
│                   └── services/
│                       └── com.pinterest.ktlint.cli.ruleset.core.api.RuleSetProviderV3
├── diktat-runner/
│   ├── build.gradle.kts
│   └── src/
│       └── main/
│           └── kotlin/
│               └── com/
│                   └── saveourtool/
│                       └── diktat/
│                           └── DiktatFactories.kt
├── examples/
│   ├── README.md
│   ├── gradle-groovy-dsl/
│   │   ├── build.gradle
│   │   ├── diktat-analysis.yml
│   │   └── src/
│   │       └── main/
│   │           └── kotlin/
│   │               ├── AnotherTest.kt
│   │               └── Test.kt
│   ├── gradle-kotlin-dsl/
│   │   ├── build.gradle.kts
│   │   ├── diktat-analysis.yml
│   │   ├── settings.gradle.kts
│   │   └── src/
│   │       └── main/
│   │           └── kotlin/
│   │               ├── AnotherTest.kt
│   │               └── Test.kt
│   ├── gradle-kotlin-dsl-multiproject/
│   │   ├── backend/
│   │   │   ├── build.gradle.kts
│   │   │   └── src/
│   │   │       └── main/
│   │   │           └── kotlin/
│   │   │               └── Test.kt
│   │   ├── build.gradle.kts
│   │   ├── diktat-analysis.yml
│   │   ├── frontend/
│   │   │   ├── build.gradle.kts
│   │   │   └── src/
│   │   │       └── main/
│   │   │           └── kotlin/
│   │   │               └── AnotherTest.kt
│   │   └── settings.gradle.kts
│   ├── maven/
│   │   ├── diktat-analysis.yml
│   │   ├── pom.xml
│   │   └── src/
│   │       └── main/
│   │           └── kotlin/
│   │               ├── AnotherTest.kt
│   │               └── Test.kt
│   └── maven-multiproject/
│       ├── backend/
│       │   ├── pom.xml
│       │   └── src/
│       │       └── main/
│       │           └── kotlin/
│       │               └── Test.kt
│       ├── diktat-analysis.yml
│       ├── frontend/
│       │   ├── pom.xml
│       │   └── src/
│       │       └── main/
│       │           └── kotlin/
│       │               └── AnotherTest.kt
│       └── pom.xml
├── gradle/
│   ├── libs.versions.toml
│   ├── plugins/
│   │   ├── build.gradle.kts
│   │   ├── settings.gradle.kts
│   │   └── src/
│   │       └── main/
│   │           └── kotlin/
│   │               ├── Versions.kt
│   │               └── com/
│   │                   └── saveourtool/
│   │                       └── diktat/
│   │                           └── buildutils/
│   │                               ├── JacocoConfiguration.kt
│   │                               ├── PublishingConfiguration.kt
│   │                               ├── TaskNames.kt
│   │                               ├── VersioningConfiguration.kt
│   │                               ├── code-quality-convention.gradle.kts
│   │                               ├── detekt-convention-configuration.gradle.kts
│   │                               ├── diktat-convention-configuration.gradle.kts
│   │                               ├── git-hook-configuration.gradle.kts
│   │                               ├── kotlin-jvm-configuration.gradle.kts
│   │                               ├── publishing-configuration.gradle.kts
│   │                               ├── publishing-default-configuration.gradle.kts
│   │                               └── versioning-configuration.gradle.kts
│   └── wrapper/
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── info/
│   ├── README.md
│   ├── available-rules.md
│   ├── build.gradle.kts
│   ├── buildSrc/
│   │   ├── build.gradle.kts
│   │   ├── gradle.properties
│   │   └── src/
│   │       └── main/
│   │           └── kotlin/
│   │               └── com/
│   │                   └── saveourtool/
│   │                       └── diktat/
│   │                           └── generation/
│   │                               └── docs/
│   │                                   ├── FullDocGenerator.kt
│   │                                   ├── GenerationAvailableRules.kt
│   │                                   ├── GenerationDocs.kt
│   │                                   ├── LatexUtils.kt
│   │                                   └── WarningsTableGenerator.kt
│   ├── gradle/
│   │   └── wrapper/
│   │       ├── gradle-wrapper.jar
│   │       └── gradle-wrapper.properties
│   ├── gradlew
│   ├── gradlew.bat
│   ├── guide/
│   │   ├── diktat-coding-convention.md
│   │   ├── guide-TOC.md
│   │   ├── guide-chapter-0.md
│   │   ├── guide-chapter-1.md
│   │   ├── guide-chapter-2.md
│   │   ├── guide-chapter-3.md
│   │   ├── guide-chapter-4.md
│   │   ├── guide-chapter-5.md
│   │   ├── guide-chapter-6.md
│   │   └── table-of-content.md
│   └── rules-mapping.md
├── renovate.json
├── settings.gradle.kts
└── wp/
    ├── README.md
    ├── makefile
    ├── references.bib
    ├── sections/
    │   ├── appendix.tex
    │   ├── compare.tex
    │   ├── conclusion.tex
    │   ├── definition.tex
    │   ├── diKTat.tex
    │   ├── download.tex
    │   ├── feature.tex
    │   ├── introduction.tex
    │   ├── kotlin.tex
    │   └── work.tex
    └── wp.tex

================================================
FILE CONTENTS
================================================

================================================
FILE: .editorconfig
================================================
# https://editorconfig.org
root = true

[*]
charset = utf-8
indent_size = 4
indent_style = space
insert_final_newline = true
max_line_length = 180
tab_width = 4
trim_trailing_whitespace = true
ij_continuation_indent_size = 8
ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
ij_formatter_tags_enabled = true
ij_smart_tabs = false
ij_visual_guides = 80,120,180
ij_wrap_on_typing = false

[{*.yaml,*.yml}]
indent_size = 2

[{*.kt,*.kts}]
ij_kotlin_align_in_columns_case_branch = false
ij_kotlin_align_multiline_binary_operation = false
ij_kotlin_align_multiline_extends_list = false
ij_kotlin_align_multiline_method_parentheses = false
ij_kotlin_align_multiline_parameters = true
ij_kotlin_align_multiline_parameters_in_calls = false
ij_kotlin_allow_trailing_comma = false
ij_kotlin_allow_trailing_comma_on_call_site = false
ij_kotlin_assignment_wrap = normal
ij_kotlin_blank_lines_after_class_header = 0
ij_kotlin_blank_lines_around_block_when_branches = 0
ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1
ij_kotlin_block_comment_add_space = false
ij_kotlin_block_comment_at_first_column = true
ij_kotlin_call_parameters_new_line_after_left_paren = true
ij_kotlin_call_parameters_right_paren_on_new_line = true
ij_kotlin_call_parameters_wrap = on_every_item
ij_kotlin_catch_on_new_line = false
ij_kotlin_class_annotation_wrap = split_into_lines
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL
ij_kotlin_continuation_indent_for_chained_calls = false
ij_kotlin_continuation_indent_for_expression_bodies = false
ij_kotlin_continuation_indent_in_argument_lists = false
ij_kotlin_continuation_indent_in_elvis = false
ij_kotlin_continuation_indent_in_if_conditions = false
ij_kotlin_continuation_indent_in_parameter_lists = false
ij_kotlin_continuation_indent_in_supertype_lists = false
ij_kotlin_else_on_new_line = false
ij_kotlin_enum_constants_wrap = off
ij_kotlin_extends_list_wrap = normal
ij_kotlin_field_annotation_wrap = split_into_lines
ij_kotlin_finally_on_new_line = false
ij_kotlin_if_rparen_on_new_line = true
ij_kotlin_import_nested_classes = false
ij_kotlin_imports_layout = android.**,androidx.**,com.android.**,com.saveourtool.diktat.**,*,java.**,javax.**,kotlin.**,kotlinx.**,^
ij_kotlin_insert_whitespaces_in_simple_one_line_method = true
ij_kotlin_keep_blank_lines_before_right_brace = 2
ij_kotlin_keep_blank_lines_in_code = 2
ij_kotlin_keep_blank_lines_in_declarations = 2
ij_kotlin_keep_first_column_comment = true
ij_kotlin_keep_indents_on_empty_lines = false
ij_kotlin_keep_line_breaks = true
ij_kotlin_lbrace_on_next_line = false
ij_kotlin_line_comment_add_space = false
ij_kotlin_line_comment_add_space_on_reformat = false
ij_kotlin_line_comment_at_first_column = true
ij_kotlin_method_annotation_wrap = split_into_lines
ij_kotlin_method_call_chain_wrap = normal
ij_kotlin_method_parameters_new_line_after_left_paren = true
ij_kotlin_method_parameters_right_paren_on_new_line = true
ij_kotlin_method_parameters_wrap = on_every_item
ij_kotlin_name_count_to_use_star_import = 2147483647
ij_kotlin_name_count_to_use_star_import_for_members = 2147483647
ij_kotlin_parameter_annotation_wrap = off
ij_kotlin_space_after_comma = true
ij_kotlin_space_after_extend_colon = true
ij_kotlin_space_after_type_colon = true
ij_kotlin_space_before_catch_parentheses = true
ij_kotlin_space_before_comma = false
ij_kotlin_space_before_extend_colon = true
ij_kotlin_space_before_for_parentheses = true
ij_kotlin_space_before_if_parentheses = true
ij_kotlin_space_before_lambda_arrow = true
ij_kotlin_space_before_type_colon = false
ij_kotlin_space_before_when_parentheses = true
ij_kotlin_space_before_while_parentheses = true
ij_kotlin_spaces_around_additive_operators = true
ij_kotlin_spaces_around_assignment_operators = true
ij_kotlin_spaces_around_equality_operators = true
ij_kotlin_spaces_around_function_type_arrow = true
ij_kotlin_spaces_around_logical_operators = true
ij_kotlin_spaces_around_multiplicative_operators = true
ij_kotlin_spaces_around_range = false
ij_kotlin_spaces_around_relational_operators = true
ij_kotlin_spaces_around_unary_operator = false
ij_kotlin_spaces_around_when_arrow = true
ij_kotlin_variable_annotation_wrap = off
ij_kotlin_while_on_new_line = false
ij_kotlin_wrap_elvis_expressions = 1
ij_kotlin_wrap_expression_body_functions = 1
ij_kotlin_wrap_first_method_in_call_chain = false

# disable ktlint rules
ktlint_standard = disabled
ktlint_experimental = disabled
ktlint_test = disabled
ktlint_custom = disabled


================================================
FILE: .git-hooks/commit-msg.sh
================================================
#!/usr/bin/env bash

commit_pattern="(Merge (remote-tracking )?branch|### What's done:)"
error_msg="Your commit message doesn't match the pattern $commit_pattern. Please fix it."
commit_count="$(git rev-list --count master..HEAD 2> /dev/null)"

if [[ $commit_count = "0" && ! $( cat "$1" ) =~ $commit_pattern ]]
then
    echo "$error_msg"
    exit 1
fi

exit 0


================================================
FILE: .git-hooks/pre-commit.sh
================================================
#!/usr/bin/env bash

branch_name="$(git rev-parse --abbrev-ref HEAD)"
branch_pattern="^(feature|bugfix|hotfix|infra)/.*$"
error_message="Your branch name doesn't match the pattern $branch_pattern. Please correct it before committing."

if [[ ! $branch_name =~ $branch_pattern ]]
then
  echo "$error_message"
  exit 1
fi

exit 0


================================================
FILE: .gitattributes
================================================
* text=auto
*.bat eol=crlf


================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: 'bug'

---

## Describe the bug

## Expected behavior

## Observed behavior

## Steps to Reproduce

## Environment information
* diktat version:
* build tool (maven/gradle):
* how is diktat run (CLI, plugin, etc.):
* kotlin version:
* operating system:
* link to a project (if your project is public):


================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: true
contact_links:
  - name: Discussions
    url: https://github.com/saveourtool/diktat/discussions
    about: Ask everything about diktat in discussions tab


================================================
FILE: .github/codecov.yml
================================================
codecov:
  max_report_age: off
coverage:
  status:
    project:
      default:
        threshold: 2%

================================================
FILE: .github/pull_request_template.md
================================================
## Which rule and warnings did you add?

This pull request closes <!-- insert related issue number -->
<!-- Briefly describe rule and warnings -->

## Actions checklist
* [ ] Implemented Rule, added Warnings
* [ ] Added tests on checks
* [ ] Added tests on fixers
* [ ] Updated diktat-analysis.yml
* [ ] Updated available-rules.md

## Fixme

<!-- Is there anything left out of scope of this PR? -->


================================================
FILE: .github/workflows/build_and_test.yml
================================================
# vim:ai et ts=2 sts=2 sw=2:
name: Build and test

on:
  pull_request:
  push:
    branches:
      - 'master'

concurrency:
    # https://docs.github.com/en/actions/using-jobs/using-concurrency
    # The latest queued workflow is preferred; the ones already in progress get cancelled
    # Workflows on master branch shouldn't be cancelled, that's why they are identified by commit SHA
    group: ${{ github.ref == 'refs/heads/master' && format('{0}-{1}', github.workflow, github.sha) || format('{0}-{1}', github.workflow, github.ref) }}
    cancel-in-progress: true

env:
  GRADLE_OPTS: -Dorg.gradle.daemon=true -Dorg.gradle.parallel=true -Dorg.gradle.welcome=never
  GPG_SEC: ${{ secrets.PGP_SEC }}
  GPG_PASSWORD: ${{ secrets.PGP_PASSWORD }}
  OSSRH_USERNAME: ${{ secrets.SONATYPE_USER }}
  OSSRH_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
  build_and_test_with_code_coverage:
    name: Build, test and upload code coverage
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
        with:
            # required for correct codecov upload
            fetch-depth: 0
      - name: Set up JDK 11
        uses: actions/setup-java@v4
        with:
          java-version: 11
          distribution: temurin
      - name: Retrieve Kotlin version
        run: |
          kv=$(cat gradle/libs.versions.toml | grep '^kotlin =' | awk -F'[=]' '{print $2}' | tr -d '" ')
          echo KOTLIN_VERSION=$kv >> $GITHUB_ENV
        shell: bash
      - name: Cache konan
        uses: actions/cache@v4
        with:
          path: ~/.konan
          key: ${{ runner.os }}-gradle-konan-${{ env.KOTLIN_VERSION }}
      - name: Build all
        uses: gradle/gradle-build-action@v3
        with:
          gradle-version: wrapper
          gradle-home-cache-cleanup: true
          arguments: |
            build
            -x detekt
            --scan
            --build-cache

      - name: Upload gradle reports
        if: ${{ always() }}
        uses: actions/upload-artifact@v4
        with:
          name: gradle-reports
          path: '**/build/reports/'
          retention-days: 1
      - name: Code coverage report
        uses: codecov/codecov-action@v5
        # Do not run coverage for forks since they cannot upload the results to codecov.
        # For reference, see:
        # https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution#example-only-run-job-for-specific-repository
        if: github.repository == 'saveourtool/diktat'
        with:
          fail_ci_if_error: false
          token: ${{ secrets.CODECOV_TOKEN }}

  build_and_test:
    name: Build and test
    runs-on: ${{ matrix.os }}
    strategy:
      # We need multiple builds to run even if the 1st one is failing, because
      # test failures may be OS-specific (or the tests themselves flaky).
      fail-fast: false
      matrix:
        os: [ ubuntu-latest, windows-latest, macos-latest ]

    # A possible workaround for <https://github.com/dorny/test-reporter/issues/168>.
    permissions:
      checks: write
      contents: write
      pull-requests: write
      statuses: write
      packages: write

    steps:
      - uses: actions/checkout@v4
      - name: Set up JDK 11
        uses: actions/setup-java@v4
        with:
          java-version: 11
          distribution: temurin
      - name: Retrieve Kotlin version
        run: |
          kv=$(cat gradle/libs.versions.toml | grep '^kotlin =' | awk -F'[=]' '{print $2}' | tr -d '" ')
          echo KOTLIN_VERSION=$kv >> $GITHUB_ENV
        shell: bash
      - name: Cache konan
        uses: actions/cache@v4
        with:
          path: ~/.konan
          key: ${{ runner.os }}-gradle-konan-${{ env.KOTLIN_VERSION }}

      - name: Build all
        uses: gradle/gradle-build-action@v3
        with:
          gradle-version: wrapper
          gradle-home-cache-cleanup: true
          arguments: |
            build
            -x detekt
            --scan
            --build-cache

        # This step needs a Git repository, so it's impossible to extract it
        # into a separate job (or, otherwise, we'd need to upload the content
        # of the whole `.git` folder as an artifact).
      - name: JUnit Tests (dorny/test-reporter@v1)
        uses: dorny/test-reporter@v1
        if: ${{ always() }}
        with:
          name: JUnit Tests (${{ runner.os }}, dorny/test-reporter@v1)
          # Comma-separated values.
          path: "**/build/test-results/*/TEST-*.xml"
          reporter: java-junit
        # Ignore the "Resource not accessible by integration" error when a PR
        # originates from a non-collaborator. This is
        # <https://github.com/dorny/test-reporter/issues/168> which may be
        # potentially fixed with <https://github.com/dorny/test-reporter/pull/174>.
        continue-on-error: true

      - name: Upload test results
        uses: actions/upload-artifact@v4
        if: ${{ always() }}
        with:
          name: xml-test-reports-${{ runner.os }}
          path: |
            **/build/test-results/*/TEST-*.xml
          retention-days: 1

      - name: Upload gradle reports
        if: ${{ always() }}
        uses: actions/upload-artifact@v4
        with:
          name: gradle-test-report-${{ matrix.os }}
          path: '**/build/reports/'
          retention-days: 1

      - name: 'Publish a snapshot to GitHub'
        id: publish-github
        if: ${{ github.event_name == 'push' && github.ref_type == 'branch' && github.ref == 'refs/heads/master' && github.repository == 'saveourtool/diktat' }}
        uses: gradle/gradle-build-action@v3
        with:
          gradle-version: wrapper
          arguments: |
            -Preckon.stage=snapshot
            publishAllPublicationsToGitHubRepository

      - name: 'Publish a snapshot to Maven Central'
        id: publish-sonatype
        if: ${{ github.event_name == 'push' && github.ref_type == 'branch' && github.ref == 'refs/heads/master' && github.repository == 'saveourtool/diktat' }}
        uses: gradle/gradle-build-action@v3
        with:
          gradle-version: wrapper
          arguments: |
            -Preckon.stage=snapshot
            publishToSonatype
            closeAndReleaseSonatypeStagingRepository

  report:
    name: Publish JUnit test results
    if: ${{ always() }}
    needs: build_and_test
    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        os: [ windows-latest, macos-latest ]

    permissions:
      checks: write
      pull-requests: write

    steps:
      - uses: actions/download-artifact@v4
        if: ${{ always() }}
        with:
          name: xml-test-reports-${{ runner.os }}

        # Uses Docker, that's why Linux-only.
      - name: JUnit Tests (EnricoMi/publish-unit-test-result-action@v2, Linux)
        uses: EnricoMi/publish-unit-test-result-action@v2
        if: ${{ runner.os == 'Linux' }}
        with:
          check_name: JUnit Tests (${{ runner.os }}, EnricoMi/publish-unit-test-result-action@v2)
          junit_files: |
            **/build/test-results/*/TEST-*.xml

      - name: JUnit Tests (EnricoMi/publish-unit-test-result-action@v2, Windows or Mac OS X)
        uses: EnricoMi/publish-unit-test-result-action/composite@v2
        if: ${{ runner.os == 'Windows' || runner.os == 'macOS' }}
        with:
          check_name: JUnit Tests (${{ runner.os }}, EnricoMi/publish-unit-test-result-action@v2)
          junit_files: |
            **/build/test-results/*/TEST-*.xml


================================================
FILE: .github/workflows/codeql-analysis.yml
================================================
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
name: "CodeQL"

on:
  push:
    branches: [master]
  pull_request:
    # The branches below must be a subset of the branches above
    branches: [master]
  schedule:
    - cron: '0 20 * * 5'

jobs:
  analyze:
    name: Analyze
    runs-on: ubuntu-latest

    strategy:
      fail-fast: false
      matrix:
        # Override automatic language detection by changing the below list
        # Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
        language: ['kotlin']
        # Learn more...
        # https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

    steps:
    - name: Checkout repository
      uses: actions/checkout@v4
      with:
        # We must fetch at least the immediate parents so that if this is
        # a pull request then we can checkout the head.
        fetch-depth: 2

    # Initializes the CodeQL tools for scanning.
    - name: Initialize CodeQL
      uses: github/codeql-action/init@v3
      with:
        languages: ${{ matrix.language }}
        # If you wish to specify custom queries, you can do so here or in a config file.
        # By default, queries listed here will override any specified in a config file.
        # Prefix the list here with "+" to use these queries and those in the config file.
        # queries: ./path/to/local/query, your-org/your-repo/queries@main

    # Autobuild attempts to build any compiled languages  (C/C++, C#, or Java).
    # If this step fails, then you should remove it and run the build manually (see below)
    # - name: Autobuild
    #   uses: github/codeql-action/autobuild@v2

    # ℹ️ Command-line programs to run using the OS shell.
    # 📚 https://git.io/JvXDl

    # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
    #    and modify them (or add more) to build your code if your project
    #    uses a compiled language

    - uses: gradle/gradle-build-action@v3
      with:
        gradle-version: wrapper
        # The `--continue` flag is necessary so that Gradle keeps going after the 1st test failure.
        # By default, when test for all MPP targets are executed, Kotlin Gradle Plugin generates a single aggregated HTML report.
        # Property `kotlin.tests.individualTaskReports` enables individual Junit-style XML reports.
        # See org.jetbrains.kotlin.gradle.testing.internal.KotlinTestReport.
        arguments: |
          build
          --continue
          -x detekt
          -Pkotlin.tests.individualTaskReports=true
          -Porg.gradle.caching=true
          -Pdetekt.multiplatform.disabled=true
          -PdisableRedundantTargets=true
          -PenabledExecutables=debug
          -PgprUser=${{ github.actor }}
          -PgprKey=${{ secrets.GITHUB_TOKEN }}

    - name: Perform CodeQL Analysis
      uses: github/codeql-action/analyze@v3


================================================
FILE: .github/workflows/dependencies.yml
================================================
name: 'Dependencies'

on:
  push:
    branches:
      - 'master'

env:
  GRADLE_OPTS: -Dorg.gradle.daemon=true -Dorg.gradle.parallel=true -Dorg.gradle.welcome=never

jobs:
  dependencies:
    name: 'Dependencies'
    runs-on: ubuntu-latest

    # The Dependency Submission API requires write permission.
    permissions:
      contents: write

    steps:
      - uses: actions/checkout@v4
        with:
          # Fetch Git tags, so that semantic version can be calculated.
          # Alternatively, run `git fetch --prune --unshallow --tags` as the
          # next step, see
          # https://github.com/actions/checkout/issues/206#issuecomment-607496604.
          fetch-depth: 0

      - name: 'Set up Java 11'
        uses: actions/setup-java@v4
        with:
          distribution: 'zulu'
          java-version: 11

      - name: 'Run snapshot action'
        uses: mikepenz/gradle-dependency-submission@v1.0.0
        with:
          use-gradlew: true
          gradle-build-module: |-
            :diktat-api
            :diktat-common-test
            :diktat-ktlint-engine
            :diktat-gradle-plugin
            :diktat-maven-plugin
            :diktat-rules
            :diktat-ruleset
            :diktat-runner
            :diktat-dev-ksp
            :diktat-cli
          gradle-build-configuration: |-
            compileClasspath
          sub-module-mode: 'INDIVIDUAL'


================================================
FILE: .github/workflows/detekt.yml
================================================
name: Run deteKT

on:
  push:
    branches: [ master ]
  pull_request:

jobs:
  detekt_check:
    runs-on: ubuntu-latest
    permissions:
      # required for all workflows
      security-events: write

    steps:
      - uses: actions/checkout@v4
      - name: Set up JDK 11
        uses: actions/setup-java@v4
        with:
          java-version: 11
          distribution: temurin
      - uses: gradle/gradle-build-action@v3
        with:
          gradle-version: wrapper
          arguments: |
            detektAll
            --build-cache
            --continue
            -PgprUser=${{ github.actor }}
            -PgprKey=${{ secrets.GITHUB_TOKEN }}
      - name: Upload SARIF report to Github
        uses: github/codeql-action/upload-sarif@v3
        if: ${{ always() }}
        with:
          sarif_file: build/detekt-sarif-reports/detekt-merged.sarif
      - name: Upload SARIF artifacts
        uses: actions/upload-artifact@v4
        if: ${{ failure() }}
        with:
          name: sarif-reports
          path: "**/build/detekt-sarif-reports/"
          retention-days: 1


================================================
FILE: .github/workflows/diktat.yml
================================================
name: Run diKTat (release)

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  diktat_check:
    runs-on: ubuntu-latest
    permissions:
      # required for all workflows
      security-events: write

    steps:
      - uses: actions/checkout@v4

      - name: Set up JDK 11
        uses: actions/setup-java@v4
        with:
          java-version: 11
          distribution: temurin

      - uses: gradle/gradle-build-action@v3
        with:
          gradle-version: wrapper
          arguments: |
            diktatCheck
            mergeDiktatReports
            -Pdiktat.githubActions=true
            -Pdetekt.multiplatform.disabled=true
            --continue
            --build-cache
            -PgprUser=${{ github.actor }}
            -PgprKey=${{ secrets.GITHUB_TOKEN }}
            --stacktrace
      - name: Upload SARIF report to Github
        uses: github/codeql-action/upload-sarif@v3
        if: ${{ always() }}
        with:
          sarif_file: build/reports/diktat/diktat-merged.sarif
      - name: Upload SARIF artifacts
        uses: actions/upload-artifact@v4
        if: ${{ failure() }}
        with:
          name: sarif-reports
          path: "**/build/reports/diktat"
          retention-days: 1


================================================
FILE: .github/workflows/diktat_snapshot.yml
================================================
name: Run diKTat (snapshot)

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  diktat_snapshot_check:
    name: 'Check the project using diktat snapshot plugin'
    runs-on: ubuntu-latest
    permissions:
      # required for all workflows
      security-events: write

    steps:
      - uses: actions/checkout@v4
        with:
          # Fetch Git tags, so that semantic version can be calculated.
          # Alternatively, run `git fetch --prune --unshallow --tags` as the
          # next step, see
          # https://github.com/actions/checkout/issues/206#issuecomment-607496604.
          fetch-depth: 0

      - name: Set up JDK 11
        uses: actions/setup-java@v4
        with:
          java-version: 11
          distribution: temurin

      - name: 'Cache ~/.konan'
        id: cache-konan
        uses: actions/cache@v4
        with:
          path: |
            ~/.konan
          key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle.kts', '**/gradle-wrapper.properties') }}-build-java${{ matrix.java-version }}
          restore-keys: |
            ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle.kts', '**/gradle-wrapper.properties') }}-
            ${{ runner.os }}-konan-

      - name: 'Publish a snapshot version to local repo'
        id: generateLibsForDiktatSnapshot
        uses: gradle/gradle-build-action@v3
        with:
          gradle-version: wrapper
          arguments: |
            :generateLibsForDiktatSnapshot
            -x detekt
            -x test
            -x diktatCheck

      # copied from .github/workflows/diktat.yml
      - uses: gradle/gradle-build-action@v3
        with:
          gradle-version: wrapper
          arguments: |
            diktatCheck
            mergeDiktatReports
            -Pdiktat.githubActions=true
            -Pdetekt.multiplatform.disabled=true
            --continue
            --build-cache
            -PgprUser=${{ github.actor }}
            -PgprKey=${{ secrets.GITHUB_TOKEN }}
      - name: Upload SARIF report to Github
        uses: github/codeql-action/upload-sarif@v3
        if: ${{ always() }}
        with:
          sarif_file: build/reports/diktat/diktat-merged.sarif
          # override category to have a different with release version
          category: diktat (snapshot)
      - name: Upload SARIF artifacts
        uses: actions/upload-artifact@v4
        if: ${{ failure() }}
        with:
          name: sarif-reports
          path: "**/build/reports/diktat"
          retention-days: 1


================================================
FILE: .github/workflows/release.yml
================================================
name: Create diKTat release

on:
  push:
    tags:
      - 'v*'

env:
  GRADLE_OPTS: -Dorg.gradle.daemon=true -Dorg.gradle.parallel=true -Dorg.gradle.welcome=never
  GPG_SEC: ${{ secrets.PGP_SEC }}
  GPG_PASSWORD: ${{ secrets.PGP_PASSWORD }}
  OSSRH_USERNAME: ${{ secrets.SONATYPE_USER }}
  OSSRH_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
  release:
    name: 'Release'
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
        with:
          # Fetch Git tags, so that semantic version can be calculated.
          # Alternatively, run `git fetch --prune --unshallow --tags` as the
          # next step, see
          # https://github.com/actions/checkout/issues/206#issuecomment-607496604.
          fetch-depth: 0

      - name: 'Set up Java'
        uses: actions/setup-java@v4
        with:
          java-version: 11
          distribution: temurin

      - name: 'Calculate the release version'
        run: |
          echo "RELEASE_VERSION=${GITHUB_REF#'refs/tags/v'}" >> $GITHUB_ENV

      - name: 'Publish a release to Maven Central'
        id: publish-sonatype
        uses: gradle/gradle-build-action@v3
        with:
          gradle-version: wrapper
          arguments: |
            publishToSonatype
            closeAndReleaseSonatypeStagingRepository

      - name: 'Publish a release to Gradle Plugins'
        id: publish-gradle
        uses: gradle/gradle-build-action@v3
        with:
          gradle-version: wrapper
          arguments: |
            :diktat-gradle-plugin:publishPlugins
            -Pgradle.publish.key=${{ secrets.GRADLE_KEY }}
            -Pgradle.publish.secret=${{ secrets.GRADLE_SECRET }}

      - name: 'Publish a release to GitHub'
        id: publish-github
        uses: gradle/gradle-build-action@v3
        with:
          gradle-version: wrapper
          arguments: |
            shadowExecutableJar
            publishAllPublicationsToGitHubRepository
      - name: 'GitHub Release'
        id: create_release
        uses: actions/create-release@v1
        with:
          tag_name: ${{ github.ref }}
          release_name: Release ${{ env.RELEASE_VERSION }}
          draft: false
          prerelease: false
      - name: Upload Diktat CLI to GitHub release
        id: upload-release-asset-cli
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }}
          asset_path: ./diktat-cli/build/diktat-cli-${{ env.RELEASE_VERSION }}
          asset_name: diktat
          asset_content_type: application/zip
      - name: Upload Diktat CLI for Windows to GitHub release
        id: upload-release-asset-cli-win
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }}
          asset_path: ./diktat-cli/src/main/script/diktat.cmd
          asset_name: diktat.cmd
          asset_content_type: application/octet-stream
      - name: Upload Diktat ruleset for KtLint to GitHub release
        id: upload-release-asset-ruleset
        uses: actions/upload-release-asset@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          upload_url: ${{ steps.create_release.outputs.upload_url }}
          asset_path: ./diktat-ruleset/build/libs/diktat-${{ env.RELEASE_VERSION }}.jar
          asset_name: diktat-${{ env.RELEASE_VERSION }}.jar
          asset_content_type: application/zip


================================================
FILE: .gitignore
================================================
target/
.gradle/
build/
!ktlint/src/main/resources/config/.idea
.idea/
*.iml
/examples/*/gradlew
/examples/*/gradlew.bat
/examples/*/gradle/wrapper/
out/
.DS_Store

# Vim swap files
*.swp

*.sarif

# a generated file for github action
/gradle/libs.versions.toml_backup


================================================
FILE: CNAME
================================================
diktat.saveourtool.com

================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Code of Conduct

This is a small code of conduct to have a good and friendly development in diKTat

## Good behavior

We expect everyone to love each other, be kind and polite.
Do not hate anyone for comments on the review or for bugs that he (or she) made in his code.

## Unacceptable behavior

But if you would like to bully some of our contributors - you are always welcome.
We love critics and do not like to be in comfort zone.
We can even organize some underground boxing match for you somewhere in Russia. 

================================================
FILE: CONTRIBUTING.md
================================================
# Contributing

If you are reading this - then you have decided to contribute to our project. Oh, poor you...
Rules are very simple:
1. Fork this repository to your own account
2. Make your changes and verify that tests pass (or wait that our CI/CD will do everything for you)
3. Commit your work and push to a new branch on your fork
4. Submit a pull request
5. Participate in the code review process by responding to feedback

# Technical part

Main components are:
1) diktat-rules — number of rules that are supported by diKTat;
2) diktat-common-test — util methods for functional/unit tests that can be used for running your code fixer on the initial code and compare it with the expected result;
3) also see our demo: diktat-demo in a separate repository.

Mainly we wanted to create a common configurable mechanism that
will give us a chance to enable/disable and customize all rules.
That's why we added logic for:
1) Parsing `.yml` file with configurations of rules and passing it to visitors;
2) Passing information about properties to visitors.
   This information is very useful, when you are trying to get,
   for example, a filename of file where the code is stored;
3) We added a bunch of visitors, checkers and fixers that will extended KTlint functionaliity with code style rules;
4) We have proposed a code style for Kotlin language.

Before you make a pull request, make sure the build is clean as we have lot of tests and other prechecks:

```bash
$ mvn clean install
```

# Hooks

We have some hooks to a commit messages:
1) your commit message should have the following format:
```
Brief Description

### What's done:
1) Long description
2) Long description
```

2) Please also do not forget to update documentation on Wiki after the merge approval and before merge.


================================================
FILE: LICENSE
================================================
The MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


================================================
FILE: README.md
================================================
<img src="/logo.svg" width="64px"/>

![Build and test](https://github.com/saveourtool/diKTat/workflows/Build%20and%20test/badge.svg?branch=master)
![deteKT static analysis](https://github.com/saveourtool/diKTat/workflows/Run%20deteKT/badge.svg)
![diKTat code style](https://github.com/saveourtool/diKTat/workflows/Run%20diKTat%20%28release%29/badge.svg?branch=master)
[![codecov](https://codecov.io/gh/saveourtool/diKTat/branch/master/graph/badge.svg)](https://codecov.io/gh/saveourtool/diKTat)

[![Releases](https://img.shields.io/github/v/release/saveourtool/diKTat)](https://github.com/saveourtool/diKTat/releases)
[![Maven Central](https://img.shields.io/maven-central/v/com.saveourtool.diktat/diktat-rules)](https://mvnrepository.com/artifact/com.saveourtool.diktat)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fsaveourtool%2Fdiktat.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fsaveourtool%2Fdiktat?ref=badge_shield)
[![Chat on Telegram](https://img.shields.io/badge/Chat%20on-Telegram-brightgreen.svg)](https://t.me/diktat_support)

[![Hits-of-Code](https://hitsofcode.com/github/saveourtool/diktat)](https://hitsofcode.com/view/github/saveourtool/diktat)
![Lines of code](https://img.shields.io/tokei/lines/github/saveourtool/diktat)
![GitHub repo size](https://img.shields.io/github/repo-size/saveourtool/diktat)
[![Awesome Kotlin Badge](https://kotlin.link/awesome-kotlin.svg)](https://github.com/KotlinBy/awesome-kotlin)


**DiKTat** is a strict [coding standard](info/guide/diktat-coding-convention.md) for Kotlin, consisting of a collection of [Kotlin](https://kotlinlang.org/) code style rules implemented as Abstract Syntax Tree (AST) visitors built on top of [KTlint](https://ktlint.github.io/). It serves the purpose of detecting and automatically fixing code smells in the Continuous Integration/Continuous Deployment (CI/CD) process. You can find the comprehensive list of supported rules and inspections [here](info/available-rules.md).

DiKTat has gained recognition and has been added to the lists of [static analysis tools](https://github.com/analysis-tools-dev/static-analysis), [kotlin-awesome](https://github.com/KotlinBy/awesome-kotlin), and [kompar](https://catalog.kompar.tools/Analyzer/diKTat/1.2.5). We extend our gratitude to the community for this support!

## See first

|  |  |  |  |  |  |
| --- | --- | --- | --- | --- | --- |
|[Codestyle](info/guide/diktat-coding-convention.md)|[Inspections](info/available-rules.md) | [Examples](examples) | [Demo](https://saveourtool.com/#/demo/diktat) | [White Paper](wp/wp.pdf) | [Groups of Inspections](info/rules-mapping.md) |

## Why Choose DiKTat for CI/CD?

While there are other tools like `detekt` and `ktlint` performing static analysis, you might wonder why DiKTat is necessary. Here are the key reasons:

1. **More Inspections:** DiKTat boasts over 100 inspections tightly coupled with its [Codestyle](info/guide/diktat-coding-convention.md).

2. **Unique Inspections:** DiKTat introduces unique inspections not found in other linters.

3. **Highly Configurable:** Every inspection is highly configurable, allowing customization and suppression. Check [configuration options](#config) and [suppression](#suppress).

4. **Strict Codestyle:** DiKTat enforces a detailed [Codestyle](info/guide/diktat-coding-convention.md) that can be adopted and applied in your project.

## Run as [CLI-application](diktat-cli/README.md)

### Download binary

1. Download diKTat manually: [here](https://github.com/saveourtool/diktat/releases)

   **OR** use `curl`:
   ```shell
   curl -sSLO https://github.com/saveourtool/diktat/releases/download/v2.0.0/diktat && chmod a+x diktat
   ```

_**For Windows only**_. Download diKTat.cmd manually: [here](https://github.com/saveourtool/diktat/releases)

### Run diKTat

Finally, run KTlint (with diKTat injected) to check your '*.kt' files in 'dir/your/dir':

```console
$ ./diktat "dir/your/dir/**/*.kt"
```

> _**On Windows**_
> ```console
> diktat.bat "dir/your/dir/**/*.kt"
> ```

To **autofix** all code style violations, use `--mode fix` option.

## Run with Maven using diktat-maven-plugin

You can see how it is configured in our examples:
- [Single project](examples/maven/pom.xml)
- [Multi-module project](examples/maven-multiproject/pom.xml)

<details>
<summary>Add this plugin to your pom.xml:</summary>

```xml
            <plugin>
                <groupId>com.saveourtool.diktat</groupId>
                <artifactId>diktat-maven-plugin</artifactId>
                <version>${diktat.version}</version>
                <executions>
                    <execution>
                        <id>diktat</id>
                        <phase>none</phase>
                        <goals>
                            <goal>check</goal>
                            <goal>fix</goal>
                        </goals>
                        <configuration>
                            <inputs>
                                <input>${project.basedir}/src/main/kotlin</input>
                                <input>${project.basedir}/src/test/kotlin</input>
                            </inputs>
                            <diktatConfigFile>diktat-analysis.yml</diktatConfigFile>
                           <excludes>
                              <exclude>${project.basedir}/src/test/kotlin/excluded</exclude>
                           </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
```
</details>

To run diktat in **only-check** mode use command `$ mvn diktat:check@diktat`.
To run diktat in **autocorrect** mode use command `$ mvn diktat:fix@diktat`.

Requesting a specific _Maven_ `executionId` on the command line (the trailing
`diktat` in the above example) may be essential in these cases:

  * In your `pom.xml`, you have multiple executions with different
    configurations (e. g.: multiple rule sets):
    <details>

    ```xml
    <executions>

        <execution>
            <id>diktat-basic</id>
            <configuration>
                <diktatConfigFile>diktat-analysis.yml</diktatConfigFile>
            </configuration>
        </execution>

        <execution>
            <id>diktat-advanced</id>
            <configuration>
                <diktatConfigFile>diktat-analysis-advanced.yml</diktatConfigFile>
            </configuration>
        </execution>

    </executions>
    ```
    </details>
  * Your YAML file with DiKTat rules has a non-default name and/or resides in a
    non-default location:
    <details>

    ```xml
    <executions>
        <execution>
            <id>diktat</id>
            <configuration>
                <diktatConfigFile>/non/default/rule-set-file.yml</diktatConfigFile>
            </configuration>
        </execution>
    </executions>
    ```
    </details>

    * You can omit the `diktatConfigFile` or if it points to non-existed file
      then DiKTat runs with default configuration.

If you omit the `executionId`:

```console
$ mvn diktat:check
```

&mdash; the plug-in will use the default configuration and search for
`diktat-analysis.yml` file in the project directory (you can still customize the
rule sets by editing the YAML file).

## Run with Gradle using diktat-gradle-plugin
Requires a gradle version no lower than 7.0

You can see how the plugin is configured in our examples:
- [Kotlin DSL](examples/gradle-kotlin-dsl/build.gradle.kts)
- [Kotlin DSL for multi-module project](examples/gradle-kotlin-dsl-multiproject/build.gradle.kts)
- [Groovy DSL](examples/gradle-groovy-dsl/build.gradle)

<details>
<summary>Add this plugin to your `build.gradle.kts`:</summary>

```kotlin
plugins {
    id("com.saveourtool.diktat") version "2.0.0"
}
```

> _**Note**_ If you want to apply the plugin to multi-module projects"
> ```kotlin
> import com.saveourtool.diktat.plugin.gradle.DiktatGradlePlugin
>
> plugins {
>     id("com.saveourtool.diktat") version "2.0.0" apply false
> }
>
> allprojects {
>     apply<DiktatGradlePlugin>()
> }
> ```

You can then configure diktat using `diktat` extension:
```kotlin
diktat {
    inputs {
        include("src/**/*.kt")  // path matching this pattern (per PatternFilterable) that will be checked by diktat
        exclude("src/test/kotlin/excluded/**")  // path matching this pattern will not be checked by diktat
    }
    debug = true  // turn on debug logging
}
```

Also in `diktat` extension you can configure different reporters and their output. You can specify `json`, `html`, `sarif`, `plain` (default).
If `output` is set, it should be a file path. If not set, results will be printed to stdout.
You can specify multiple reporters.
If no reporter is specified, `plain` will be used with `stdout` as output.
```kotlin
diktat {
    reporters {
        plain()
        json()
        html {
            output = file("someFile.html")
        }
        // checkstyle()
        // sarif()
        // gitHubActions()
    }
}
```
</details>

You can run diktat checks using task `./gradlew diktatCheck` and automatically fix errors with task `./gradlew diktatFix`.

## Run with Spotless
[Spotless](https://github.com/diffplug/spotless) is a linter aggregator.

### Gradle
Diktat can be run via spotless-gradle-plugin since version 5.10.0

<details>
<summary>Add this plugin to your build.gradle.kts</summary>

```kotlin
plugins {
   id("com.diffplug.spotless") version "5.10.0"
}

spotless {
   kotlin {
      diktat()
   }
   kotlinGradle {
      diktat()
   }
}
```
</details>

<details>
<summary>You can provide a version and configuration path manually as configFile.</summary>

```kotlin
spotless {
   kotlin {
      diktat("2.0.0").configFile("full/path/to/diktat-analysis.yml")
   }
}
```
</details>

### Maven
Diktat can be run via spotless-maven-plugin since version 2.8.0

<details>
<summary>Add this plugin to your pom.xml</summary>

```xml
<plugin>
   <groupId>com.diffplug.spotless</groupId>
   <artifactId>spotless-maven-plugin</artifactId>
   <version>${spotless.version}</version>
   <configuration>
      <kotlin>
         <diktat />
      </kotlin>
   </configuration>
</plugin>
```
</details>

<details>
<summary>You can provide a version and configuration path manually as configFile</summary>

```xml
<diktat>
  <version>2.0.0</version> <!-- optional -->
  <configFile>full/path/to/diktat-analysis.yml</configFile> <!-- optional, configuration file path -->
</diktat>
```
</details>

## GitHub Integration
We suggest everyone to use common ["sarif"](https://docs.oasis-open.org/sarif/sarif/v2.0/sarif-v2.0.html) format as a `reporter` in CI/CD.
GitHub has an [integration](https://docs.github.com/en/code-security/code-scanning/integrating-with-code-scanning/sarif-support-for-code-scanning)
with SARIF format and provides you a native reporting of diktat issues in Pull Requests.

![img.png](example.png)

<details>
<summary> Github Integration</summary>
1) Add the following configuration to your project's setup for GitHub Actions:

Gradle Plugin:
```text
    githubActions = true
```

Maven Plugin (pom.xml):
```xml
    <githubActions>true</githubActions>
```

Maven Plugin (cli options):
```text
mvn -B diktat:check@diktat -Ddiktat.githubActions=true
```

2) Add the following code to your GitHub Action to upload diktat SARIF report (after it was generated):

```yml
      - name: Upload SARIF to Github using the upload-sarif action
        uses: github/codeql-action/upload-sarif@v1
        if: ${{ always() }}
        with:
          sarif_file: ${{ github.workspace }}
```

*Note*: `codeql-action/upload-sarif` limits the number of uploaded files at 15. If your project has more than 15 subprojects,
the limit will be exceeded and the step will fail. To solve this issue one can merge SARIF reports.

`diktat-gradle-plugin` provides this capability with `mergeDiktatReports` task. This task aggregates reports of all diktat tasks
of all Gradle project, which produce SARIF reports, and outputs the merged report into root project's build directory. Then this single
file can be used as an input for GitHub action:
```yaml
with:
    sarif_file: build/reports/diktat/diktat-merged.sarif
```

</details>

## <a name="config"></a> Customizations via `diktat-analysis.yml`

In Diktat we have supported `diktat-analysis.yml` that can be easily
changed and help in customization of your own rule set.
It has simple fields:
`name` — name of the rule,
`enabled` (true/false) — to enable or disable that rule (all rules are enabled by the default),
`configuration` — a simple map of some extra unique configurations for this particular rule.
For example:

```yaml
- name: HEADER_MISSING_OR_WRONG_COPYRIGHT
  # all rules are enabled by the default. To disable add 'enabled: false' to the config.
  enabled: true
  configuration:
    isCopyrightMandatory: true
    copyrightText: Copyright (c) Jeff Lebowski, 2012-2020. All rights reserved.
```
Note, that you can specify and put `diktat-analysis.yml` that contains configuration of diktat in the parent directory of your project on the same level where `build.gradle/pom.xml` is stored. \
See default configuration in [diktat-analysis.yml](diktat-rules/src/main/resources/diktat-analysis.yml) \
Also see [the list of all rules supported by diKTat](info/available-rules.md).


## <a name="suppress"></a> Suppress warnings/inspections

<details>
<summary>Suppress warnings on individual code blocks</summary>
In addition to enabling/disabling warning globally via config file (`enable = false`), you can suppress warnings
by adding `@Suppress` annotation on individual code blocks or `@file:Suppress()` annotation on a file-level.

For example:

``` kotlin
@Suppress("FUNCTION_NAME_INCORRECT_CASE")
class SomeClass {
    fun methODTREE(): String {

    }
}
```
</details>

<details>
<summary>Disable all inspections on selected code blocks</summary>
Also you can suppress **all** warnings by adding `@Suppress("diktat")` annotation on individual code blocks.

For example:

``` kotlin
@Suppress("diktat")
class SomeClass {
    fun methODTREE(): String {

    }
}
```
</details>

<details>
<summary>ignoreAnnotated: disable inspections on blocks with predefined annotation</summary>
In the `diktat-analysis.yml` file for each inspection it is possible to define a list of annotations that will cause
disabling of the inspection on that particular code block:

```yaml
- name: HEADER_NOT_BEFORE_PACKAGE
  enabled: true
  ignoreAnnotated: [MyAnnotation, Compose, Controller]
```
</details>

<details>
<summary>Suppress groups of inspections by chapters</summary>
It is easy to suppress even groups of inspections in diKTat.

These groups are linked to chapters of [Codestyle](info/guide/diktat-coding-convention.md).

To disable chapters, you will need to add the following configuration to common configuration (`- name: DIKTAT_COMMON`):
```yaml
    disabledChapters: "1, 2, 3"
```

Mapping of inspections to chapters can be found in [Groups of Inspections](info/rules-mapping.md).
</details>

## Running against the baseline
When setting up code style analysis on a large existing project, one often doesn't have an ability to fix all findings at once.
To allow gradual adoption, diktat and ktlint support baseline mode. When running ktlint for the first time with active baseline,
the baseline file will be generated. It is a xml file with a complete list of findings by the tool. On later invocations,
only the findings that are not in the baseline file will be reported. Baseline can be activated with CLI flag:
```bash
./diktat --baseline=diktat-baseline.xml **/*.kt
```
or with corresponding configuration options in maven or gradle plugins. Baseline report is intended to be added into the VCS,
but it can be removed and re-generated later, if needed.

## Contribution
See our [Contributing Policy](CONTRIBUTING.md) and [Code of Conduct](CODE_OF_CONDUCT.md)

## Kotlin Coding Style Guide (Diktat Code Style), v.1.0.0

I [Preface](#c0)
* [I.I Purpose of this document](#c0.1)
* [I.II General principles](#c0.2)
* [I.III Terminology](#c0.3)
* [I.IV Exceptions](#c0.4)

[1. Naming](#c1)

* [1.1 Identifiers](#c1.1)
* [1.2 Packages](#c1.2)
* [1.3 Classes, enumerations, interfaces](#c1.3)
* [1.4 Functions](#c1.4)
* [1.5 Constants](#c1.5)
* [1.6 Non-constant fields (variables)](#c1.6)
    * [1.6.1 Non-constant field name](#r1.6.1)
    * [1.6.2 Boolean variable names with negative meaning](#r1.6.2)

[2. Comments](#c2)
* [2.1 General form of Kdoc](#c2.1)
    * [2.1.1 Using KDoc for the public, protected, or internal code elements](#r2.1.1)
    * [2.1.2 Describing methods that have arguments, a return value, or can throw an exception in the KDoc block](#r2.1.2)
    * [2.1.3 Only one space between the Kdoc tag and content. Tags are arranged in the order.](#r2.1.3)
* [2.2 Adding comments on the file header](#c2.2)
* [2.3 Comments on the function header](#c2.3)
* [2.4 Code comments](#c2.4)
    * [2.4.1 Add a blank line between the body of the comment and Kdoc tag-blocks](#r2.4.1)
    * [2.4.2 Do not comment on unused code blocks](#r2.4.2)
    * [2.4.3 Code delivered to the client should not contain TODO/FIXME comments](#r2.4.3)

[3. General formatting (typesetting)](#c3)
* [3.1 File-related rules](#c3.1)
    * [3.1.1 Avoid files that are too long](#r3.1.1)
    * [3.1.2 Code blocks in the source file should be separated by one blank line](#r3.1.2)
    * [3.1.3 Import statements order](#r3.1.3)
    * [3.1.4 Order of declaration parts of class-like code structures](#r3.1.4)
    * [3.1.5 Order of declaration of top-level code structures](#r3.1.5)
* [3.2 Braces](#c3.2)
    * [3.2.1 Using braces in conditional statements and loop blocks](#r3.2.1)
    * [3.2.2 Opening braces are placed at the end of the line in *non-empty* blocks and block structures](#r3.2.2)
* [3.3 Indentation](#c3.3)
* [3.4 Empty blocks](#c3.4)
* [3.5 Line length](#c3.5)
* [3.6 Line breaks (newlines)](#c3.6)
    * [3.6.1 Each line can have a maximum of one statement](#r3.6.1)
    * [3.6.2 Rules for line-breaking](#r3.6.2)
* [3.7 Using blank lines](#c3.7)
* [3.8 Horizontal space](#c3.8)
    * [3.8.1 Usage of whitespace for code separation](#r3.8.1)
    * [3.8.2 No spaces for horizontal alignment](#r3.8.2)
* [3.9 Enumerations](#c3.9)
* [3.10 Variable declaration](#c3.10)
    * [3.10.1 Declare one variable per line](#r3.10.1)
    * [3.10.2 Variables should be declared near the line where they are first used](#r3.10.2)
* [3.11 'When' expression](#c3.11)
* [3.12 Annotations](#c3.12)
* [3.13 Block comments](#c3.13)
* [3.14 Modifiers and constant values](#c3.14)
    * [3.14.1 Declaration with multiple modifiers](#r3.14.1)
    * [3.14.2 Separate long numerical values with an underscore](#r3.14.2)
* [3.15 Strings](#c3.15)
    * [3.15.1 Concatenation of Strings](#r3.15.1)
    * [3.15.2 String template format](#r3.15.2)
* [3.16 Conditional statements](#c3.16)
    * [3.16.1 Collapsing redundant nested if-statements](#r3.16.1)
    * [3.16.2 Too complex conditions](#r3.16.2)

[4. Variables and types](#c4)
* [4.1 Variables](#c4.1)
    * [4.1.1 Do not use Float and Double types when accurate calculations are needed](#r4.1.1)
    * [4.1.2 Comparing numeric float type values](#r4.1.2)
    * [4.1.3 Try to use 'val' instead of 'var' for variable declaration [SAY_NO_TO_VAR]](#r4.1.3)
* [4.2 Types](#c4.2)
    * [4.2.1 Use Contracts and smart cast as much as possible](#r4.2.1)
    * [4.2.2 Try to use type alias to represent types making code more readable](#r4.2.2)
* [4.3 Null safety and variable declarations](#c4.3)
    * [4.3.1 Avoid declaring variables with nullable types, especially from Kotlin stdlib](#r4.3.1)
    * [4.3.2 Variables of generic types should have an explicit type declaration](#r4.3.2)
    * [4.3.3 Null-safety](#r4.3.3)

[5. Functions](#c5)
* [5.1 Function design](#c5.1)
    * [5.1.1 Avoid functions that are too long ](#r5.1.1)
    * [5.1.2 Avoid deep nesting of function code blocks, limiting to four levels](#r5.1.2)
    * [5.1.3 Avoid using nested functions](#r5.1.3)
    * [5.1.4 Negated function calls](#r5.1.4)
* [5.2 Function arguments](#c5.2)
    * [5.2.1 The lambda parameter of the function should be placed at the end of the argument list](#r5.2.1)
    * [5.2.2 Number of function parameters should be limited to five](#r5.2.2)
    * [5.2.3 Use default values for function arguments instead of overloading them](#r5.2.3)
    * [5.2.4 Synchronizing code inside asynchronous code](#r5.2.4)
    * [5.2.5 Long lambdas should have explicit parameters](#r5.2.5)
    * [5.2.6 Avoid using unnecessary, custom label](#r5.2.6)

[6. Classes, interfaces, and extension functions](#c6)
* [6.1 Classes](#c6.1)
    * [6.1.1 Denoting a class with a single constructor](#r6.1.1)
    * [6.1.2 Prefer data classes instead of classes without any functional logic](#r6.1.2)
    * [6.1.3 Do not use the primary constructor if it is empty or useless](#r6.1.3)
    * [6.1.4 Do not use redundant init blocks in your class](#r6.1.4)
    * [6.1.5 Explicit supertype qualification](#r6.1.5)
    * [6.1.6 Abstract class should have at least one abstract method](#r6.1.6)
    * [6.1.7 When using the "implicit backing property" scheme, the name of real and back property should be the same](#r6.1.7)
    * [6.1.8 Avoid using custom getters and setters](#r6.1.8)
    * [6.1.9 Never use the name of a variable in the custom getter or setter (possible_bug)](#r6.1.9)
    * [6.1.10 No trivial getters and setters are allowed in the code](#r6.1.10)
    * [6.1.11 Use 'apply' for grouping object initialization](#r6.1.11)
    * [6.1.12 Prefer Inline classes when a class has a single property](#r6.1.12)
* [6.2 Extension functions](#c6.2)
    * [6.2.1 Use extension functions for making logic of classes less coupled](#r6.2.1)
    * [6.2.2 No extension functions with the same name and signature if they extend base and inheritor classes (possible_bug)](#r6.2.2)
    * [6.2.3 Don't use extension functions for the class in the same file](#r6.2.3)
* [6.3 Interfaces](#c6.3)
* [6.4 Objects](#c6.4)
    * [6.4.1 Instead of using utility classes/objects, use extensions](#r6.4.1)
    * [6.4.2 Objects should be used for Stateless Interfaces](#r6.4.2)
* [6.5 Kts Files](#c6.5)
    * [6.5.1 kts files should wrap logic into top-level scope](#r6.5.1)

## <a name="c0"></a> Preface
 <!-- =============================================================================== -->
### <a name="c0.1"></a> Purpose of this document

The purpose of this document is to provide a specification that software developers could reference to enhance their ability to write consistent, easy-to-read, and high-quality code.
Such a specification will ultimately improve software development efficiency and product competitiveness.
For the code to be considered high-quality, it must entail the following characteristics:
1.	Simplicity
2.	Maintainability
3.	Reliability
4.	Testability
5.	Efficiency
6.	Portability
7.	Reusability


<!-- =============================================================================== -->
### <a name="c0.2"></a> General principles

Like other modern programming languages, Kotlin is an advanced programming language that complies with the following general principles:
1.	Clarity — a necessary feature of programs that are easy to maintain and refactor.
2.	Simplicity — a code is easy to understand and implement.
3.	Consistency — enables a code to be easily modified, reviewed, and understood by the team members. Unification is particularly important when the same team works on the same project, utilizing similar styles enabling a code to be easily modified, reviewed, and understood by the team members.

Also, we need to consider the following factors when programming on Kotlin:

1. Writing clean and simple Kotlin code

   Kotlin combines two of the main programming paradigms: functional and object-oriented.
   Both of these paradigms are trusted and well-known software engineering practices.
   As a young programming language, Kotlin is built on top of well-established languages such as Java, C++, C#, and Scala.
   This enables Kotlin to introduce many features that help a developer write cleaner, more readable code while also reducing the number of complex code structures. For example, type and null safety, extension functions, infix syntax, immutability, val/var differentiation, expression-oriented features, "when" statements, much easier work with collections, type auto conversion, and other syntactic sugar.

2. Following Kotlin idioms

   The author of Kotlin, Andrey Breslav, mentioned that Kotlin is both pragmatic and practical, but not academic.
   Its pragmatic features enable ideas to be transformed into real working software easily. Kotlin is closer to natural languages than its predecessors, and it implements the following design principles: readability, reusability, interoperability, security, and tool-friendliness (https://blog.jetbrains.com/kotlin/2018/10/kotlinconf-2018-announcements/).

3. Using Kotlin efficiently

   Some Kotlin features can help you to write higher-performance code: including rich coroutine library, sequences, inline functions/classes, arrays of basic types, tailRec, and CallsInPlace of contract.

<!-- =============================================================================== -->
### <a name="c0.3"></a> Terminology

**Rules** — conventions that should be followed when programming.

**Recommendations** — conventions that should be considered when programming.

**Explanation** — necessary explanations of rules and recommendations.

**Valid Example** — recommended examples of rules and recommendations.

**Invalid Example** — not recommended examples of rules and recommendations.

Unless otherwise stated, this specification applies to versions 1.3 and later of Kotlin.

<!-- =============================================================================== -->
### <a name="c0.4"></a> Exceptions

Even though exceptions may exist, it is essential to understand why rules and recommendations are needed.
Depending on a project situation or personal habits, you can break some of the rules. However, remember that one exception may lead to many and eventually can destroy code consistency. As such, there should be very few exceptions.
When modifying open-source code or third-party code, you can choose to use the code style from this open-source project (instead of using the existing specifications) to maintain consistency.
Software that is directly based on the Android native operating system interface, such as the Android Framework, remains consistent with the Android style.
# <a name="c1"></a> 1. Naming
In programming, it is not always easy to meaningfully and appropriately name variables, functions, classes, etc. Using meaningful names helps to clearly express your code's main ideas and functionality and avoid misinterpretation, unnecessary coding and decoding, "magic" numbers, and inappropriate abbreviations.

Note: The source file encoding format (including comments) must be UTF-8 only. The ASCII horizontal space character (0x20, that is, space) is the only permitted whitespace character. Tabs should not be used for indentation.

<!-- =============================================================================== -->
### <a name="c1.1"></a> 1.1 Identifiers
This section describes the general rules for naming identifiers.
#### <a name="r1.1.1"></a> 1.1.1 Identifiers naming conventions

For identifiers, use the following naming conventions:
1.	All identifiers should use only ASCII letters or digits, and the names should match regular expressions `\w{2,64}`.
      Explanation: Each valid identifier name should match the regular expression `\w{2,64}`.
      `{2,64}` means that the name length is 2 to 64 characters, and the length of the variable name should be proportional to its life range, functionality, and responsibility.
      Name lengths of less than 31 characters are generally recommended. However, this depends on the project. Otherwise, a class declaration with generics or inheritance from a superclass can cause line breaking.
      No special prefix or suffix should be used in names. The following examples are inappropriate names: name_, mName, s_name, and kName.

2.	Choose file names that would describe the content. Use camel case (PascalCase) and `.kt` extension.

3.	Typical examples of naming:

| Meaning | Correct |Incorrect|
| ---- | ---- | ---- |
| "XML Http Request" | XmlHttpRequest | XMLHTTPRequest |
| "new customer ID" | newCustomerId | newCustomerID |
| "inner stopwatch" | innerStopwatch | innerStopWatch |
| "supports IPv6 on iOS" | supportsIpv6OnIos | supportsIPv6OnIOS |
| "YouTube importer" | YouTubeImporter | YoutubeImporter |

4.	The usage of (``) and free naming for functions and identifiers are prohibited. For example, the following code is not recommended:

```kotlin
val `my dummy name-with-minus` = "value"
```

The only exception is function names in `Unit tests.`

5.	Backticks (``) should not be used for identifiers, except the names of test methods (marked with @Test annotation):
```kotlin
 @Test fun `my test`() { /*...*/ }
```
6.  The following table contains some characters that may cause confusion. Be careful when using them as identifiers. To avoid issues, use other names instead.

| Expected      | Confusing name           | Suggested name   |
| ------------- | ------------------------ | ---------------- |
| 0 (zero)      | O, D                     | obj, dgt         |
| 1 (one)       | I, l                     | it, ln, line     |
| 2 (two)       | Z                        | n1, n2           |
| 5 (five)      | S                        | xs, str          |
| 6 (six)       | e                        | ex, elm          |
| 8 (eight)     | B                        | bt, nxt          |
| n,h           | h,n                      | nr, head, height |
| rn, m         | m,rn                     | mbr, item        |

**Exceptions:**
- The i,j,k variables used in loops are part of the industry standard. One symbol can be used for such variables.
- The `e` variable can be used to catch exceptions in catch block: `catch (e: Exception) {}`
- The Java community generally does not recommend the use of prefixes. However, when developing Android code, you can use the s and m prefixes for static and non-public non-static fields, respectively.
  Note that prefixing can also negatively affect the style and the auto-generation of getters and setters.

| Type | Naming style |
| ---- | ---- |
| Interfaces, classes, annotations, enumerated types, and object type names | Camel case, starting with a capital letter. Test classes have a Test suffix. The filename is 'TopClassName'.kt.  |
| Class fields, local variables, methods, and method parameters | Camel case starting with a low case letter. Test methods can be underlined with '_'; the only exception is [backing properties](#r6.1.7).
| Static constants and enumerated values | Only uppercase underlined with '_' |
| Generic type variable | Single capital letter, which can be followed by a number, for example: `E, T, U, X, T2` |
| Exceptions | Same as class names, but with a suffix Exception, for example: `AccessException` and `NullPointerException`|

<!-- =============================================================================== -->
### <a name="c1.2"></a> 1.2 Packages

#### <a name="r1.2.1"></a> Rule 1.2.1 Package names dots
Package names are in lower case and separated by dots. Code developed within your company should start with `your.company.domain.` Numbers are permitted in package names.
Each file should have a `package` directive.
Package names are all written in lowercase, and consecutive words are concatenated together (no underscores). Package names should contain both the product or module names and the department (or team) name to prevent conflicts with other teams.  Numbers are not permitted. For example: `org.apache.commons.lang3`, `xxx.yyy.v2`.

**Exceptions:**

- In certain cases, such as open-source projects or commercial cooperation, package names should not start with `your.company.domain.`
- If the package name starts with a number or other character that cannot be used at the beginning of the Java/Kotlin package name, then underscores are allowed. For example: `com.example._123name`.
- Underscores are sometimes permitted if the package name contains reserved Java/Kotlin keywords, such as `org.example.hyphenated_name`, `int_.example`.

**Valid example**:
```kotlin
package your.company.domain.mobilecontrol.views
```

<!-- =============================================================================== -->
### <a name="c1.3"></a> 1.3 Classes, enumerations, typealias, interfaces
This section describes the general rules for naming classes, enumerations, and interfaces.
### <a name="r1.3.1"></a> 1.3.1 Classes, enumerations, typealias, interface names use Camel case
Classes, enumerations, and interface names use `UpperCamelCase` nomenclature. Follow the naming rules described below:
1.	A class name is usually a noun (or a noun phrase) denoted using the camel case nomenclature, such as UpperCamelCase. For example: `Character` or `ImmutableList`.
      An interface name can also be a noun or noun phrase (such as `List`) or an adjective or adjective phrase (such as `Readable`).
      Note that verbs are not used to name classes. However, nouns (such as `Customer`, `WikiPage`, and `Account`) can be used. Try to avoid using vague words such as `Manager` and `Process`.

2.	Test classes start with the name of the class they are testing and end with 'Test'. For example, `HashTest` or `HashIntegrationTest`.

**Invalid example**:
```kotlin
class marcoPolo {}
class XMLService {}
interface TAPromotion {}
class info {}
```

**Valid example**:
```kotlin
class MarcoPolo {}
class XmlService {}
interface TaPromotion {}
class Order {}
```

<!-- =============================================================================== -->
### <a name="c1.4"></a> 1.4 Functions
This section describes the general rules for naming functions.
### <a name="r1.4.1"></a> 1.4.1 Function names should be in camel case
Function names should use `lowerCamelCase` nomenclature. Follow the naming rules described below:
1.	Function names are usually verbs or verb phrases denoted with the camel case nomenclature (`lowerCamelCase`).
      For example: `sendMessage`, `stopProcess`, or `calculateValue`.
      To name functions, use the following formatting rules:

a) To get, modify, or calculate a certain value: get + non-boolean field(). Note that the Kotlin compiler automatically generates getters for some classes, applying the special syntax preferred for the 'get' fields: kotlin private val field: String get() { }. kotlin private val field: String get() { }.
```kotlin
private val field: String
get() {
}
```
Note: The calling property access syntax is preferred to call getter directly. In this case, the Kotlin compiler automatically calls the corresponding getter.

b) `is` + boolean variable name()

c) `set` + field/attribute name(). However, note that the syntax and code generation for Kotlin are completely the same as those described for the getters in point a.

d) `has` + Noun / adjective ()

e) verb()
Note: Note: Verb are primarily used for the action objects, such as `document.print ()`

f) verb + noun()

g) The Callback function allows the names that use the preposition + verb format, such as: `onCreate()`, `onDestroy()`, `toString()`.

**Invalid example**:

```kotlin
fun type(): String
fun Finished(): Boolean
fun visible(boolean)
fun DRAW()
fun KeyListener(Listener)
```

**Valid example**:

```kotlin
fun getType(): String
fun isFinished(): Boolean
fun setVisible(boolean)
fun draw()
fun addKeyListener(Listener)
```

2.	An underscore (`_`) can be included in the JUnit test function name and should be used as a separator. Each logical part is denoted in `lowerCamelCase`, for example, a typical pattern of using underscore: `pop_emptyStack`.
<!-- =============================================================================== -->
### <a name="c1.5"></a> 1.5 Constants
This section describes the general rules for naming constraints.
### <a name="r1.5.1"></a> 1.5.1 Using UPPER case and underscore characters in a constraint name
Constant names should be in UPPER case, words separated by underscore. The general constant naming conventions are listed below:
1. Constants are attributes created with the `const` keyword or top-level/`val` local variables of an object that holds immutable data. In most cases, constants can be identified as a `const val` property from the `object`/`companion object`/file top level. These variables contain fixed constant values that typically should never be changed by programmers. This includes basic types, strings, immutable types, and immutable collections of immutable types. The value is not constant for the object, which state can be changed.
2. Constant names should contain only uppercase letters separated by an underscores. They should have a val or const val modifier to make them final explicitly. In most cases, if you need to specify a constant value, then you need to create it with the "const val" modifier. Note that not all `val` variables are constants.
3. Objects with immutable content, such as `Logger` and `Lock`, can be in uppercase as constants or have camel case as regular variables.
4. Use meaningful constants instead of `magic numbers`. SQL or logging strings should not be treated as magic numbers, nor should they be defined as string constants.
   Magic constants, such as `NUM_FIVE = 5` or `NUM_5 = 5` should not be treated as constants. This is because mistakes will easily be made if they are changed to `NUM_5 = 50` or 55.
   These constants typically represent business logic values, such as measures, capacity, scope, location, tax rate, promotional discounts, and power base multiples in algorithms.
   You can avoid using magic numbers with the following method:
- Using library functions and APIs. For example, instead of checking that `size == 0`, use `isEmpty()` function. To work with `time`, use built-ins from `java.time API`.
- Enumerations can be used to name patterns. Refer to [Recommended usage scenario for enumeration in 3.9](#c3.9).

**Invalid example**:

```kotlin
var int MAXUSERNUM = 200;
val String sL = "Launcher";
```

**Valid example**:

```kotlin
const val int MAX_USER_NUM = 200;
const val String APPLICATION_NAME = "Launcher";
```

<!-- =============================================================================== -->
### <a name="c1.6"></a> 1.6 Non-constant fields (variables)
This section describes the general rules for naming variables.
### <a name="r1.6.1"></a> 1.6.1 Non-constant field name
Non-constant field names should use camel case and start with a lowercase letter.
A local variable cannot be treated as constant even if it is final and immutable. Therefore, it should not use the preceding rules. Names of collection type variables (sets, lists, etc.) should contain plural nouns.
For example: `var namesList: List<String>`

Names of non-constant variables should use `lowerCamelCase`. The name of the final immutable field used to store the singleton object can use the same camel case notation.

**Invalid example**:
```kotlin
customername: String
user: List<String> = listof()
```

**Valid example**:
```kotlin
var customerName: String
val users: List<String> = listOf();
val mutableCollection: MutableSet<String> = HashSet()
```

### <a name="r1.6.2"></a> 1.6.2 Boolean variable names with negative meaning

Avoid using Boolean variable names with a negative meaning. When using a logical operator and name with a negative meaning, the code may be difficult to understand, which is referred to as the "double negative".
For instance, it is not easy to understand the meaning of !isNotError.
The JavaBeans specification automatically generates isXxx() getters for attributes of Boolean classes.
However, not all methods returning Boolean type have this notation.
For Boolean local variables or methods, it is highly recommended that you add non-meaningful prefixes, including is (commonly used by JavaBeans), has, can, should, and must. Modern integrated development environments (IDEs) such as Intellij are already capable of doing this for you when you generate getters in Java. For Kotlin, this process is even more straightforward as everything is on the byte-code level under the hood.

**Invalid example**:
```kotlin
val isNoError: Boolean
val isNotFound: Boolean
fun empty()
fun next();
```

**Valid example**:
```kotlin
val isError: Boolean
val isFound: Boolean
val hasLicense: Boolean
val canEvaluate: Boolean
val shouldAbort: Boolean
fun isEmpty()
fun hasNext()
```
# <a name="c2"></a> 2. Comments

The best practice is to begin your code with a summary, which can be one sentence.
Try to balance between writing no comments at all and obvious commentary statements for each line of code.
Comments should be accurately and clearly expressed, without repeating the name of the class, interface, or method.
Comments are not a solution to the wrong code. Instead, you should fix the code as soon as you notice an issue or plan to fix it (by entering a TODO comment, including a Jira number).
Comments should accurately reflect the code's design ideas and logic and further describe its business logic.
As a result, other programmers will be able to save time when trying to understand the code.
Imagine that you are writing the comments to help yourself to understand the original ideas behind the code in the future.

### <a name="c2.1"></a> 2.1 General form of Kdoc

KDoc is a combination of JavaDoc's block tags syntax (extended to support specific constructions of Kotlin) and Markdown's inline markup.
The basic format of KDoc is shown in the following example:

```kotlin
 /**
 * There are multiple lines of KDoc text,
 * Other ...
 */
fun method(arg: String) {
    // ...
}
```

It is also shown in the following single-line form:

```kotlin
 /** Short form of KDoc. */
```
Use a single-line form when you store the entire KDoc block in one line (and there is no KDoc mark @XXX). For detailed instructions on how to use KDoc, refer to [Official Document](https://docs.oracle.com/en/Kotlin/Kotlinse/11/tools/KDoc.html).

#### <a name="r2.1.1"></a> 2.1.1 Using KDoc for the public, protected, or internal code elements

At a minimum, KDoc should be used for every public, protected, or internal decorated class, interface, enumeration, method, and member field (property).
Other code blocks can also have KDocs if needed.
Instead of using comments or KDocs before properties in the primary constructor of a class - use `@property` tag in a KDoc of a class.
All properties of the primary constructor should also be documented in a KDoc with a `@property` tag.


**Incorrect example:**
```kotlin
/**
 * Class description
 */
class Example(
 /**
  * property description
  */
  val foo: Foo,
  // another property description
  val bar: Bar
)
```

**Correct example:**
```kotlin
/**
 * Class description
 * @property foo property description
 * @property bar another property description
 */
class Example(
  val foo: Foo,
  val bar: Bar
)
```
- Don't use Kdoc comments inside code blocks as block comments

**Incorrect Example:**

```kotlin
class Example {
  fun doGood() {
    /**
     * wrong place for kdoc
     */
    1 + 2
  }
}
```

**Correct Example:**

```kotlin
class Example {
  fun doGood() {
    /*
     * right place for block comment
    */
    1 + 2
  }
}
```

**Exceptions:**

* For setters/getters of properties, obvious comments (like `this getter returns field`) are optional. Note that Kotlin generates simple `get/set` methods under the hood.

* It is optional to add comments for simple one-line methods, such as shown in the example below:
```kotlin
val isEmpty: Boolean
    get() = this.size == 0
```

or

```kotlin
fun isEmptyList(list: List<String>) = list.size == 0
```

**Note:** You can skip KDocs for a method's override if it is almost the same as the superclass method.

#### <a name="r2.1.2"></a> 2.1.2 Describing methods that have arguments, a return value, or can throw an exception in the KDoc block

When the method has such details as arguments, return value, or can throw exceptions, it must be described in the KDoc block (with @param, @return, @throws, etc.).

**Valid examples:**

 ```kotlin
/**
 * This is the short overview comment for the example interface.
 *     / * Add a blank line between the comment text and each KDoc tag underneath * /
 * @since 1.6
 */
 protected abstract class Sample {
    /**
     * This is a long comment with whitespace that should be split in
     * comments on multiple lines if the line comment formatting is enabled.
     *     / * Add a blank line between the comment text and each KDoc tag underneath * /
     * @param fox A quick brown fox jumps over the lazy dog
     * @return battle between fox and dog
     */
    protected abstract fun foo(Fox fox)
     /**
      * These possibilities include: Formatting of header comments
      *     / * Add a blank line between the comment text and each KDoc tag underneath * /
      * @return battle between fox and dog
      * @throws ProblemException if lazy dog wins
      */
    protected fun bar() throws ProblemException {
        // Some comments / * No need to add a blank line here * /
        var aVar = ...

        // Some comments  / * Add a blank line before the comment * /
        fun doSome()
    }
 }
 ```

#### <a name="r2.1.3"></a>2.1.3 Only one space between the Kdoc tag and content. Tags are arranged in the order.

There should be only one space between the Kdoc tag and content. Tags are arranged in the following order: @param, @return, and @throws.

Therefore, Kdoc should contain the following:
- Functional and technical description, explaining the principles, intentions, contracts, API, etc.
- The function description and @tags (`implSpec`, `apiNote`, and `implNote`) require an empty line after them.
- `@implSpec`: A specification related to API implementation, and it should let the implementer decide whether to override it.
- `@apiNote`: Explain the API precautions, including whether to allow null and whether the method is thread-safe, as well as the algorithm complexity, input, and output range, exceptions, etc.
- `@implNote`: A note related to API implementation, which implementers should keep in mind.
- One empty line, followed by regular `@param`, `@return`, `@throws`, and other comments.
- The conventional standard "block labels" are arranged in the following order: `@param`, `@return`, `@throws`.
  Kdoc should not contain:
- Empty descriptions in tag blocks. It is better not to write Kdoc than waste code line space.
- There should be no empty lines between the method/class declaration and the end of Kdoc (`*/` symbols).
- `@author` tag. It doesn't matter who originally created a class when you can use `git blame` or VCS of your choice to look through the changes history.
  Important notes:
- KDoc does not support the `@deprecated` tag. Instead, use the `@Deprecated` annotation.
- The `@since` tag should be used for versions only. Do not use dates in `@since` tag, it's confusing and less accurate.

If a tag block cannot be described in one line, indent the content of the new line by *four spaces* from the `@` position to achieve alignment (`@` counts as one + three spaces).

**Exception:**

When the descriptive text in a tag block is too long to wrap, you can indent the alignment with the descriptive text in the last line. The descriptive text of multiple tags does not need to be aligned.
See [3.8 Horizontal space](#c3.8).

In Kotlin, compared to Java, you can put several classes inside one file, so each class should have a Kdoc formatted comment (as stated in rule 2.1).
This comment should contain @since tag. The right style is to write the application version when its functionality is released. It should be entered after the `@since` tag.

**Examples:**

```kotlin
/**
 * Description of functionality
 *
 * @since 1.6
 */
```

Other KDoc tags (such as @param type parameters and @see.) can be added as follows:
```kotlin
/**
 * Description of functionality
 *
 * @apiNote: Important information about API
 *
 * @since 1.6
 */
```

### <a name="c2.2"></a> 2.2 Adding comments on the file header

This section describes the general rules of adding comments on the file header.

### <a name="r2.2.1"></a> 2.2.1 Formatting of comments in the file header

Comments on the file header should be placed before the package name and imports. If you need to add more content to the comment, subsequently add it in the same format.

Comments on the file header must include copyright information, without the creation date and author's name (use VCS for history management).
Also, describe the content inside files that contain multiple or no classes.

The following examples for Huawei describe the format of the *copyright license*: \
Chinese version: `版权所有 (c) 华为技术有限公司 2012-2020` \
English version: `Copyright (c) Huawei Technologies Co., Ltd. 2012-2020. All rights reserved.`
`2012` and `2020` are the years the file was first created and the current year, respectively.

Do not place **release notes** in header, use VCS to keep track of changes in file. Notable changes can be marked in individual KDocs using `@since` tag with version.

Invalid example:
```kotlin
/**
 * Release notes:
 * 2019-10-11: added class Foo
 */

class Foo
```

Valid example:
```kotlin
/**
 * @since 2.4.0
 */
class Foo
```

- The **copyright statement** can use your company's subsidiaries, as shown in the below examples: \
  Chinese version: `版权所有 (c) 海思半导体 2012-2020` \
  English version: `Copyright (c) Hisilicon Technologies Co., Ltd. 2012-2020. All rights reserved.`

- The copyright information should not be written in KDoc style or use single-line comments. It must start from the beginning of the file.
  The following example is a copyright statement for Huawei, without other functional comments:

```kotlin
/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2012-2020. All rights reserved.
 */
```

The following factors should be considered when writing the file header or comments for top-level classes:
- File header comments must start from the top of the file. If it is a top-level file comment, there should be a blank line after the last Kdoc `*/` symbol. If it is a comment for a top-level class, the class declaration should start immediately without using a newline.
- Maintain a unified format. The specific format can be formulated by the project (for example, if you use an existing opensource project), and you need to follow it.
- A top-level file-Kdoc must include a copyright and functional description, especially if there is more than one top-level class.
- Do not include empty comment blocks. If there is no content after the option `@apiNote`, the entire tag block should be deleted.
- The industry practice is not to include historical information in the comments. The corresponding history can be found in VCS (git, svn, etc.). Therefore, it is not recommended to include historical data in the comments of the Kotlin source code.

### <a name="c2.3"></a> 2.3 Comments on the function header

Comments on the function header are placed above function declarations or definitions. A newline should not exist between a function declaration and its Kdoc. Use the preceding <<c2.1,KDoc>> style rules.

As stated in Chapter 1, the function name should reflect its functionality as much as possible. Therefore, in the Kdoc, try to describe the functionality that is not mentioned in the function name.
Avoid unnecessary comments on dummy coding.

The function header comment's content is optional, but not limited to function description, return value, performance constraints, usage, memory conventions, algorithm implementation, reentrant requirements, etc.

### <a name="c2.4"></a> 2.4 Code comments

This section describes the general rules of adding code comments.

#### <a name="r2.4.1"></a> 2.4.1 Add a blank line between the body of the comment and Kdoc tag-blocks.

It is a good practice to add a blank line between the body of the comment and Kdoc tag-blocks. Also, consider the following rules:
- There must be one space between the comment character and the content of the comment.
- There must be a newline between a Kdoc and the presiding code.
- An empty line should not exist between a Kdoc and the code it is describing. You do not need to add a blank line before the first comment in a particular namespace (code block) (for example, between the function declaration and first comment in a function body).

**Valid Examples:**

```kotlin
/**
 * This is the short overview comment for the example interface.
 *
 * @since 1.6
 */
 public interface Example {
    // Some comments  /* Since it is the first member definition in this code block, there is no need to add a blank line here */
    val aField: String = ...
                     /* Add a blank line above the comment */
    // Some comments
    val bField: String = ...
                      /* Add a blank line above the comment */
    /**
     * This is a long comment with whitespace that should be split in
     * multiple line comments in case the line comment formatting is enabled.
     *                /* blank line between description and Kdoc tag */
     * @param fox A quick brown fox jumps over the lazy dog
     * @return the rounds of battle of fox and dog
     */
    fun foo(Fox fox)
                      /* Add a blank line above the comment */
     /**
      * These possibilities include: Formatting of header comments
      *
      * @return the rounds of battle of fox and dog
      * @throws ProblemException if lazy dog wins
      */
    fun bar() throws ProblemException {
        // Some comments  /* Since it is the first member definition in this range, there is no need to add a blank line here */
        var aVar = ...

        // Some comments  /* Add a blank line above the comment */
        fun doSome()
    }
 }
```

- Leave one single space between the comment on the right side of the code and the code.
  If you use conditional comments in the `if-else-if` scenario, put the comments inside the `else-if` branch or in the conditional block, but not before the `else-if`. This makes the code more understandable.
  When the if-block is used with curly braces, the comment should be placed on the next line after opening the curly braces.
  Compared to Java, the `if` statement in Kotlin statements returns a value. For this reason, a comment block can describe a whole `if-statement`.

**Valid examples:**

```kotlin

val foo = 100  // right-side comment
val bar = 200  /* right-side comment */

// general comment for the value and whole if-else condition
val someVal = if (nr % 15 == 0) {
    // when nr is a multiple of both 3 and 5
    println("fizzbuzz")
} else if (nr % 3 == 0) {
    // when nr is a multiple of 3, but not 5
    // We print "fizz", only.
    println("fizz")
} else if (nr % 5 == 0) {
    // when nr is a multiple of 5, but not 3
    // we print "buzz" only.
    println("buzz")
} else {
    // otherwise, we print the number.
    println(x)
}
```

- Start all comments (including KDoc) with a space after the first symbol (`//`, `/*`, `/**` and `*`)

**Valid example:**

```kotlin
val x = 0  // this is a comment
```

#### <a name="r2.4.2"></a> 2.4.2 Do not comment on unused code blocks

Do not comment on unused code blocks, including imports. Delete these code blocks immediately.
A code is not used to store history. Git, svn, or other VCS tools should be used for this purpose.
Unused imports increase the coupling of the code and are not conducive to maintenance. The commented out code cannot be appropriately maintained.
In an attempt to reuse the code, there is a high probability that you will introduce defects that are easily missed.
The correct approach is to delete the unnecessary code directly and immediately when it is not used anymore.
If you need the code again, consider porting or rewriting it as changes could have occurred since you first commented on the code.

#### <a name="r2.4.3"></a>2.4.3 Code delivered to the client should not contain TODO/FIXME comments

The code officially delivered to the client typically should not contain TODO/FIXME comments.
`TODO` comments are typically used to describe modification points that need to be improved and added. For example, refactoring FIXME comments are typically used to describe known defects and bugs that will be subsequently fixed and are not critical for an application.
They should all have a unified style to facilitate unified text search processing.

**Example:**

```kotlin
// TODO(<author-name>): Jira-XXX - support new json format
// FIXME: Jira-XXX - fix NPE in this code block
```

At a version development stage, these annotations can be used to highlight the issues in the code, but all of them should be fixed before a new product version is released.
# <a name="c3"></a>3. General formatting (typesetting)
<!-- =============================================================================== -->
### <a name="c3.1"></a> 3.1 File-related rules
This section describes the rules related to using files in your code.
#### <a name="r3.1.1"></a> 3.1.1 Avoid files that are too long

If the file is too long and complicated, it should be split into smaller files, functions, or modules. Files should not exceed 2000 lines (non-empty and non-commented lines).
It is recommended to horizontally or vertically split the file according to responsibilities or hierarchy of its parts.
The only exception to this rule is code generation - the auto-generated files that are not manually modified can be longer.

#### <a name="r3.1.2"></a> 3.1.2 Code blocks in the source file should be separated by one blank line
A source file contains code blocks in the following order: copyright, package name, imports, and top-level classes. They should be separated by one blank line.

a) Code blocks should be in the following order:
1.	Kdoc for licensed or copyrighted files
2.	`@file` annotation
3.	Package name
4.	Import statements
5.	Top-class header and top-function header comments
6.	Top-level classes or functions

b) Each of the preceding code blocks should be separated by a blank line.

c) Import statements are alphabetically arranged, without using line breaks and wildcards ( wildcard imports - `*`).

d) **Recommendation**: One `.kt` source file should contain only one class declaration, and its name should match the filename

e) Avoid empty files that do not contain the code or contain only imports/comments/package name

f) Unused imports should be removed
#### <a name="r3.1.3"></a> 3.1.3 Import statements order

From top to bottom, the order is the following:
1. Android
2. Imports of packages used internally in your organization
3. Imports from other non-core dependencies
4. Java core packages
5. kotlin stdlib

Each category should be alphabetically arranged. Each group should be separated by a blank line. This style is compatible with  [Android import order](https://source.android.com/setup/contribute/code-style#order-import-statements).

**Valid example**:
```kotlin
import android.* // android
import androidx.* // android
import com.android.* // android

import com.your.company.* // your company's libs
import your.company.* // your company's libs

import com.fasterxml.jackson.databind.ObjectMapper // other third-party dependencies
import org.junit.jupiter.api.Assertions

import java.io.IOException // java core packages
import java.net.URL

import kotlin.system.exitProcess  // kotlin standard library
import kotlinx.coroutines.*  // official kotlin extension library
```

#### <a name="r3.1.4"></a> 3.1.4 Order of declaration parts of class-like code structures
The declaration parts of class-like code structures (class, interface, etc.) should be in the following order: compile-time constants (for objects), class properties, late-init class properties, init-blocks, constructors, public methods, internal methods, protected methods, private methods, and companion object. Blank lines should separate their declaration.
Notes:
1.	There should be no blank lines between properties with the following **exceptions**: when there is a comment before a property on a separate line or annotations on a separate line.
2.	Properties with comments/Kdoc should be separated by a newline before the comment/Kdoc.
3.	Enum entries and constant properties (`const val`) in companion objects should be alphabetically arranged.

The declaration part of a class or interface should be in the following order:
- Compile-time constants (for objects)
- Properties
- Late-init class properties
- Init-blocks
- Constructors
- Methods or nested classes. Put nested classes next to the code they are used by.
  If the classes are meant to be used externally, and are not referenced inside the class, put them after the companion object.
- Companion object

**Exception:**
All variants of a `private val` logger should be placed at the beginning of the class (`private val log`, `LOG`, `logger`, etc.).

#### <a name="r3.1.5"></a> 3.1.5 Order of declaration of top-level code structures
Kotlin allows several top-level declaration types: classes, objects, interfaces, properties and functions.
When declaring more than one class or zero classes (e.g. only functions), as per rule [2.2.1](#r2.2.1), you should document the whole file in the header KDoc.
When declaring top-level structures, keep the following order:
1. Top-level constants and properties (following same order as properties inside a class: `const val`,`val`, `lateinit var`, `var`)
2. typealiases (grouped by their visibility modifiers)
2. Interfaces, classes and objects (grouped by their visibility modifiers)
3. Extension functions
4. Other functions

**Note**:
Extension functions shouldn't have receivers declared in the same file according to [rule 6.2.3](#r6.2.3)

Valid example:
```kotlin
package com.saveourtool.diktat.example

const val CONSTANT = 42

val topLevelProperty = "String constant"

internal typealias ExamplesHandler = (IExample) -> Unit

interface IExample

class Example : IExample

private class Internal

fun Other.asExample(): Example { /* ... */ }

private fun Other.asInternal(): Internal { /* ... */ }

fun doStuff() { /* ... */ }
```

**Note**:
kotlin scripts (.kts) allow arbitrary code to be placed on the top level. When writing kotlin scripts, you should first declare all properties, classes
and functions. Only then you should execute functions on top level. It is still recommended wrapping logic inside functions and avoid using top-level statements
for function calls or wrapping blocks of code in top-level scope functions like `run`.

Example:
```kotlin
/* class declarations */
/* function declarations */
run {
    // call functions here
}
```

<!-- =============================================================================== -->
### <a name="c3.2"></a> 3.2 Braces
This section describes the general rules of using braces in your code.
#### <a name="r3.2.1"></a> 3.2.1 Using braces in conditional statements and loop blocks

Braces should always be used in `if`, `else`, `for`, `do`, and `while` statements, even if the program body is empty or contains only one statement. In special Kotlin `when` statements, you do not need to use braces for single-line statements.

**Valid example:**

```kotlin
when (node.elementType) {
    FILE -> {
        checkTopLevelDoc(node)
        checkSomething()
     }
    CLASS -> checkClassElements(node)
}
```
**Exception:** The only exception is ternary operator in Kotlin (a single line `if () <> else <>` )

**Invalid example:**

```kotlin
val value = if (string.isEmpty())  // WRONG!
                0
            else
                1
```

**Valid example**:

```kotlin
val value = if (string.isEmpty()) 0 else 1  // Okay
```

```kotlin
if (condition) {
    println("test")
} else {
    println(0)
}
```

#### <a name="r3.2.2"></a> 3.2.2  Opening braces are placed at the end of the line in *non-empty* blocks and block structures
For *non-empty* blocks and block structures, the opening brace is placed at the end of the line.
Follow the K&R style (1TBS or OTBS) for *non-empty* code blocks with braces:
- The opening brace and first line of the code block are on the same line.
- The closing brace is on its own new line.
- The closing brace can be followed by a newline character. The only exceptions are `else`, `finally`, and `while` (from `do-while` statement), or `catch` keywords.
  These keywords should not be split from the closing brace by a newline character.

**Exception cases**:

1) For lambdas, there is no need to put a newline character after the first (function-related) opening brace. A newline character should appear only after an arrow (`->`) (see [point 5 of Rule 3.6.2](#r3.6.2)).

```kotlin
arg.map { value ->
    foo(value)
}
```

2) for `else`/`catch`/`finally`/`while` (from `do-while` statement) keywords closing brace should stay on the same line:
 ```kotlin
do {
    if (true) {
        x++
    } else {
        x--
    }
} while (x > 0)
```

**Valid example:**

 ```kotlin
        return arg.map { value ->
            while (condition()) {
                method()
            }
            value
        }

        return MyClass() {
            @Override
              fun method() {
                if (condition()) {
                    try {
                        something()
                    } catch (e: ProblemException) {
                        recover()
                    }
                } else if (otherCondition()) {
                    somethingElse()
                } else {
                    lastThing()
                }
            }
        }
 ```

<!-- =============================================================================== -->
### <a name="c3.3"></a> 3.3 Indentation

Only spaces are permitted for indentation, and each indentation should equal `four spaces` (tabs are not permitted).
If you prefer using tabs, simply configure them to change to spaces in your IDE automatically.
These code blocks should be indented if they are placed on the new line, and the following conditions are met:
-	The code block is placed immediately after an opening brace.
-	The code block is placed after each operator, including the assignment operator (`+`/`-`/`&&`/`=`/etc.)
-	The code block is a call chain of methods:
```kotlin
someObject
    .map()
    .filter()
```
-  The code block is placed immediately after the opening parenthesis.
-  The code block is placed immediately after an arrow in lambda:

 ```kotlin
arg.map { value ->
    foo(value)
}
```

**Exceptions**:
1.	Argument lists: \
      a) Eight spaces are used to indent argument lists (both in declarations and at call sites). \
      b) Arguments in argument lists can be aligned if they are on different lines.

2.	Eight spaces are used if there is a newline after any binary operator.

3.	Eight spaces are used for functional-like styles when the newline is placed before the dot.

4.	Supertype lists: \
      a) Four spaces are used if the colon before the supertype list is on a new line. \
      b) Four spaces are used before each supertype, and eight spaces are used if the colon is on a new line.

**Note:** there should be an indentation after all statements such as `if`, `for`, etc. However, according to this code style, such statements require braces.

```kotlin
if (condition)
    foo()
```

**Exceptions**:
- When breaking the parameter list of a method/class constructor, it can be aligned with `8 spaces`. A parameter that was moved to a new line can be on the same level as the previous argument:

```kotlin
fun visit(
        node: ASTNode,
        autoCorrect: Boolean,
        params: KtLint.ExperimentalParams,
        emit: (offset: Int, errorMessage: String, canBeAutoCorrected: Boolean) -> Unit
) {
}
```

- Such operators as `+`/`-`/`*` can be indented with `8 spaces`:

```kotlin
val abcdef = "my splitted" +
                " string"
```

- Opening and closing quotes in multiline string should have same indentation

```kotlin
lintMethod(
            """
                    |val q = 1
                    |
            """.trimMargin()
    )
```

- A list of supertypes should be indented with `4 spaces` if they are on different lines or with `8 spaces` if the leading colon is also on a separate line

```kotlin
class A :
    B()

class A
    :
        B()
```

<!-- =============================================================================== -->
### <a name="c3.4"></a> 3.4 Empty blocks

Avoid empty blocks, and ensure braces start on a new line. An empty code block can be closed immediately on the same line and the next line. However, a newline is recommended between opening and closing braces `{}` (see the examples below.)

Generally, empty code blocks are prohibited; using them is considered a bad practice (especially for catch block).
They are appropriate for overridden functions, when the base class's functionality is not needed in the class-inheritor, for lambdas used as a function and for empty function in implementation of functional interface.
```kotlin
override fun foo() {
}
```

**Valid examples** (note once again that generally empty blocks are prohibited):

```kotlin
fun doNothing() {}

fun doNothingElse() {
}

fun foo(bar: () -> Unit = {})
```

**Invalid examples:**
```kotlin
try {
  doSomething()
} catch (e: Some) {}
```

Use the following valid code instead:
```kotlin
try {
   doSomething()
} catch (e: Some) {
}
```

<!-- =============================================================================== -->
### <a name="c3.5"></a> 3.5 Line length

Line length should be less than 120 symbols. Otherwise, it should be split.

If `complex property` initializing is too long, It should be split into priorities: \
1. Logic Binary Expression (&&  ||) \
2. Comparison Binary Expression (> < == >= <= !=) \
3. Other types (Arithmetical and Bit operation) (+ - * / % >> << *= += -= /= %= ++ -- ! in !in etc)

**Invalid example:**
```kotlin
val complexProperty = 1 + 2 + 3 + 4
```
**Valid example:**
```kotlin
val complexProperty = 1 + 2 +
    3 + 4
```

**Invalid example:**
```kotlin
val complexProperty = (1 + 2 + 3 > 0) && ( 23 * 4 > 10 * 6)
```
**Valid example:**
```kotlin
val complexProperty = (1 + 2 + 3 > 0) &&
    (23 * 4 > 10 * 6)
```

If long line should be split in `Elvis Operator` (?:), it`s done like this

**Invalid example:**
```kotlin
val value = first ?: second
```
**Valid example:**
```kotlin
val value = first
    ?: second
```

If long line in `Dot Qualified Expression` or `Safe Access Expression`, it`s done like this:

**Invalid example:**
```kotlin
val value = This.Is.Very.Long.Dot.Qualified.Expression
```
**Valid example:**
```kotlin
val value = This.Is.Very.Long
    .Dot.Qualified.Expression
```

**Invalid example:**
```kotlin
val value = This.Is?.Very?.Long?.Safe?.Access?.Expression
```
**Valid example:**
```kotlin
val value = This.Is?.Very?.Long
    ?.Safe?.Access?.Expression
```

if `value arguments list` is too long, it also should be split:

**Invalid example:**
```kotlin
val result1 = ManyParamInFunction(firstArgument, secondArgument, thirdArgument, fourthArgument, fifthArguments)
```
**Valid example:**
```kotlin
val result1 = ManyParamInFunction(firstArgument,
 secondArgument, thirdArgument, fourthArgument,
 fifthArguments)
```

If `annotation` is too long, it also should be split:

**Invalid example:**
```kotlin
@Query(value = "select * from table where age = 10", nativeQuery = true)
fun foo() {}
```
**Valid example:**
```kotlin
@Query(
    value = "select * from table where age = 10",
    nativeQuery = true)
fun foo() {}
```

Long one line `function` should be split:

**Invalid example:**
```kotlin
fun foo() = goo().write("TooLong")
```
**Valid example:**
```kotlin
fun foo() =
    goo().write("TooLong")
```

Long `binary expression` should be split into priorities: \
1. Logic Binary Expression (**&&**  **||**) \
2. Comparison Binary Expression (**>** **<** **==** **>=** **<=** **!=**) \
3. Other types (Arithmetical and Bit operation) (**+** **-** * **/** **%** **>>** **<<** **/*=** **+=** **-=** **/=** **%=** **++** **--** **!** **in** **!in** etc)

**Invalid example:**
```kotlin
if (( x >  100) || y < 100 && !isFoo()) {}
```

**Valid example:**
```kotlin
if (( x >  100) ||
    y < 100 && !isFoo()) {}
```

`String template` also can be split in white space in string text

**Invalid example:**
```kotlin
val nameString = "This is very long string template"
```

**Valid example:**
```kotlin
val nameString = "This is very long" +
        " string template"
```

Long `Lambda argument` should be split:

**Invalid example:**
```kotlin
val variable = a?.filter { it.elementType == true } ?: null
```

**Valid example:**
```kotlin
val variable = a?.filter {
    it.elementType == true
} ?: null
```

Long one line `When Entry` should be split:

**Invalid example:**
```kotlin
when(elem) {
    true -> long.argument.whenEntry
}
```
**Valid example:**
```kotlin
when(elem) {
    true -> {
        long.argument.whenEntry
    }
}
```

If the examples above do not fit, but the line needs to be split and this in `property`, this is fixed like thisЖ

**Invalid example:**
```kotlin
val element = veryLongNameFunction(firstParam)
```
**Valid example:**
```kotlin
val element =
    varyLongNameFunction(firstParam)
```

`Eol comment` also can be split, but it depends on comment location.
If this comment is on the same line with code it should be on line before:

**Invalid example:**
```kotlin
fun foo() {
    val name = "Nick" // this comment is too long
}
```
**Valid example:**
```kotlin
fun foo() {
    // this comment is too long
    val name = "Nick"
}
```

But if this comment is on new line - it should be split to several lines:

**Invalid example:**
```kotlin
// This comment is too long. It should be on two lines.
fun foo() {}
```

**Valid example:**
```kotlin
// This comment is too long.
// It should be on two lines.
fun foo() {}
```

The international code style prohibits `non-Latin` (`non-ASCII`) symbols. (See [Identifiers](#r1.1.1)) However, if you still intend on using them, follow
the following convention:

- One wide character occupies the width of two narrow characters.
  The "wide" and "narrow" parts of a character are defined by its [east Asian width Unicode attribute](https://unicode.org/reports/tr11/).
  Typically, narrow characters are also called "half-width" characters.
  All characters in the ASCII character set include letters (such as `a, A`), numbers (such as `0, 3`), and punctuation spaces (such as `,` , `{`), all of which are narrow characters.
  Wide characters are also called "full-width" characters. Chinese characters (such as `中, 文`), Chinese punctuation (`,` , `;` ), full-width letters and numbers (such as `A、3`) are "full-width" characters.
  Each one of these characters represents two narrow characters.

- Any line that exceeds this limit (`120 narrow symbols`) should be wrapped, as described in the [Newline section](#c3.5).

**Exceptions:**

1.	The long URL or long JSON method reference in KDoc.
2.	The `package` and `import` statements.
3.	The command line in the comment, enabling it to be cut and pasted into the shell for use.

<!-- =============================================================================== -->
### <a name="c3.6"></a> 3.6 Line breaks (newlines)
This section contains the rules and recommendations on using line breaks.
#### <a name="r3.6.1"></a> 3.6.1 Each line can have a maximum of one statement
Each line can have a maximum of one code statement. This recommendation prohibits the use of code with `;` because it decreases code visibility.

**Invalid example:**
```kotlin
val a = ""; val b = ""
```

**Valid example:**
```kotlin
val a = ""
val b = ""
```

#### <a name="r3.6.2"></a> 3.6.2 Rules for line-breaking

1) Unlike Java, Kotlin allows you not to put a semicolon (`;`) after each statement separated by a newline character.
   There should be no redundant semicolon at the end of the lines.

When a newline character is needed to split the line, it should be placed after such operators as `&&`/`||`/`+`/etc. and all infix functions (for example, `xor`).
However, the newline character should be placed before operators such as `.`, `?.`, `?:`, and `::`.

Note that all comparison operators, such as `==`, `>`, `<`, should not be split.

**Invalid example**:
```kotlin
     if (node !=
             null && test != null) {}
```

**Valid example**:
```kotlin
         if (node != null &&
                 test != null) {
         }
```

**Note:** You need to follow the functional style, meaning each function call in a chain with `.` should start at a new line if the chain of functions contains more than one call:
```kotlin
  val value = otherValue!!
          .map { x -> x }
          .filter {
              val a = true
              true
          }
          .size
```
**Note:** The parser prohibits the separation of the `!!` operator from the value it is checking.

**Exception**: If a functional chain is used inside the branches of a ternary operator, it does not need to be split with newlines.

**Valid example**:
```kotlin
if (condition) list.map { foo(it) }.filter { bar(it) } else list.drop(1)
```

**Note:** If dot qualified expression is inside condition or passed as an argument - it should be replaced with new variable.

**Invalid example**:
```kotlin
 if (node.treeParent.treeParent?.treeParent.findChildByType(IDENTIFIER) != null) {}
```

**Valid example**:
```kotlin
        val grandIdentifier = node
            .treeParent
            .treeParent
            ?.treeParent
            .findChildByType(IDENTIFIER)
        if (grandIdentifier != null) {}
```
**Second valid example**:
```kotlin
        val grandIdentifier = node.treeParent
            .treeParent
            ?.treeParent
            .findChildByType(IDENTIFIER)
        if (grandIdentifier != null) {}
```

2)	Newlines should be placed after the assignment operator (`=`).
3)	In function or class declarations, the name of a function or constructor should not be split by a newline from the opening brace `(`.
      A brace should be placed immediately after the name without any spaces in declarations or at call sites.
4)	Newlines should be placed right after the comma (`,`).
5)	If a lambda statement contains more than one line in its body, a newline should be placed after an arrow if the lambda statement has explicit parameters.
      If it uses an implicit parameter (`it`), the newline character should be placed after the opening brace (`{`).
      The following examples illustrate this rule:


**Invalid example:**
```kotlin
    value.map { name -> foo()
        bar()
    }
```

**Valid example:**
```kotlin
value.map { name ->
    foo()
    bar()
}

val someValue = { node:String -> node }
```

6) When the function contains only a single expression, it can be written as [expression function](https://kotlinlang.org/docs/reference/functions.html#single-expression-functions).
   The below example shows the style that should not be used.

Instead of:
```kotlin
override fun toString(): String { return "hi" }
```
use:
```kotlin
override fun toString() = "hi"
```

7)  If an argument list in a function declaration (including constructors) or function call contains more than two arguments, these arguments should be split by newlines in the following style.

**Valid example:**
 ```kotlin
class Foo(val a: String,
          b: String,
          val c: String) {
}

fun foo(
        a: String,
        b: String,
        c: String
) {

}
 ```

If and only if the first parameter is on the same line as an opening parenthesis, all parameters can be horizontally aligned by the first parameter.
Otherwise, there should be a line break after an opening parenthesis.

Kotlin 1.4 introduced a trailing comma as an optional feature, so it is generally recommended to place all parameters on a separate line
and append [trailing comma](https://kotlinlang.org/docs/reference/whatsnew14.html#trailing-comma).
It makes the resolving of merge conflicts easier.

**Valid example:**
 ```kotlin
fun foo(
        a: String,
        b: String,
) {

}
 ```

same should be done for function calls/constructor arguments/e.t.c

Kotlin supports trailing commas in the following cases:

Enumerations
Value arguments
Class properties and parameters
Function value parameters
Parameters with optional type (including setters)
Indexing suffix
Lambda parameters
when entry
Collection literals (in annotations)
Type arguments
Type parameters
Destructuring declarations

8) If the supertype list has more than two elements, they should be separated by newlines.

**Valid example:**
```kotlin
class MyFavouriteVeryLongClassHolder :
    MyLongHolder<MyFavouriteVeryLongClass>(),
    SomeOtherInterface,
    AndAnotherOne { }
```

<!-- =============================================================================== -->
### <a name="c3.7"></a> 3.7 Using blank lines

Reduce unnecessary blank lines and maintain a compact code size. By reducing unnecessary blank lines, you can display more code on one screen, which improves code readability.
- Blank lines should separate content based on relevance and should be placed between groups of fields, constructors, methods, nested classes, `init` blocks, and objects (see [3.1.2](#r3.1.2)).
- Do not use more than one line inside methods, type definitions, and initialization expressions.
- Generally, do not use more than two consecutive blank lines in a row.
- Do not put newlines in the beginning or end of code blocks with curly braces.

**Valid example:**
```kotlin
fun baz() {

    doSomething()  // No need to add blank lines at the beginning and end of the code block
    // ...

}
```

<!-- =============================================================================== -->
### <a name="c3.8"></a> 3.8 Horizontal space
This section describes general rules and recommendations for using spaces in the code.
#### <a name="r3.8.1"></a> 3.8.1: Usage of whitespace for code separation

Follow the recommendations below for using space to separate keywords:

**Note:** These recommendations are for cases where symbols are located on the same line. However, in some cases, a line break could be used instead of a space.

1.  Separate keywords (such as `if`, `when`, `for`) from the opening parenthesis with single whitespace.
    The only exception is the `constructor` keyword, which should not be separated from the opening parenthesis.

2.  Separate keywords like `else` or `try` from the opening brace (`{`) with single whitespace.
    If `else` is used in a ternary-style statement without braces, there should be a single space between `else` and the statement after: `if (condition) foo() else bar()`

3.  Use a **single** whitespace before all opening braces (`{`). The only exception is the passing of a lambda as a parameter inside parentheses:
 ```kotlin
     private fun foo(a: (Int) -> Int, b: Int) {}
     foo({x: Int -> x}, 5) // no space before '{'
 ```

4.  Single whitespace should be placed on both sides of binary operators. This also applies to operator-like symbols.
    For example:

- A colon in generic structures with the `where` keyword:  `where T : Type`
- Arrow in lambdas: `(str: String) -> str.length()`

**Exceptions:**

- Two colons (`::`) are written without spaces:\
  `Object::toString`
- The dot separator (`.`) that stays on the same line with an object name:\
  `object.toString()`
- Safe access modifiers `?.` and `!!` that stay on the same line with an object name:\
  `object?.toString()`
- Operator `..` for creating ranges:\
  `1..100`

5.  Use spaces after (`,`), (`:`), and (`;`), except when the symbol is at the end of the line.
    However, note that this code style prohibits the use of (`;`) in the middle of a line ([see 3.3.2](#r3.2.2)).
    There should be no whitespaces at the end of a line.
    The only scenario where there should be no space after a colon is when the colon is used in the annotation to specify a use-site target (for example, `@param:JsonProperty`).
    There should be no spaces before `,` , `:` and `;`.

    **Exceptions** for spaces and colons:

    - When `:` is used to separate a type and a supertype, including an anonymous object (after object keyword)
    - When delegating to a superclass constructor or different constructor of the same class

**Valid example:**
```kotlin
  abstract class Foo<out T : Any> : IFoo { }

  class FooImpl : Foo() {
      constructor(x: String) : this(x) { /*...*/ }

      val x = object : IFoo { /*...*/ }
  }
```

6. There should be *only one space* between the identifier and its type: `list: List<String>`
   If the type is nullable, there should be no space before `?`.

7. When using `[]` operator (`get/set`) there should be **no** spaces between identifier and `[` : `someList[0]`.

8. There should be no space between a method or constructor name (both at declaration and at call site) and a parenthesis:
   `foo() {}`. Note that this sub-rule is related only to spaces; the rules for whitespaces are described in [see 3.6.2](#r3.6.2).
   This rule does not prohibit, for example, the following code:
```kotlin
fun foo
(
    a: String
)
```

9. Never put a space after `(`, `[`, `<` (when used as a bracket in templates) or before `)`, `]`, `>` (when used as a bracket in templates).

10. There should be no spaces between a prefix/postfix operator (like `!!` or `++`) and its operand.

#### <a name="r3.8.2"></a> 3.8.2: No spaces for horizontal alignment

*Horizontal alignment* refers to aligning code blocks by adding space to the code. Horizontal alignment should not be used because:

- When modifying code, it takes much time for new developers to format, support, and fix alignment issues.
- Long identifier names will break the alignment and lead to less presentable code.
- There are more disadvantages than advantages in alignment. To reduce maintenance costs, misalignment (???) is the best choice.

Recommendation: Alignment only looks suitable for `enum class`, where it can be used in table format to improve code readability:
```kotlin
enum class Warnings(private val id: Int, private val canBeAutoCorrected: Boolean, private val warn: String) : Rule {
    PACKAGE_NAME_MISSING         (1, true,  "no package name declared in a file"),
    PACKAGE_NAME_INCORRECT_CASE  (2, true,  "package name should be completely in a lower case"),
    PACKAGE_NAME_INCORRECT_PREFIX(3, false, "package name should start from the company's domain")
    ;
}
```

**Valid example:**
 ```kotlin
 private val nr: Int // no alignment, but looks fine
 private var color: Color // no alignment
 ```

**Invalid example**:
 ```kotlin
 private val    nr: Int    // aligned comment with extra spaces
 private val color: Color  // alignment for a comment and alignment for identifier name
 ```

<!-- =============================================================================== -->
### <a name="c3.9"></a> 3.9 Enumerations
Enum values are separated by a comma and line break, with ';' placed on the new line.

1) The comma and line break characters separate enum values. Put `;` on the new line:
```kotlin
enum class Warnings {
    A,
    B,
    C,
    ;
}
```

This will help to resolve conflicts and reduce the number of conflicts during merging pull requests.
Also, use [trailing comma](https://kotlinlang.org/docs/reference/whatsnew14.html#trailing-comma).

2) If the enum is simple (no properties, methods, and comments inside), you can declare it in a single line:
```kotlin
enum class Suit { CLUBS, HEARTS, SPADES, DIAMONDS }
```

3) Enum classes take preference (if it is possible to use it). For example, instead of two boolean properties:

```kotlin
val isCelsius = true
val isFahrenheit = false
```

use enum class:

```kotlin
enum class TemperatureScale { CELSIUS, FAHRENHEIT }
```

- The variable value only changes within a fixed range and is defined with the enum type.
- Avoid comparison with magic numbers of `-1, 0, and 1`; use enums instead.

```kotlin
enum class ComparisonResult {
    ORDERED_ASCENDING,
    ORDERED_SAME,
    ORDERED_DESCENDING,
    ;
}
```

<!-- =============================================================================== -->
### <a name="c3.10"></a> 3.10 Variable declaration
This section describes rules for the declaration of variables.
#### <a name="r3.10.1"></a> 3.10.1 Declare one variable per line

Each property or variable must be declared on a separate line.

**Invalid example**:
```kotlin
val n1: Int; val n2: Int
```

#### <a name="r3.10.2"></a> 3.10.2 Variables should be declared near the line where they are first used
Declare local variables close to the point where they are first used to minimize their scope. This will also increase the readability of the code.
Local variables are usually initialized during their declaration or immediately after.
The member fields of the class should be declared collectively (see [Rule 3.1.2](#r3.1.2) for details on the class structure).

<!-- =============================================================================== -->
### <a name="c3.11"></a> 3.11 'When' expression

The `when` statement must have an 'else' branch unless the condition variable is enumerated or a sealed type.
Each `when` statement should contain an `else` statement group, even if it does not contain any code.

**Exception:** If 'when' statement of the `enum or sealed` type contains all enum values, there is no need to have an "else" branch.
The compiler can issue a warning when it is missing.

<!-- =============================================================================== -->
### <a name="c3.12"></a> 3.12 Annotations

Each annotation applied to a class, method or constructor should be placed on its own line. Consider the following examples:
1. Annotations applied to the class, method or constructor are placed on separate lines (one annotation per line).

**Valid example**:
```kotlin
@MustBeDocumented
@CustomAnnotation
fun getNameIfPresent() { /* ... */ }
```

2. A single annotation should be on the same line as the code it is annotating.

**Valid example**:
```kotlin
@CustomAnnotation class Foo {}
```

3. Multiple annotations applied to a field or property can appear on the same line as the corresponding field.

**Valid example**:
```kotlin
@MustBeDocumented @CustomAnnotation val loader: DataLoader
```

<!-- =============================================================================== -->
### <a name="c3.13"></a> 3.13 Block comments

Block comments should be placed at the same indentation level as the surrounding code. See examples below.

**Valid example**:

 ```kotlin
class SomeClass {
     /*
      * This is
      * okay
      */
      fun foo() {}
}
 ```

**Note**: Use `/*...*/` block comments to enable automatic formatting by IDEs.

<!-- =============================================================================== -->
### <a name="c3.14"></a> 3.14 Modifiers and constant values
This section contains recommendations regarding modifiers and constant values.
#### <a name="r3.14.1"></a> 3.14.1 Declaration with multiple modifiers
If a declaration has multiple modifiers, always follow the proper sequence.
**Valid sequence:**

```kotlin
public / internal / protected / private
expect / actual
final / open / abstract / sealed / const
external
override
lateinit
tailrec
crossinline
vararg
suspend
inner
out
enum / annotation
companion
inline / noinline
reified
infix
operator
data
```

#### <a name="r3.14.2"></a> 3.14.2: Separate long numerical values with an underscore
An underscore character should separate long numerical values.
**Note:** Using underscores simplifies reading and helps to find errors in numeric constants.
```kotlin
val oneMillion = 1_000_000
val creditCardNumber = 1234_5678_9012_3456L
val socialSecurityNumber = 999_99_9999L
val hexBytes = 0xFF_EC_DE_5E
val bytes = 0b11010010_01101001_10010100_10010010
```
#### <a name="r3.14.3"></a> 3.14.3: Magic number
Prefer defining constants with clear names describing what the magic number means.
**Valid example**:
```kotlin
class Person() {
    fun isAdult(age: Int): Boolean = age >= majority

    companion object {
        private const val majority = 18
    }
}
```
**Invalid example**:
```kotlin
class Person() {
    fun isAdult(age: Int): Boolean = age >= 18
}
```

<!-- =============================================================================== -->
### <a name="c3.15"></a> 3.15 Strings
This section describes the general rules of using strings.

#### <a name="r3.15.1"></a> 3.15.1 Concatenation of Strings
String concatenation is prohibited if the string can fit on one line. Use raw strings and string templates instead. Kotlin has significantly improved the use of Strings:
[String templates](https://kotlinlang.org/docs/reference/basic-types.html#string-templates), [Raw strings](https://kotlinlang.org/docs/reference/basic-types.html#string-literals).
Therefore, compared to using explicit concatenation, code looks much better when proper Kotlin strings are used for short lines, and you do not need to split them with newline characters.

**Invalid example**:
```kotlin
val myStr = "Super string"
val value = myStr + " concatenated"
```

**Valid example**:
```kotlin
val myStr = "Super string"
val value = "$myStr concatenated"
```

#### <a name="r3.15.2"></a> 3.15.2 String template format
**Redundant curly braces in string templates**

If there is only one variable in a string template, there is no need to use such a template. Use this variable directly.
**Invalid example**:
```kotlin
val someString = "${myArgument} ${myArgument.foo()}"
```

**Valid example**:
```kotlin
val someString = "$myArgument ${myArgument.foo()}"
```

**Redundant string template**

In case a string template contains only one variable - there is no need to use the string template. Use this variable directly.

**Invalid example**:
```kotlin
val someString = "$myArgument"
```

**Valid example**:
```kotlin
val someString = myArgument
```

<!-- =============================================================================== -->
### <a name="c3.16"></a> 3.16 Conditional Statements
This section describes the general rules related to the сonditional statements.

#### <a name="r3.16.1"></a> 3.16.1 Collapsing redundant nested if-statements
The nested if-statements, when possible, should be collapsed into a single one
by concatenating their conditions with the infix operator &&.

This improves the readability by reducing the number of the nested language constructs.

#### Simple collapse

**Invalid example**:
```kotlin
if (cond1) {
    if (cond2) {
        doSomething()
    }
}
```

**Valid example**:
```kotlin
if (cond1 && cond2) {
    doSomething()
}
```

#### Compound conditions

**Invalid example**:
```kotlin
if (cond1) {
    if (cond2 || cond3) {
        doSomething()
    }
}
```

**Valid example**:
```kotlin
if (cond1 && (cond2 || cond3)) {
    doSomething()
}
```
#### <a name="r3.16.2"></a> 3.16.2 Too complex conditions
Too complex conditions should be simplified according to boolean algebra rules, if it is possible.
The following rules are considered when simplifying an expression:
* boolean literals are removed (e.g. `foo() || false` -> `foo()`)
* double negation is removed (e.g. `!(!a)` -> `a`)
* expression with the same variable are simplified (e.g. `a && b && a` -> `a && b`)
* remove expression from disjunction, if they are subset of other expression (e.g. `a || (a && b)` -> `a`)
* remove expression from conjunction, if they are more broad than other expression (e.g. `a && (a || b)` -> `a`)
* de Morgan's rule (negation is moved inside parentheses, i.e. `!(a || b)` -> `!a && !b`)

**Valid example**
```kotlin
if (condition1 && condition2) {
    foo()
}
```

**Invalid example**
```kotlin
if (condition1 && condition2 && condition1) {
    foo()
}
```
# <a name="c4"></a> 4. Variables and types
This section is dedicated to the rules and recommendations for using variables and types in your code.
<!-- =============================================================================== -->
### <a name="c4.1"></a> 4.1 Variables
The rules of using variables are explained in the below topics.
#### <a name="r4.1.1"></a> 4.1.1 Do not use Float and Double types when accurate calculations are needed
Floating-point numbers provide a good approximation over a wide range of values, but they cannot produce accurate results in some cases.
Binary floating-point numbers are unsuitable for precise calculations because it is impossible to represent 0.1 or any other negative power of 10 in a `binary representation` with a finite length.

The following code example seems to be obvious:
```kotlin
    val myValue = 2.0 - 1.1
    println(myValue)
```

However, it will print the following value: `0.8999999999999999`

Therefore, for precise calculations (for example, in finance or exact sciences), using such types as `Int`, `Long`, `BigDecimal`are recommended.
The `BigDecimal` type should serve as a good choice.

**Invalid example**:
Float values containing more than six or seven decimal numbers will be rounded.
 ```kotlin
 val eFloat = 2.7182818284f // Float, will be rounded to 2.7182817
 ```

**Valid example**: (when precise calculations are needed):
 ```kotlin
    val income = BigDecimal("2.0")
    val expense = BigDecimal("1.1")
    println(income.subtract(expense)) // you will obtain 0.9 here
 ```

#### <a name="r4.1.2"></a> 4.1.2: Comparing numeric float type values
Numeric float type values should not be directly compared with the equality operator (==) or other methods, such as `compareTo()` and `equals()`. Since floating-point numbers involve precision problems in computer representation, it is better to use `BigDecimal` as recommended in [Rule 4.1.1](#r4.1.1) to make accurate computations and comparisons. The following code describes these problems.

**Invalid example**:
 ```kotlin
val f1 = 1.0f - 0.9f
val f2 = 0.9f - 0.8f
if (f1 == f2) {
    println("Expected to enter here")
} else {
    println("But this block will be reached")
}

val flt1 = f1;
val flt2 = f2;
if (flt1.equals(flt2)) {
    println("Expected to enter here")
} else {
    println("But this block will be reached")
}
 ```

**Valid example**:

```kotlin
val foo = 1.03f
val bar = 0.42f
if (abs(foo - bar) > 1e-6f) {
    println("Ok")
} else {
    println("Not")
}
```

#### <a name="r4.1.3"></a> 4.1.3 Try to use 'val' instead of 'var' for variable declaration [SAY_NO_TO_VAR]

Variables with the `val` modifier are immutable (read-only).
Using `val` variables instead of `var` variables increases code robustness and readability.
This is because `var` variables can be reassigned several times in the business logic.
However, in some scenarios with loops or accumulators, only `var`s are permitted.

<!-- =============================================================================== -->
### <a name="c4.2"></a> 4.2 Types
This section provides recommendations for using types.
#### <a name="r4.2.1"></a> 4.2.1: Use Contracts and smart cast as much as possible

The Kotlin compiler has introduced [Smart Casts](https://kotlinlang.org/docs/reference/typecasts.html#smart-casts) that help reduce the size of code.

**Invalid example**:
```kotlin
    if (x is String) {
        print((x as String).length) // x was already automatically cast to String - no need to use 'as' keyword here
    }
```

**Valid example**:
```kotlin
    if (x is String) {
        print(x.length) // x was already automatically cast to String - no need to use 'as' keyword here
    }
```

Also, Kotlin 1.3 introduced [Contracts](https://kotlinlang.org/docs/reference/whatsnew13.html#contracts) that provide enhanced logic for smart-cast.
Contracts are used and are very stable in `stdlib`, for example:


```kotlin
fun bar(x: String?) {
    if (!x.isNullOrEmpty()) {
        println("length of '$x' is ${x.length}") // smartcasted to not-null
    }
}
```

Smart cast and contracts are a better choice because they reduce boilerplate code and features forced type conversion.

**Invalid example**:
```kotlin
fun String?.isNotNull(): Boolean = this != null

fun foo(s: String?) {
    if (s.isNotNull()) s!!.length // No smartcast here and !! operator is used
}
```

**Valid example**:
```kotlin
fun foo(s: String?) {
    if (s.isNotNull()) s.length // We have used a method with contract from stdlib that helped compiler to execute smart cast
}
```

#### <a name="r4.2.2"></a> 4.2.2: Try to use type alias to represent types making code more readable

Type aliases provide alternative names for existing types.
If the type name is too long, you can replace it with a shorter name, which helps to shorten long generic types.
For example, code looks much more readable if you introduce a `typealias` instead of a long chain of nested generic types.
We recommend using a `typealias` if the type contains **more than two** nested generic types and is longer than **25 chars**.

**Invalid example**:
```kotlin
val b: MutableMap<String, MutableList<String>>
```

**Valid example**:
```kotlin
typealias FileTable = MutableMap<String, MutableList<String>>
val b: FileTable
```

You can also provide additional aliases for function (lambda-like) types:
```kotlin
typealias MyHandler = (Int, String, Any) -> Unit

typealias Predicate<T> = (T) -> Boolean
```

<!-- =============================================================================== -->
### <a name="c4.3"></a> 4.3 Null safety and variable declarations
Kotlin is declared as a null-safe programming language. However, to achieve compatibility with Java, it still supports nullable types.

#### <a name="r4.3.1"></a> 4.3.1: Avoid declaring variables with nullable types, especially from Kotlin stdlib
To avoid `NullPointerException` and help the compiler prevent Null Pointer Exceptions, avoid using nullable types (with `?` symbol).

**Invalid example**:
```kotlin
val a: Int? = 0
```

**Valid example**:
```kotlin
val a: Int = 0
```

Nevertheless, when using Java libraries extensively, you have to use nullable types and enrich the code with `!!` and `?` symbols.
Avoid using nullable types for Kotlin stdlib (declared in [official documentation](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/)).
Try to use initializers for empty collections. For example, if you want to initialize a list instead of `null`, use `emptyList()`.

**Invalid example**:
```kotlin
val a: List<Int>? = null
```

**Valid example**:
```kotlin
val a: List<Int> = emptyList()
```

#### <a name="r4.3.2"></a> 4.3.2: Variables of generic types should have an explicit type declaration
Like in Java, classes in Kotlin may have type parameters. To create an instance of such a class, we typically need to provide type arguments:

```kotlin
val myVariable: Map<Int, String> = emptyMap<Int, String>()
```

However, the compiler can inherit type parameters from the r-value (value assigned to a variable). Therefore, it will not force users to declare the type explicitly.
These declarations are not recommended because programmers would need to find the return value and understand the variable type by looking at the method.

**Invalid example**:
```kotlin
val myVariable = emptyMap<Int, String>()
```

**Valid example**:
```kotlin
val myVariable: Map<Int, String> = emptyMap()
```

#### <a name="r4.3.3"></a> 4.3.3 Null-safety

Try to avoid explicit null checks (explicit comparison with `null`)
Kotlin is declared as [Null-safe](https://kotlinlang.org/docs/reference/null-safety.html) language.
However, Kotlin architects wanted Kotlin to be fully compatible with Java; that's why the `null` keyword was also introduced in Kotlin.

There are several code-structures that can be used in Kotlin to avoid null-checks. For example: `?:`,  `.let {}`, `.also {}`, e.t.c

**Invalid example:**
```kotlin
// example 1
var myVar: Int? = null
if (myVar == null) {
    println("null")
    return
}

// example 2
if (myVar != null) {
    println("not null")
    return
}

// example 3
val anotherVal = if (myVar != null) {
                     println("not null")
                     1
                 } else {
                     2
                 }
// example 4
if (myVar == null) {
    println("null")
} else {
    println("not null")
}
```

**Valid example:**
```kotlin
// example 1
var myVar: Int? = null
myVar?: run {
    println("null")
    return
}

// example 2
myVar?.let {
    println("not null")
    return
}

// example 3
val anotherVal = myVar?.also {
                     println("not null")
                     1
                 } ?: 2

// example 4
myVar?.let {
    println("not null")
} ?: run { println("null") }
```

**Exceptions:**

In the case of complex expressions, such as multiple `else-if` structures or long conditional statements, there is common sense to use explicit comparison with `null`.

**Valid examples:**

```kotlin
if (myVar != null) {
    println("not null")
} else if (anotherCondition) {
    println("Other condition")
}
```

```kotlin
if (myVar == null || otherValue == 5 && isValid) {}
```

Please also note, that instead of using `require(a != null)` with a not null check - you should use a special Kotlin function called `requireNotNull(a)`.

# <a name="c5"></a> 5. Functions
This section describes the rules of using functions in your code.
<!-- =============================================================================== -->
### <a name="c5.1"></a> 5.1 Function design
Developers can write clean code by gaining knowledge of how to build design patterns and avoid code smells.
You should utilize this approach, along with functional style, when writing Kotlin code.
The concepts behind functional style are as follows:
Functions are the smallest unit of combinable and reusable code.
They should have clean logic, **high cohesion**, and **low coupling** to organize the code effectively.
The code in functions should be simple and not conceal the author's original intentions.

Additionally, it should have a clean abstraction, and control statements should be used straightforwardly.
The side effects (code that does not affect a function's return value but affects global/object instance variables) should not be used for state changes of an object.
The only exceptions to this are state machines.

Kotlin is [designed](https://www.slideshare.net/abreslav/whos-more-functional-kotlin-groovy-scala-or-java) to support and encourage functional programming, featuring the corresponding built-in mechanisms.
Also, it supports standard collections and sequences feature methods that enable functional programming (for example, `apply`, `with`, `let`, and `run`), Kotlin Higher-Order functions, function types, lambdas, and default function arguments.
As [previously discussed](#r4.1.3), Kotlin supports and encourages the use of immutable types, which in turn motivates programmers to write pure functions that avoid side effects and have a corresponding output for specific input.
The pipeline data flow for the pure function comprises a functional paradigm. It is easy to implement concurrent programming when you have chains of function calls, where each step features the following characteristics:
1.	Simplicity
2.	Verifiability
3.	Testability
4.	Replaceability
5.	Pluggability
6.	Extensibility
7.	Immutable results

There can be only one side effect in this data stream, which can be placed only at the end of the execution queue.

#### <a name="r5.1.1"></a> 5.1.1 Avoid functions that are too long

The function should be displayable on one screen and only implement one certain logic.
If a function is too long, it often means complex and could be split or simplified. Functions should consist of 30 lines (non-empty and non-comment) in total.

**Exception:** Some functions that implement complex algorithms may exceed 30 lines due to aggregation and comprehensiveness.
Linter warnings for such functions **can be suppressed**.

Even if a long function works well, new problems or bugs may appear due to the function's complex logic once it is modified by someone else.
Therefore, it is recommended to split such functions into several separate and shorter functions that are easier to manage.
This approach will enable other programmers to read and modify the code properly.
#### <a name="r5.1.2"></a> 5.1.2 Avoid deep nesting of function code blocks, limiting to four levels

The nesting depth of a function's code block is the depth of mutual inclusion between the code control blocks in the function (for example: if, for, while, and when).
Each nesting level will increase the amount of effort needed to read the code because you need to remember the current "stack" (for example, entering conditional statements and loops).
**Exception:** The nesting levels of the lambda expressions, local classes, and anonymous classes in functions are calculated based on the innermost function. The nesting levels of enclosing methods are not accumulated.
Functional decomposition should be implemented to avoid confusion for the developer who reads the code.
This will help the reader switch between contexts.

#### <a name="r5.1.3"></a> 5.1.3 Avoid using nested functions
Nested functions create a more complex function context, thereby confusing readers.
With nested functions, the visibility context may not be evident to the code reader.

**Invalid example**:
```kotlin
fun foo() {
    fun nested():String {
        return "String from nested function"
    }
    println("Nested Output: ${nested()}")
}
```
#### <a name="r5.1.4"></a> 5.1.4 Negated function calls
Don't use negated function calls if it can be replaced with negated version of this function

**Invalid example**:
```kotlin
fun foo() {
    val list = listOf(1, 2, 3)

    if (!list.isEmpty()) {
        // Some cool logic
    }
}
```

**Valid example**:
```kotlin
fun foo() {
    val list = listOf(1, 2, 3)

    if (list.isNotEmpty()) {
        // Some cool logic
    }
}
```

<!-- =============================================================================== -->
### <a name="c5.2"></a> 5.2 Function arguments
The rules for using function arguments are described in the below topics.
#### <a name="r5.2.1"></a> 5.2.1 The lambda parameter of the function should be placed at the end of the argument list

With such notation, it is easier to use curly brackets, leading to better code readability.

**Valid example**:
```kotlin
// declaration
fun myFoo(someArg: Int, myLambda: () -> Unit) {
// ...
}

// usage
myFoo(1) {
println("hey")
}
```

#### <a name="r5.2.2"></a> 5.2.2 Number of function parameters should be limited to five

A long argument list is a [code smell](https://en.wikipedia.org/wiki/Code_smell) that leads to less reliable code.
It is recommended to reduce the number of parameters. Having **more than five** parameters leads to difficulties in maintenance and conflicts merging.
If parameter groups appear in different functions multiple times, these parameters are closely related and can be encapsulated into a single Data Class.
It is recommended that you use Data Classes and Maps to unify these function arguments.

#### <a name="r5.2.3"></a> 5.2.3 Use default values for function arguments instead of overloading them
In Java, default values for function arguments are prohibited. That is why the function should be overloaded when you need to create a function with fewer arguments.
In Kotlin, you can use default arguments instead.

**Invalid example**:
```kotlin
private fun foo(arg: Int) {
    // ...
}

private fun foo() {
    // ...
}
```

**Valid example**:
```kotlin
 private fun foo(arg: Int = 0) {
     // ...
 }
```
#### <a name="r5.2.4"></a> 5.2.4 Synchronizing code inside asynchronous code
Try to avoid using `runBlocking` in asynchronous code

**Invalid example**:
```kotlin
GlobalScope.async {
    runBlocking {
        count++
    }
}
```
#### <a name="r5.2.5"></a> 5.2.5 Long lambdas should have explicit parameters
The lambda without parameters shouldn't be too long.
If a lambda is too long, it can confuse the user. Lambda without parameters should consist of 10 lines (non-empty and non-comment) in total.

#### <a name="r5.2.6"></a> 5.2.6 Avoid using unnecessary, custom label
Expressions with unnecessary, custom labels generally increase complexity and worsen the maintainability of the code.

**Invalid example**:
```kotlin
run lab@ {
    list.forEach {
        return@lab
    }
}
```

**Valid example**:
```kotlin
list.forEachIndexed { index, i ->
    return@forEachIndexed
}

lab@ for(i: Int in q) {
    for (j: Int in q) {
        println(i)
        break@lab
    }
}
```
# <a name="c6"></a> 6. Classes, interfaces, and extension functions
<!-- =============================================================================== -->
### <a name="c6.1"></a> 6.1 Classes
This section describes the rules of denoting classes in your code.
#### <a name="r6.1.1"></a> 6.1.1  Denoting a class with a single constructor
When a class has a single constructor, it should be defined as a primary constructor in the declaration of the class. If the class contains only one explicit constructor, it should be converted to a primary constructor.

**Invalid example**:
```kotlin
class Test {
    var a: Int
    constructor(a: Int) {
        this.a = a
    }
}
```

**Valid example**:
```kotlin
class Test(var a: Int) {
    // ...
}

// in case of any annotations or modifiers used on a constructor:
class Test private constructor(var a: Int) {
    // ...
}
```

#### <a name="r6.1.2"></a> 6.1.2 Prefer data classes instead of classes without any functional logic
Some people say that the data class is a code smell. However, if you need to use it (which makes your code more simple), you can utilize the Kotlin `data class`. The main purpose of this class is to hold data,
but also `data class` will automatically generate several useful methods:
- equals()/hashCode() pair;
- toString()
- componentN() functions corresponding to the properties in their order of declaration;
- copy() function

Therefore, instead of using `normal` classes:

```kotlin
class Test {
    var a: Int = 0
        get() = field
        set(value: Int) { field = value}
}

class Test {
    var a: Int = 0
    var b: Int = 0

    constructor(a:Int, b: Int) {
        this.a = a
        this.b = b
    }
}

// or
class Test(var a: Int = 0, var b: Int = 0)

// or
class Test() {
    var a: Int = 0
    var b: Int = 0
}
```

**prefer data classes:**
```kotlin
data class Test1(var a: Int = 0, var b: Int = 0)
```

**Exception 1**: Note that data classes cannot be abstract, open, sealed, or inner; that is why these types of classes cannot be changed to a data class.

**Exception 2**: No need to convert a class to a data class if this class extends some other class or implements an interface.

#### <a name="r6.1.3"></a> 6.1.3 Do not use the primary constructor if it is empty or useless
The primary constructor is a part of the class header; it is placed after the class name and type parameters (optional) but can be omitted if it is not used.

**Invalid example**:
```kotlin
// simple case that does not need a primary constructor
class Test() {
    var a: Int = 0
    var b: Int = 0
}

// empty primary constructor is not needed here
// it can be replaced with a primary contructor with one argument or removed
class Test() {
    var a  = "Property"

    init {
        println("some init")
    }

    constructor(a: String): this() {
        this.a = a
    }
}
```

**Valid example**:
```kotlin
// the good example here is a data class; this example also shows that you should get rid of braces for the primary constructor
class Test {
    var a: Int = 0
    var b: Int = 0
}
```

#### <a name="r6.1.4"></a> 6.1.4 Do not use redundant init blocks in your class
Several init blocks are redundant and generally should not be used in your class. The primary constructor cannot contain any code. That is why Kotlin has introduced `init` blocks.
These blocks store the code to be run during the class initialization.
Kotlin allows writing multiple initialization blocks executed in the same order as they appear in the class body.
Even when you follow (rule 3.2)[#r3.2], this makes your code less readable as the programmer needs to keep in mind all init blocks and trace the execution of the code.
Therefore, you should try to use a single `init` block to reduce the code's complexity. If you need to do some logging or make some calculations before the class property assignment, you can use powerful functional programming. This will reduce the possibility of the error if your `init` blocks' order is accidentally changed and
make the code logic more coupled. It is always enough to use one `init` block to implement your idea in Kotlin.

**Invalid example**:
```kotlin
class YourClass(var name: String) {
    init {
        println("First initializer block that prints ${name}")
    }

    val property = "Property: ${name.length}".also(::println)

    init {
        println("Second initializer block that prints ${name.length}")
    }
}
```

**Valid example**:
```kotlin
class YourClass(var name: String) {
    init {
        println("First initializer block that prints ${name}")
    }

    val property = "Property: ${name.length}".also { prop ->
        println(prop)
        println("Second initializer block that prints ${name.length}")
    }
}
```

The `init` block was not added to Kotlin to help you initialize your properties; it is needed for more complex tasks.
Therefore if the `init` block contains only assignments of variables - move it directly to properties to be correctly initialized near the declaration.
In some cases, this rule can be in clash with [6.1.1](#r6.1.1), but that should not stop you.

**Invalid example**:
```kotlin
class A(baseUrl: String) {
    private val customUrl: String
    init {
        customUrl = "$baseUrl/myUrl"
    }
}
```

**Valid example**:
```kotlin
class A(baseUrl: String) {
    private val customUrl = "$baseUrl/myUrl"
}
```

#### <a name="r6.1.5"></a> 6.1.5 Explicit supertype qualification
The explicit supertype qualification should not be used if there is no clash between called methods. This rule is applicable to both interfaces and classes.

**Invalid example**:
```kotlin
open class Rectangle {
    open fun draw() { /* ... */ }
}

class Square() : Rectangle() {
    override fun draw() {
        super<Rectangle>.draw() // no need in super<Rectangle> here
    }
}
```

#### <a name="r6.1.6"></a> 6.1.6 Abstract class should have at least one abstract method
Abstract classes are used to force a developer to implement some of its parts in their inheritors.
When the abstract class has no abstract methods, it was set `abstract` incorrectly and can be converted to a regular class.

**Invalid example**:
```kotlin
abstract class NotAbstract {
    fun foo() {}

    fun test() {}
}
```

**Valid example**:
```kotlin
abstract class NotAbstract {
    abstract fun foo()

    fun test() {}
}

// OR
class NotAbstract {
    fun foo() {}

    fun test() {}
}
```


#### <a name="r6.1.7"></a> 6.1.7 When using the "implicit backing property" scheme, the name of real and back property should be the same
Kotlin has a mechanism of [backing properties](https://kotlinlang.org/docs/reference/properties.html#backing-properties).
In some cases, implicit backing is not enough and it should be done explicitly:
```kotlin
private var _table: Map<String, Int>? = null
val table: Map<String, Int>
    get() {
        if (_table == null) {
            _table = HashMap() // Type parameters are inferred
        }
        return _table ?: throw AssertionError("Set to null by another thread")
    }
```

In this case, the name of the backing property (`_table`) should be the same as the name of the real property (`table`) but should have an underscore (`_`) prefix.
It is one of the exceptions from the [identifier names rule](#r1.2)

#### <a name="r6.1.8"></a> 6.1.8 Avoid using custom getters and setters
Kotlin has a perfect mechanism of [properties](https://kotlinlang.org/docs/reference/properties.html#properties-and-fields).
Kotlin compiler automatically generates `get` and `set` methods for properties and can override them.

**Invalid example:**
```kotlin
class A {
    var size: Int = 0
        set(value) {
            println("Side effect")
            field = value
        }
        // user of this class does not expect calling A.size receive size * 2
        get() = field * 2
}
```

From the callee code, these methods look like access to this property: `A().isEmpty = true` for setter and `A().isEmpty` for getter.

However, when `get` and `set` are overridden, it  isn't very clear for a developer who uses this particular class.
The developer expects to get the property value but receives some unknown value and some extra side-effect hidden by the custom getter/setter.
Use extra functions instead to avoid confusion.



**Valid example**:
```kotlin
class A {
    var size: Int = 0
    fun initSize(value: Int) {
        // some custom logic
    }

    // this will not confuse developer and he will get exactly what he expects
    fun goodNameThatDescribesThisGetter() = this.size * 2
}
```

**Exception:** `Private setters` are only exceptions that are not prohibited by this rule.

#### <a name="r6.1.9"></a> 6.1.9 Never use the name of a variable in the custom getter or setter (possible_bug)
If you ignored [recommendation 6.1.8](#r6.1.8), be careful with using the name of the property in your custom getter/setter
as it can accidentally cause a recursive call and a `StackOverflow Error`. Use the `field` keyword instead.

**Invalid example (very bad)**:
```kotlin
var isEmpty: Boolean
    set(value) {
        println("Side effect")
        isEmpty = value
    }
    get() = isEmpty
```

#### <a name="r6.1.10"></a> 6.1.10 No trivial getters and setters are allowed in the code
In Java, trivial getters - are the getters that are just returning the field value.
Trivial setters - are merely setting the field with a value without any transformation.
However, in Kotlin, trivial getters/setters are generated by default. There is no need to use it explicitly for all types of data structures in Kotlin.

**Invalid example**:
```kotlin
class A {
    var a: Int = 0
    get() = field
    set(value: Int) { field = value }

    //
}
```

**Valid example**:
```kotlin
class A {
    var a: Int = 0
    get() = field
    set(value: Int) { field = value }

    //
}
```

#### <a name="r6.1.11"></a> 6.1.11 Use 'apply' for grouping object initialization
In Java, before functional programming became popular, many classes from common libraries used the configuration paradigm.
To use these classes, you had to create an object with the constructor with 0-2 arguments and set the fields needed to run the object.
In Kotlin, to reduce the number of dummy code line and to group objects [`apply` extension](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/apply.html) was added:

**Invalid example**:
```kotlin
class HttpClient(var name: String) {
    var url: String = ""
    var port: String = ""
    var timeout = 0

    fun doRequest() {}
}

fun main() {
    val httpClient = HttpClient("myConnection")
    httpClient.url = "http://example.com"
    httpClient.port = "8080"
    httpClient.timeout = 100

    httpCLient.doRequest()
}

```

**Valid example**:
```kotlin
class HttpClient(var name: String) {
    var url: String = ""
    var port: String = ""
    var timeout = 0

    fun doRequest() {}
}

fun main() {
    val httpClient = HttpClient("myConnection")
            .apply {
                url = "http://example.com"
                port = "8080"
                timeout = 100
            }
    httpClient.doRequest()
}
```

### <a name="r6.1.12"></a> 6.1.12 Prefer Inline classes when a class has a single property
If a class has only one immutable property, then it can be converted to the inline class.

Sometimes it is necessary for business logic to create a wrapper around some type. However, it introduces runtime overhead due to additional heap allocations. Moreover, if the wrapped type is primitive, the performance hit is terrible, because primitive types are usually heavily optimized by the runtime, while their wrappers don't get any special treatment.

**Invalid example**:
```kotlin
class Password {
    val value: String
}
```

**Valid example**:
```kotlin
inline class Password(val value: String)
```

<!-- =============================================================================== -->
### <a name="c6.2"></a>6.2 Extension functions
This section describes the rules of using extension functions in your code.

[Extension functions](https://kotlinlang.org/docs/reference/extensions.html) is a killer-feature in Kotlin.
It gives you a chance to extend classes that were already implemented in external libraries and helps you to make classes less heavy.
Extension functions are resolved statically.

#### <a name="r6.2.1"></a> 6.2.1 Use extension functions for making logic of classes less coupled
It is recommended that for classes, the non-tightly coupled functions, which are rarely used in the class, should be implemented as extension functions where possible.
They should be implemented in the same class/file where they are used. This is a non-deterministic rule, so the code cannot be checked or fixed automatically by a static analyzer.

#### <a name="r6.2.2"></a> 6.2.2 No extension functions with the same name and signature if they extend base and inheritor classes (possible_bug)
You should avoid declaring extension functions with the same name and signature if their receivers are base and inheritor classes (possible_bug),
as extension functions are resolved statically. There could be a situation when a developer implements two extension functions: one is for the base class and
another for the inheritor. This can lead to an issue when an incorrect method is used.

**Invalid example**:
```kotlin
open class A
class B: A()

// two extension functions with the same signature
fun A.foo() = "A"
fun B.foo() = "B"

fun printClassName(s: A) { println(s.foo()) }

// this call will run foo() method from the base class A, but
// programmer can expect to run foo() from the class inheritor B
fun main() { printClassName(B()) }
```

#### <a name="r6.2.3"></a> 6.2.3 Don't use extension functions for the class in the same file
You should not use extension functions for the class in the same file, where it is defined.

**Invalid example**:
```kotlin
class SomeClass {

}

fun SomeClass.deleteAllSpaces() {

}
```

#### <a name="r6.2.4"></a> 6.2.4 Use 'lastIndex' in case you need to get latest element of a collection
You should not use property length with operation - 1, you can change this to lastIndex

**Invalid example**:
```kotlin
val A = "name"
val B = A.length - 1
val C = A[A.length - 1]
```

**Valid example**:
```kotlin
val A = "name"
val B = A.lastIndex
val C = A[A.lastIndex]
```



<!-- =============================================================================== -->
### <a name="c6.3"></a> 6.3 Interfaces
An `Interface` in Kotlin can contain declarations of abstract methods, as well as method implementations. What makes them different from abstract classes is that interfaces cannot store state.
They can have properties, but these need to be abstract or to provide accessor implementations.

Kotlin's interfaces can define attributes and functions.
In Kotlin and Java, the interface is the main presentation means of application programming interface (API) design and should take precedence over the use of (abstract) classes.

<!-- =============================================================================== -->
### <a name="c6.4"></a> 6.4 Objects
This section describes the rules of using objects in code.
#### <a name="r6.4.1"></a> 6.4.1 Instead of using utility classes/objects, use extensions
Avoid using utility classes/objects; use extensions instead. As described in [6.2 Extension functions](#c6.2), using extension functions is a powerful method.
This enables you to avoid unnecessary complexity and class/object wrapping and use top-level functions instead.

**Invalid example**:
```kotlin
object StringUtil {
    fun stringInfo(myString: String): Int {
        return myString.count{ "something".contains(it) }
    }
}
StringUtil.stringInfo("myStr")
```

**Valid example**:
```kotlin
fun String.stringInfo(): Int {
    return this.count{ "something".contains(it) }
}

"myStr".stringInfo()
```

#### <a name="r6.4.2"></a> 6.4.2 Objects should be used for Stateless Interfaces
Kotlin’s objects are extremely useful when you need to implement some interface from an external library that does not have any state.
There is no need to use classes for such structures.

**Valid example**:
```
interface I {
    fun foo()
}

object O: I {
    override fun foo() {}
}
```
### <a name="c6.5"></a> 6.5 Kts Files
This section describes general rules for `.kts` files
#### <a name="r6.5.1"></a> 6.5.1 kts files should wrap logic into top-level scope
It is still recommended wrapping logic inside functions and avoid using top-level statements for function calls or wrapping blocks of code
in top-level scope functions like `run`.

**Valid example**:
```
run {
    // some code
}

fun foo() {

}
```


================================================
FILE: RELEASING.md
================================================
# How to release a new version of diKTat

* You should have permissions to push to the main repo
* Simply create a new git tag with format `v*` and push it. Github workflow will perform release automatically.
  
  For example:
  ```bash
  $ git tag v1.0.0
  $ git push origin --tags 
  ```
  
After the release workflow has started, version number is determined from tag. Binaries are uploaded to maven repo and 
a new github release is created with fat jar.


================================================
FILE: _config.yml
================================================
theme: jekyll-theme-minimal

================================================
FILE: build.gradle.kts
================================================
import org.jetbrains.kotlin.incremental.createDirectory
import java.nio.file.Files
import java.nio.file.StandardCopyOption

@Suppress("DSL_SCOPE_VIOLATION", "RUN_IN_SCRIPT")  // https://github.com/gradle/gradle/issues/22797
plugins {
    id("com.saveourtool.diktat.buildutils.versioning-configuration")
    id("com.saveourtool.diktat.buildutils.git-hook-configuration")
    id("com.saveourtool.diktat.buildutils.code-quality-convention")
    id("com.saveourtool.diktat.buildutils.publishing-configuration")
    alias(libs.plugins.talaiot.base)
    java
    `maven-publish`
}

talaiot {
    metrics {
        // disabling due to problems with OSHI on some platforms
        performanceMetrics = false
        environmentMetrics = false
    }
    publishers {
        timelinePublisher = true
    }
}

project.description = "diKTat kotlin formatter and fixer"

val libsFileName = "libs.versions.toml"
val libsFile = rootProject.file("gradle/$libsFileName")
val libsFileBackup = rootProject.file("gradle/${libsFileName}_backup")

tasks.create("generateLibsForDiktatSnapshot") {
    val dir = rootProject.layout
        .buildDirectory
        .dir("diktat-snapshot")
        .get()
        .asFile

    val dependency = rootProject.project(":diktat-gradle-plugin")
    dependsOn(dependency.let { "${it.path}:publishToMavenLocal" })

    inputs.file(libsFile)
    inputs.files(dependency.pomFile())
    inputs.files(dependency.artifactFile())
    inputs.property("project-version", version.toString())
    outputs.dir(dir)

    doFirst {
        dir.deleteRecursively()
        dir.createDirectory()
    }
    doLast {
        Files.readAllLines(libsFile.toPath())
            .map { line ->
                when {
                    line.contains("diktat = ") -> "diktat = \"$version\""
                    else -> line
                }
            }
            .let {
                val libsFileForDiktatSnapshot = dir.resolve(libsFileName)
                Files.write(libsFileForDiktatSnapshot.toPath(), it)
                Files.move(libsFile.toPath(), libsFileBackup.toPath(), StandardCopyOption.REPLACE_EXISTING)
                Files.copy(libsFileForDiktatSnapshot.toPath(), libsFile.toPath())
            }

        val artifactDir = dir.pathToMavenArtifact(dependency)
            .also { it.createDirectory() }
        Files.copy(dependency.pomFile().toPath(), artifactDir.resolve(dependency.pomFileName()).toPath())
        Files.copy(dependency.artifactFile().toPath(), artifactDir.resolve(dependency.artifactFileName()).toPath())
    }
}

tasks.create("rollbackLibsForDiktatSnapshot") {
    inputs.file(libsFileBackup)
    outputs.file(libsFile)

    doLast {
        Files.deleteIfExists(libsFile.toPath())
        Files.move(libsFileBackup.toPath(), libsFile.toPath())
    }
}

/**
 * @param project
 * @return resolved path to directory according to maven coordinate
 */
fun File.pathToMavenArtifact(project: Project): File = project.group.toString()
    .split(".")
    .fold(this) { dirToArtifact, newPart -> dirToArtifact.resolve(newPart) }
    .resolve(project.name)
    .resolve(project.version.toString())

/**
 * @return generated pom.xml for project dependency
 */
fun Project.pomFile(): File = layout.buildDirectory
    .dir("publications")
    .map { publicationsDir ->
        publicationsDir.dir("pluginMaven")
            .takeIf { it.asFile.exists() }
            ?: publicationsDir.dir("maven")
    }
    .map { it.file("pom-default.xml").asFile }
    .get()

/**
 * @return file name of pom.xml for project
 */
fun Project.pomFileName(): String = "$name-$version.pom"

/**
 * @return generated artifact for project dependency
 */
fun Project.artifactFile(): File = layout.buildDirectory
    .dir("libs")
    .map { it.file(artifactFileName()).asFile }
    .get()

/**
 * @return file name of artifact for project dependency
 */
fun Project.artifactFileName(): String = "$name-$version.jar"


================================================
FILE: detekt-config.yml
================================================
build:
  maxIssues: 0
  excludeCorrectable: false
  weights:
  # complexity: 2
  # LongParameterList: 1
  # style: 1
  # comments: 1

config:
  validation: true
  warningsAsErrors: false
  # when writing own rules with new properties, exclude the property path e.g.: 'my_rule_set,.*>.*>[my_property]'
  excludes: ''

processors:
  active: true
  exclude:
    - 'DetektProgressListener'
  # - 'KtFileCountProcessor'
  # - 'PackageCountProcessor'
  # - 'ClassCountProcessor'
  # - 'FunctionCountProcessor'
  # - 'PropertyCountProcessor'
  # - 'ProjectComplexityProcessor'
  # - 'ProjectCognitiveComplexityProcessor'
  # - 'ProjectLLOCProcessor'
  # - 'ProjectCLOCProcessor'
  # - 'ProjectLOCProcessor'
  # - 'ProjectSLOCProcessor'
  # - 'LicenseHeaderLoaderExtension'

console-reports:
  active: true
  exclude:
    - 'ProjectStatisticsReport'
    - 'ComplexityReport'
    - 'NotificationReport'
    #  - 'FindingsReport'
    - 'FileBasedFindingsReport'

output-reports:
  active: true
  exclude:
  # - 'TxtOutputReport'
  # - 'XmlOutputReport'
  # - 'HtmlOutputReport'

comments:
  active: true
  excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  AbsentOrWrongFileLicense:
    active: false
    licenseTemplateFile: 'license.template'
    licenseTemplateIsRegex: false
  CommentOverPrivateFunction:
    active: false
  CommentOverPrivateProperty:
    active: false
  EndOfSentenceFormat:
    active: false
    endOfSentenceFormat: '([.?!][ \t\n\r\f<])|([.?!:]$)'
  UndocumentedPublicClass:
    active: false
    searchInNestedClass: true
    searchInInnerClass: true
    searchInInnerObject: true
    searchInInnerInterface: true
  UndocumentedPublicFunction:
    active: false
  UndocumentedPublicProperty:
    active: false

complexity:
  active: true
  ComplexCondition:
    active: false
    threshold: 4
  ComplexInterface:
    active: false
    threshold: 10
    includeStaticDeclarations: false
    includePrivateDeclarations: false
  CyclomaticComplexMethod:
    active: true
    threshold: 15
    ignoreSingleWhenExpression: false
    ignoreSimpleWhenEntries: false
    ignoreNestingFunctions: false
    nestingFunctions: [run, let, apply, with, also, use, forEach, isNotNull, ifNull]
  LabeledExpression:
    active: false
    ignoredLabels: []
  LargeClass:
    active: true
    threshold: 600
  LongMethod:
    active: true
    threshold: 60
  LongParameterList:
    active: true
    functionThreshold: 6
    constructorThreshold: 7
    ignoreDefaultParameters: false
    ignoreDataClasses: true
    ignoreAnnotated: []
  MethodOverloading:
    active: true
    threshold: 6
  NamedArguments:
    active: false
    threshold: 3
  NestedBlockDepth:
    active: false
    threshold: 4
  ReplaceSafeCallChainWithRun:
    active: false
  StringLiteralDuplication:
    active: false
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
    threshold: 3
    ignoreAnnotation: true
    excludeStringsWithLessThan5Characters: true
    ignoreStringsRegex: '$^'
  TooManyFunctions:
    active: false
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
    thresholdInFiles: 11
    thresholdInClasses: 11
    thresholdInInterfaces: 11
    thresholdInObjects: 11
    thresholdInEnums: 11
    ignoreDeprecated: false
    ignorePrivate: false
    ignoreOverridden: false

coroutines:
  active: true
  GlobalCoroutineUsage:
    active: true
  RedundantSuspendModifier:
    active: true
  SleepInsteadOfDelay:
    active: true
  SuspendFunWithFlowReturnType:
    active: true

empty-blocks:
  active: true
  EmptyCatchBlock:
    active: true
    allowedExceptionNameRegex: '_|(ignore|expected).*'
  EmptyClassBlock:
    active: true
  EmptyDefaultConstructor:
    active: true
  EmptyDoWhileBlock:
    active: true
  EmptyElseBlock:
    active: true
  EmptyFinallyBlock:
    active: true
  EmptyForBlock:
    active: true
  EmptyFunctionBlock:
    active: true
    ignoreOverridden: false
  EmptyIfBlock:
    active: true
  EmptyInitBlock:
    active: true
  EmptyKtFile:
    active: true
  EmptySecondaryConstructor:
    active: true
  EmptyTryBlock:
    active: true
  EmptyWhenBlock:
    active: true
  EmptyWhileBlock:
    active: true

exceptions:
  active: true
  ExceptionRaisedInUnexpectedLocation:
    active: true
    methodNames: [toString, hashCode, equals, finalize]
  InstanceOfCheckForException:
    active: false
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  NotImplementedDeclaration:
    active: true
  ObjectExtendsThrowable:
    active: true
  PrintStackTrace:
    active: true
  RethrowCaughtException:
    active: true
  ReturnFromFinally:
    active: true
    ignoreLabeled: false
  SwallowedException:
    active: false
    ignoredExceptionTypes:
      - InterruptedException
      - NumberFormatException
      - ParseException
      - MalformedURLException
    allowedExceptionNameRegex: '_|(ignore|expected).*'
  ThrowingExceptionFromFinally:
    active: true
  ThrowingExceptionInMain:
    active: true
  ThrowingExceptionsWithoutMessageOrCause:
    active: true
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
    exceptions:
      - IllegalArgumentException
      - IllegalStateException
      - IOException
  ThrowingNewInstanceOfSameException:
    active: true
  TooGenericExceptionCaught:
    active: true
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
    exceptionNames:
      - ArrayIndexOutOfBoundsException
      - Error
      - Exception
      - IllegalMonitorStateException
      - NullPointerException
      - IndexOutOfBoundsException
      - RuntimeException
      - Throwable
    allowedExceptionNameRegex: '_|(ignore|expected).*'
  TooGenericExceptionThrown:
    active: true
    exceptionNames:
      - Error
      - Exception
      - Throwable
      - RuntimeException

naming:
  active: true
  ClassNaming:
    active: true
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
    classPattern: '[A-Z][a-zA-Z0-9]*'
  ConstructorParameterNaming:
    active: true
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
    parameterPattern: '[a-z][A-Za-z0-9]*'
    privateParameterPattern: '[a-z][A-Za-z0-9]*'
    excludeClassPattern: '$^'
  EnumNaming:
    active: true
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
    enumEntryPattern: '[A-Z][_a-zA-Z0-9]*'
  ForbiddenClassName:
    active: false
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
    forbiddenName: []
  FunctionMaxLength:
    active: false
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
    maximumFunctionNameLength: 30
  FunctionMinLength:
    active: false
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
    minimumFunctionNameLength: 3
  FunctionNaming:
    active: true
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
    functionPattern: '([a-z][a-zA-Z0-9]*)|(`.*`)'
    excludeClassPattern: '$^'
    ignoreAnnotated: ['Composable']
  FunctionParameterNaming:
    active: true
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
    parameterPattern: '[a-z][A-Za-z0-9]*'
    excludeClassPattern: '$^'
  InvalidPackageDeclaration:
    active: false
    excludes: ['*.kts']
    rootPackage: ''
  MatchingDeclarationName:
    active: true
    mustBeFirst: true
  MemberNameEqualsClassName:
    active: true
    ignoreOverridden: true
  NoNameShadowing:
    active: false
  NonBooleanPropertyPrefixedWithIs:
    active: false
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  ObjectPropertyNaming:
    active: true
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
    constantPattern: '[A-Za-z][_A-Za-z0-9]*'
    propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
    privatePropertyPattern: '(_)?[A-Za-z][_A-Za-z0-9]*'
  PackageNaming:
    active: true
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
    packagePattern: '[a-z]+(\.[a-z][A-Za-z0-9]*)*'
  TopLevelPropertyNaming:
    active: true
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
    constantPattern: '[A-Z][_A-Z0-9]*'
    propertyPattern: '[A-Za-z][_A-Za-z0-9]*'
    privatePropertyPattern: '_?[A-Za-z][_A-Za-z0-9]*'
  VariableMaxLength:
    active: false
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
    maximumVariableNameLength: 64
  VariableMinLength:
    active: false
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
    minimumVariableNameLength: 1
  VariableNaming:
    active: true
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
    variablePattern: '[a-z][A-Za-z0-9]*'
    privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*'
    excludeClassPattern: '$^'

performance:
  active: true
  ArrayPrimitive:
    active: true
  ForEachOnRange:
    active: true
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  SpreadOperator:
    active: true
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
  UnnecessaryTemporaryInstantiation:
    active: true

potential-bugs:
  active: true
  CastToNullableType:
    active: false
  Deprecation:
    active: true
  DontDowncastCollectionTypes:
    active: true
  EqualsAlwaysReturnsTrueOrFalse:
    active: true
  EqualsWithHashCodeExist:
    active: true
  ExitOutsideMain:
    active: false
  ExplicitGarbageCollectionCall:
    active: true
  HasPlatformType:
    active: false
  IgnoredReturnValue:
    active: true
    restrictToConfig: true
    returnValueAnnotations: ['*.CheckReturnValue', '*.CheckResult']
  ImplicitDefaultLocale:
    active: false
  ImplicitUnitReturnType:
    active: false
    allowExplicitReturnType: true
  InvalidRange:
    active: true
  IteratorHasNextCallsNextMethod:
    active: true
  IteratorNotThrowingNoSuchElementException:
    active: true
  LateinitUsage:
    active: false
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
    ignoreOnClassesPattern: ''
  MapGetWithNotNullAssertionOperator:
    active: false
  NullableToStringCall:
    active: false
  UnconditionalJumpStatementInLoop:
    active: false
  UnnecessaryNotNullOperator:
    active: true
  UnnecessarySafeCall:
    active: true
  UnreachableCatchBlock:
    active: false
  UnreachableCode:
    active: true
  UnsafeCallOnNullableType:
    active: true
  UnsafeCast:
    active: true
  UnusedUnaryOperator:
    active: false
  UselessPostfixExpression:
    active: false
  WrongEqualsTypeParameter:
    active: true

style:
  active: true
  ClassOrdering:
    active: true
  CollapsibleIfStatements:
    active: false
  DataClassContainsFunctions:
    active: false
    conversionFunctionPrefix: 'to'
  DataClassShouldBeImmutable:
    active: false
  DestructuringDeclarationWithTooManyEntries:
    active: true
    maxDestructuringEntries: 3
  EqualsNullCall:
    active: true
  EqualsOnSignatureLine:
    active: false
  ExplicitCollectionElementAccessMethod:
    active: false
  ExplicitItLambdaParameter:
    active: false
  ExpressionBodySyntax:
    active: false
    includeLineWrapping: false
  ForbiddenImport:
    active: false
    imports: []
    forbiddenPatterns: ''
  ForbiddenMethodCall:
    active: true
    methods: ['kotlin.io.println', 'kotlin.io.print']
    excludes: ["**/src/test/**"]
  ForbiddenPublicDataClass:
    active: true
    excludes: ['**']
    ignorePackages: ['*.internal', '*.internal.*']
  ForbiddenVoid:
    active: false
    ignoreOverridden: false
    ignoreUsageInGenerics: false
  FunctionOnlyReturningConstant:
    active: true
    ignoreOverridableFunction: true
    ignoreActualFunction: true
    excludedFunctions: 'describeContents'
    ignoreAnnotated: ['dagger.Provides']
  LibraryCodeMustSpecifyReturnType:
    active: true
    excludes: ['**']
  LibraryEntitiesShouldNotBePublic:
    active: true
    excludes: ['**']
  LoopWithTooManyJumpStatements:
    active: true
    maxJumpCount: 1
  MagicNumber:
    active: true
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
    ignoreNumbers: ['-1', '0', '1', '2']
    ignoreHashCodeFunction: true
    ignorePropertyDeclaration: false
    ignoreLocalVariableDeclaration: false
    ignoreConstantDeclaration: true
    ignoreCompanionObjectPropertyDeclaration: true
    ignoreAnnotation: false
    ignoreNamedArgument: true
    ignoreEnums: false
    ignoreRanges: false
    ignoreExtensionFunctions: true
  MandatoryBracesLoops:
    active: false
  MaxLineLength:
    active: true
    maxLineLength: 180
    excludePackageStatements: true
    excludeImportStatements: true
    excludeCommentStatements: false
  MayBeConst:
    active: true
  ModifierOrder:
    active: true
  MultilineLambdaItParameter:
    active: false
  NestedClassesVisibility:
    active: true
  NewLineAtEndOfFile:
    active: true
  NoTabs:
    active: false
  OptionalAbstractKeyword:
    active: true
  OptionalUnit:
    active: false
  PreferToOverPairSyntax:
    active: false
  ProtectedMemberInFinalClass:
    active: true
  RedundantExplicitType:
    active: false
  RedundantHigherOrderMapUsage:
    active: true
  RedundantVisibilityModifierRule:
    active: false
  ReturnCount:
    active: false
    max: 4
    excludedFunctions: 'equals'
    excludeLabeled: false
    excludeReturnFromLambda: true
    excludeGuardClauses: false
  SafeCast:
    active: true
  SerialVersionUIDInSerializableClass:
    active: true
  SpacingBetweenPackageAndImports:
    active: false
  ThrowsCount:
    active: true
    max: 2
  TrailingWhitespace:
    active: false
  UnderscoresInNumericLiterals:
    active: false
    acceptableLength: 5
  UnnecessaryAbstractClass:
    active: true
    ignoreAnnotated: ['dagger.Module']
  UnnecessaryAnnotationUseSiteTarget:
    active: false
  UnnecessaryApply:
    active: true
  UnnecessaryFilter:
    active: false
  UnnecessaryInheritance:
    active: true
  UnnecessaryLet:
    active: false
  UnnecessaryParentheses:
    active: false
  UntilInsteadOfRangeTo:
    active: false
  UnusedImports:
    active: false
  UnusedPrivateClass:
    active: true
  UnusedPrivateMember:
    active: false
    allowedNames: '(_|ignored|expected|serialVersionUID)'
  UseArrayLiteralsInAnnotations:
    active: false
  UseCheckNotNull:
    active: false
  UseCheckOrError:
    active: false
  UseDataClass:
    active: false
    allowVars: false
  UseEmptyCounterpart:
    active: true
  UseIfEmptyOrIfBlank:
    active: true
  UseIfInsteadOfWhen:
    active: false
  UseIsNullOrEmpty:
    active: true
  UseOrEmpty:
    active: false
  UseRequire:
    active: false
  UseRequireNotNull:
    active: true
  UselessCallOnNotNull:
    active: true
  UtilityClassWithPublicConstructor:
    active: true
  VarCouldBeVal:
    active: true
    ignoreAnnotated: ['org.apache.maven.plugins.annotations.Parameter']
  WildcardImport:
    active: true
    excludes: ['**/test/**', '**/androidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
    excludeImports: ['com.saveourtool.diktat.ruleset.utils.*', 'java.util.*', 'kotlinx.android.synthetic.*', 'kotlinx.serialization']


================================================
FILE: diktat-analysis.yml
================================================
# Common configuration
- name: DIKTAT_COMMON
  enabled: true
  configuration:
    # put your package name here - it will be autofixed and checked
    domainName: com.saveourtool.diktat
    # testDirs: test
    # can also use chapter names here (not only numbers)
    # expected values:  disabledChapters: "Naming, Comments, General, Variables, Functions, Classes"
    # or: "1, 2, 3, 4, 5, 6"
    disabledChapters: ""
    testDirs: test
    kotlinVersion: 2.1
    srcDirectories: "main"
# Checks that the Class/Enum/Interface name matches Pascal case
- name: CLASS_NAME_INCORRECT
  enabled: true
# Checks that CONSTANT (treated as const val from companion object or class level) is in non UPPER_SNAKE_CASE
- name: CONSTANT_UPPERCASE
  enabled: true
  configuration:
    exceptionConstNames: "serialVersionUID"
# Checks that enum value is in upper SNAKE_CASE or in PascalCase depending on the config. UPPER_SNAKE_CASE is the default, but can be changed by 'enumStyle' config
- name: ENUM_VALUE
  enabled: true
  configuration:
    # Two options: SNAKE_CASE (default), PascalCase
    enumStyle: SNAKE_CASE
# Checks that class which extends any Exception class has Exception suffix
- name: EXCEPTION_SUFFIX
  enabled: true
# Checks that file name has extension
- name: FILE_NAME_INCORRECT
  enabled: true
# Checks that file name matches class name, if it is only one class in file
- name: FILE_NAME_MATCH_CLASS
  enabled: true
# Checks that functions/methods which return boolean have special prefix like "is/should/e.t.c"
- name: FUNCTION_BOOLEAN_PREFIX
  enabled: true
  configuration:
    allowedPrefixes: "" # A list of functions that return boolean and are allowed to use. Input is in a form "foo, bar".
# Checks that function/method name is in lowerCamelCase
- name: FUNCTION_NAME_INCORRECT_CASE
  enabled: true
# Checks that generic name doesn't contain more than 1 letter (capital). It can be followed by numbers, example: T12, T
- name: GENERIC_NAME
  enabled: true
# Identifier length should be in range [2,64] except names that used in industry like {i, j} and 'e' for catching exceptions
- name: IDENTIFIER_LENGTH
  enabled: true
# Checks that the object matches PascalCase
- name: OBJECT_NAME_INCORRECT
  enabled: true
# Checks that package name is in correct (lower) case
- name: PACKAGE_NAME_INCORRECT_CASE
  enabled: true
# Checks that package name starts with the company's domain
- name: PACKAGE_NAME_INCORRECT_PREFIX
  enabled: true
# Checks that package name does not have incorrect symbols like underscore or non-ASCII letters/digits
- name: PACKAGE_NAME_INCORRECT_SYMBOLS
  enabled: true
# Checks that the path for a file matches with a package name
- name: PACKAGE_NAME_INCORRECT_PATH
  enabled: true
# Checks that package name is in the file
- name: PACKAGE_NAME_MISSING
  enabled: true
# Checks that variable does not have prefix (like mVariable or M_VARIABLE)
- name: VARIABLE_HAS_PREFIX
  enabled: true
# Checks that variable does not contain one single letter, only exceptions are fixed names that used in industry like {i, j}
- name: VARIABLE_NAME_INCORRECT
  enabled: true
# Checks that the name of variable is in lowerCamelCase and contains only ASCII letters
- name: VARIABLE_NAME_INCORRECT_FORMAT
  enabled: true
# Checks that functions have kdoc
- name: MISSING_KDOC_ON_FUNCTION
  enabled: true
# Checks that on file level internal or public class or function has missing KDoc
- name: MISSING_KDOC_TOP_LEVEL
  enabled: true
# Checks that accessible internal elements (protected, public, internal) in a class are documented
- name: MISSING_KDOC_CLASS_ELEMENTS
  enabled: true
# Checks that accessible method parameters are documented in KDoc
- name: KDOC_WITHOUT_PARAM_TAG
  enabled: true
# Checks that accessible method explicit return type is documented in KDoc
- name: KDOC_WITHOUT_RETURN_TAG
  enabled: true
# Checks that accessible method throw keyword is documented in KDoc
- name: KDOC_WITHOUT_THROWS_TAG
  enabled: true
# Checks that KDoc is not empty
- name: KDOC_EMPTY_KDOC
  enabled: true
# Checks that underscore is correctly used to split package naming
- name: INCORRECT_PACKAGE_SEPARATOR
  enabled: true
# Checks that code block doesn't contain kdoc comments
- name: COMMENTED_BY_KDOC
  enabled: true
# Checks that there is no @deprecated tag in kdoc
- name: KDOC_NO_DEPRECATED_TAG
  enabled: true
# Checks that there is no empty content in kdoc tags
- name: KDOC_NO_EMPTY_TAGS
  enabled: true
# Checks that there is only one space after kdoc tag
- name: KDOC_WRONG_SPACES_AFTER_TAG
  enabled: true
# Checks tags order in kDoc. `@param`, `@return`, `@throws`
- name: KDOC_WRONG_TAGS_ORDER
  enabled: true
# Checks that there is no newline of empty KDoc line (with leading asterisk) between `@param`, `@return`, `@throws` tags
- name: KDOC_NO_NEWLINES_BETWEEN_BASIC_TAGS
  enabled: true
# Checks that block of tags @param, @return, @throws is separated from previous part of KDoc by exactly one empty line
- name: KDOC_NEWLINES_BEFORE_BASIC_TAGS
  enabled: true
# Checks that special tags `@apiNote`, `@implNote`, `@implSpec` have exactly one empty line after
- name: KDOC_NO_NEWLINE_AFTER_SPECIAL_TAGS
  enabled: true
# Checks that KDoc does not contain single line with words 'return', 'get' or 'set'
- name: KDOC_TRIVIAL_KDOC_ON_FUNCTION
  enabled: true
# Checks that kdoc does not contain @author tag or date
- name: KDOC_CONTAINS_DATE_OR_AUTHOR
  enabled: true
  configuration:
    versionRegex: \d+\.\d+\.\d+[-.\w\d]*
# Checks that there is newline after header KDoc
- name: HEADER_WRONG_FORMAT
  enabled: true
# Checks that file with zero or >1 classes has header KDoc
- name: HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE
  enabled: true
# Checks that copyright exists on top of file and is properly formatted (as a block comment)
- name: HEADER_MISSING_OR_WRONG_COPYRIGHT
  enabled: true
  configuration:
    isCopyrightMandatory: false
    copyrightText: ''
# Checks that header kdoc is located before package directive
- name: HEADER_NOT_BEFORE_PACKAGE
  enabled: true
# Checks that file does not contain lines > maxSize
- name: FILE_IS_TOO_LONG
  enabled: true
  configuration:
    # number of lines
    maxSize: '2000'
# Checks that file does not contain commented out code
- name: COMMENTED_OUT_CODE
  enabled: true
# Checks that file does not contain only comments, imports and package directive
- name: FILE_CONTAINS_ONLY_COMMENTS
  enabled: true
# Orders imports alphabetically
- name: FILE_UNORDERED_IMPORTS
  enabled: true
  configuration:
    # use logical imports grouping with sorting inside of a group
    useRecommendedImportsOrder: true
# Checks that general order of code parts is right
- name: FILE_INCORRECT_BLOCKS_ORDER
  enabled: true
# Checks that there is exactly one line between code blocks
- name: FILE_NO_BLANK_LINE_BETWEEN_BLOCKS
  enabled: true
# Checks that there is no wildcard imports. Exception: allowedWildcards
- name: FILE_WILDCARD_IMPORTS
  enabled: true
  configuration:
    # Allowed wildcards for imports (e.g. "import com.saveourtool.diktat.*, import org.jetbrains.kotlin.*")
    allowedWildcards: "kotlinx.serialization.*,com.saveourtool.diktat.ruleset.utils.*"
# Checks unused imports
- name: UNUSED_IMPORT
  enabled: true
  configuration:
    deleteUnusedImport: true
# Checks that braces are used in if, else, when, for, do, and while statements. Exception: single line ternary operator statement
- name: NO_BRACES_IN_CONDITIONALS_AND_LOOPS
  enabled: true
# Checks that the declaration part of a class-like code structures (class/interface/etc.) is in the proper order
- name: WRONG_ORDER_IN_CLASS_LIKE_STRUCTURES
  enabled: true
# Checks that properties with comments are separated by a blank line
- name: BLANK_LINE_BETWEEN_PROPERTIES
  enabled: true
# Checks top level order
- name: TOP_LEVEL_ORDER
  enabled: true
# Checks that non-empty code blocks with braces follow the K&R style (1TBS or OTBS style)
- name: BRACES_BLOCK_STRUCTURE_ERROR
  enabled: true
  configuration:
    openBraceNewline: 'True'
    closeBraceNewline: 'True'
# Checks that indentation is correct
- name: WRONG_INDENTATION
  enabled: true
  configuration:
    # Is newline at the end of a file needed
    newlineAtEnd: true
    # If true: in parameter list when parameters are split by newline they are indented with two indentations instead of one
    extendedIndentOfParameters: false
    # If true: if first parameter in parameter list is on the same line as opening parenthesis, then other parameters can be aligned with it
    alignedParameters: true
    # If true, expression bodies which begin on a separate line are indented
    # using a continuation indent. The default is false.
    #
    # This flag is called CONTINUATION_INDENT_FOR_EXPRESSION_BODIES in IDEA and
    # ij_kotlin_continuation_indent_for_expression_bodies in .editorconfig.
    extendedIndentForExpressionBodies: false
    # If true: if expression is split by newline after operator like +/-/`*`, then the next line is indented with two indentations instead of one
    extendedIndentAfterOperators: true
    # If true: when dot qualified expression starts on a new line, this line will be indented with two indentations instead of one
    extendedIndentBeforeDot: false
    # The indentation size for each file
    indentationSize: 4
# Checks that there is no empty blocks in a file.
# If allowEmptyBlocks is true, checks that it follows correct style (have a newline)
- name: EMPTY_BLOCK_STRUCTURE_ERROR
  enabled: true
  configuration:
    # Whether a newline after `{` is required in an empty block
    styleEmptyBlockWithNewline: 'True'
    allowEmptyBlocks: 'False'
# Checks that there is no more than one statement per line
- name: MORE_THAN_ONE_STATEMENT_PER_LINE
  enabled: true
# Checks that the line length is < lineLength parameter
- name: LONG_LINE
  enabled: true
  configuration:
    lineLength: '180'
# Checks that semicolons are not used at the end of a line
- name: REDUNDANT_SEMICOLON
  enabled: true
# Checks that line breaks follow code style guide: rule 3.6
- name: WRONG_NEWLINES
  enabled: true
  configuration:
    # If the number of parameters on one line is more than this threshold, all parameters will be placed on separate lines.
    maxParametersInOneLine: 2
    # 3 by default.
    maxCallsInOneLine: 3
# Checks trailing comma
- name: TRAILING_COMMA
  enabled: true
  configuration:
    # VALUE_ARGUMENT
    valueArgument: false
    # VALUE_PARAMETER
    valueParameter: false
    # REFERENCE_EXPRESSION
    indices: false
    # WHEN_CONDITION_WITH_EXPRESSION
    whenConditions: false
    # STRING_TEMPLATE
    collectionLiteral: false
    # TYPE_PROJECTION
    typeArgument: false
    # TYPE_PARAMETER
    typeParameter: false
    # DESTRUCTURING_DECLARATION_ENTRY
    destructuringDeclaration: false
# Inspection that checks if a long dot qualified expression is used in condition or as an argument
- name: COMPLEX_EXPRESSION
  enabled: true
# Checks that there are not too many consecutive spaces in line
- name: TOO_MANY_CONSECUTIVE_SPACES
  enabled: true
  configuration:
    # Maximum allowed number of consecutive spaces (not counting indentation)
    maxSpaces: '1'
    # Whether formatting for enums should be kept without checking
    saveInitialFormattingForEnums: false
# Checks that blank lines are used correctly.
# For example: triggers when there are too many blank lines between function declaration
- name: TOO_MANY_BLANK_LINES
  enabled: true
# Checks that usage of horizontal spaces doesn't violate code style guide
- name: WRONG_WHITESPACE
  enabled: true
# Checks that backticks (``) are not used in the identifier name, except the case when it is test method (marked with @Test annotation)
- name: BACKTICKS_PROHIBITED
  enabled: true
  # all code blocks annotated with  @Nested, @ParameterizedTest (JUnit 5) will
  # be ignored and not checked.
  ignoreAnnotated: [ Nested, ParameterizedTest, IndentationTest ]
# Checks that a single line concatenation of strings is not used
- name: STRING_CONCATENATION
  enabled: true
# Checks that each when statement have else in the end
- name: WHEN_WITHOUT_ELSE
  enabled: true
# Checks that annotation is on a single line
- name: ANNOTATION_NEW_LINE
  enabled: true
# Checks that method annotated with `Preview` annotation is private and has Preview suffix
- name: PREVIEW_ANNOTATION
  enabled: true
# Checks that enum structure is correct: enum entries should be separated by comma and line break and last entry should have semicolon in the end.
- name: ENUMS_SEPARATED
  enabled: true
# Checks that value on integer or float constant is not too big
- name: LONG_NUMERICAL_VALUES_SEPARATED
  enabled: true
  configuration:
    # Maximum number of digits which are not split
    maxNumberLength: '5'
    # Maximum number of digits between separators
    maxBlockLength: '3'
# Checks magic number
- name: MAGIC_NUMBER
  enabled: true
  configuration:
    # Ignore numbers from test
    ignoreTest: "true"
    # Ignore numbers
    ignoreNumbers: "-1, 1, 0, 2, 0U, 1U, 2U, -1L, 0L, 1L, 2L, 0UL, 1UL, 2UL"
    # Is ignore override hashCode function
    ignoreHashCodeFunction: "true"
    # Is ignore property
    ignorePropertyDeclaration: "false"
    # Is ignore local variable
    ignoreLocalVariableDeclaration: "false"
    # Is ignore value parameter
    ignoreValueParameter: "true"
    # Is ignore constant
    ignoreConstantDeclaration: "true"
    # Is ignore property in companion object
    ignoreCompanionObjectPropertyDeclaration: "true"
    # Is ignore numbers in enum
    ignoreEnums: "false"
    # Is ignore number in ranges
    ignoreRanges: "false"
    # Is ignore number in extension function
    ignoreExtensionFunctions: "false"
    # Is ignore number in pairs created using to
    ignorePairsCreatedUsingTo: "false"
# Checks that order of enum values or constant property inside companion is correct
- name: WRONG_DECLARATIONS_ORDER
  enabled: true
  configuration:
    # Whether enum members should be sorted alphabetically
    sortEnum: true
    # Whether class properties should be sorted alphabetically
    sortProperty: true
# Checks that multiple modifiers sequence is in the correct order
- name: WRONG_MULTIPLE_MODIFIERS_ORDER
  enabled: true
# Checks that identifier has appropriate name (See table of rule 1.2 part 6)
- name: CONFUSING_IDENTIFIER_NAMING
  enabled: true
# Checks year in the copyright
- name: WRONG_COPYRIGHT_YEAR
  enabled: true
# Inspection that checks if local variables are declared close to the first usage site
- name: LOCAL_VARIABLE_EARLY_DECLARATION
  enabled: true
# Try to avoid initialize val by null (e.g. val a: Int? = null -> val a: Int = 0)
- name: NULLABLE_PROPERTY_TYPE
  enabled: true
# Inspection that checks if there is a blank line before kDoc and none after
- name: WRONG_NEWLINES_AROUND_KDOC
  enabled: true
# Inspection that checks if there is no blank lines before first comment
- name: FIRST_COMMENT_NO_BLANK_LINE
  enabled: true
# Inspection that checks if there are blank lines between code and comment and between code start token and comment's text
- name: COMMENT_WHITE_SPACE
  enabled: true
  configuration:
    maxSpacesBeforeComment: 2
    maxSpacesInComment: 1
# Inspection that checks if all comment's are inside if-else code blocks. Exception is general if comment
- name: IF_ELSE_COMMENTS
  enabled: true
# Type aliases provide alternative names for existing types when type's reference text is longer 25 chars
- name: TYPE_ALIAS
  enabled: true
  configuration:
    typeReferenceLength: '25' # max length of type reference
# Checks if casting can be omitted
- name: SMART_CAST_NEEDED
  enabled: true
# Checks that variables of generic types have explicit type declaration
- name: GENERIC_VARIABLE_WRONG_DECLARATION
  enabled: true
# Inspection that checks if string template has redundant curly braces
- name: STRING_TEMPLATE_CURLY_BRACES
  enabled: true
# Variables with `val` modifier - ar
Download .txt
gitextract_zjq19om1/

├── .editorconfig
├── .git-hooks/
│   ├── commit-msg.sh
│   └── pre-commit.sh
├── .gitattributes
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.md
│   │   └── config.yml
│   ├── codecov.yml
│   ├── pull_request_template.md
│   └── workflows/
│       ├── build_and_test.yml
│       ├── codeql-analysis.yml
│       ├── dependencies.yml
│       ├── detekt.yml
│       ├── diktat.yml
│       ├── diktat_snapshot.yml
│       └── release.yml
├── .gitignore
├── CNAME
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── RELEASING.md
├── _config.yml
├── build.gradle.kts
├── detekt-config.yml
├── diktat-analysis.yml
├── diktat-api/
│   ├── build.gradle.kts
│   └── src/
│       └── main/
│           └── kotlin/
│               └── com/
│                   └── saveourtool/
│                       └── diktat/
│                           ├── Constants.kt
│                           ├── DiktatProcessor.kt
│                           ├── DiktatProcessorFactory.kt
│                           ├── DiktatRunner.kt
│                           ├── DiktatRunnerArguments.kt
│                           ├── DiktatRunnerFactory.kt
│                           ├── api/
│                           │   ├── DiktatBaseline.kt
│                           │   ├── DiktatBaselineFactory.kt
│                           │   ├── DiktatCallback.kt
│                           │   ├── DiktatError.kt
│                           │   ├── DiktatErrorEmitter.kt
│                           │   ├── DiktatProcessorListener.kt
│                           │   ├── DiktatReporterCreationArguments.kt
│                           │   ├── DiktatReporterFactory.kt
│                           │   ├── DiktatReporterType.kt
│                           │   ├── DiktatRule.kt
│                           │   ├── DiktatRuleConfig.kt
│                           │   ├── DiktatRuleConfigReader.kt
│                           │   ├── DiktatRuleNameAware.kt
│                           │   ├── DiktatRuleSet.kt
│                           │   └── DiktatRuleSetFactory.kt
│                           ├── common/
│                           │   └── config/
│                           │       └── rules/
│                           │           └── LegacyAliases.kt
│                           └── util/
│                               ├── DiktatProcessorListenerWrapper.kt
│                               └── FileUtils.kt
├── diktat-cli/
│   ├── README.md
│   ├── build.gradle.kts
│   └── src/
│       ├── main/
│       │   ├── kotlin/
│       │   │   └── com/
│       │   │       └── saveourtool/
│       │   │           └── diktat/
│       │   │               ├── DiktatMain.kt
│       │   │               ├── cli/
│       │   │               │   ├── DiktatMode.kt
│       │   │               │   └── DiktatProperties.kt
│       │   │               └── util/
│       │   │                   └── CliUtils.kt
│       │   └── script/
│       │       ├── diktat.cmd
│       │       └── header-diktat.sh
│       └── test/
│           ├── kotlin/
│           │   └── com/
│           │       └── saveourtool/
│           │           └── diktat/
│           │               ├── smoke/
│           │               │   ├── DiktatCliTest.kt
│           │               │   ├── DiktatSaveSmokeTest.kt
│           │               │   ├── DiktatSmokeTest.kt
│           │               │   ├── DiktatSmokeTestBase.kt
│           │               │   └── DiktatSmokeTestUtils.kt
│           │               └── util/
│           │                   └── CliUtilsKtTest.kt
│           └── resources/
│               └── test/
│                   └── smoke/
│                       ├── .editorconfig
│                       ├── .gitignore
│                       ├── build.gradle.kts_
│                       ├── save.toml
│                       └── src/
│                           ├── jsMain/
│                           │   └── kotlin/
│                           │       └── com/
│                           │           └── saveourtool/
│                           │               └── diktat/
│                           │                   └── scripts/
│                           │                       ├── ScriptExpected.kt
│                           │                       └── ScriptTest.kt
│                           └── main/
│                               └── kotlin/
│                                   ├── Bug1Expected.kt
│                                   ├── Bug1Test.kt
│                                   ├── DefaultPackageExpected.kt
│                                   ├── DefaultPackageTest.kt
│                                   ├── Example1-2Expected.kt
│                                   ├── Example1Expected.kt
│                                   ├── Example1Test.kt
│                                   ├── Example2Expected.kt
│                                   ├── Example2Test.kt
│                                   ├── Example3Expected.kt
│                                   ├── Example3Test.kt
│                                   ├── Example4Expected.kt
│                                   ├── Example4Test.kt
│                                   ├── Example5Expected.kt
│                                   ├── Example5Test.kt
│                                   ├── Example6Expected.kt
│                                   ├── Example6Test.kt
│                                   ├── Example7Expected.kt
│                                   ├── Example7Test.kt
│                                   ├── Example8Expected.kt
│                                   ├── Example8Test.kt
│                                   ├── KdocFormattingMultilineTagsExpected.kt
│                                   ├── KdocFormattingMultilineTagsTest.kt
│                                   ├── LocalVariableWithOffsetExpected.kt
│                                   ├── LocalVariableWithOffsetTest.kt
│                                   ├── ManyLineTransformInLongLineExpected.kt
│                                   ├── ManyLineTransformInLongLineTest.kt
│                                   ├── NewlinesAfterInterfacesExpected.kt
│                                   ├── NewlinesAfterInterfacesTest.kt
│                                   ├── SemicolonsExpected.kt
│                                   ├── SemicolonsTest.kt
│                                   ├── kotlin-library-expected.gradle.kts
│                                   ├── kotlin-library.gradle.kts
│                                   ├── save.toml
│                                   └── script/
│                                       ├── PackageInScriptExpected.kts
│                                       ├── PackageInScriptTest.kts
│                                       ├── SimpleRunInScriptExpected.kts
│                                       └── SimpleRunInScriptTest.kts
├── diktat-common-test/
│   ├── build.gradle.kts
│   └── src/
│       └── main/
│           └── kotlin/
│               └── com/
│                   └── saveourtool/
│                       └── diktat/
│                           └── test/
│                               └── framework/
│                                   ├── processing/
│                                   │   ├── ResourceReader.kt
│                                   │   ├── TestComparatorUnit.kt
│                                   │   └── TestFileContent.kt
│                                   └── util/
│                                       └── TestUtils.kt
├── diktat-dev-ksp/
│   ├── build.gradle.kts
│   └── src/
│       └── main/
│           ├── kotlin/
│           │   └── com/
│           │       └── saveourtool/
│           │           └── diktat/
│           │               └── ruleset/
│           │                   └── generation/
│           │                       ├── EnumNames.kt
│           │                       ├── EnumNamesSymbolProcessor.kt
│           │                       └── EnumNamesSymbolProcessorProvider.kt
│           └── resources/
│               └── META-INF/
│                   └── services/
│                       └── com.google.devtools.ksp.processing.SymbolProcessorProvider
├── diktat-gradle-plugin/
│   ├── README.md
│   ├── build.gradle.kts
│   └── src/
│       ├── functionalTest/
│       │   └── kotlin/
│       │       └── com/
│       │           └── saveourtool/
│       │               └── diktat/
│       │                   └── plugin/
│       │                       └── gradle/
│       │                           ├── DiktatGradlePluginFunctionalTest.kt
│       │                           ├── DiktatGradlePluginGroovyFunctionalTest.kt
│       │                           ├── DiktatGradlePluginMultiprojectFunctionalTest.kt
│       │                           └── Utils.kt
│       ├── main/
│       │   └── kotlin/
│       │       └── com/
│       │           └── saveourtool/
│       │               └── diktat/
│       │                   └── plugin/
│       │                       └── gradle/
│       │                           ├── DiktatExtension.kt
│       │                           ├── DiktatGradlePlugin.kt
│       │                           ├── Utils.kt
│       │                           ├── extension/
│       │                           │   ├── DefaultReporter.kt
│       │                           │   ├── Reporter.kt
│       │                           │   └── Reporters.kt
│       │                           └── tasks/
│       │                               ├── DiktatCheckTask.kt
│       │                               ├── DiktatFixTask.kt
│       │                               ├── DiktatTaskBase.kt
│       │                               └── SarifReportMergeTask.kt
│       └── test/
│           └── kotlin/
│               └── com/
│                   └── saveourtool/
│                       └── diktat/
│                           └── plugin/
│                               └── gradle/
│                                   ├── DiktatGradlePluginTest.kt
│                                   └── DiktatJavaExecTaskTest.kt
├── diktat-ktlint-engine/
│   ├── build.gradle.kts
│   └── src/
│       ├── main/
│       │   └── kotlin/
│       │       └── com/
│       │           ├── pinterest/
│       │           │   └── ktlint/
│       │           │       └── rule/
│       │           │           └── engine/
│       │           │               └── api/
│       │           │                   └── Code.kt
│       │           └── saveourtool/
│       │               └── diktat/
│       │                   └── ktlint/
│       │                       ├── DiktatBaselineFactoryImpl.kt
│       │                       ├── DiktatProcessorFactoryImpl.kt
│       │                       ├── DiktatReporterFactoryImpl.kt
│       │                       ├── DiktatReporterImpl.kt
│       │                       ├── KtLintRuleWrapper.kt
│       │                       ├── KtLintUtils.kt
│       │                       └── ReporterV2Wrapper.kt
│       └── test/
│           └── kotlin/
│               └── com/
│                   └── saveourtool/
│                       └── diktat/
│                           └── ktlint/
│                               └── KtLintRuleWrapperTest.kt
├── diktat-maven-plugin/
│   ├── README.md
│   ├── build.gradle.kts
│   └── src/
│       ├── main/
│       │   └── kotlin/
│       │       └── com/
│       │           └── saveourtool/
│       │               └── diktat/
│       │                   └── plugin/
│       │                       └── maven/
│       │                           ├── DiktatBaseMojo.kt
│       │                           ├── DiktatMojo.kt
│       │                           ├── Utils.kt
│       │                           └── reporters/
│       │                               ├── DefaultReporter.kt
│       │                               ├── GitHubActionsReporter.kt
│       │                               ├── Reporter.kt
│       │                               └── Reporters.kt
│       └── test/
│           ├── kotlin/
│           │   └── com/
│           │       └── saveourtool/
│           │           └── diktat/
│           │               └── plugin/
│           │                   └── maven/
│           │                       ├── DiktatBaseMojoTest.kt
│           │                       └── DiktatMavenPluginIntegrationTest.kt
│           └── resources/
│               └── .mvn/
│                   ├── jvm.config
│                   └── maven.config
├── diktat-rules/
│   ├── build.gradle.kts
│   └── src/
│       ├── main/
│       │   ├── kotlin/
│       │   │   └── com/
│       │   │       └── saveourtool/
│       │   │           └── diktat/
│       │   │               ├── common/
│       │   │               │   └── config/
│       │   │               │       └── rules/
│       │   │               │           └── LegacyUtils.kt
│       │   │               └── ruleset/
│       │   │                   ├── config/
│       │   │                   │   ├── AbstractDiktatRuleConfigReader.kt
│       │   │                   │   ├── CommonConfiguration.kt
│       │   │                   │   ├── DiktatRuleConfigYamlReader.kt
│       │   │                   │   └── RuleConfiguration.kt
│       │   │                   ├── constants/
│       │   │                   │   ├── Chapters.kt
│       │   │                   │   └── Warnings.kt
│       │   │                   ├── rules/
│       │   │                   │   ├── DiktatRule.kt
│       │   │                   │   ├── DiktatRuleSetFactoryImpl.kt
│       │   │                   │   ├── chapter1/
│       │   │                   │   │   ├── FileNaming.kt
│       │   │                   │   │   ├── IdentifierNaming.kt
│       │   │                   │   │   └── PackageNaming.kt
│       │   │                   │   ├── chapter2/
│       │   │                   │   │   ├── comments/
│       │   │                   │   │   │   ├── CommentsRule.kt
│       │   │                   │   │   │   └── HeaderCommentRule.kt
│       │   │                   │   │   └── kdoc/
│       │   │                   │   │       ├── CommentsFormatting.kt
│       │   │                   │   │       ├── KdocComments.kt
│       │   │                   │   │       ├── KdocFormatting.kt
│       │   │                   │   │       └── KdocMethods.kt
│       │   │                   │   ├── chapter3/
│       │   │                   │   │   ├── AnnotationNewLineRule.kt
│       │   │                   │   │   ├── BlockStructureBraces.kt
│       │   │                   │   │   ├── BooleanExpressionsRule.kt
│       │   │                   │   │   ├── BracesInConditionalsAndLoopsRule.kt
│       │   │                   │   │   ├── ClassLikeStructuresOrderRule.kt
│       │   │                   │   │   ├── CollapseIfStatementsRule.kt
│       │   │                   │   │   ├── ConsecutiveSpacesRule.kt
│       │   │                   │   │   ├── DebugPrintRule.kt
│       │   │                   │   │   ├── EmptyBlock.kt
│       │   │                   │   │   ├── EnumsSeparated.kt
│       │   │                   │   │   ├── LineLength.kt
│       │   │                   │   │   ├── LongNumericalValuesSeparatedRule.kt
│       │   │                   │   │   ├── MagicNumberRule.kt
│       │   │                   │   │   ├── MultipleModifiersSequence.kt
│       │   │                   │   │   ├── NullableTypeRule.kt
│       │   │                   │   │   ├── PreviewAnnotationRule.kt
│       │   │                   │   │   ├── RangeConventionalRule.kt
│       │   │                   │   │   ├── SingleLineStatementsRule.kt
│       │   │                   │   │   ├── SortRule.kt
│       │   │                   │   │   ├── StringConcatenationRule.kt
│       │   │                   │   │   ├── StringTemplateFormatRule.kt
│       │   │                   │   │   ├── TrailingCommaRule.kt
│       │   │                   │   │   ├── WhenMustHaveElseRule.kt
│       │   │                   │   │   ├── files/
│       │   │                   │   │   │   ├── BlankLinesRule.kt
│       │   │                   │   │   │   ├── FileSize.kt
│       │   │                   │   │   │   ├── FileStructureRule.kt
│       │   │                   │   │   │   ├── IndentationAmount.kt
│       │   │                   │   │   │   ├── IndentationAware.kt
│       │   │                   │   │   │   ├── IndentationConfigAware.kt
│       │   │                   │   │   │   ├── IndentationError.kt
│       │   │                   │   │   │   ├── IndentationRule.kt
│       │   │                   │   │   │   ├── IndentedElementType.kt
│       │   │                   │   │   │   ├── NewlinesRule.kt
│       │   │                   │   │   │   ├── SemicolonsRule.kt
│       │   │                   │   │   │   ├── TopLevelOrderRule.kt
│       │   │                   │   │   │   └── WhiteSpaceRule.kt
│       │   │                   │   │   └── identifiers/
│       │   │                   │   │       └── LocalVariablesRule.kt
│       │   │                   │   ├── chapter4/
│       │   │                   │   │   ├── ImmutableValNoVarRule.kt
│       │   │                   │   │   ├── NullChecksRule.kt
│       │   │                   │   │   ├── SmartCastRule.kt
│       │   │                   │   │   ├── TypeAliasRule.kt
│       │   │                   │   │   ├── VariableGenericTypeDeclarationRule.kt
│       │   │                   │   │   └── calculations/
│       │   │                   │   │       └── AccurateCalculationsRule.kt
│       │   │                   │   ├── chapter5/
│       │   │                   │   │   ├── AsyncAndSyncRule.kt
│       │   │                   │   │   ├── AvoidNestedFunctionsRule.kt
│       │   │                   │   │   ├── CheckInverseMethodRule.kt
│       │   │                   │   │   ├── CustomLabel.kt
│       │   │                   │   │   ├── FunctionArgumentsSize.kt
│       │   │                   │   │   ├── FunctionLength.kt
│       │   │                   │   │   ├── LambdaLengthRule.kt
│       │   │                   │   │   ├── LambdaParameterOrder.kt
│       │   │                   │   │   ├── NestedFunctionBlock.kt
│       │   │                   │   │   ├── OverloadingArgumentsFunction.kt
│       │   │                   │   │   └── ParameterNameInOuterLambdaRule.kt
│       │   │                   │   └── chapter6/
│       │   │                   │       ├── AvoidEmptyPrimaryConstructor.kt
│       │   │                   │       ├── AvoidUtilityClass.kt
│       │   │                   │       ├── CustomGetterSetterRule.kt
│       │   │                   │       ├── ExtensionFunctionsInFileRule.kt
│       │   │                   │       ├── ExtensionFunctionsSameNameRule.kt
│       │   │                   │       ├── ImplicitBackingPropertyRule.kt
│       │   │                   │       ├── PropertyAccessorFields.kt
│       │   │                   │       ├── RunInScript.kt
│       │   │                   │       ├── TrivialPropertyAccessors.kt
│       │   │                   │       ├── UseLastIndex.kt
│       │   │                   │       ├── UselessSupertype.kt
│       │   │                   │       └── classes/
│       │   │                   │           ├── AbstractClassesRule.kt
│       │   │                   │           ├── CompactInitialization.kt
│       │   │                   │           ├── DataClassesRule.kt
│       │   │                   │           ├── InlineClassesRule.kt
│       │   │                   │           ├── SingleConstructorRule.kt
│       │   │                   │           ├── SingleInitRule.kt
│       │   │                   │           └── StatelessClassesRule.kt
│       │   │                   └── utils/
│       │   │                       ├── AstConstants.kt
│       │   │                       ├── AstNodeUtils.kt
│       │   │                       ├── AstNodeUtilsFromKtLint.kt
│       │   │                       ├── FileUtils.kt
│       │   │                       ├── FunctionAstNodeUtils.kt
│       │   │                       ├── KdocUtils.kt
│       │   │                       ├── KotlinParseException.kt
│       │   │                       ├── KotlinParser.kt
│       │   │                       ├── PositionInTextLocator.kt
│       │   │                       ├── PsiUtils.kt
│       │   │                       ├── StringCaseUtils.kt
│       │   │                       ├── StringUtils.kt
│       │   │                       ├── indentation/
│       │   │                       │   ├── Checkers.kt
│       │   │                       │   ├── CustomIndentationChecker.kt
│       │   │                       │   └── IndentationConfig.kt
│       │   │                       └── search/
│       │   │                           ├── VariablesSearch.kt
│       │   │                           ├── VariablesWithAssignmentSearch.kt
│       │   │                           └── VariablesWithUsagesSearch.kt
│       │   └── resources/
│       │       ├── diktat-analysis-huawei.yml
│       │       └── diktat-analysis.yml
│       └── test/
│           ├── kotlin/
│           │   └── com/
│           │       └── saveourtool/
│           │           └── diktat/
│           │               ├── ruleset/
│           │               │   ├── chapter1/
│           │               │   │   ├── EnumValueCaseTest.kt
│           │               │   │   ├── IdentifierNamingFixTest.kt
│           │               │   │   ├── IdentifierNamingWarnTest.kt
│           │               │   │   ├── MethodNamingWarnTest.kt
│           │               │   │   ├── PackageNamingFixTest.kt
│           │               │   │   ├── PackageNamingWarnTest.kt
│           │               │   │   └── PackagePathFixTest.kt
│           │               │   ├── chapter2/
│           │               │   │   ├── CommentsFormattingFixTest.kt
│           │               │   │   ├── CommentsFormattingTest.kt
│           │               │   │   ├── HeaderCommentRuleFixTest.kt
│           │               │   │   ├── HeaderCommentRuleTest.kt
│           │               │   │   ├── KdocCommentsFixTest.kt
│           │               │   │   ├── KdocCommentsWarnTest.kt
│           │               │   │   ├── KdocFormattingFixTest.kt
│           │               │   │   ├── KdocFormattingTest.kt
│           │               │   │   ├── KdocMethodsFixTest.kt
│           │               │   │   ├── KdocMethodsTest.kt
│           │               │   │   ├── KdocParamPresentWarnTest.kt
│           │               │   │   └── comments/
│           │               │   │       └── CommentedCodeTest.kt
│           │               │   ├── chapter3/
│           │               │   │   ├── AnnotationNewLineRuleFixTest.kt
│           │               │   │   ├── AnnotationNewLineRuleWarnTest.kt
│           │               │   │   ├── BlockStructureBracesFixTest.kt
│           │               │   │   ├── BlockStructureBracesWarnTest.kt
│           │               │   │   ├── BooleanExpressionsRuleFixTest.kt
│           │               │   │   ├── BooleanExpressionsRuleWarnTest.kt
│           │               │   │   ├── BracesRuleFixTest.kt
│           │               │   │   ├── BracesRuleWarnTest.kt
│           │               │   │   ├── ClassLikeStructuresOrderFixTest.kt
│           │               │   │   ├── ClassLikeStructuresOrderRuleWarnTest.kt
│           │               │   │   ├── CollapseIfStatementsRuleFixTest.kt
│           │               │   │   ├── CollapseIfStatementsRuleWarnTest.kt
│           │               │   │   ├── ConsecutiveSpacesRuleFixTest.kt
│           │               │   │   ├── ConsecutiveSpacesRuleWarnTest.kt
│           │               │   │   ├── DebugPrintRuleWarnTest.kt
│           │               │   │   ├── EmptyBlockFixTest.kt
│           │               │   │   ├── EmptyBlockWarnTest.kt
│           │               │   │   ├── EnumsSeparatedFixTest.kt
│           │               │   │   ├── EnumsSeparatedWarnTest.kt
│           │               │   │   ├── FileSizeWarnTest.kt
│           │               │   │   ├── FileStructureRuleFixTest.kt
│           │               │   │   ├── FileStructureRuleTest.kt
│           │               │   │   ├── LineLengthFixTest.kt
│           │               │   │   ├── LineLengthWarnTest.kt
│           │               │   │   ├── LocalVariablesWarnTest.kt
│           │               │   │   ├── LongNumericalValuesSeparatedFixTest.kt
│           │               │   │   ├── LongNumericalValuesSeparatedWarnTest.kt
│           │               │   │   ├── MagicNumberRuleWarnTest.kt
│           │               │   │   ├── MultipleModifiersSequenceFixTest.kt
│           │               │   │   ├── MultipleModifiersSequenceWarnTest.kt
│           │               │   │   ├── NullableTypeRuleFixTest.kt
│           │               │   │   ├── NullableTypeRuleWarnTest.kt
│           │               │   │   ├── PreviewAnnotationFixTest.kt
│           │               │   │   ├── PreviewAnnotationWarnTest.kt
│           │               │   │   ├── RangeConventionalRuleFixTest.kt
│           │               │   │   ├── RangeConventionalRuleWarnTest.kt
│           │               │   │   ├── SingleLineStatementsRuleFixTest.kt
│           │               │   │   ├── SingleLineStatementsRuleWarnTest.kt
│           │               │   │   ├── SortRuleFixTest.kt
│           │               │   │   ├── SortRuleWarnTest.kt
│           │               │   │   ├── StringConcatenationRuleFixTest.kt
│           │               │   │   ├── StringConcatenationWarnTest.kt
│           │               │   │   ├── StringTemplateRuleFixTest.kt
│           │               │   │   ├── StringTemplateRuleWarnTest.kt
│           │               │   │   ├── SuperClassListWarnTest.kt
│           │               │   │   ├── TrailingCommaFixTest.kt
│           │               │   │   ├── TrailingCommaWarnTest.kt
│           │               │   │   ├── WhenMustHaveElseFixTest.kt
│           │               │   │   ├── WhenMustHaveElseWarnTest.kt
│           │               │   │   ├── files/
│           │               │   │   │   ├── BlankLinesFixTest.kt
│           │               │   │   │   ├── BlankLinesWarnTest.kt
│           │               │   │   │   ├── NewlinesRuleFixTest.kt
│           │               │   │   │   ├── NewlinesRuleWarnTest.kt
│           │               │   │   │   ├── SemicolonsRuleFixTest.kt
│           │               │   │   │   ├── SemicolonsRuleWarnTest.kt
│           │               │   │   │   ├── TopLevelOrderRuleFixTest.kt
│           │               │   │   │   └── TopLevelOrderRuleWarnTest.kt
│           │               │   │   └── spaces/
│           │               │   │       ├── ExpectedIndentationError.kt
│           │               │   │       ├── IndentationConfigAwareTest.kt
│           │               │   │       ├── IndentationConfigFactory.kt
│           │               │   │       ├── IndentationRuleFixTest.kt
│           │               │   │       ├── IndentationRuleTest.kt
│           │               │   │       ├── IndentationRuleTestSuite.kt
│           │               │   │       ├── IndentationRuleTestUtils.kt
│           │               │   │       ├── IndentationRuleWarnTest.kt
│           │               │   │       ├── WhiteSpaceRuleFixTest.kt
│           │               │   │       ├── WhiteSpaceRuleWarnTest.kt
│           │               │   │       └── junit/
│           │               │   │           ├── IndentationTest.kt
│           │               │   │           ├── IndentationTestExtension.kt
│           │               │   │           ├── IndentationTestFixExtension.kt
│           │               │   │           ├── IndentationTestFixInvocationContext.kt
│           │               │   │           ├── IndentationTestInput.kt
│           │               │   │           ├── IndentationTestInvocationContext.kt
│           │               │   │           ├── IndentationTestInvocationContextProvider.kt
│           │               │   │           ├── IndentationTestWarnExtension.kt
│           │               │   │           ├── IndentationTestWarnInvocationContext.kt
│           │               │   │           └── IndentedSourceCode.kt
│           │               │   ├── chapter4/
│           │               │   │   ├── AccurateCalculationsWarnTest.kt
│           │               │   │   ├── NoVarRuleWarnTest.kt
│           │               │   │   ├── NullChecksRuleFixTest.kt
│           │               │   │   ├── NullChecksRuleWarnTest.kt
│           │               │   │   ├── SmartCastRuleFixTest.kt
│           │               │   │   ├── SmartCastRuleWarnTest.kt
│           │               │   │   ├── TypeAliasRuleWarnTest.kt
│           │               │   │   ├── VariableGenericTypeDeclarationRuleFixTest.kt
│           │               │   │   └── VariableGenericTypeDeclarationRuleWarnTest.kt
│           │               │   ├── chapter5/
│           │               │   │   ├── AsyncAndSyncRuleTest.kt
│           │               │   │   ├── AvoidNestedFunctionsFixTest.kt
│           │               │   │   ├── AvoidNestedFunctionsWarnTest.kt
│           │               │   │   ├── CheckInverseMethodRuleFixTest.kt
│           │               │   │   ├── CheckInverseMethodRuleWarnTest.kt
│           │               │   │   ├── CustomLabelsTest.kt
│           │               │   │   ├── FunctionArgumentsSizeWarnTest.kt
│           │               │   │   ├── FunctionLengthWarnTest.kt
│           │               │   │   ├── LambdaLengthWarnTest.kt
│           │               │   │   ├── LambdaParameterOrderWarnTest.kt
│           │               │   │   ├── NestedFunctionBlockWarnTest.kt
│           │               │   │   ├── OverloadingArgumentsFunctionWarnTest.kt
│           │               │   │   └── ParameterNameInOuterLambdaRuleWarnTest.kt
│           │               │   ├── chapter6/
│           │               │   │   ├── AbstractClassesFixTest.kt
│           │               │   │   ├── AbstractClassesWarnTest.kt
│           │               │   │   ├── AvoidUtilityClassWarnTest.kt
│           │               │   │   ├── CompactInitializationFixTest.kt
│           │               │   │   ├── CompactInitializationWarnTest.kt
│           │               │   │   ├── CustomGetterSetterWarnTest.kt
│           │               │   │   ├── DataClassesRuleWarnTest.kt
│           │               │   │   ├── EmptyPrimaryConstructorFixTest.kt
│           │               │   │   ├── EmptyPrimaryConstructorWarnTest.kt
│           │               │   │   ├── ExtensionFunctionsInFileWarnTest.kt
│           │               │   │   ├── ExtensionFunctionsSameNameWarnTest.kt
│           │               │   │   ├── ImplicitBackingPropertyWarnTest.kt
│           │               │   │   ├── InlineClassesWarnTest.kt
│           │               │   │   ├── PropertyAccessorFieldsWarnTest.kt
│           │               │   │   ├── RunInScriptFixTest.kt
│           │               │   │   ├── RunInScriptWarnTest.kt
│           │               │   │   ├── SingleConstructorRuleFixTest.kt
│           │               │   │   ├── SingleConstructorRuleWarnTest.kt
│           │               │   │   ├── SingleInitRuleFixTest.kt
│           │               │   │   ├── SingleInitRuleWarnTest.kt
│           │               │   │   ├── StatelessClassesRuleFixTest.kt
│           │               │   │   ├── StatelessClassesRuleWarnTest.kt
│           │               │   │   ├── TrivialPropertyAccessorsFixTest.kt
│           │               │   │   ├── TrivialPropertyAccessorsWarnTest.kt
│           │               │   │   ├── UseLastIndexFixTest.kt
│           │               │   │   ├── UseLastIndexWarnTest.kt
│           │               │   │   ├── UselessSupertypeFixTest.kt
│           │               │   │   └── UselessSupertypeWarnTest.kt
│           │               │   ├── config/
│           │               │   │   └── DiktatRuleConfigYamlReaderTest.kt
│           │               │   ├── junit/
│           │               │   │   ├── BooleanOrDefault.kt
│           │               │   │   ├── CloseablePath.kt
│           │               │   │   ├── ExpectedLintError.kt
│           │               │   │   ├── ExpectedLintErrors.kt
│           │               │   │   ├── NaturalDisplayName.kt
│           │               │   │   └── RuleInvocationContextProvider.kt
│           │               │   ├── smoke/
│           │               │   │   └── RulesConfigValidationTest.kt
│           │               │   └── utils/
│           │               │       ├── AstNodeUtilsTest.kt
│           │               │       ├── AvailableRulesDocTest.kt
│           │               │       ├── FunctionAstNodeUtilsTest.kt
│           │               │       ├── KotlinParserTest.kt
│           │               │       ├── RulesConfigYamlTest.kt
│           │               │       ├── StringCaseUtilsTest.kt
│           │               │       ├── SuppressAnnotatedExpressionTest.kt
│           │               │       ├── SuppressTest.kt
│           │               │       ├── VariablesSearchTest.kt
│           │               │       ├── VariablesWithAssignmentsSearchTest.kt
│           │               │       ├── VariablesWithUsagesSearchTest.kt
│           │               │       └── WarningsGenerationTest.kt
│           │               └── util/
│           │                   ├── DiktatRuleSetFactoryImplTest.kt
│           │                   ├── DiktatRuleTest.kt
│           │                   ├── FixTestBase.kt
│           │                   ├── LintTestBase.kt
│           │                   ├── SuppressingTest.kt
│           │                   └── TestUtils.kt
│           └── resources/
│               ├── log4j2.properties
│               ├── test/
│               │   ├── chapter6/
│               │   │   ├── abstract_classes/
│               │   │   │   ├── ShouldReplaceAbstractKeywordExpected.kt
│               │   │   │   └── ShouldReplaceAbstractKeywordTest.kt
│               │   │   ├── classes/
│               │   │   │   ├── AssignmentWithLocalPropertyExpected.kt
│               │   │   │   ├── AssignmentWithLocalPropertyTest.kt
│               │   │   │   ├── ConstructorShouldKeepExpressionsOrderExpected.kt
│               │   │   │   ├── ConstructorShouldKeepExpressionsOrderTest.kt
│               │   │   │   ├── ConstructorWithCommentsExpected.kt
│               │   │   │   ├── ConstructorWithCommentsTest.kt
│               │   │   │   ├── ConstructorWithComplexAssignmentsExpected.kt
│               │   │   │   ├── ConstructorWithComplexAssignmentsTest.kt
│               │   │   │   ├── ConstructorWithCustomAssignmentsExpected.kt
│               │   │   │   ├── ConstructorWithCustomAssignmentsTest.kt
│               │   │   │   ├── ConstructorWithInitExpected.kt
│               │   │   │   ├── ConstructorWithInitTest.kt
│               │   │   │   ├── ConstructorWithModifiersExpected.kt
│               │   │   │   ├── ConstructorWithModifiersTest.kt
│               │   │   │   ├── SimpleConstructorExpected.kt
│               │   │   │   └── SimpleConstructorTest.kt
│               │   │   ├── compact_initialization/
│               │   │   │   ├── ApplyOnStatementsWithThisKeywordExpected.kt
│               │   │   │   ├── ApplyOnStatementsWithThisKeywordTest.kt
│               │   │   │   ├── ApplyWithValueArgumentExpected.kt
│               │   │   │   ├── ApplyWithValueArgumentTest.kt
│               │   │   │   ├── ExampleWithCommentsExpected.kt
│               │   │   │   ├── ExampleWithCommentsTest.kt
│               │   │   │   ├── ParenthesizedReceiverExpected.kt
│               │   │   │   ├── ParenthesizedReceiverTest.kt
│               │   │   │   ├── SimpleExampleExpected.kt
│               │   │   │   ├── SimpleExampleTest.kt
│               │   │   │   ├── StatementUseFieldMultipleTimesExpected.kt
│               │   │   │   └── StatementUseFieldMultipleTimesTest.kt
│               │   │   ├── init_blocks/
│               │   │   │   ├── InitBlockWithAssignmentsExpected.kt
│               │   │   │   ├── InitBlockWithAssignmentsTest.kt
│               │   │   │   ├── InitBlocksExpected.kt
│               │   │   │   ├── InitBlocksTest.kt
│               │   │   │   ├── InitBlocksWithAssignmentsExpected.kt
│               │   │   │   └── InitBlocksWithAssignmentsTest.kt
│               │   │   ├── lastIndex_change/
│               │   │   │   ├── IncorrectUseLengthMinusOneExpected.kt
│               │   │   │   ├── IncorrectUseLengthMinusOneTest.kt
│               │   │   │   ├── UseAnyWhiteSpacesExpected.kt
│               │   │   │   └── UseAnyWhiteSpacesTest.kt
│               │   │   ├── primary_constructor/
│               │   │   │   ├── EmptyPCExpected.kt
│               │   │   │   └── EmptyPCTest.kt
│               │   │   ├── properties/
│               │   │   │   ├── TrivialPropertyAccessorsExpected.kt
│               │   │   │   └── TrivialPropertyAccessorsTest.kt
│               │   │   ├── script/
│               │   │   │   ├── SimpleRunInScriptExpected.kts
│               │   │   │   └── SimpleRunInScriptTest.kts
│               │   │   └── stateless_classes/
│               │   │       ├── StatelessClassExpected.kt
│               │   │       └── StatelessClassTest.kt
│               │   ├── paragraph1/
│               │   │   └── naming/
│               │   │       ├── class_/
│               │   │       │   ├── IncorrectClassNameExpected.kt
│               │   │       │   └── IncorrectClassNameTest.kt
│               │   │       ├── enum_/
│               │   │       │   ├── EnumValuePascalCaseExpected.kt
│               │   │       │   ├── EnumValuePascalCaseTest.kt
│               │   │       │   ├── EnumValueSnakeCaseExpected.kt
│               │   │       │   └── EnumValueSnakeCaseTest.kt
│               │   │       ├── file/
│               │   │       │   ├── fileNameTest.kt
│               │   │       │   └── file_nameTest.kt
│               │   │       ├── function/
│               │   │       │   ├── FunctionNameExpected.kt
│               │   │       │   └── FunctionNameTest.kt
│               │   │       ├── generic/
│               │   │       │   ├── GenericFunctionExpected.kt
│               │   │       │   └── GenericFunctionTest.kt
│               │   │       ├── identifiers/
│               │   │       │   ├── ConstantValNameExpected.kt
│               │   │       │   ├── ConstantValNameTest.kt
│               │   │       │   ├── IdentifierNameRegressionExpected.kt
│               │   │       │   ├── IdentifierNameRegressionTest.kt
│               │   │       │   ├── LambdaArgExpected.kt
│               │   │       │   ├── LambdaArgTest.kt
│               │   │       │   ├── PrefixInNameExpected.kt
│               │   │       │   ├── PrefixInNameTest.kt
│               │   │       │   ├── PropertyInKdocExpected.kt
│               │   │       │   ├── PropertyInKdocTest.kt
│               │   │       │   ├── TypeAliasNameExpected.kt
│               │   │       │   ├── TypeAliasNameTest.kt
│               │   │       │   ├── VariableNamingExpected.kt
│               │   │       │   └── VariableNamingTest.kt
│               │   │       ├── object_/
│               │   │       │   ├── IncorrectObjectNameExpected.kt
│               │   │       │   └── IncorrectObjectNameTest.kt
│               │   │       └── package/
│               │   │           ├── FixUnderscoreExpected.kt
│               │   │           ├── FixUnderscoreTest.kt
│               │   │           ├── FixUpperExpected.kt
│               │   │           ├── FixUpperTest.kt
│               │   │           ├── MissingDomainNameExpected.kt
│               │   │           ├── MissingDomainNameTest.kt
│               │   │           └── src/
│               │   │               └── main/
│               │   │                   └── kotlin/
│               │   │                       ├── com/
│               │   │                       │   └── saveourtool/
│               │   │                       │       └── diktat/
│               │   │                       │           └── some/
│               │   │                       │               └── name/
│               │   │                       │                   ├── FixIncorrectExpected.kt
│               │   │                       │                   ├── FixIncorrectTest.kt
│               │   │                       │                   ├── FixMissingExpected.kt
│               │   │                       │                   ├── FixMissingTest.kt
│               │   │                       │                   ├── FixMissingWithAnnotationExpected.kt
│               │   │                       │                   ├── FixMissingWithAnnotationExpected2.kt
│               │   │                       │                   ├── FixMissingWithAnnotationExpected3.kt
│               │   │                       │                   ├── FixMissingWithAnnotationTest.kt
│               │   │                       │                   ├── FixMissingWithAnnotationTest2.kt
│               │   │                       │                   ├── FixMissingWithAnnotationTest3.kt
│               │   │                       │                   ├── FixMissingWithoutImportExpected.kt
│               │   │                       │                   ├── FixMissingWithoutImportTest.kt
│               │   │                       │                   ├── FixPackageRegressionExpected.kt
│               │   │                       │                   └── FixPackageRegressionTest.kt
│               │   │                       └── some/
│               │   │                           ├── FixIncorrectExpected.kt
│               │   │                           ├── FixIncorrectTest.kt
│               │   │                           ├── FixMissingExpected.kt
│               │   │                           └── FixMissingTest.kt
│               │   ├── paragraph2/
│               │   │   ├── header/
│               │   │   │   ├── AutoCopyrightApplyPatternExpected.kt
│               │   │   │   ├── AutoCopyrightApplyPatternTest.kt
│               │   │   │   ├── AutoCopyrightExpected.kt
│               │   │   │   ├── AutoCopyrightTest.kt
│               │   │   │   ├── CopyrightAbsentInvalidPatternExpected.kt
│               │   │   │   ├── CopyrightAbsentInvalidPatternTest.kt
│               │   │   │   ├── CopyrightDifferentYearExpected.kt
│               │   │   │   ├── CopyrightDifferentYearExpected2.kt
│               │   │   │   ├── CopyrightDifferentYearTest.kt
│               │   │   │   ├── CopyrightDifferentYearTest2.kt
│               │   │   │   ├── CopyrightInvalidPatternValidCodeExpected.kt
│               │   │   │   ├── CopyrightInvalidPatternValidCodeTest.kt
│               │   │   │   ├── CopyrightShouldNotTriggerNPEExpected.kt
│               │   │   │   ├── CopyrightShouldNotTriggerNPETest.kt
│               │   │   │   ├── MisplacedHeaderKdocAppendedCopyrightExpected.kt
│               │   │   │   ├── MisplacedHeaderKdocAppendedCopyrightTest.kt
│               │   │   │   ├── MisplacedHeaderKdocExpected.kt
│               │   │   │   ├── MisplacedHeaderKdocNoCopyrightExpected.kt
│               │   │   │   ├── MisplacedHeaderKdocNoCopyrightTest.kt
│               │   │   │   ├── MisplacedHeaderKdocTest.kt
│               │   │   │   ├── MultilineCopyrightExample.kt
│               │   │   │   ├── MultilineCopyrightNotTriggerExample.kt
│               │   │   │   ├── MultilineCopyrightNotTriggerTest.kt
│               │   │   │   ├── MultilineCopyrightTest.kt
│               │   │   │   ├── NewlineAfterHeaderKdocExpected.kt
│               │   │   │   └── NewlineAfterHeaderKdocTest.kt
│               │   │   └── kdoc/
│               │   │       ├── BasicTagsEmptyLineBeforeExpected.kt
│               │   │       ├── BasicTagsEmptyLineBeforeTest.kt
│               │   │       ├── BasicTagsEmptyLinesExpected.kt
│               │   │       ├── BasicTagsEmptyLinesTest.kt
│               │   │       ├── ConstructorCommentExpected.kt
│               │   │       ├── ConstructorCommentNewlineExpected.kt
│               │   │       ├── ConstructorCommentNewlineTest.kt
│               │   │       ├── ConstructorCommentNoKDocExpected.kt
│               │   │       ├── ConstructorCommentNoKDocTest.kt
│               │   │       ├── ConstructorCommentPropertiesExpected.kt
│               │   │       ├── ConstructorCommentPropertiesTest.kt
│               │   │       ├── ConstructorCommentTest.kt
│               │   │       ├── DeprecatedTagExpected.kt
│               │   │       ├── DeprecatedTagTest.kt
│               │   │       ├── KdocBlockCommentExpected.kt
│               │   │       ├── KdocBlockCommentTest.kt
│               │   │       ├── KdocCodeBlockFormattingExampleExpected.kt
│               │   │       ├── KdocCodeBlockFormattingExampleTest.kt
│               │   │       ├── KdocCodeBlocksFormattingExpected.kt
│               │   │       ├── KdocCodeBlocksFormattingTest.kt
│               │   │       ├── KdocEmptyLineExpected.kt
│               │   │       ├── KdocEmptyLineTest.kt
│               │   │       ├── KdocFormattingFullExpected.kt
│               │   │       ├── KdocFormattingFullTest.kt
│               │   │       ├── KdocFormattingOrderExpected.kt
│               │   │       ├── KdocFormattingOrderTest.kt
│               │   │       ├── NoPackageNoImportExpected.kt
│               │   │       ├── NoPackageNoImportTest.kt
│               │   │       ├── OrderedTagsAssertionExpected.kt
│               │   │       ├── OrderedTagsAssertionTest.kt
│               │   │       ├── OrderedTagsExpected.kt
│               │   │       ├── OrderedTagsTest.kt
│               │   │       ├── SpacesAfterTagExpected.kt
│               │   │       ├── SpacesAfterTagTest.kt
│               │   │       ├── SpecialTagsInKdocExpected.kt
│               │   │       ├── SpecialTagsInKdocTest.kt
│               │   │       └── package/
│               │   │           └── src/
│               │   │               └── main/
│               │   │                   └── kotlin/
│               │   │                       └── com/
│               │   │                           └── saveourtool/
│               │   │                               └── diktat/
│               │   │                                   └── kdoc/
│               │   │                                       └── methods/
│               │   │                                           ├── EmptyKdocExpected.kt
│               │   │                                           ├── EmptyKdocTested.kt
│               │   │                                           ├── KdocMethodsFullExpected.kt
│               │   │                                           ├── KdocMethodsFullTested.kt
│               │   │                                           ├── KdocWithoutThrowsTagExpected.kt
│               │   │                                           ├── KdocWithoutThrowsTagTested.kt
│               │   │                                           ├── MissingKdocExpected.kt
│               │   │                                           ├── MissingKdocOnFunctionExpected.kt
│               │   │                                           ├── MissingKdocOnFunctionTest.kt
│               │   │                                           ├── MissingKdocTested.kt
│               │   │                                           ├── MissingKdocWithModifiersExpected.kt
│               │   │                                           ├── MissingKdocWithModifiersTest.kt
│               │   │                                           ├── ParamTagInsertionExpected.kt
│               │   │                                           ├── ParamTagInsertionTested.kt
│               │   │                                           ├── ReturnTagInsertionExpected.kt
│               │   │                                           ├── ReturnTagInsertionTested.kt
│               │   │                                           ├── ThrowsTagInsertionExpected.kt
│               │   │                                           └── ThrowsTagInsertionTested.kt
│               │   ├── paragraph3/
│               │   │   ├── annotations/
│               │   │   │   ├── AnnotationCommentExpected.kt
│               │   │   │   ├── AnnotationCommentTest.kt
│               │   │   │   ├── AnnotationConstructorSingleLineExpected.kt
│               │   │   │   ├── AnnotationConstructorSingleLineTest.kt
│               │   │   │   ├── AnnotationSingleLineExpected.kt
│               │   │   │   └── AnnotationSingleLineTest.kt
│               │   │   ├── blank_lines/
│               │   │   │   ├── CodeBlockWithBlankLinesExpected.kt
│               │   │   │   ├── CodeBlockWithBlankLinesTest.kt
│               │   │   │   ├── RedundantBlankLinesAtTheEndOfBlockExpected.kt
│               │   │   │   ├── RedundantBlankLinesAtTheEndOfBlockTest.kt
│               │   │   │   ├── RedundantBlankLinesExpected.kt
│               │   │   │   └── RedundantBlankLinesTest.kt
│               │   │   ├── block_brace/
│               │   │   │   ├── ClassBracesExpected.kt
│               │   │   │   ├── ClassBracesTest.kt
│               │   │   │   ├── DoWhileBracesExpected.kt
│               │   │   │   ├── DoWhileBracesTest.kt
│               │   │   │   ├── IfElseBracesExpected.kt
│               │   │   │   ├── IfElseBracesTest.kt
│               │   │   │   ├── LoopsBracesExpected.kt
│               │   │   │   ├── LoopsBracesTest.kt
│               │   │   │   ├── TryBraceExpected.kt
│               │   │   │   ├── TryBraceTest.kt
│               │   │   │   ├── WhenBranchesExpected.kt
│               │   │   │   └── WhenBranchesTest.kt
│               │   │   ├── boolean_expressions/
│               │   │   │   ├── BooleanExpressionsExpected.kt
│               │   │   │   ├── BooleanExpressionsTest.kt
│               │   │   │   ├── DistributiveLawExpected.kt
│               │   │   │   ├── DistributiveLawTest.kt
│               │   │   │   ├── ExpressionSimplificationExpected.kt
│               │   │   │   ├── ExpressionSimplificationTest.kt
│               │   │   │   ├── NegativeExpressionExpected.kt
│               │   │   │   ├── NegativeExpressionTest.kt
│               │   │   │   ├── OrderIssueExpected.kt
│               │   │   │   ├── OrderIssueTest.kt
│               │   │   │   ├── SameExpressionsInConditionExpected.kt
│               │   │   │   ├── SameExpressionsInConditionTest.kt
│               │   │   │   ├── SubstitutionIssueExpected.kt
│               │   │   │   └── SubstitutionIssueTest.kt
│               │   │   ├── braces/
│               │   │   │   ├── DoWhileBracesExpected.kt
│               │   │   │   ├── DoWhileBracesTest.kt
│               │   │   │   ├── IfElseBraces1Expected.kt
│               │   │   │   ├── IfElseBraces1Test.kt
│               │   │   │   ├── IfElseBracesInsideScopeFunctionsExpected.kt
│               │   │   │   ├── IfElseBracesInsideScopeFunctionsTest.kt
│               │   │   │   ├── LoopsBracesExpected.kt
│               │   │   │   ├── LoopsBracesInsideScopeFunctionsExpected.kt
│               │   │   │   ├── LoopsBracesInsideScopeFunctionsTest.kt
│               │   │   │   ├── LoopsBracesTest.kt
│               │   │   │   ├── WhenBranchesExpected.kt
│               │   │   │   └── WhenBranchesTest.kt
│               │   │   ├── collapse_if/
│               │   │   │   ├── CollapseIfStatementsExpected.kt
│               │   │   │   └── CollapseIfStatementsTest.kt
│               │   │   ├── else_expected/
│               │   │   │   ├── ElseInWhenExpected.kt
│               │   │   │   └── ElseInWhenTest.kt
│               │   │   ├── empty_block/
│               │   │   │   ├── EmptyBlockExpected.kt
│               │   │   │   └── EmptyBlockTest.kt
│               │   │   ├── enum_separated/
│               │   │   │   ├── EnumSeparatedExpected.kt
│               │   │   │   ├── EnumSeparatedTest.kt
│               │   │   │   ├── LastElementCommentExpected.kt
│               │   │   │   └── LastElementCommentTest.kt
│               │   │   ├── file_structure/
│               │   │   │   ├── BlankLinesBetweenBlocksExpected.kt
│               │   │   │   ├── CompanionObjectWithCommentExpected.kt
│               │   │   │   ├── CompanionObjectWithCommentTest.kt
│               │   │   │   ├── CopyrightCommentPositionExpected.kt
│               │   │   │   ├── CopyrightCommentPositionTest.kt
│               │   │   │   ├── DeclarationsInClassOrderExpected.kt
│               │   │   │   ├── DeclarationsInClassOrderTest.kt
│               │   │   │   ├── DefaultPackageWithImportsExpected.kt
│               │   │   │   ├── DefaultPackageWithImportsTest.kt
│               │   │   │   ├── FileAnnotationExpected.kt
│               │   │   │   ├── FileAnnotationTest.kt
│               │   │   │   ├── HeaderKdocAfterPackageExpected.kt
│               │   │   │   ├── HeaderKdocAfterPackageTest.kt
│               │   │   │   ├── LoggerOrderExpected.kt
│               │   │   │   ├── LoggerOrderTest.kt
│               │   │   │   ├── MissingBlankLinesBetweenBlocksTest.kt
│               │   │   │   ├── NoImportNoPackageExpected.kt
│               │   │   │   ├── NoImportNoPackageTest.kt
│               │   │   │   ├── OrderWithCommentExpected.kt
│               │   │   │   ├── OrderWithCommentTest.kt
│               │   │   │   ├── OrderWithEnumsExpected.kt
│               │   │   │   ├── OrderWithEnumsTest.kt
│               │   │   │   ├── OtherCommentsExpected.kt
│               │   │   │   ├── OtherCommentsTest.kt
│               │   │   │   ├── RedundantBlankLinesBetweenBlocksTest.kt
│               │   │   │   ├── ReorderingImportsExpected.kt
│               │   │   │   ├── ReorderingImportsRecommendedExpected.kt
│               │   │   │   ├── ReorderingImportsRecommendedTest.kt
│               │   │   │   ├── ReorderingImportsTest.kt
│               │   │   │   ├── ScriptPackageDirectiveExpected.kts
│               │   │   │   └── ScriptPackageDirectiveTest.kts
│               │   │   ├── indentation/
│               │   │   │   ├── ConstructorExpected.kt
│               │   │   │   ├── ConstructorTest.kt
│               │   │   │   ├── IndentFullExpected.kt
│               │   │   │   ├── IndentFullTest.kt
│               │   │   │   ├── IndentationFull1Expected.kt
│               │   │   │   ├── IndentationFull1Test.kt
│               │   │   │   ├── IndentationParametersExpected.kt
│               │   │   │   └── IndentationParametersTest.kt
│               │   │   ├── long_line/
│               │   │   │   ├── LongBinaryExpressionExpected.kt
│               │   │   │   ├── LongBinaryExpressionLastWordExpected.kt
│               │   │   │   ├── LongBinaryExpressionLastWordTest.kt
│               │   │   │   ├── LongBinaryExpressionTest.kt
│               │   │   │   ├── LongComplexExpressionExpected.kt
│               │   │   │   ├── LongComplexExpressionTest.kt
│               │   │   │   ├── LongConditionInSmallFunctionExpected.kt
│               │   │   │   ├── LongConditionInSmallFunctionTest.kt
│               │   │   │   ├── LongDotQualifiedExpressionExpected.kt
│               │   │   │   ├── LongDotQualifiedExpressionTest.kt
│               │   │   │   ├── LongExpressionInConditionExpected.kt
│               │   │   │   ├── LongExpressionInConditionTest.kt
│               │   │   │   ├── LongExpressionNoFixExpected.kt
│               │   │   │   ├── LongExpressionNoFixTest.kt
│               │   │   │   ├── LongInlineCommentsExpected.kt
│               │   │   │   ├── LongInlineCommentsTest.kt
│               │   │   │   ├── LongLineAnnotationExpected.kt
│               │   │   │   ├── LongLineAnnotationTest.kt
│               │   │   │   ├── LongLineCommentExpected.kt
│               │   │   │   ├── LongLineCommentExpected2.kt
│               │   │   │   ├── LongLineCommentTest.kt
│               │   │   │   ├── LongLineCommentTest2.kt
│               │   │   │   ├── LongLineExpressionExpected.kt
│               │   │   │   ├── LongLineExpressionTest.kt
│               │   │   │   ├── LongLineFunExpected.kt
│               │   │   │   ├── LongLineFunTest.kt
│               │   │   │   ├── LongLineRValueExpected.kt
│               │   │   │   ├── LongLineRValueTest.kt
│               │   │   │   ├── LongShortRValueExpected.kt
│               │   │   │   ├── LongShortRValueTest.kt
│               │   │   │   ├── LongStringTemplateExpected.kt
│               │   │   │   ├── LongStringTemplateTest.kt
│               │   │   │   ├── LongValueArgumentsListExpected.kt
│               │   │   │   └── LongValueArgumentsListTest.kt
│               │   │   ├── long_numbers/
│               │   │   │   ├── LongNumericalValuesExpected.kt
│               │   │   │   └── LongNumericalValuesTest.kt
│               │   │   ├── multiple_modifiers/
│               │   │   │   ├── AnnotationExpected.kt
│               │   │   │   ├── AnnotationTest.kt
│               │   │   │   ├── ModifierExpected.kt
│               │   │   │   └── ModifierTest.kt
│               │   │   ├── newlines/
│               │   │   │   ├── ColonExpected.kt
│               │   │   │   ├── ColonTest.kt
│               │   │   │   ├── CommaExpected.kt
│               │   │   │   ├── CommaTest.kt
│               │   │   │   ├── ExpressionBodyExpected.kt
│               │   │   │   ├── ExpressionBodyTest.kt
│               │   │   │   ├── FunctionalStyleExpected.kt
│               │   │   │   ├── FunctionalStyleTest.kt
│               │   │   │   ├── LParExpected.kt
│               │   │   │   ├── LParTest.kt
│               │   │   │   ├── LambdaExpected.kt
│               │   │   │   ├── LambdaTest.kt
│               │   │   │   ├── ListArgumentLambdaExpected.kt
│               │   │   │   ├── ListArgumentLambdaTest.kt
│               │   │   │   ├── LongDotQualifiedExpressionExpected.kt
│               │   │   │   ├── LongDotQualifiedExpressionTest.kt
│               │   │   │   ├── OneLineFunctionExpected.kt
│               │   │   │   ├── OneLineFunctionTest.kt
│               │   │   │   ├── OperatorsExpected.kt
│               │   │   │   ├── OperatorsTest.kt
│               │   │   │   ├── ParameterListExpected.kt
│               │   │   │   ├── ParameterListTest.kt
│               │   │   │   ├── SizeParameterListExpected.kt
│               │   │   │   ├── SizeParameterListTest.kt
│               │   │   │   ├── SuperClassListOnTheSameLineExpected.kt
│               │   │   │   └── SuperClassListOnTheSameLineTest.kt
│               │   │   ├── nullable/
│               │   │   │   ├── CollectionExpected.kt
│               │   │   │   ├── CollectionTest.kt
│               │   │   │   ├── NullPrimitiveExpected.kt
│               │   │   │   └── NullPrimitiveTest.kt
│               │   │   ├── preview_annotation/
│               │   │   │   ├── PreviewAnnotationMethodNameExpected.kt
│               │   │   │   ├── PreviewAnnotationMethodNameTest.kt
│               │   │   │   ├── PreviewAnnotationPrivateModifierExpected.kt
│               │   │   │   └── PreviewAnnotationPrivateModifierTest.kt
│               │   │   ├── range/
│               │   │   │   ├── RangeToExpected.kt
│               │   │   │   ├── RangeToTest.kt
│               │   │   │   ├── RangeToUntilExpected.kt
│               │   │   │   └── RangeToUntilTest.kt
│               │   │   ├── semicolons/
│               │   │   │   ├── SemicolonsExpected.kt
│               │   │   │   └── SemicolonsTest.kt
│               │   │   ├── sort_error/
│               │   │   │   ├── ConstantsExpected.kt
│               │   │   │   ├── ConstantsTest.kt
│               │   │   │   ├── EnumSortExpected.kt
│               │   │   │   └── EnumSortTest.kt
│               │   │   ├── spaces/
│               │   │   │   ├── AnnotationExpected.kt
│               │   │   │   ├── AnnotationTest.kt
│               │   │   │   ├── BinaryOpExpected.kt
│               │   │   │   ├── BinaryOpTest.kt
│               │   │   │   ├── BracesLambdaSpacesExpected.kt
│               │   │   │   ├── BracesLambdaSpacesTest.kt
│               │   │   │   ├── EolSpacesExpected.kt
│               │   │   │   ├── EolSpacesTest.kt
│               │   │   │   ├── EqualsExpected.kt
│               │   │   │   ├── EqualsTest.kt
│               │   │   │   ├── LBraceAfterKeywordExpected.kt
│               │   │   │   ├── LBraceAfterKeywordTest.kt
│               │   │   │   ├── LambdaAsArgumentExpected.kt
│               │   │   │   ├── LambdaAsArgumentTest.kt
│               │   │   │   ├── LbraceExpected.kt
│               │   │   │   ├── LbraceTest.kt
│               │   │   │   ├── TooManySpacesEnumExpected.kt
│               │   │   │   ├── TooManySpacesEnumTest.kt
│               │   │   │   ├── TooManySpacesExpected.kt
│               │   │   │   ├── TooManySpacesTest.kt
│               │   │   │   ├── WhiteSpaceBeforeLBraceExpected.kt
│               │   │   │   ├── WhiteSpaceBeforeLBraceTest.kt
│               │   │   │   ├── WhiteSpaceBeforeLParExpected.kt
│               │   │   │   └── WhiteSpaceBeforeLParTest.kt
│               │   │   ├── src/
│               │   │   │   └── main/
│               │   │   │       ├── A/
│               │   │   │       │   ├── FileSize2000.kt
│               │   │   │       │   └── FileSizeA.kt
│               │   │   │       ├── B/
│               │   │   │       │   └── FileSizeB.kt
│               │   │   │       ├── C/
│               │   │   │       │   └── FileSizeC.kt
│               │   │   │       └── FileSizeLarger.kt
│               │   │   ├── statement/
│               │   │   │   ├── StatementExpected.kt
│               │   │   │   └── StatementTest.kt
│               │   │   ├── string_concatenation/
│               │   │   │   ├── StringConcatenationExpected.kt
│               │   │   │   └── StringConcatenationTest.kt
│               │   │   ├── string_template/
│               │   │   │   ├── StringTemplateExpected.kt
│               │   │   │   └── StringTemplateTest.kt
│               │   │   ├── top_level/
│               │   │   │   ├── TopLevelSortExpected.kt
│               │   │   │   ├── TopLevelSortTest.kt
│               │   │   │   ├── TopLevelWithCommentExpected.kt
│               │   │   │   └── TopLevelWithCommentTest.kt
│               │   │   └── trailing_comma/
│               │   │       ├── TrailingCommaExpected.kt
│               │   │       └── TrailingCommaTest.kt
│               │   ├── paragraph4/
│               │   │   ├── generics/
│               │   │   │   ├── VariableGenericTypeDeclarationExpected.kt
│               │   │   │   └── VariableGenericTypeDeclarationTest.kt
│               │   │   ├── null_checks/
│               │   │   │   ├── IfConditionAssignCheckExpected.kt
│               │   │   │   ├── IfConditionAssignCheckTest.kt
│               │   │   │   ├── IfConditionBreakCheckExpected.kt
│               │   │   │   ├── IfConditionBreakCheckTest.kt
│               │   │   │   ├── IfConditionNullCheckExpected.kt
│               │   │   │   ├── IfConditionNullCheckTest.kt
│               │   │   │   ├── RequireFunctionExpected.kt
│               │   │   │   └── RequireFunctionTest.kt
│               │   │   └── smart_cast/
│               │   │       ├── SmartCastExpected.kt
│               │   │       └── SmartCastTest.kt
│               │   ├── paragraph5/
│               │   │   ├── method_call_names/
│               │   │   │   ├── ReplaceMethodCallNamesExpected.kt
│               │   │   │   └── ReplaceMethodCallNamesTest.kt
│               │   │   └── nested_functions/
│               │   │       ├── AvoidNestedFunctionsExample.kt
│               │   │       ├── AvoidNestedFunctionsNoTriggerExample.kt
│               │   │       ├── AvoidNestedFunctionsNoTriggerTest.kt
│               │   │       ├── AvoidNestedFunctionsSeveralExample.kt
│               │   │       ├── AvoidNestedFunctionsSeveralTest.kt
│               │   │       └── AvoidNestedFunctionsTest.kt
│               │   └── paragraph6/
│               │       └── useless-override/
│               │           ├── SeveralSuperTypesExpected.kt
│               │           ├── SeveralSuperTypesTest.kt
│               │           ├── UselessOverrideExpected.kt
│               │           └── UselessOverrideTest.kt
│               └── test-rules-config.yml
├── diktat-ruleset/
│   ├── build.gradle.kts
│   └── src/
│       └── main/
│           ├── kotlin/
│           │   └── com/
│           │       └── saveourtool/
│           │           └── diktat/
│           │               └── ruleset/
│           │                   └── rules/
│           │                       └── DiktatRuleSetProviderV3Spi.kt
│           └── resources/
│               └── META-INF/
│                   └── services/
│                       └── com.pinterest.ktlint.cli.ruleset.core.api.RuleSetProviderV3
├── diktat-runner/
│   ├── build.gradle.kts
│   └── src/
│       └── main/
│           └── kotlin/
│               └── com/
│                   └── saveourtool/
│                       └── diktat/
│                           └── DiktatFactories.kt
├── examples/
│   ├── README.md
│   ├── gradle-groovy-dsl/
│   │   ├── build.gradle
│   │   ├── diktat-analysis.yml
│   │   └── src/
│   │       └── main/
│   │           └── kotlin/
│   │               ├── AnotherTest.kt
│   │               └── Test.kt
│   ├── gradle-kotlin-dsl/
│   │   ├── build.gradle.kts
│   │   ├── diktat-analysis.yml
│   │   ├── settings.gradle.kts
│   │   └── src/
│   │       └── main/
│   │           └── kotlin/
│   │               ├── AnotherTest.kt
│   │               └── Test.kt
│   ├── gradle-kotlin-dsl-multiproject/
│   │   ├── backend/
│   │   │   ├── build.gradle.kts
│   │   │   └── src/
│   │   │       └── main/
│   │   │           └── kotlin/
│   │   │               └── Test.kt
│   │   ├── build.gradle.kts
│   │   ├── diktat-analysis.yml
│   │   ├── frontend/
│   │   │   ├── build.gradle.kts
│   │   │   └── src/
│   │   │       └── main/
│   │   │           └── kotlin/
│   │   │               └── AnotherTest.kt
│   │   └── settings.gradle.kts
│   ├── maven/
│   │   ├── diktat-analysis.yml
│   │   ├── pom.xml
│   │   └── src/
│   │       └── main/
│   │           └── kotlin/
│   │               ├── AnotherTest.kt
│   │               └── Test.kt
│   └── maven-multiproject/
│       ├── backend/
│       │   ├── pom.xml
│       │   └── src/
│       │       └── main/
│       │           └── kotlin/
│       │               └── Test.kt
│       ├── diktat-analysis.yml
│       ├── frontend/
│       │   ├── pom.xml
│       │   └── src/
│       │       └── main/
│       │           └── kotlin/
│       │               └── AnotherTest.kt
│       └── pom.xml
├── gradle/
│   ├── libs.versions.toml
│   ├── plugins/
│   │   ├── build.gradle.kts
│   │   ├── settings.gradle.kts
│   │   └── src/
│   │       └── main/
│   │           └── kotlin/
│   │               ├── Versions.kt
│   │               └── com/
│   │                   └── saveourtool/
│   │                       └── diktat/
│   │                           └── buildutils/
│   │                               ├── JacocoConfiguration.kt
│   │                               ├── PublishingConfiguration.kt
│   │                               ├── TaskNames.kt
│   │                               ├── VersioningConfiguration.kt
│   │                               ├── code-quality-convention.gradle.kts
│   │                               ├── detekt-convention-configuration.gradle.kts
│   │                               ├── diktat-convention-configuration.gradle.kts
│   │                               ├── git-hook-configuration.gradle.kts
│   │                               ├── kotlin-jvm-configuration.gradle.kts
│   │                               ├── publishing-configuration.gradle.kts
│   │                               ├── publishing-default-configuration.gradle.kts
│   │                               └── versioning-configuration.gradle.kts
│   └── wrapper/
│       ├── gradle-wrapper.jar
│       └── gradle-wrapper.properties
├── gradle.properties
├── gradlew
├── gradlew.bat
├── info/
│   ├── README.md
│   ├── available-rules.md
│   ├── build.gradle.kts
│   ├── buildSrc/
│   │   ├── build.gradle.kts
│   │   ├── gradle.properties
│   │   └── src/
│   │       └── main/
│   │           └── kotlin/
│   │               └── com/
│   │                   └── saveourtool/
│   │                       └── diktat/
│   │                           └── generation/
│   │                               └── docs/
│   │                                   ├── FullDocGenerator.kt
│   │                                   ├── GenerationAvailableRules.kt
│   │                                   ├── GenerationDocs.kt
│   │                                   ├── LatexUtils.kt
│   │                                   └── WarningsTableGenerator.kt
│   ├── gradle/
│   │   └── wrapper/
│   │       ├── gradle-wrapper.jar
│   │       └── gradle-wrapper.properties
│   ├── gradlew
│   ├── gradlew.bat
│   ├── guide/
│   │   ├── diktat-coding-convention.md
│   │   ├── guide-TOC.md
│   │   ├── guide-chapter-0.md
│   │   ├── guide-chapter-1.md
│   │   ├── guide-chapter-2.md
│   │   ├── guide-chapter-3.md
│   │   ├── guide-chapter-4.md
│   │   ├── guide-chapter-5.md
│   │   ├── guide-chapter-6.md
│   │   └── table-of-content.md
│   └── rules-mapping.md
├── renovate.json
├── settings.gradle.kts
└── wp/
    ├── README.md
    ├── makefile
    ├── references.bib
    ├── sections/
    │   ├── appendix.tex
    │   ├── compare.tex
    │   ├── conclusion.tex
    │   ├── definition.tex
    │   ├── diKTat.tex
    │   ├── download.tex
    │   ├── feature.tex
    │   ├── introduction.tex
    │   ├── kotlin.tex
    │   └── work.tex
    └── wp.tex
Condensed preview — 967 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (3,613K chars).
[
  {
    "path": ".editorconfig",
    "chars": 4517,
    "preview": "# https://editorconfig.org\nroot = true\n\n[*]\ncharset = utf-8\nindent_size = 4\nindent_style = space\ninsert_final_newline = "
  },
  {
    "path": ".git-hooks/commit-msg.sh",
    "chars": 361,
    "preview": "#!/usr/bin/env bash\n\ncommit_pattern=\"(Merge (remote-tracking )?branch|### What's done:)\"\nerror_msg=\"Your commit message "
  },
  {
    "path": ".git-hooks/pre-commit.sh",
    "chars": 328,
    "preview": "#!/usr/bin/env bash\n\nbranch_name=\"$(git rev-parse --abbrev-ref HEAD)\"\nbranch_pattern=\"^(feature|bugfix|hotfix|infra)/.*$"
  },
  {
    "path": ".gitattributes",
    "chars": 27,
    "preview": "* text=auto\n*.bat eol=crlf\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "chars": 383,
    "preview": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: 'bug'\n\n---\n\n## Describe the bug\n\n## Exp"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "chars": 181,
    "preview": "blank_issues_enabled: true\ncontact_links:\n  - name: Discussions\n    url: https://github.com/saveourtool/diktat/discussio"
  },
  {
    "path": ".github/codecov.yml",
    "chars": 100,
    "preview": "codecov:\n  max_report_age: off\ncoverage:\n  status:\n    project:\n      default:\n        threshold: 2%"
  },
  {
    "path": ".github/pull_request_template.md",
    "chars": 399,
    "preview": "## Which rule and warnings did you add?\n\nThis pull request closes <!-- insert related issue number -->\n<!-- Briefly desc"
  },
  {
    "path": ".github/workflows/build_and_test.yml",
    "chars": 7535,
    "preview": "# vim:ai et ts=2 sts=2 sw=2:\nname: Build and test\n\non:\n  pull_request:\n  push:\n    branches:\n      - 'master'\n\nconcurren"
  },
  {
    "path": ".github/workflows/codeql-analysis.yml",
    "chars": 3171,
    "preview": "# For most projects, this workflow file will not need changing; you simply need\n# to commit it to your repository.\n#\n# Y"
  },
  {
    "path": ".github/workflows/dependencies.yml",
    "chars": 1399,
    "preview": "name: 'Dependencies'\n\non:\n  push:\n    branches:\n      - 'master'\n\nenv:\n  GRADLE_OPTS: -Dorg.gradle.daemon=true -Dorg.gra"
  },
  {
    "path": ".github/workflows/detekt.yml",
    "chars": 1096,
    "preview": "name: Run deteKT\n\non:\n  push:\n    branches: [ master ]\n  pull_request:\n\njobs:\n  detekt_check:\n    runs-on: ubuntu-latest"
  },
  {
    "path": ".github/workflows/diktat.yml",
    "chars": 1267,
    "preview": "name: Run diKTat (release)\n\non:\n  push:\n    branches: [ master ]\n  pull_request:\n    branches: [ master ]\n\njobs:\n  dikta"
  },
  {
    "path": ".github/workflows/diktat_snapshot.yml",
    "chars": 2543,
    "preview": "name: Run diKTat (snapshot)\n\non:\n  push:\n    branches: [ master ]\n  pull_request:\n    branches: [ master ]\n\njobs:\n  dikt"
  },
  {
    "path": ".github/workflows/release.yml",
    "chars": 3624,
    "preview": "name: Create diKTat release\n\non:\n  push:\n    tags:\n      - 'v*'\n\nenv:\n  GRADLE_OPTS: -Dorg.gradle.daemon=true -Dorg.grad"
  },
  {
    "path": ".gitignore",
    "chars": 269,
    "preview": "target/\n.gradle/\nbuild/\n!ktlint/src/main/resources/config/.idea\n.idea/\n*.iml\n/examples/*/gradlew\n/examples/*/gradlew.bat"
  },
  {
    "path": "CNAME",
    "chars": 22,
    "preview": "diktat.saveourtool.com"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "chars": 516,
    "preview": "# Code of Conduct\n\nThis is a small code of conduct to have a good and friendly development in diKTat\n\n## Good behavior\n\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 1788,
    "preview": "# Contributing\n\nIf you are reading this - then you have decided to contribute to our project. Oh, poor you...\nRules are "
  },
  {
    "path": "LICENSE",
    "chars": 1040,
    "preview": "The MIT License\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and assoc"
  },
  {
    "path": "README.md",
    "chars": 129390,
    "preview": "<img src=\"/logo.svg\" width=\"64px\"/>\n\n![Build and test](https://github.com/saveourtool/diKTat/workflows/Build%20and%20tes"
  },
  {
    "path": "RELEASING.md",
    "chars": 459,
    "preview": "# How to release a new version of diKTat\n\n* You should have permissions to push to the main repo\n* Simply create a new g"
  },
  {
    "path": "_config.yml",
    "chars": 27,
    "preview": "theme: jekyll-theme-minimal"
  },
  {
    "path": "build.gradle.kts",
    "chars": 3922,
    "preview": "import org.jetbrains.kotlin.incremental.createDirectory\nimport java.nio.file.Files\nimport java.nio.file.StandardCopyOpti"
  },
  {
    "path": "detekt-config.yml",
    "chars": 16376,
    "preview": "build:\n  maxIssues: 0\n  excludeCorrectable: false\n  weights:\n  # complexity: 2\n  # LongParameterList: 1\n  # style: 1\n  #"
  },
  {
    "path": "diktat-analysis.yml",
    "chars": 22938,
    "preview": "# Common configuration\n- name: DIKTAT_COMMON\n  enabled: true\n  configuration:\n    # put your package name here - it will"
  },
  {
    "path": "diktat-api/build.gradle.kts",
    "chars": 1415,
    "preview": "plugins {\n    id(\"com.saveourtool.diktat.buildutils.kotlin-jvm-configuration\")\n    id(\"com.saveourtool.diktat.buildutils"
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/Constants.kt",
    "chars": 388,
    "preview": "/**\n * This file contains common constants for Diktat\n */\n\npackage com.saveourtool.diktat\n\n/**\n * Common application nam"
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/DiktatProcessor.kt",
    "chars": 1416,
    "preview": "package com.saveourtool.diktat\n\nimport com.saveourtool.diktat.api.DiktatCallback\nimport java.nio.file.Path\n\n/**\n * Proce"
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/DiktatProcessorFactory.kt",
    "chars": 441,
    "preview": "package com.saveourtool.diktat\n\nimport com.saveourtool.diktat.api.DiktatRuleSet\n\n/**\n * A factory to create [DiktatProce"
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/DiktatRunner.kt",
    "chars": 2638,
    "preview": "package com.saveourtool.diktat\n\nimport com.saveourtool.diktat.api.DiktatProcessorListener\nimport com.saveourtool.diktat."
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/DiktatRunnerArguments.kt",
    "chars": 1091,
    "preview": "package com.saveourtool.diktat\n\nimport com.saveourtool.diktat.api.DiktatProcessorListener\nimport com.saveourtool.diktat."
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/DiktatRunnerFactory.kt",
    "chars": 2729,
    "preview": "package com.saveourtool.diktat\n\nimport com.saveourtool.diktat.api.DiktatBaseline\nimport com.saveourtool.diktat.api.Dikta"
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/api/DiktatBaseline.kt",
    "chars": 1724,
    "preview": "package com.saveourtool.diktat.api\n\nimport com.saveourtool.diktat.util.DiktatProcessorListenerWrapper\nimport java.nio.fi"
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/api/DiktatBaselineFactory.kt",
    "chars": 792,
    "preview": "package com.saveourtool.diktat.api\n\nimport java.nio.file.Path\n\n/**\n * A factory to load or generate [DiktatBaseline]\n */"
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/api/DiktatCallback.kt",
    "chars": 618,
    "preview": "package com.saveourtool.diktat.api\n\n/**\n * Callback for diktat process\n */\n@FunctionalInterface\nfun interface DiktatCall"
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/api/DiktatError.kt",
    "chars": 446,
    "preview": "package com.saveourtool.diktat.api\n\n/**\n * Error found by `diktat`\n *\n * @property line line number (one-based)\n * @prop"
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/api/DiktatErrorEmitter.kt",
    "chars": 682,
    "preview": "package com.saveourtool.diktat.api\n\n/**\n * The **file-specific** error emitter, initialized and used in [DiktatRule] imp"
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/api/DiktatProcessorListener.kt",
    "chars": 3552,
    "preview": "package com.saveourtool.diktat.api\n\nimport com.saveourtool.diktat.util.DiktatProcessorListenerWrapper\nimport java.nio.fi"
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/api/DiktatReporterCreationArguments.kt",
    "chars": 3691,
    "preview": "/**\n * Contains a base interface and implementations for a container with arguments to create a reporter\n */\n\npackage co"
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/api/DiktatReporterFactory.kt",
    "chars": 506,
    "preview": "package com.saveourtool.diktat.api\n\ntypealias DiktatReporter = DiktatProcessorListener\n\n/**\n * A factory to create [Dikt"
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/api/DiktatReporterType.kt",
    "chars": 373,
    "preview": "package com.saveourtool.diktat.api\n\n/**\n * @property id\n * @property extension\n */\nenum class DiktatReporterType(\n    va"
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/api/DiktatRule.kt",
    "chars": 707,
    "preview": "package com.saveourtool.diktat.api\n\nimport org.jetbrains.kotlin.com.intellij.lang.ASTNode\n\n/**\n * This is a base interfa"
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/api/DiktatRuleConfig.kt",
    "chars": 1923,
    "preview": "package com.saveourtool.diktat.api\n\nimport kotlinx.serialization.Serializable\n\n/**\n * Configuration of individual [Dikta"
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/api/DiktatRuleConfigReader.kt",
    "chars": 364,
    "preview": "package com.saveourtool.diktat.api\n\nimport java.io.InputStream\n\n/**\n * A reader for [DiktatRuleConfig]\n */\nfun interface"
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/api/DiktatRuleNameAware.kt",
    "chars": 236,
    "preview": "package com.saveourtool.diktat.api\n\n/**\n * This interface represents *name* of individual inspection in rule set.\n */\nin"
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/api/DiktatRuleSet.kt",
    "chars": 186,
    "preview": "package com.saveourtool.diktat.api\n\n/**\n * A group of [DiktatRule]'s as a single set.\n *\n * @property rules diktat rules"
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/api/DiktatRuleSetFactory.kt",
    "chars": 391,
    "preview": "package com.saveourtool.diktat.api\n\n/**\n * A factory which creates a [DiktatRuleSet].\n */\nfun interface DiktatRuleSetFac"
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/common/config/rules/LegacyAliases.kt",
    "chars": 575,
    "preview": "/**\n * Contains typealias for legacy support\n */\n\npackage com.saveourtool.diktat.common.config.rules\n\nimport com.saveour"
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/util/DiktatProcessorListenerWrapper.kt",
    "chars": 2755,
    "preview": "package com.saveourtool.diktat.util\n\nimport com.saveourtool.diktat.api.DiktatError\nimport com.saveourtool.diktat.api.Dik"
  },
  {
    "path": "diktat-api/src/main/kotlin/com/saveourtool/diktat/util/FileUtils.kt",
    "chars": 1096,
    "preview": "/**\n * Utility methods to work with file paths.\n */\n\npackage com.saveourtool.diktat.util\n\nimport java.nio.file.Path\nimpo"
  },
  {
    "path": "diktat-cli/README.md",
    "chars": 4692,
    "preview": "# _diktat-cli_, the command-line client for [_diktat_](https://github.com/saveourtool/diktat)\n\n---\n\n# Table of contents\n"
  },
  {
    "path": "diktat-cli/build.gradle.kts",
    "chars": 3511,
    "preview": "import com.saveourtool.diktat.buildutils.configurePublications\nimport com.github.jengelman.gradle.plugins.shadow.ShadowE"
  },
  {
    "path": "diktat-cli/src/main/kotlin/com/saveourtool/diktat/DiktatMain.kt",
    "chars": 1583,
    "preview": "/**\n * The file contains main method\n */\n\npackage com.saveourtool.diktat\n\nimport com.saveourtool.diktat.api.DiktatProces"
  },
  {
    "path": "diktat-cli/src/main/kotlin/com/saveourtool/diktat/cli/DiktatMode.kt",
    "chars": 261,
    "preview": "package com.saveourtool.diktat.cli\n\nimport kotlinx.serialization.SerialName\nimport kotlinx.serialization.Serializable\n\n/"
  },
  {
    "path": "diktat-cli/src/main/kotlin/com/saveourtool/diktat/cli/DiktatProperties.kt",
    "chars": 10189,
    "preview": "package com.saveourtool.diktat.cli\n\nimport com.saveourtool.diktat.DIKTAT\nimport com.saveourtool.diktat.DIKTAT_ANALYSIS_C"
  },
  {
    "path": "diktat-cli/src/main/kotlin/com/saveourtool/diktat/util/CliUtils.kt",
    "chars": 3593,
    "preview": "/**\n * This class contains util methods to operate with java.nio.file.Path for CLI\n */\n\npackage com.saveourtool.diktat.u"
  },
  {
    "path": "diktat-cli/src/main/script/diktat.cmd",
    "chars": 541,
    "preview": "@echo off\n\nrem\nrem diKTat command-line client for Windows\nrem\nrem Uses Git Bash, so requires Git to be installed.\nrem\n\ns"
  },
  {
    "path": "diktat-cli/src/main/script/header-diktat.sh",
    "chars": 2211,
    "preview": "#!/usr/bin/env bash\n#\n# vim:ai et sw=4 si sta ts=4:\n#\n# External variables used:\n#\n# - JAVA_HOME\n# - GITHUB_ACTIONS\n\n# B"
  },
  {
    "path": "diktat-cli/src/test/kotlin/com/saveourtool/diktat/smoke/DiktatCliTest.kt",
    "chars": 5176,
    "preview": "package com.saveourtool.diktat.smoke\n\nimport com.saveourtool.diktat.test.framework.util.checkForkedJavaHome\nimport com.s"
  },
  {
    "path": "diktat-cli/src/test/kotlin/com/saveourtool/diktat/smoke/DiktatSaveSmokeTest.kt",
    "chars": 5502,
    "preview": "package com.saveourtool.diktat.smoke\n\nimport com.saveourtool.diktat.api.DiktatError\nimport com.saveourtool.diktat.test.f"
  },
  {
    "path": "diktat-cli/src/test/kotlin/com/saveourtool/diktat/smoke/DiktatSmokeTest.kt",
    "chars": 2051,
    "preview": "package com.saveourtool.diktat.smoke\n\nimport com.saveourtool.diktat.api.DiktatError\nimport com.saveourtool.diktat.ktlint"
  },
  {
    "path": "diktat-cli/src/test/kotlin/com/saveourtool/diktat/smoke/DiktatSmokeTestBase.kt",
    "chars": 19941,
    "preview": "@file:Suppress(\n    \"MISSING_KDOC_CLASS_ELEMENTS\",\n    \"MISSING_KDOC_ON_FUNCTION\",\n    \"BACKTICKS_PROHIBITED\",\n)\n\npackag"
  },
  {
    "path": "diktat-cli/src/test/kotlin/com/saveourtool/diktat/smoke/DiktatSmokeTestUtils.kt",
    "chars": 2766,
    "preview": "@file:Suppress(\"HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE\")\n\npackage com.saveourtool.diktat.smoke\n\nimport com.saveourtool."
  },
  {
    "path": "diktat-cli/src/test/kotlin/com/saveourtool/diktat/util/CliUtilsKtTest.kt",
    "chars": 5649,
    "preview": "package com.saveourtool.diktat.util\n\nimport org.assertj.core.api.Assertions\nimport org.junit.jupiter.api.BeforeAll\nimpor"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/.editorconfig",
    "chars": 182,
    "preview": "# https://editorconfig.org\nroot = true\n[{*.kt,*.kts}]\n# disable ktlint rules\nktlint_standard = disabled\nktlint_experimen"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/.gitignore",
    "chars": 87,
    "preview": "/diktat.jar\n/diktat-analysis.yml\n/ktlint\n/save-*-mingwX64.exe\n/tmpSave.txt\n/.save-cli/\n"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/build.gradle.kts_",
    "chars": 740,
    "preview": "import com.saveourtool.diktat.generation.docs.generateAvailableRules\n\nplugins {\n    kotlin(\"jvm\") version \"1.4.21\"\n    i"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/save.toml",
    "chars": 716,
    "preview": "[general]\nexecCmd=\"java -showversion -jar diktat.jar --log-level debug\"\ntags = [\"smokeTest\"]\ndescription = \"SmokeTest\"\ns"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/jsMain/kotlin/com/saveourtool/diktat/scripts/ScriptExpected.kt",
    "chars": 149,
    "preview": "package com.saveourtool.diktat.scripts\n\nimport kotlinx.browser.document\n\nfun main() {\n    (document.getElementById(\"myId"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/jsMain/kotlin/com/saveourtool/diktat/scripts/ScriptTest.kt",
    "chars": 143,
    "preview": "package com.saveourtool.diktat.js\n\nimport kotlinx.browser.document\n\nfun main() {\n    (document.getElementById(\"myId\") as"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/Bug1Expected.kt",
    "chars": 1356,
    "preview": "// ;warn:$line:1: [FILE_NAME_MATCH_CLASS] file name is incorrect - it should match with the class described in it if the"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/Bug1Test.kt",
    "chars": 149,
    "preview": "package test.smoke.src.main.kotlin\n\nfun readFile(foo: Foo) {\n    var bar: Bar\n}\n\nclass D {val x = 0\nfun bar(): Bar {val "
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/DefaultPackageExpected.kt",
    "chars": 497,
    "preview": "// ;warn:1:1: [FILE_NAME_MATCH_CLASS] file name is incorrect - it should match with the class described in it if there i"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/DefaultPackageTest.kt",
    "chars": 156,
    "preview": "@file:Suppress(\n    \"PACKAGE_NAME_MISSING\",\n    \"PACKAGE_NAME_INCORRECT_PATH\",\n    \"PACKAGE_NAME_INCORRECT_PREFIX\"\n)\n/**"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/Example1-2Expected.kt",
    "chars": 717,
    "preview": "package test.smoke\n\nclass example{ @get : JvmName ( \"getIsValid\" )\n    val isValid = true\n\n    fun Foo.foo() { }\n\n    va"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/Example1Expected.kt",
    "chars": 2572,
    "preview": "// ;warn:$line:1: [FILE_NAME_MATCH_CLASS] file name is incorrect - it should match with the class described in it if the"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/Example1Test.kt",
    "chars": 583,
    "preview": "package test.smoke\n\nclass example{ @get : JvmName ( \"getIsValid\" )\n    val isValid = true\n\n    fun Foo.foo() { }\n\n    va"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/Example2Expected.kt",
    "chars": 1914,
    "preview": "// ;warn:$line:1: [HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE] files that contain multiple or no classes should contain des"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/Example2Test.kt",
    "chars": 1437,
    "preview": "package test.smoke\n\nimport java.io.IOException\nimport java.util.Properties\nimport kotlin.system.exitProcess\nimport org.s"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/Example3Expected.kt",
    "chars": 5485,
    "preview": "// ;warn:$line:1: [HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE] files that contain multiple or no classes should contain des"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/Example3Test.kt",
    "chars": 1069,
    "preview": "/*\n * Copyright (c) Your Company Name Here. 2010-2020\n */\n\nclass HttpClient {\n    var name: String\n    var url: String ="
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/Example4Expected.kt",
    "chars": 3375,
    "preview": "// ;warn:$line:1: [FILE_NAME_MATCH_CLASS] file name is incorrect - it should match with the class described in it if the"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/Example4Test.kt",
    "chars": 1326,
    "preview": "package com.saveourtool.diktat\n\nclass SpecialTagsInKdoc {\n\n    /**\n     * Empty function to test KDocs\n     * @apiNote f"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/Example5Expected.kt",
    "chars": 1006,
    "preview": "// ;warn:$line:1: [FILE_NAME_MATCH_CLASS] file name is incorrect - it should match with the class described in it if the"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/Example5Test.kt",
    "chars": 73,
    "preview": "package com.saveourtool.diktat\n\nclass Some {\n    val config = Config()\n}\n"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/Example6Expected.kt",
    "chars": 744,
    "preview": "// ;warn:$line:1: [HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE] files that contain multiple or no classes should contain des"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/Example6Test.kt",
    "chars": 506,
    "preview": "package com.saveourtool.diktat\n\nval foo =\n    \"\"\"\n        some\n        cool\n        text\n    \"\"\".trimIndent()\n\nval bar ="
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/Example7Expected.kt",
    "chars": 1253,
    "preview": "// ;warn:$line:1: [HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE] files that contain multiple or no classes should contain des"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/Example7Test.kt",
    "chars": 422,
    "preview": "package com.saveourtool.diktat\n\nfun foo() {\n    val prop: Int? = null\n\n    if (prop == null) {\n        println(\"prop is "
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/Example8Expected.kt",
    "chars": 1704,
    "preview": "// ;warn:$line:1: [HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE] files that contain multiple or no classes should contain des"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/Example8Test.kt",
    "chars": 247,
    "preview": "package com.saveourtool.diktat\n\nfun foo() {\n    val sum: (Int, Int, Int,) -> Int = fun(\n        x,\n        y,\n        z\n"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/KdocFormattingMultilineTagsExpected.kt",
    "chars": 823,
    "preview": "// ;warn:$line:1: [HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE] files that contain multiple or no classes should contain des"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/KdocFormattingMultilineTagsTest.kt",
    "chars": 208,
    "preview": "/**\n * @param bar lorem ipsum\n *\n * dolor sit amet\n */\nfun foo1(bar: Bar): Baz {\n    // placeholder\n}\n\n/**\n * @param bar"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/LocalVariableWithOffsetExpected.kt",
    "chars": 757,
    "preview": "// ;warn:$line:1: [HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE] files that contain multiple or no classes should contain des"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/LocalVariableWithOffsetTest.kt",
    "chars": 318,
    "preview": "package com.saveourtool.diktat\n\n    override fun boo() {\n     val listTestResult: MutableList<TestResult> = mutableListO"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/ManyLineTransformInLongLineExpected.kt",
    "chars": 1333,
    "preview": "package com.saveourtool.diktat\n\nfun foo() {\n    (1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/ManyLineTransformInLongLineTest.kt",
    "chars": 3772,
    "preview": "package com.saveourtool.diktat\n\nfun foo(){\n    (1\n            or 2\n            or 3\n            or 4\n            or 5\n  "
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/NewlinesAfterInterfacesExpected.kt",
    "chars": 103,
    "preview": "package com.saveourtool.diktat\n\nclass A<K : Any, P : Any, G : Any> :\n    B<K>(),\n    C<P>,\n    D<G> {}\n"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/NewlinesAfterInterfacesTest.kt",
    "chars": 91,
    "preview": "package com.saveourtool.diktat\n\nclass A<K : Any, P : Any, G : Any> : B<K>(), C<P>, D<G> {}\n"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/SemicolonsExpected.kt",
    "chars": 2537,
    "preview": "package com.saveourtool.diktat\n\nimport io.micrometer.core.instrument.MeterRegistry\nimport io.micrometer.core.instrument."
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/SemicolonsTest.kt",
    "chars": 2638,
    "preview": "import io.micrometer.core.instrument.MeterRegistry\nimport io.micrometer.core.instrument.MultiGauge\nimport io.micrometer."
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/kotlin-library-expected.gradle.kts",
    "chars": 114,
    "preview": "import org.gradle.kotlin.dsl.plugins\n// import org.jetbrains.kotlin.gradle.dsl.jvm\n\nplugins {\n    kotlin(\"jvm\")\n}\n"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/kotlin-library.gradle.kts",
    "chars": 112,
    "preview": "import org.gradle.kotlin.dsl.plugins\n//import org.jetbrains.kotlin.gradle.dsl.jvm\n\nplugins {\n    kotlin(\"jvm\")\n}"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/save.toml",
    "chars": 429,
    "preview": "[general]\nexecCmd=\"java -showversion -jar diktat.jar --log-level debug\"\ntags = [\"smokeTest\"]\ndescription = \"SmokeTest\"\ns"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/script/PackageInScriptExpected.kts",
    "chars": 1337,
    "preview": "// ;warn:$line:1: [HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE] files that contain multiple or no classes should contain des"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/script/PackageInScriptTest.kts",
    "chars": 175,
    "preview": "package com.saveourtool.diktat.script\n\nrun {\n    println(\"hello world!\")\n}\n\nfun foo() {\n    println()\n}\n\nval q = Config("
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/script/SimpleRunInScriptExpected.kts",
    "chars": 1299,
    "preview": "// ;warn:$line:1: [HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE] files that contain multiple or no classes should contain des"
  },
  {
    "path": "diktat-cli/src/test/resources/test/smoke/src/main/kotlin/script/SimpleRunInScriptTest.kts",
    "chars": 125,
    "preview": "\nprintln(\"hello world!\")\n\nfun foo() {\n    println()\n}\n\nval q = Config()\n\nrun {\n    println(\"a\")\n}\n\nalso {\n    println(\"a"
  },
  {
    "path": "diktat-common-test/build.gradle.kts",
    "chars": 414,
    "preview": "plugins {\n    id(\"com.saveourtool.diktat.buildutils.kotlin-jvm-configuration\")\n    id(\"com.saveourtool.diktat.buildutils"
  },
  {
    "path": "diktat-common-test/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/ResourceReader.kt",
    "chars": 2898,
    "preview": "package com.saveourtool.diktat.test.framework.processing\n\nimport com.saveourtool.diktat.test.framework.util.readTextOrNu"
  },
  {
    "path": "diktat-common-test/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/TestComparatorUnit.kt",
    "chars": 4686,
    "preview": "package com.saveourtool.diktat.test.framework.processing\n\nimport com.saveourtool.diktat.test.framework.processing.Resour"
  },
  {
    "path": "diktat-common-test/src/main/kotlin/com/saveourtool/diktat/test/framework/processing/TestFileContent.kt",
    "chars": 2709,
    "preview": "/**\n * It's a class container for test file content.\n * Plus exception cases when resource or file is not found\n */\n\npac"
  },
  {
    "path": "diktat-common-test/src/main/kotlin/com/saveourtool/diktat/test/framework/util/TestUtils.kt",
    "chars": 10542,
    "preview": "/**\n * Utility classes and methods for tests\n */\n\npackage com.saveourtool.diktat.test.framework.util\n\nimport io.github.o"
  },
  {
    "path": "diktat-dev-ksp/build.gradle.kts",
    "chars": 411,
    "preview": "plugins {\n    id(\"com.saveourtool.diktat.buildutils.kotlin-jvm-configuration\")\n    id(\"com.saveourtool.diktat.buildutils"
  },
  {
    "path": "diktat-dev-ksp/src/main/kotlin/com/saveourtool/diktat/ruleset/generation/EnumNames.kt",
    "chars": 371,
    "preview": "package com.saveourtool.diktat.ruleset.generation\n\n/**\n * Annotation that marks to generate an object with names from En"
  },
  {
    "path": "diktat-dev-ksp/src/main/kotlin/com/saveourtool/diktat/ruleset/generation/EnumNamesSymbolProcessor.kt",
    "chars": 4249,
    "preview": "package com.saveourtool.diktat.ruleset.generation\n\nimport com.google.devtools.ksp.processing.CodeGenerator\nimport com.go"
  },
  {
    "path": "diktat-dev-ksp/src/main/kotlin/com/saveourtool/diktat/ruleset/generation/EnumNamesSymbolProcessorProvider.kt",
    "chars": 564,
    "preview": "package com.saveourtool.diktat.ruleset.generation\n\nimport com.google.devtools.ksp.processing.SymbolProcessor\nimport com."
  },
  {
    "path": "diktat-dev-ksp/src/main/resources/META-INF/services/com.google.devtools.ksp.processing.SymbolProcessorProvider",
    "chars": 75,
    "preview": "com.saveourtool.diktat.ruleset.generation.EnumNamesSymbolProcessorProvider\n"
  },
  {
    "path": "diktat-gradle-plugin/README.md",
    "chars": 244,
    "preview": "## Local testing\n\nYou can build and publish to maven local by using `gradlew :diktat-gradle-plugin:publishToMavenLocal`."
  },
  {
    "path": "diktat-gradle-plugin/build.gradle.kts",
    "chars": 4710,
    "preview": "import com.saveourtool.diktat.buildutils.configurePom\n\nimport com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar"
  },
  {
    "path": "diktat-gradle-plugin/src/functionalTest/kotlin/com/saveourtool/diktat/plugin/gradle/DiktatGradlePluginFunctionalTest.kt",
    "chars": 5594,
    "preview": "package com.saveourtool.diktat.plugin.gradle\n\nimport com.saveourtool.diktat.plugin.gradle.DiktatGradlePlugin.Companion.D"
  },
  {
    "path": "diktat-gradle-plugin/src/functionalTest/kotlin/com/saveourtool/diktat/plugin/gradle/DiktatGradlePluginGroovyFunctionalTest.kt",
    "chars": 1630,
    "preview": "package com.saveourtool.diktat.plugin.gradle\n\nimport org.gradle.buildinit.plugins.internal.modifiers.BuildInitDsl\nimport"
  },
  {
    "path": "diktat-gradle-plugin/src/functionalTest/kotlin/com/saveourtool/diktat/plugin/gradle/DiktatGradlePluginMultiprojectFunctionalTest.kt",
    "chars": 1191,
    "preview": "package com.saveourtool.diktat.plugin.gradle\n\nimport org.gradle.buildinit.plugins.internal.modifiers.BuildInitDsl\nimport"
  },
  {
    "path": "diktat-gradle-plugin/src/functionalTest/kotlin/com/saveourtool/diktat/plugin/gradle/Utils.kt",
    "chars": 3303,
    "preview": "package com.saveourtool.diktat.plugin.gradle\n\nimport org.gradle.buildinit.plugins.internal.modifiers.BuildInitDsl\nimport"
  },
  {
    "path": "diktat-gradle-plugin/src/main/kotlin/com/saveourtool/diktat/plugin/gradle/DiktatExtension.kt",
    "chars": 2223,
    "preview": "package com.saveourtool.diktat.plugin.gradle\n\nimport com.saveourtool.diktat.plugin.gradle.extension.Reporters\nimport org"
  },
  {
    "path": "diktat-gradle-plugin/src/main/kotlin/com/saveourtool/diktat/plugin/gradle/DiktatGradlePlugin.kt",
    "chars": 1682,
    "preview": "package com.saveourtool.diktat.plugin.gradle\n\nimport com.saveourtool.diktat.plugin.gradle.tasks.DiktatCheckTask.Companio"
  },
  {
    "path": "diktat-gradle-plugin/src/main/kotlin/com/saveourtool/diktat/plugin/gradle/Utils.kt",
    "chars": 615,
    "preview": "/**\n * Utilities for diktat gradle plugin\n */\n\npackage com.saveourtool.diktat.plugin.gradle\n\nimport org.gradle.api.Proje"
  },
  {
    "path": "diktat-gradle-plugin/src/main/kotlin/com/saveourtool/diktat/plugin/gradle/extension/DefaultReporter.kt",
    "chars": 4325,
    "preview": "/**\n * All default reporters\n */\n\n@file:Suppress(\"UnnecessaryAbstractClass\")\n\npackage com.saveourtool.diktat.plugin.grad"
  },
  {
    "path": "diktat-gradle-plugin/src/main/kotlin/com/saveourtool/diktat/plugin/gradle/extension/Reporter.kt",
    "chars": 598,
    "preview": "package com.saveourtool.diktat.plugin.gradle.extension\n\nimport com.saveourtool.diktat.api.DiktatReporterCreationArgument"
  },
  {
    "path": "diktat-gradle-plugin/src/main/kotlin/com/saveourtool/diktat/plugin/gradle/extension/Reporters.kt",
    "chars": 2365,
    "preview": "package com.saveourtool.diktat.plugin.gradle.extension\n\nimport org.gradle.api.Action\nimport org.gradle.api.model.ObjectF"
  },
  {
    "path": "diktat-gradle-plugin/src/main/kotlin/com/saveourtool/diktat/plugin/gradle/tasks/DiktatCheckTask.kt",
    "chars": 1538,
    "preview": "package com.saveourtool.diktat.plugin.gradle.tasks\n\nimport com.saveourtool.diktat.DiktatRunner\nimport com.saveourtool.di"
  },
  {
    "path": "diktat-gradle-plugin/src/main/kotlin/com/saveourtool/diktat/plugin/gradle/tasks/DiktatFixTask.kt",
    "chars": 1655,
    "preview": "package com.saveourtool.diktat.plugin.gradle.tasks\n\nimport com.saveourtool.diktat.DiktatRunner\nimport com.saveourtool.di"
  },
  {
    "path": "diktat-gradle-plugin/src/main/kotlin/com/saveourtool/diktat/plugin/gradle/tasks/DiktatTaskBase.kt",
    "chars": 7501,
    "preview": "package com.saveourtool.diktat.plugin.gradle.tasks\n\nimport com.saveourtool.diktat.DiktatRunner\nimport com.saveourtool.di"
  },
  {
    "path": "diktat-gradle-plugin/src/main/kotlin/com/saveourtool/diktat/plugin/gradle/tasks/SarifReportMergeTask.kt",
    "chars": 4057,
    "preview": "package com.saveourtool.diktat.plugin.gradle.tasks\n\nimport com.saveourtool.diktat.plugin.gradle.DiktatGradlePlugin.Compa"
  },
  {
    "path": "diktat-gradle-plugin/src/test/kotlin/com/saveourtool/diktat/plugin/gradle/DiktatGradlePluginTest.kt",
    "chars": 1452,
    "preview": "package com.saveourtool.diktat.plugin.gradle\n\nimport com.saveourtool.diktat.plugin.gradle.tasks.DiktatCheckTask\nimport o"
  },
  {
    "path": "diktat-gradle-plugin/src/test/kotlin/com/saveourtool/diktat/plugin/gradle/DiktatJavaExecTaskTest.kt",
    "chars": 11076,
    "preview": "package com.saveourtool.diktat.plugin.gradle\n\nimport com.saveourtool.diktat.api.DiktatReporter\nimport com.saveourtool.di"
  },
  {
    "path": "diktat-ktlint-engine/build.gradle.kts",
    "chars": 1805,
    "preview": "import org.gradle.accessors.dm.LibrariesForLibs\n\nplugins {\n    id(\"com.saveourtool.diktat.buildutils.kotlin-jvm-configur"
  },
  {
    "path": "diktat-ktlint-engine/src/main/kotlin/com/pinterest/ktlint/rule/engine/api/Code.kt",
    "chars": 3896,
    "preview": "/**\n * Copied from KtLint and open the constructor\n */\n\n@file:Suppress(\n    \"TOO_LONG_FUNCTION\",\n    \"PACKAGE_NAME_INCOR"
  },
  {
    "path": "diktat-ktlint-engine/src/main/kotlin/com/saveourtool/diktat/ktlint/DiktatBaselineFactoryImpl.kt",
    "chars": 1646,
    "preview": "package com.saveourtool.diktat.ktlint\n\nimport com.saveourtool.diktat.api.DiktatBaseline\nimport com.saveourtool.diktat.ap"
  },
  {
    "path": "diktat-ktlint-engine/src/main/kotlin/com/saveourtool/diktat/ktlint/DiktatProcessorFactoryImpl.kt",
    "chars": 4079,
    "preview": "package com.saveourtool.diktat.ktlint\n\nimport com.saveourtool.diktat.DiktatProcessor\nimport com.saveourtool.diktat.Dikta"
  },
  {
    "path": "diktat-ktlint-engine/src/main/kotlin/com/saveourtool/diktat/ktlint/DiktatReporterFactoryImpl.kt",
    "chars": 2906,
    "preview": "package com.saveourtool.diktat.ktlint\n\nimport com.saveourtool.diktat.api.DiktatReporter\nimport com.saveourtool.diktat.ap"
  },
  {
    "path": "diktat-ktlint-engine/src/main/kotlin/com/saveourtool/diktat/ktlint/DiktatReporterImpl.kt",
    "chars": 1772,
    "preview": "package com.saveourtool.diktat.ktlint\n\nimport com.saveourtool.diktat.api.DiktatError\nimport com.saveourtool.diktat.api.D"
  },
  {
    "path": "diktat-ktlint-engine/src/main/kotlin/com/saveourtool/diktat/ktlint/KtLintRuleWrapper.kt",
    "chars": 3146,
    "preview": "package com.saveourtool.diktat.ktlint\n\nimport com.saveourtool.diktat.api.DiktatRule\nimport com.saveourtool.diktat.api.Di"
  },
  {
    "path": "diktat-ktlint-engine/src/main/kotlin/com/saveourtool/diktat/ktlint/KtLintUtils.kt",
    "chars": 6078,
    "preview": "/**\n * This file contains util methods for __KtLint__\n */\n\npackage com.saveourtool.diktat.ktlint\n\nimport com.saveourtool"
  },
  {
    "path": "diktat-ktlint-engine/src/main/kotlin/com/saveourtool/diktat/ktlint/ReporterV2Wrapper.kt",
    "chars": 945,
    "preview": "package com.saveourtool.diktat.ktlint\n\nimport com.pinterest.ktlint.cli.reporter.core.api.KtlintCliError\nimport com.pinte"
  },
  {
    "path": "diktat-ktlint-engine/src/test/kotlin/com/saveourtool/diktat/ktlint/KtLintRuleWrapperTest.kt",
    "chars": 5467,
    "preview": "package com.saveourtool.diktat.ktlint\n\nimport com.saveourtool.diktat.api.DiktatErrorEmitter\nimport com.saveourtool.dikta"
  },
  {
    "path": "diktat-maven-plugin/README.md",
    "chars": 413,
    "preview": "## Local testing\n\nYou can build and publish to maven local by using `:diktat-api:publishToMavenLocal :diktat-rules:publi"
  },
  {
    "path": "diktat-maven-plugin/build.gradle.kts",
    "chars": 1695,
    "preview": "import com.saveourtool.diktat.buildutils.configurePublications\nimport de.benediktritter.maven.plugin.development.task.Ge"
  },
  {
    "path": "diktat-maven-plugin/src/main/kotlin/com/saveourtool/diktat/plugin/maven/DiktatBaseMojo.kt",
    "chars": 5996,
    "preview": "package com.saveourtool.diktat.plugin.maven\n\nimport com.saveourtool.diktat.DiktatRunner\nimport com.saveourtool.diktat.Di"
  },
  {
    "path": "diktat-maven-plugin/src/main/kotlin/com/saveourtool/diktat/plugin/maven/DiktatMojo.kt",
    "chars": 948,
    "preview": "/**\n * MOJOs for goals of diktat plugin\n */\n\npackage com.saveourtool.diktat.plugin.maven\n\nimport com.saveourtool.diktat."
  },
  {
    "path": "diktat-maven-plugin/src/main/kotlin/com/saveourtool/diktat/plugin/maven/Utils.kt",
    "chars": 539,
    "preview": "/**\n * Utilities for diktat maven plugin\n */\n\npackage com.saveourtool.diktat.plugin.maven\n\nimport com.saveourtool.diktat"
  },
  {
    "path": "diktat-maven-plugin/src/main/kotlin/com/saveourtool/diktat/plugin/maven/reporters/DefaultReporter.kt",
    "chars": 1795,
    "preview": "/**\n * All default reporters\n */\n\npackage com.saveourtool.diktat.plugin.maven.reporters\n\nimport com.saveourtool.diktat.a"
  },
  {
    "path": "diktat-maven-plugin/src/main/kotlin/com/saveourtool/diktat/plugin/maven/reporters/GitHubActionsReporter.kt",
    "chars": 839,
    "preview": "package com.saveourtool.diktat.plugin.maven.reporters\n\nimport com.saveourtool.diktat.api.DiktatReporterCreationArguments"
  },
  {
    "path": "diktat-maven-plugin/src/main/kotlin/com/saveourtool/diktat/plugin/maven/reporters/Reporter.kt",
    "chars": 1040,
    "preview": "package com.saveourtool.diktat.plugin.maven.reporters\n\nimport com.saveourtool.diktat.api.DiktatReporterCreationArguments"
  },
  {
    "path": "diktat-maven-plugin/src/main/kotlin/com/saveourtool/diktat/plugin/maven/reporters/Reporters.kt",
    "chars": 1044,
    "preview": "package com.saveourtool.diktat.plugin.maven.reporters\n\nimport org.apache.maven.plugins.annotations.Parameter\n\n/**\n * Con"
  },
  {
    "path": "diktat-maven-plugin/src/test/kotlin/com/saveourtool/diktat/plugin/maven/DiktatBaseMojoTest.kt",
    "chars": 6299,
    "preview": "package com.saveourtool.diktat.plugin.maven\n\nimport org.apache.maven.execution.DefaultMavenExecutionRequest\nimport org.a"
  },
  {
    "path": "diktat-maven-plugin/src/test/kotlin/com/saveourtool/diktat/plugin/maven/DiktatMavenPluginIntegrationTest.kt",
    "chars": 3770,
    "preview": "package com.saveourtool.diktat.plugin.maven\n\nimport com.soebes.itf.jupiter.extension.MavenGoal\nimport com.soebes.itf.jup"
  },
  {
    "path": "diktat-maven-plugin/src/test/resources/.mvn/jvm.config",
    "chars": 210,
    "preview": "-javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco.version}/org.jacoco.agent-${jacoco.version}-"
  },
  {
    "path": "diktat-maven-plugin/src/test/resources/.mvn/maven.config",
    "chars": 35,
    "preview": "-Ddiktat.version=${project.version}"
  },
  {
    "path": "diktat-rules/build.gradle.kts",
    "chars": 1531,
    "preview": "@Suppress(\"DSL_SCOPE_VIOLATION\", \"RUN_IN_SCRIPT\")  // https://github.com/gradle/gradle/issues/22797\nplugins {\n    id(\"co"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/common/config/rules/LegacyUtils.kt",
    "chars": 1294,
    "preview": "/**\n * This file contains aliases to support old names and util methods\n */\n\npackage com.saveourtool.diktat.common.confi"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/config/AbstractDiktatRuleConfigReader.kt",
    "chars": 2179,
    "preview": "package com.saveourtool.diktat.ruleset.config\n\nimport com.saveourtool.diktat.api.DiktatRuleConfig\nimport com.saveourtool"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/config/CommonConfiguration.kt",
    "chars": 2621,
    "preview": "package com.saveourtool.diktat.ruleset.config\n\nimport io.github.oshai.kotlinlogging.KLogger\nimport io.github.oshai.kotli"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/config/DiktatRuleConfigYamlReader.kt",
    "chars": 866,
    "preview": "package com.saveourtool.diktat.ruleset.config\n\nimport com.saveourtool.diktat.common.config.rules.RulesConfig\nimport com."
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/config/RuleConfiguration.kt",
    "chars": 294,
    "preview": "package com.saveourtool.diktat.ruleset.config\n\n/**\n * Configuration that allows customizing additional options of partic"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/constants/Chapters.kt",
    "chars": 2137,
    "preview": "package com.saveourtool.diktat.ruleset.constants\n\nimport com.saveourtool.diktat.common.config.rules.RulesConfig\nimport c"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/constants/Warnings.kt",
    "chars": 20873,
    "preview": "package com.saveourtool.diktat.ruleset.constants\n\nimport com.saveourtool.diktat.api.DiktatErrorEmitter\nimport com.saveou"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/DiktatRule.kt",
    "chars": 3377,
    "preview": "package com.saveourtool.diktat.ruleset.rules\n\nimport com.saveourtool.diktat.api.DiktatErrorEmitter\nimport com.saveourtoo"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/DiktatRuleSetFactoryImpl.kt",
    "chars": 11324,
    "preview": "package com.saveourtool.diktat.ruleset.rules\n\nimport com.saveourtool.diktat.api.DiktatRuleConfig\nimport com.saveourtool."
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter1/FileNaming.kt",
    "chars": 3511,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter1\n\nimport com.saveourtool.diktat.common.config.rules.RulesConfig\nimp"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter1/IdentifierNaming.kt",
    "chars": 26632,
    "preview": "@file:Suppress(\"FILE_WILDCARD_IMPORTS\")\n\npackage com.saveourtool.diktat.ruleset.rules.chapter1\n\nimport com.saveourtool.d"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter1/PackageNaming.kt",
    "chars": 16989,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter1\n\nimport com.saveourtool.diktat.common.config.rules.CommonConfigura"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter2/comments/CommentsRule.kt",
    "chars": 9721,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter2.comments\n\nimport com.saveourtool.diktat.common.config.rules.RulesC"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter2/comments/HeaderCommentRule.kt",
    "chars": 13855,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter2.comments\n\nimport com.saveourtool.diktat.common.config.rules.RuleCo"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter2/kdoc/CommentsFormatting.kt",
    "chars": 19657,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter2.kdoc\n\nimport com.saveourtool.diktat.common.config.rules.RuleConfig"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter2/kdoc/KdocComments.kt",
    "chars": 33231,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter2.kdoc\n\nimport com.saveourtool.diktat.common.config.rules.RuleConfig"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter2/kdoc/KdocFormatting.kt",
    "chars": 20087,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter2.kdoc\n\nimport com.saveourtool.diktat.common.config.rules.RuleConfig"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter2/kdoc/KdocMethods.kt",
    "chars": 19452,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter2.kdoc\n\nimport com.saveourtool.diktat.common.config.rules.RulesConfi"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/AnnotationNewLineRule.kt",
    "chars": 3148,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter3\n\nimport com.saveourtool.diktat.common.config.rules.RulesConfig\nimp"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/BlockStructureBraces.kt",
    "chars": 12877,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter3\n\nimport com.saveourtool.diktat.common.config.rules.RuleConfigurati"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/BooleanExpressionsRule.kt",
    "chars": 13134,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter3\n\nimport com.saveourtool.diktat.common.config.rules.RulesConfig\nimp"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/BracesInConditionalsAndLoopsRule.kt",
    "chars": 10281,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter3\n\nimport com.saveourtool.diktat.common.config.rules.RulesConfig\nimp"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/ClassLikeStructuresOrderRule.kt",
    "chars": 13975,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter3\n\nimport com.saveourtool.diktat.common.config.rules.RulesConfig\nimp"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/CollapseIfStatementsRule.kt",
    "chars": 9764,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter3\n\nimport com.saveourtool.diktat.common.config.rules.RuleConfigurati"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/ConsecutiveSpacesRule.kt",
    "chars": 3525,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter3\n\nimport com.saveourtool.diktat.common.config.rules.RuleConfigurati"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/DebugPrintRule.kt",
    "chars": 2923,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter3\n\nimport com.saveourtool.diktat.common.config.rules.RulesConfig\nimp"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/EmptyBlock.kt",
    "chars": 6914,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter3\n\nimport com.saveourtool.diktat.common.config.rules.RuleConfigurati"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/EnumsSeparated.kt",
    "chars": 5067,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter3\n\nimport com.saveourtool.diktat.common.config.rules.RulesConfig\nimp"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/LineLength.kt",
    "chars": 40397,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter3\n\nimport com.saveourtool.diktat.common.config.rules.RuleConfigurati"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/LongNumericalValuesSeparatedRule.kt",
    "chars": 5983,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter3\n\nimport com.saveourtool.diktat.common.config.rules.RuleConfigurati"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/MagicNumberRule.kt",
    "chars": 6824,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter3\n\nimport com.saveourtool.diktat.common.config.rules.RuleConfigurati"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/MultipleModifiersSequence.kt",
    "chars": 5022,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter3\n\nimport com.saveourtool.diktat.common.config.rules.RulesConfig\nimp"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/NullableTypeRule.kt",
    "chars": 8226,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter3\n\nimport com.saveourtool.diktat.common.config.rules.RulesConfig\nimp"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/PreviewAnnotationRule.kt",
    "chars": 5820,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter3\n\nimport com.saveourtool.diktat.common.config.rules.RulesConfig\nimp"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/RangeConventionalRule.kt",
    "chars": 6075,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter3\n\nimport com.saveourtool.diktat.common.config.rules.RuleConfigurati"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/SingleLineStatementsRule.kt",
    "chars": 2292,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter3\n\nimport com.saveourtool.diktat.common.config.rules.RulesConfig\nimp"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/SortRule.kt",
    "chars": 8215,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter3\n\nimport com.saveourtool.diktat.common.config.rules.RuleConfigurati"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/StringConcatenationRule.kt",
    "chars": 10081,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter3\n\nimport com.saveourtool.diktat.common.config.rules.RulesConfig\nimp"
  },
  {
    "path": "diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter3/StringTemplateFormatRule.kt",
    "chars": 5511,
    "preview": "package com.saveourtool.diktat.ruleset.rules.chapter3\n\nimport com.saveourtool.diktat.common.config.rules.RulesConfig\nimp"
  }
]

// ... and 767 more files (download for full content)

About this extraction

This page contains the full source code of the saveourtool/diktat GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 967 files (3.2 MB), approximately 910.7k tokens. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!