diktat

Strict coding standard for Kotlin and a custom set of rules for detecting code smells, code style issues and bugs

View the Project on GitHub saveourtool/diktat

Diktat Rule Code Style Auto-fixed? Chapter
VARIABLE_NAME_INCORRECT 1.1.1 no Naming
VARIABLE_HAS_PREFIX 1.1.1 yes Naming
IDENTIFIER_LENGTH 1.1.1 no Naming
GENERIC_NAME 1.1.1 yes Naming
BACKTICKS_PROHIBITED 1.1.1 no Naming
FILE_NAME_INCORRECT 1.1.1 yes Naming
EXCEPTION_SUFFIX 1.1.1 yes Naming
CONFUSING_IDENTIFIER_NAMING 1.1.1 no Naming
PACKAGE_NAME_MISSING 1.2.1 yes Naming
PACKAGE_NAME_INCORRECT_CASE 1.2.1 yes Naming
PACKAGE_NAME_INCORRECT_PREFIX 1.2.1 yes Naming
PACKAGE_NAME_INCORRECT_SYMBOLS 1.2.1 no Naming
PACKAGE_NAME_INCORRECT_PATH 1.2.1 yes Naming
INCORRECT_PACKAGE_SEPARATOR 1.2.1 yes Naming
CLASS_NAME_INCORRECT 1.3.1 yes Naming
OBJECT_NAME_INCORRECT 1.3.1 yes Naming
ENUM_VALUE 1.3.1 yes Naming
TYPEALIAS_NAME_INCORRECT_CASE 1.3.1 yes Naming
FUNCTION_NAME_INCORRECT_CASE 1.4.1 yes Naming
CONSTANT_UPPERCASE 1.5.1 yes Naming
VARIABLE_NAME_INCORRECT_FORMAT 1.6.1 yes Naming
FUNCTION_BOOLEAN_PREFIX 1.6.2 yes Naming
MISSING_KDOC_TOP_LEVEL 2.1.1 no Comments
MISSING_KDOC_CLASS_ELEMENTS 2.1.1 no Comments
MISSING_KDOC_ON_FUNCTION 2.1.1 yes Comments
KDOC_NO_CONSTRUCTOR_PROPERTY 2.1.1 yes Comments
KDOC_NO_CLASS_BODY_PROPERTIES_IN_HEADER 2.1.1 yes Comments
KDOC_EXTRA_PROPERTY 2.1.1 no Comments
KDOC_DUPLICATE_PROPERTY 2.1.1 no Comments
KDOC_NO_CONSTRUCTOR_PROPERTY_WITH_COMMENT 2.1.1 yes Comments
KDOC_WITHOUT_PARAM_TAG 2.1.2 yes Comments
KDOC_WITHOUT_RETURN_TAG 2.1.2 yes Comments
KDOC_WITHOUT_THROWS_TAG 2.1.2 yes Comments
KDOC_EMPTY_KDOC 2.1.3 no Comments
KDOC_WRONG_SPACES_AFTER_TAG 2.1.3 yes Comments
KDOC_WRONG_TAGS_ORDER 2.1.3 yes Comments
KDOC_NEWLINES_BEFORE_BASIC_TAGS 2.1.3 yes Comments
KDOC_NO_NEWLINES_BETWEEN_BASIC_TAGS 2.1.3 yes Comments
KDOC_NO_NEWLINE_AFTER_SPECIAL_TAGS 2.1.3 yes Comments
KDOC_NO_DEPRECATED_TAG 2.1.3 yes Comments
KDOC_CONTAINS_DATE_OR_AUTHOR 2.1.3 no Comments
KDOC_NO_EMPTY_TAGS 2.2.1 no Comments
HEADER_WRONG_FORMAT 2.2.1 yes Comments
HEADER_MISSING_OR_WRONG_COPYRIGHT 2.2.1 yes Comments
WRONG_COPYRIGHT_YEAR 2.2.1 yes Comments
HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE 2.2.1 no Comments
HEADER_NOT_BEFORE_PACKAGE 2.2.1 yes Comments
KDOC_TRIVIAL_KDOC_ON_FUNCTION 2.3.1 no Comments
WRONG_NEWLINES_AROUND_KDOC 2.4.1 yes Comments
FIRST_COMMENT_NO_BLANK_LINE 2.4.1 yes Comments
COMMENT_WHITE_SPACE 2.4.1 yes Comments
IF_ELSE_COMMENTS 2.4.1 yes Comments
COMMENTED_OUT_CODE 2.4.2 no Comments
FILE_IS_TOO_LONG 3.1.1 no General
FILE_CONTAINS_ONLY_COMMENTS 3.1.2 no General
FILE_INCORRECT_BLOCKS_ORDER 3.1.2 yes General
FILE_NO_BLANK_LINE_BETWEEN_BLOCKS 3.1.2 yes General
FILE_UNORDERED_IMPORTS 3.1.2 yes General
FILE_WILDCARD_IMPORTS 3.1.2 no General
UNUSED_IMPORT 3.1.2 yes General
FILE_NAME_MATCH_CLASS 3.1.2 yes General
WRONG_ORDER_IN_CLASS_LIKE_STRUCTURES 3.1.4 yes General
BLANK_LINE_BETWEEN_PROPERTIES 3.1.4 yes General
WRONG_DECLARATIONS_ORDER 3.1.4 yes General
TOP_LEVEL_ORDER 3.1.5 yes General
NO_BRACES_IN_CONDITIONALS_AND_LOOPS 3.2.1 yes General
BRACES_BLOCK_STRUCTURE_ERROR 3.2.2 yes General
WRONG_INDENTATION 3.3.1 yes General
EMPTY_BLOCK_STRUCTURE_ERROR 3.4.1 yes General
LONG_LINE 3.5.1 yes General
MORE_THAN_ONE_STATEMENT_PER_LINE 3.6.1 yes General
REDUNDANT_SEMICOLON 3.6.2 yes General
WRONG_NEWLINES 3.6.2 yes General
TRAILING_COMMA 3.6.2 yes General
COMPLEX_EXPRESSION 3.6.3 no General
COMPLEX_BOOLEAN_EXPRESSION 3.6.4 yes General
TOO_MANY_BLANK_LINES 3.7.1 yes General
WRONG_WHITESPACE 3.8.1 yes General
TOO_MANY_CONSECUTIVE_SPACES 3.8.1 yes General
ENUMS_SEPARATED 3.9.1 yes General
LOCAL_VARIABLE_EARLY_DECLARATION 3.10.2 no General
WHEN_WITHOUT_ELSE 3.11.1 yes General
ANNOTATION_NEW_LINE 3.12.1 yes General
WRONG_MULTIPLE_MODIFIERS_ORDER 3.14.1 yes General
LONG_NUMERICAL_VALUES_SEPARATED 3.14.2 yes General
MAGIC_NUMBER 3.14.3 no General
STRING_CONCATENATION 3.15.1 yes General
STRING_TEMPLATE_CURLY_BRACES 3.15.2 yes General
STRING_TEMPLATE_QUOTES 3.15.2 yes General
COLLAPSE_IF_STATEMENTS 3.16.1 yes General
CONVENTIONAL_RANGE 3.17.1 yes General
DEBUG_PRINT 3.18.1 no General
FLOAT_IN_ACCURATE_CALCULATIONS 4.1.1 no Variables
SAY_NO_TO_VAR 4.1.3 no Variables
SMART_CAST_NEEDED 4.2.1 yes Variables
TYPE_ALIAS 4.2.2 no Variables
NULLABLE_PROPERTY_TYPE 4.3.1 yes Variables
GENERIC_VARIABLE_WRONG_DECLARATION 4.3.2 yes Variables
AVOID_NULL_CHECKS 4.3.3 yes Variables
TOO_LONG_FUNCTION 5.1.1 no Functions
NESTED_BLOCK 5.1.2 no Functions
AVOID_NESTED_FUNCTIONS 5.1.3 yes Functions
INVERSE_FUNCTION_PREFERRED 5.1.4 yes Functions
LAMBDA_IS_NOT_LAST_PARAMETER 5.2.1 no Functions
TOO_MANY_PARAMETERS 5.2.2 no Functions
WRONG_OVERLOADING_FUNCTION_ARGUMENTS 5.2.3 no Functions
RUN_BLOCKING_INSIDE_ASYNC 5.2.4 no Functions
TOO_MANY_LINES_IN_LAMBDA 5.2.5 no Functions
CUSTOM_LABEL 5.2.6 no Functions
PARAMETER_NAME_IN_OUTER_LAMBDA 5.2.7 no Functions
SINGLE_CONSTRUCTOR_SHOULD_BE_PRIMARY 6.1.1 yes Classes
USE_DATA_CLASS 6.1.2 no Classes
EMPTY_PRIMARY_CONSTRUCTOR 6.1.3 yes Classes
MULTIPLE_INIT_BLOCKS 6.1.4 yes Classes
USELESS_SUPERTYPE 6.1.5 yes Classes
CLASS_SHOULD_NOT_BE_ABSTRACT 6.1.6 yes Classes
NO_CORRESPONDING_PROPERTY 6.1.7 no Classes
CUSTOM_GETTERS_SETTERS 6.1.8 no Classes
WRONG_NAME_OF_VARIABLE_INSIDE_ACCESSOR 6.1.9 no Classes
TRIVIAL_ACCESSORS_ARE_NOT_RECOMMENDED 6.1.10 yes Classes
COMPACT_OBJECT_INITIALIZATION 6.1.11 yes Classes
INLINE_CLASS_CAN_BE_USED 6.1.12 yes Classes
EXTENSION_FUNCTION_SAME_SIGNATURE 6.2.2 no Classes
EXTENSION_FUNCTION_WITH_CLASS 6.2.3 no Classes
USE_LAST_INDEX 6.2.4 yes Classes
AVOID_USING_UTILITY_CLASS 6.4.1 no Classes
OBJECT_IS_PREFERRED 6.4.2 yes Classes
RUN_IN_SCRIPT 6.5.1 yes Classes