From 912b713c046cd03a32cda125b6b4af8b73969f76 Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Thu, 30 Jun 2022 19:55:29 +0300 Subject: [PATCH 01/31] Update available-rules.md --- info/available-rules.md | 232 ++++++++++++++++++++-------------------- 1 file changed, 116 insertions(+), 116 deletions(-) diff --git a/info/available-rules.md b/info/available-rules.md index 16049b8201..5964d120c9 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -1,131 +1,131 @@ | Chap | Standard | Rule name | Description | Fix | Config | FixMe | |------|----------|-------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| 1 | 1.1.1 | CONFUSING_IDENTIFIER_NAMING | Check: warns if identifier has inappropriate name (See table of rule 1.2 part 6). | no | no | no | -| 1 | 1.1.1 | BACKTICKS_PROHIBITED | Check: warns if backticks (``) are used in the identifier name, except the case when it is test method (marked with @Test annotation) | no | no | - | | -| 1 | 1.1.1 | VARIABLE_NAME_INCORRECT | Check: warns if variable contains one single letter, only exceptions are fixed names that used in industry like {i, j}
Fix: no fix as we are not able to imagine good name by machine | no | no | Recursively update usages of this class in the projectMake exceptions configurable | -| 1 | 1.1.1 | EXCEPTION_SUFFIX | Check: warns if class that extends any Exception class does not have Exception suffix
Fix: Adding suffix "Exception" to a class name | yes | no | Need to add tests for this | -| 1 | 1.1.1 | IDENTIFIER_LENGTH | Check: identifier length should be in range [2,64] except names that used in industry like {i, j} and 'e' for catching exceptions.
Fix: no fix as we are not able to imagine good name by machine | no | no | May be make this rule configurable (length) | -| 1 | 1.1.1 | FILE_NAME_INCORRECT | Check: warns if file name does not have extension .kt/.kts
Fix: no | no | no | Extensions should be configurableIt can be aggressively autofixed | -| 1 | 1.1.1 | GENERIC_NAME | Check: warns if generic name contains more than 1 letter (capital). It can be followed by numbers, example: T12, T
Fix: | yes | no | Recursively update usages of this identifier in the project | -| 1 | 1.1.1 | VARIABLE_HAS_PREFIX | Check: warns if variable has prefix (like mVariable or M_VARIABLE), generally it is a bad code style (Android - is the only exception
Fix: no fix as we are not able to imagine good name by machine | no | no | may be we can fix it, but I do not see any sense for it | -| 1 | 1.2.1 | PACKAGE_NAME_MISSING | Check: warns if package name is missing in a file
Fix: automatically adds package directive with the name that starts from the domain name (in example - com.huawei) and contains the real directory | yes | no | Recursively fix all imports in project.
Fix the directory where the code is stored.
Make this check isolated from domain name addition | -| 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_CASE | Check: warns if package name is in incorrect (non-lower) case
Fix: automatically update the case in package name | yes | no | Recursively update all imports in the project. | -| 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_PREFIX | Check: warns if package name does not start with the company's domain
Fix: automatically update the prefix in the package name | yes | no | Fix the directory where the code is stored.
Recursively update all imports in the project. | -| 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_SYMBOLS | Check: warns if package name has incorrect symbols like underscore or non-ASCII letters/digits.Exception: underscores that are used for differentiating of keywords in a name.
Fix: no but will be | no | no | Add autofix for at least converting underscore to a dot or replacing itFix the directory where the code is stored.Cover autofix with tests | -| 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_PATH | Check: warns if the path for a file does not match with a package name
Fix: replacing incorrect package name with the name constructed from a path to the file. | yes | no | Make this check isolated from domain name creationRecursively update all imports in the project.Fix the directory where the code is stored.Add test mechanism to test checker | -| 1 | 1.2.1 | INCORRECT_PACKAGE_SEPARATOR | Check: warns if underscore is incorrectly used to split package naming
Fix: fixing all nodes in AST and the package name to remove all underscores | no | no | Recursively update usages of this class in the project | -| 1 | 1.3.1 | CLASS_NAME_INCORRECT | Check: warns if the Class/Enum/Interface name does not match Pascal case ("([A-Z][a-z0-9]+)+")
Fix: fixing the case: if the it is some fixed case (like snake/camel) - with word saving. If not - will restore PascalCase as is. | yes | no | Recursively update usages of this class in the projectCheck and decide the better way on converting identifier to PascalCaseNeed to add checks using natural language processing to check that class name contains only nouns | -| 1 | 1.3.1 | OBJECT_NAME_INCORRECT | Check: warns if the object does not match Pascal case ("([A-Z][a-z0-9]+)+")
Fix: fixing the case in the same way as for classes | yes | no | Recursively update usages of this class in the project | -| 1 | 1.3.1 | ENUM_VALUE | Check: checks if enum value is in upper SNAKE_CASE or in PascalCase depending on the config. UPPER_SNAKE_CASE is the default configuration, but can be changed by 'enumStyle' config
Fix: automatically converting case of enum to a proper selected case | yes | enumStyle: snakeCase, pascalCase | Recursively update usages of this identifier in the project | +| 1 | 1.1.1 | CONFUSING_IDENTIFIER_NAMING | Check: warns if the identifier has inappropriate name (See table of rule 1.2 part 6). | no | no | no | +| 1 | 1.1.1 | BACKTICKS_PROHIBITED | Check: warns if backticks (``) are used in the identifier name, except in the case when it is a test method (marked with @Test annotation) | no | no | - | | +| 1 | 1.1.1 | VARIABLE_NAME_INCORRECT | Check: warns if a variable contains one single letter; the only exceptions are fixed names that are used in industry like {i, j}
Fix: no fix is available to automatically create a name | no | no | Recursively update usages of this class in the projectMake exceptions configurable | +| 1 | 1.1.1 | EXCEPTION_SUFFIX | Check: warns if a class that extends any Exception class does not have an Exception suffix
Fix: Adding suffix "Exception" to a class name | yes | no | Need to add tests for this | +| 1 | 1.1.1 | IDENTIFIER_LENGTH | Check: identifier length should be in range [2,64] except names that are used in industry like {i, j} and 'e' for catching exceptions.
Fix: no fix is available to automatically create a name | no | no | May be make this rule configurable (length) | +| 1 | 1.1.1 | FILE_NAME_INCORRECT | Check: warns if a file name does not have an extension .kt/.kts
Fix: no | no | no | Extensions should be configurable; it can be autofixed | +| 1 | 1.1.1 | GENERIC_NAME | Check: warns if a generic name contains more than 1 letter (capital). It can be followed by numbers, for example: T12, T
Fix: | yes | no | Recursively update usages of this identifier in the project | +| 1 | 1.1.1 | VARIABLE_HAS_PREFIX | Check: warns if a variable has a prefix (like mVariable or M_VARIABLE), generally it is a bad code style (Android - is the only exception
Fix: no fix is available to automatically create a name | no | no | Maybe we can fix it, but I do not see any sense for it | +| 1 | 1.2.1 | PACKAGE_NAME_MISSING | Check: warns if the package name is missing in a file
Fix: automatically adds a package directive with the name that starts from the domain name (example - com.huawei) and contains the real directory | yes | no | Recursively fix all imports in the project.
Fix the directory where the code is stored.
Make this check isolated from the domain name addition. | +| 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_CASE | Check: warns if a package name is incorrect (non-lower) case
Fix: automatically update the case in package name | yes | no | Recursively update all imports in the project. | +| 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_PREFIX | Check: warns if a package name does not start with the company's domain
Fix: automatically update the prefix in the package name | yes | no | Fix the directory where the code is stored.
Recursively update all imports in the project. | +| 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_SYMBOLS | Check: warns if a package name has incorrect symbols like underscore or non-ASCII letters/digits.Exception: underscores that are used for differentiating of keywords in a name.
Fix: no fix currently; will be suggested later | no | no | Add autofix for at least converting underscore to a dot or replacing itFix the directory where the code is stored.Cover autofix with tests | +| 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_PATH | Check: warns if the path for a file does not match with a package name
Fix: replacing the incorrect package name with the name constructed from a path to the file. | yes | no | Make this check isolated from domain name creation.Recursively update all imports in the project.Fix the directory where the code is stored.Add a test mechanism to test checker. | +| 1 | 1.2.1 | INCORRECT_PACKAGE_SEPARATOR | Check: warns if the underscore is incorrectly used to split the package naming
Fix: fixing all nodes in AST and the package name to remove all underscores | no | no | Recursively update usages of this class in the project | +| 1 | 1.3.1 | CLASS_NAME_INCORRECT | Check: warns if the Class/Enum/Interface name does not match Pascal case ("([A-Z][a-z0-9]+)+")
Fix: fixing the case: if it is some fixed case (like snake/camel) - with word saving; if not - will restore PascalCase as is. | yes | no | Recursively update usages of this class in the projectCheck and decide the better way of converting the identifier to PascalCaseNeed to add checks using natural language processing to check that the class name contains only nouns | +| 1 | 1.3.1 | OBJECT_NAME_INCORRECT | Check: warns if the object does not match the Pascal case ("([A-Z][a-z0-9]+)+")
Fix: fixing the case in the same way as for the classes | yes | no | Recursively update usages of this class in the project | +| 1 | 1.3.1 | ENUM_VALUE | Check: checks if the enum value is in upper SNAKE_CASE or in PascalCase depending on the config. UPPER_SNAKE_CASE is the default configuration, but can be changed by 'enumStyle' config
Fix: automatically converting the enum case to a properly selected case | yes | enumStyle: snakeCase, pascalCase | Recursively update usages of this identifier in the project | | 1 | 1.3.1 | TYPEALIAS_NAME_INCORRECT_CASE | Check: typealias name should be in pascalCase:
Fix: | yes | no | Recursively update usages of this typealias in the project | | 1 | 1.4.1 | FUNCTION_NAME_INCORRECT_CASE | Check: function/method name should be in lowerCamelCase:
Fix: | yes | no | Recursively update usages of this function in the project | | 1 | 1.5.1 | CONSTANT_UPPERCASE | Check: warns if CONSTANT (treated as const val from companion object or class level) is in non UPPER_SNAKE_CASE
Fix: name is changed to UPPER_SNAKE_CASE | yes | no | Recursively update usages of this identifier in the project | -| 1 | 1.6.1 | VARIABLE_NAME_INCORRECT_FORMAT | Check: warns if the name of variable is not in lowerCamelCase or contains non-ASCII letters
Fix: fixing the case format to lowerCamelCase | | no | - | -| 1 | 1.6.2 | FUNCTION_BOOLEAN_PREFIX | Check: functions/methods that return boolean should have special prefix like "is/should/e.t.c"
Fix: | yes | no | Recursively update usages of this function in the projectAggressive fix - what if new name will not be valid | -| 2 | 2.1.1 | MISSING_KDOC_TOP_LEVEL | Check: warns on file level internal or public class or function has missing KDoc
Fix: no | no | no | Support extension for setters/gettersSupport extension for method "override" | -| 2 | 2.1.1 | KDOC_EXTRA_PROPERTY | Check: warn if there is property in KDoc which is not present in the class | no | no | - | -| 2 | 2.1.1 | MISSING_KDOC_CLASS_ELEMENTS | Check: warns if accessible internal elements (protected, public, internal) in a class are not documented
Fix: no | no | no | May be need to add exception cases for setters and getters. There is no sense in adding KDoc to them. | +| 1 | 1.6.1 | VARIABLE_NAME_INCORRECT_FORMAT | Check: warns if the name of the variable is not in lowerCamelCase or contains non-ASCII letters
Fix: fixing the case format to lowerCamelCase | | no | - | +| 1 | 1.6.2 | FUNCTION_BOOLEAN_PREFIX | Check: functions/methods that return boolean should have a special prefix, such as "is/should/e.t.c"
Fix: | yes | no | Recursively update usages of this function in the projectAggressive fix - what if the new name will not be valid? | +| 2 | 2.1.1 | MISSING_KDOC_TOP_LEVEL | Check: warns at file level internal or public class or if the function has a missing KDoc
Fix: no | no | no | Support extension for setters/gettersSupport extension for method "override" | +| 2 | 2.1.1 | KDOC_EXTRA_PROPERTY | Check: warn if there is a property in KDoc that is not present in the class | no | no | - | +| 2 | 2.1.1 | MISSING_KDOC_CLASS_ELEMENTS | Check: warns if accessible internal elements (protected, public, internal) in a class are not documented
Fix: no | no | no | Maybe need to add exception cases for setters and getters. There is no sense in adding KDoc to them. | | 2 | 2.1.1 | MISSING_KDOC_ON_FUNCTION | Check: warns if accessible function doesn't have KDoc
Fix: adds KDoc template if it is not empty | yes | no | | -| 2 | 2.1.1 | KDOC_NO_CONSTRUCTOR_PROPERTY | Check: warns if there is no property tag inside KDoc before constructor | yes | no | | -| 2 | 2.1.1 | KDOC_NO_CLASS_BODY_PROPERTIES_IN_HEADER | Check: warns if property is declared in class body but documented with property tag inside KDoc before constructor | yes | no | | -| 2 | 2.1.1 | KDOC_NO_CONSTRUCTOR_PROPERTY_WITH_COMMENT | Check: warns if there is comment before property in constructor | yes | no | | -| 2 | 2.1.1 | COMMENTED_BY_KDOC | Check: warns if there is kdoc comment in code block | yes | no | replace "/**" to "/*" | -| 2 | 2.1.2 | KDOC_WITHOUT_PARAM_TAG | Check: warns if accessible method has parameters and they are not documented in KDoc
Fix: If accessible method has no KDoc, KDoc template is added | yes | no | Should also make separate fix, even if there is already some Kdoc in place | -| 2 | 2.1.2 | KDOC_WITHOUT_RETURN_TAG | Check: warns if accessible method has explicit return type they it is not documented in KDoc
Fix: If accessible method has no KDoc, KDoc template is added | yes | no | Should also make separate fix, even if there is already some Kdoc in place | -| 2 | 2.1.2 | KDOC_WITHOUT_THROWS_TAG | Check: warns if accessible method has throw keyword and it is not documented in KDoc
Fix: If accessible method has no KDoc, KDoc template is added | yes | no | Should also make separate fix, even if there is already some Kdoc in place | -| 2 | 2.1.3 | KDOC_EMPTY_KDOC | Check: warns if KDoc is empty
Fix: no | no | no | | -| 2 | 2.1.3 | KDOC_WRONG_SPACES_AFTER_TAG | Check: warns if there is more than one space after KDoc tag
Fix: removes redundant spaces | yes | no | | -| 2 | 2.1.3 | KDOC_WRONG_TAGS_ORDER | Check: warns if basic KDoc tags are not oredered properly
Fix: reorders them `@param`, `@return`, `@throws` | yes | no | Ensure basic tags are at the end of KDoc | -| 2 | 2.1.3 | KDOC_NEWLINES_BEFORE_BASIC_TAGS | Check: warns if block of tags @param, @return, @throws is not separated from previous part of KDoc by exactly one empty line
Fix: adds empty line or removes redundant | yes | no | | -| 2 | 2.1.3 | KDOC_NO_NEWLINES_BETWEEN_BASIC_TAGS | Check: if there is newline of empty KDoc line (with leading asterisk) between `@param`, `@return`, `@throws` tags
Fix: removes line | yes | no | | -| 2 | 2.1.3 | KDOC_NO_NEWLINE_AFTER_SPECIAL_TAGS | Check: warns if special tags `@apiNote`, `@implNote`, `@implSpec` don't have exactly one empty line after
Fix: removes redundant lines or adds one | yes | no | Handle empty lines without leading asterisk | -| 2 | 2.1.3 | KDOC_NO_DEPRECATED_TAG | Check: warns if `@deprecated` is used in KDoc
Fix: adds `@Deprecated` annotation with message, removes tag | yes | no | Annotation's `replaceWith` field can be filled too | -| 2 | 2.2.1 | KDOC_NO_EMPTY_TAGS | Check: warns if KDoc tags have empty content | no | no | | -| 2 | 2.2.1 | KDOC_CONTAINS_DATE_OR_AUTHOR | Check: warns if header KDoc contains `@author` tag.
Warns if `@since` tag contains version and not date. | no | no | Detect author by other patterns (e.g. 'created by' etc.) | -| 2 | 2.2.1 | HEADER_WRONG_FORMAT | Checks: warns if there is no newline after header KDoc
Fix: adds newline | yes | no | Check if header is on the very top of file. It's hard to determine when it's not. | -| 2 | 2.2.1 | HEADER_MISSING_OR_WRONG_COPYRIGHT | Checks: copyright exists on top of file and is properly formatted (as a block comment)
Fix: adds copyright if it is missing and required | yes | isCopyrightMandatory, copyrightText (sets the copyright pattern for your project, you also can use `;@currYear;` key word in your text in aim to indicate current year, instead of explicit specifying) | | -| 2 | 2.2.1 | WRONG_COPYRIGHT_YEAR | Checks: copyright have a valid year
Fix: makes a year valid | yes | no | - | -| 2 | 2.2.1 | HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE | Check: warns if file with zero or >1 classes doesn't have header KDoc | no | no | | -| 2 | 2.2.1 | HEADER_NOT_BEFORE_PACKAGE | Check: warns if header KDoc if file is located not before package directive
Fix: moves this KDoc | yes | no | | +| 2 | 2.1.1 | KDOC_NO_CONSTRUCTOR_PROPERTY | Check: warns if there is no property tag inside KDoc before the constructor | yes | no | | +| 2 | 2.1.1 | KDOC_NO_CLASS_BODY_PROPERTIES_IN_HEADER | Check: warns if property is declared in class body but documented with property tag inside KDoc before the constructor | yes | no | | +| 2 | 2.1.1 | KDOC_NO_CONSTRUCTOR_PROPERTY_WITH_COMMENT | Check: warns if there is a comment before the property in the constructor | yes | no | | +| 2 | 2.1.1 | COMMENTED_BY_KDOC | Check: warns if there is a kdoc comment in the code block | yes | no | replace "/**" to "/*" | +| 2 | 2.1.2 | KDOC_WITHOUT_PARAM_TAG | Check: warns if an accessible method has parameters and they are not documented in KDoc
Fix: If accessible method has no KDoc, the KDoc template is added | yes | no | Should also make a separate fix, even if there is already some Kdoc in place | +| 2 | 2.1.2 | KDOC_WITHOUT_RETURN_TAG | Check: warns if accessible method has an explicit return type, then it is not documented in KDoc
Fix: If the accessible method has no KDoc, the KDoc template is added | yes | no | Should also make separate fix, even if there is already some Kdoc in place | +| 2 | 2.1.2 | KDOC_WITHOUT_THROWS_TAG | Check: warns if the accessible method has a throw keyword and it is not documented in KDoc
Fix: If the accessible method has no KDoc, KDoc template is added | yes | no | Should also make separate fix, even if there is already some Kdoc in place | +| 2 | 2.1.3 | KDOC_EMPTY_KDOC | Check: warns if the KDoc is empty
Fix: no | no | no | | +| 2 | 2.1.3 | KDOC_WRONG_SPACES_AFTER_TAG | Check: warns if there is more than one space after the KDoc tag
Fix: removes redundant spaces | yes | no | | +| 2 | 2.1.3 | KDOC_WRONG_TAGS_ORDER | Check: warns if the basic KDoc tags are not ordered properly
Fix: reorders them (`@param`, `@return`, `@throws`) | yes | no | Ensure basic tags are at the end of KDoc | +| 2 | 2.1.3 | KDOC_NEWLINES_BEFORE_BASIC_TAGS | Check: warns if the block of tags @param, @return, @throws is not separated from the previous part of KDoc by exactly one empty line
Fix: adds an empty line or removes a redundant one | yes | no | | +| 2 | 2.1.3 | KDOC_NO_NEWLINES_BETWEEN_BASIC_TAGS | Check: if there is a newline of an empty KDoc line (with a leading asterisk) between `@param`, `@return`, `@throws` tags
Fix: removes line | yes | no | | +| 2 | 2.1.3 | KDOC_NO_NEWLINE_AFTER_SPECIAL_TAGS | Check: warns if special tags `@apiNote`, `@implNote`, `@implSpec` don't have exactly one empty line after
Fix: removes redundant lines or adds one | yes | no | Handle empty lines without a leading asterisk | +| 2 | 2.1.3 | KDOC_NO_DEPRECATED_TAG | Check: warns if `@deprecated` is used in KDoc
Fix: adds `@Deprecated` annotation with a message, removes tag | yes | no | The `replaceWith` field in the annotation can be filled too | +| 2 | 2.2.1 | KDOC_NO_EMPTY_TAGS | Check: warns if the KDoc tags have empty content | no | no | | +| 2 | 2.2.1 | KDOC_CONTAINS_DATE_OR_AUTHOR | Check: warns if the KDoc header contains `@author` tag.
Warns if `@since` tag contains a version and not a date. | no | no | Detect the author by other patterns (e.g. 'created by' etc.) | +| 2 | 2.2.1 | HEADER_WRONG_FORMAT | Checks: warns if there is no newline after the KDoc header
Fix: adds a newline | yes | no | Check if the header is on the very top of the file. It is hard to determine when it is not. | +| 2 | 2.2.1 | HEADER_MISSING_OR_WRONG_COPYRIGHT | Checks: copyright exists on top of the file and is properly formatted (as a block comment)
Fix: adds copyright if it is missing and required | yes | isCopyrightMandatory, copyrightText (sets the copyright pattern for your project, you also can use `;@currYear;` the key word in your text in aim to indicate the current year, instead of explicitly specifying) | | +| 2 | 2.2.1 | WRONG_COPYRIGHT_YEAR | Checks: copyright has a valid year
Fix: makes the year valid | yes | no | - | +| 2 | 2.2.1 | HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE | Check: warns if a file with zero or >1 classes doesn't have a KDoc header | no | no | | +| 2 | 2.2.1 | HEADER_NOT_BEFORE_PACKAGE | Check: warns if a KDoc file header is located not before package directive
Fix: moves this KDoc | yes | no | | | 2 | 2.3.1 | KDOC_TRIVIAL_KDOC_ON_FUNCTION | Check: warns if KDoc contains single line with words 'return', 'get' or 'set' | no | no | | -| 2 | 2.4.1 | COMMENT_WHITE_SPACE | Check: warns if there is no space between // and comment, if there is no space between code and comment
Fix: adds a white space | yes | maxSpaces | - | -| 2 | 2.4.1 | WRONG_NEWLINES_AROUND_KDOC | Check: warns if there is no new line above and under comment. Exception first comment
Fix: adds a new line | yes | no | - | -| 2 | 2.4.1 | FIRST_COMMENT_NO_BLANK_LINE | Check: warns if there is a new line before first comment
Fix: deletes a new line | yes | no | - | +| 2 | 2.4.1 | COMMENT_WHITE_SPACE | Check: warns if there is no space between // and comment, if there is no space between the code and the comment
Fix: adds a white space | yes | maxSpaces | - | +| 2 | 2.4.1 | WRONG_NEWLINES_AROUND_KDOC | Check: warns if there is no new line above and under the comment. Exception on the first comment
Fix: adds a new line | yes | no | - | +| 2 | 2.4.1 | FIRST_COMMENT_NO_BLANK_LINE | Check: warns if there is a new line before the first comment
Fix: deletes a new line | yes | no | - | | 2 | 2.4.1 | IF_ELSE_COMMENTS | Check: warns if there is a comment not in the else block
Fix: adds the comment to the first line in else block | yes | no | - | -| 2 | 2.4.2 | COMMENTED_OUT_CODE | Check: warns if commented code is detected (when un-commented, can be parsed) | no | no | Offset is lost when joined EOL comments are split again | -| 3 | 3.1.1 | FILE_IS_TOO_LONG | Check: warns if file has too many lines
Fix: no | no | maxSize | - | -| 1 | 3.1.2 | FILE_NAME_MATCH_CLASS | Check: warns
Fix: no | no | no | Probably it can be autofixed, but it will be aggressive fix | -| 3 | 3.1.2 | FILE_CONTAINS_ONLY_COMMENTS | Check: warns if file contains only comments, imports and package directive. | no | no | - | -| 3 | 3.1.2 | FILE_INCORRECT_BLOCKS_ORDER | Check: warns if general order of code parts is wrong.
Fix: rearranges them. | yes | no | handle other elements that could be present before package directive (other comments) | -| 3 | 3.1.2 | FILE_NO_BLANK_LINE_BETWEEN_BLOCKS | Check: warns if there is not exactly one blank line between code parts.
Fix: leaves single empty line | yes | no | - | -| 3 | 3.1.2 | FILE_UNORDERED_IMPORTS | Check: warns if imports are not sorted alphabetically or contain empty lines among them
Fix: reorders imports. | yes | no | - | -| 3 | 3.1.2 | FILE_WILDCARD_IMPORTS | Check: warns if wildcard imports are used except allows. | no | allowedWildcards | - | +| 2 | 2.4.2 | COMMENTED_OUT_CODE | Check: warns if the commented code is detected (when uncommented, can be parsed) | no | no | Offset is lost when joined EOL comments are split again | +| 3 | 3.1.1 | FILE_IS_TOO_LONG | Check: warns if the file has too many lines
Fix: no | no | maxSize | - | +| 1 | 3.1.2 | FILE_NAME_MATCH_CLASS | Check: warns
Fix: no | no | no | Probably it can be agressively autofixed | +| 3 | 3.1.2 | FILE_CONTAINS_ONLY_COMMENTS | Check: warns if the file contains only comments, imports and package directive. | no | no | - | +| 3 | 3.1.2 | FILE_INCORRECT_BLOCKS_ORDER | Check: warns if the general order of code parts is wrong.
Fix: rearranges them. | yes | no | handle other elements that could be present before the package directive (other comments) | +| 3 | 3.1.2 | FILE_NO_BLANK_LINE_BETWEEN_BLOCKS | Check: warns if there is not exactly one blank line between the code parts.
Fix: leaves a single empty line | yes | no | - | +| 3 | 3.1.2 | FILE_UNORDERED_IMPORTS | Check: warns if the imports are not sorted alphabetically or contain empty lines among them
Fix: reorders imports. | yes | no | - | +| 3 | 3.1.2 | FILE_WILDCARD_IMPORTS | Check: warns if the wildcard imports are used except allows. | no | allowedWildcards | - | | 3 | 3.1.2 | UNUSED_IMPORT | Check: warns if import is unused. | no | deleteUnusedImport | - | -| 3 | 3.1.4 | WRONG_ORDER_IN_CLASS_LIKE_STRUCTURES | Check: warns if the declaration part of a class-like code structures (class/interface/etc.) is not in the proper order.
Fix: restores order according to code style guide. | yes | no | - | -| 3 | 3.1.4 | BLANK_LINE_BETWEEN_PROPERTIES | Check: warns if properties with comments are not separated by a blank line, properties without comments are
Fix: fixes number of blank lines | yes | no | - | -| 3 | 3.1.4 | WRONG_DECLARATIONS_ORDER | Check: if order of enum values or constant property inside companion isn't correct | yes | no | - | -| 3 | 3.1.5 | TOP_LEVEL_ORDER | Check: warns if top level order is incorrect | yes | no | - | +| 3 | 3.1.4 | WRONG_ORDER_IN_CLASS_LIKE_STRUCTURES | Check: warns if the declaration part of a class, such as code structure (class/interface/etc.) is not in the proper order.
Fix: restores order according to the code style guide. | yes | no | - | +| 3 | 3.1.4 | BLANK_LINE_BETWEEN_PROPERTIES | Check: warns if properties with comments are not separated by a blank line
Fix: fixes the number of blank lines | yes | no | - | +| 3 | 3.1.4 | WRONG_DECLARATIONS_ORDER | Check: if the order of enum values or constant property inside the companion is not correct | yes | no | - | +| 3 | 3.1.5 | TOP_LEVEL_ORDER | Check: warns if the top level order is incorrect | yes | no | - | | 3 | 3.2.1 | NO_BRACES_IN_CONDITIONALS_AND_LOOPS | Check: warns if braces are not used in if, else, when, for, do, and while statements. Exception: single line if statement (ternary operator).
Fix: adds missing braces. | yes | no | - | -| 3 | 3.2.2 | BRACES_BLOCK_STRUCTURE_ERROR | Check: warns if non-empty code blocks with braces don't follow the K&R style (1TBS or OTBS style) | yes | openBraceNewline closeBraceNewline | - | -| 3 | 3.3.1 | WRONG_INDENTATION | Check: warns if indentation is incorrect
Fix: corrects indentation.

Basic cases are covered currently. | yes | extendedIndentOfParameters
alignedParameters
extendedIndentAfterOperators
extendedIndentBeforeDot
indentationSize | - | -| 3 | 3.4.1 | EMPTY_BLOCK_STRUCTURE_ERROR | Check: warns if empty block exist or if it's style is incorrect | yes | allowEmptyBlocks styleEmptyBlockWithNewline | - | -| 3 | 3.5.1 | LONG_LINE | Check: warns if length doesn't exceed the specified length | no | lineLength | handle json method in KDoc | +| 3 | 3.2.2 | BRACES_BLOCK_STRUCTURE_ERROR | Check: warns if non-empty code blocks with braces do not follow the K&R style (1TBS or OTBS style) | yes | openBraceNewline closeBraceNewline | - | +| 3 | 3.3.1 | WRONG_INDENTATION | Check: warns if an indentation is incorrect
Fix: corrects the indentation.

Basic cases are covered currently. | yes | extendedIndentOfParameters
alignedParameters
extendedIndentAfterOperators
extendedIndentBeforeDot
indentationSize | - | +| 3 | 3.4.1 | EMPTY_BLOCK_STRUCTURE_ERROR | Check: warns if an empty block exists or if its style is incorrect | yes | allowEmptyBlocks styleEmptyBlockWithNewline | - | +| 3 | 3.5.1 | LONG_LINE | Check: warns if the length doesn't exceed the specified length | no | lineLength | handle json method in KDoc | | 3 | 3.6.1 | MORE_THAN_ONE_STATEMENT_PER_LINE | Check: warns if there is more than one statement per line | yes | no | - | -| 3 | 3.6.2 | REDUNDANT_SEMICOLON | Check: warns if semicolons are used at the end of line.
Fix: removes semicolon. | yes | no | - | -| 3 | 3.6.2 | WRONG_NEWLINES | Check: warns if line breaks do not follow code style guid.
Fix: fixes incorrect line breaks. | yes | no | - | -| 3 | 3.6.2 | COMPLEX_EXPRESSION | Check: warns if a long dot qualified expression is used in condition or as an argument | no | no | - | -| 3 | 3.6.2 | TRAILING_COMMA | Check: warns if missing trailing comma | yes | valueArgument valueParameter indices whenConditions collectionLiteral typeArgument typeParameter destructuringDeclaration | - | -| 3 | 3.7.1 | TOO_MANY_BLANK_LINES | Check: warns if blank lines are used placed incorrectly.
Fix: removes redundant blank lines. | yes | no | | -| 3 | 3.8.1 | WRONG_WHITESPACE | Check: warns if usage of horizontal spaces violates code style guide.
Fix: fixes incorrect whitespaces. | yes | no | - | -| 3 | 3.8.1 | TOO_MANY_CONSECUTIVE_SPACES | Check: warns if there are too many consecutive spaces in line. Exception: in enum if configured and single eol comments
Fix: squeezes spaces to 1. | yes | maxSpaces saveInitialFormattingForEnums | - | -| 3 | 3.9.1 | ENUMS_SEPARATED | Check: warns if enum structure is incorrect: enum entries should be separated by comma and line break and last entry should have semicolon in the end. | yes | no | Replace variable to enum if it possible | -| 3 | 3.10.2 | LOCAL_VARIABLE_EARLY_DECLARATION | Check: warns if local variable is declared not immediately before it's usage
Fix (not implemented yet): moves variable declaration | no | no | add auto fix | -| 3 | 3.11.1 | WHEN_WITHOUT_ELSE | Check: warns if when statement don't have else in the end.
Fix: adds else if when doesn't have it. | yes | no | - | If a when statement of type enum or sealed contains all values of a enum - there is no need to have "else" branch. | -| 3 | 3.12.1 | ANNOTATION_NEW_LINE | Check: warns if annotation not on a new single line | yes | no | - | -| 3 | 3.14.1 | WRONG_MULTIPLE_MODIFIERS_ORDER | Check: if multiple modifiers sequence is in the wrong order. Value identifier supported in Kotlin 1.5 | yes | no | - | -| 3 | 3.14.2 | LONG_NUMERICAL_VALUES_SEPARATED | Check: warns if value on integer or float constant is too big | no | maxNumberLength maxBlockLength | - | -| 3 | 3.14.3 | MAGIC_NUMBER | Check: warns if there is magic numbers in the code | no | ignoreNumbers, ignoreHashCodeFunction, ignorePropertyDeclaration, ignoreLocalVariableDeclaration, ignoreConstantDeclaration, ignoreCompanionObjectPropertyDeclaration, ignoreEnums, ignoreRanges, ignoreExtensionFunctions | no | -| 3 | 3.15.1 | STRING_CONCATENATION | Check: warns if in a single line concatenation of strings is used | yes | no | - | -| 3 | 3.15.2 | STRING_TEMPLATE_CURLY_BRACES | Check: warns if there is redundant curly braces in string template
Fix: deletes curly braces | yes | no | + | -| 3 | 3.15.2 | STRING_TEMPLATE_QUOTES | Check: warns if there are redundant quotes in string template
Fix: deletes quotes and $ symbol | yes | no | + | -| 3 | 3.16.1 | COLLAPSE_IF_STATEMENTS | Check: warns if there are redundant nested if-statements, which could be collapsed into a single one by concatenating their conditions | yes | no | - | -| 3 | 3.16.2 | COMPLEX_BOOLEAN_EXPRESSION | Check: warns if boolean expression is complex and can be simplified.
Fix: replaces boolean expression with the simpler one | yes | no | + | -| 3 | 3.17.1 | CONVENTIONAL_RANGE | Check: warns if possible to replace range with until or replace `rangeTo` function with range.
Fix: replace range with until or replace `rangeTo` function with range | yes | no | - | +| 3 | 3.6.2 | REDUNDANT_SEMICOLON | Check: warns if semicolons are used at the end of a line.
Fix: removes the semicolon. | yes | no | - | +| 3 | 3.6.2 | WRONG_NEWLINES | Check: warns if line breaks do not follow the code style guide.
Fix: fixes incorrect line breaks. | yes | no | - | +| 3 | 3.6.2 | COMPLEX_EXPRESSION | Check: warns if a long dot qualified expression is used in a condition or as an argument | no | no | - | +| 3 | 3.6.2 | TRAILING_COMMA | Check: warns if missing a trailing comma | yes | valueArgument valueParameter indices whenConditions collectionLiteral typeArgument typeParameter destructuringDeclaration | - | +| 3 | 3.7.1 | TOO_MANY_BLANK_LINES | Check: warns if blank lines are used or placed incorrectly.
Fix: removes redundant blank lines. | yes | no | | +| 3 | 3.8.1 | WRONG_WHITESPACE | Check: warns if usage of horizontal spaces violates the code style guide.
Fix: fixes incorrect whitespaces. | yes | no | - | +| 3 | 3.8.1 | TOO_MANY_CONSECUTIVE_SPACES | Check: warns if there are too many consecutive spaces in a line. Exception: in an enum if there is a configured and single eol comment
Fix: squeezes spaces to 1. | yes | maxSpaces saveInitialFormattingForEnums | - | +| 3 | 3.9.1 | ENUMS_SEPARATED | Check: warns if an enum structure is incorrect: the enum entries should be separated by a comma and line break and the last entry should have a semicolon in the end. | yes | no | Replace variable to enum if it possible | +| 3 | 3.10.2 | LOCAL_VARIABLE_EARLY_DECLARATION | Check: warns if a local variable is declared not immediately before its usage
Fix (not implemented yet): moves the variable declaration | no | no | add auto fix | +| 3 | 3.11.1 | WHEN_WITHOUT_ELSE | Check: warns if when a statement does not have else in the end.
Fix: adds else when a statement doesn't have it. | yes | no | - | If a when statement of type enum or sealed contains all values of a enum - there is no need to have "else" branch. | +| 3 | 3.12.1 | ANNOTATION_NEW_LINE | Check: warns if an annotation is not on a new single line | yes | no | - | +| 3 | 3.14.1 | WRONG_MULTIPLE_MODIFIERS_ORDER | Check: warns if the multiple modifiers sequence is in the wrong order. Value identifier supported in Kotlin 1.5 | yes | no | - | +| 3 | 3.14.2 | LONG_NUMERICAL_VALUES_SEPARATED | Check: warns if the value of the integer or float constant is too big | no | maxNumberLength maxBlockLength | - | +| 3 | 3.14.3 | MAGIC_NUMBER | Check: warns if there are magic numbers in the code | no | ignoreNumbers, ignoreHashCodeFunction, ignorePropertyDeclaration, ignoreLocalVariableDeclaration, ignoreConstantDeclaration, ignoreCompanionObjectPropertyDeclaration, ignoreEnums, ignoreRanges, ignoreExtensionFunctions | no | +| 3 | 3.15.1 | STRING_CONCATENATION | Check: warns if in a single line, the concatenation of strings is used | yes | no | - | +| 3 | 3.15.2 | STRING_TEMPLATE_CURLY_BRACES | Check: warns if there are redundant curly braces in the string template
Fix: deletes the curly braces | yes | no | + | +| 3 | 3.15.2 | STRING_TEMPLATE_QUOTES | Check: warns if there are redundant quotes in the string template
Fix: deletes the quotes and $ symbol | yes | no | + | +| 3 | 3.16.1 | COLLAPSE_IF_STATEMENTS | Check: warns if there are redundant nested if-statements, which could be collapsed into a single statement by concatenating their conditions | yes | no | - | +| 3 | 3.16.2 | COMPLEX_BOOLEAN_EXPRESSION | Check: warns if the boolean expression is complex and can be simplified.
Fix: replaces the boolean expression with a simpler one | yes | no | + | +| 3 | 3.17.1 | CONVENTIONAL_RANGE | Check: warns if possible to replace the range with until or replace the `rangeTo` function with a range.
Fix: replace range with until or replace the `rangeTo` function with a range | yes | no | - | | 3 | 3.18.1 | DEBUG_PRINT | Check: warns if there is a printing to console. Assumption that it's a debug logging | no | no | - | -| 4 | 4.1.1 | FLOAT_IN_ACCURATE_CALCULATIONS | Checks that floating-point values are not used in arithmetic expressions
Fix: no | no | no | Current implementation detects only floating-point constants | -| 4 | 4.1.3 | SAY_NO_TO_VAR | Check: raises a warning if `var` modifier is used on local variable (not in class, not on file level). And this var is not used in accumulators | no | no | no | several fixmes related to the search mechanism (VariablesSearch) and fixme for checking reassinment of this var | -| 4 | 4.2.1 | SMART_CAST_NEEDED | Check: warns if casting can be omitted
Fix: Deletes casting | yes | no | - | | +| 4 | 4.1.1 | FLOAT_IN_ACCURATE_CALCULATIONS | Checks that the floating-point values are not used in the arithmetic expressions
Fix: no | no | no | Current implementation detects only floating-point constants | +| 4 | 4.1.3 | SAY_NO_TO_VAR | Check: warns if `var` modifier is used for a local variable (not in a class, not at file level). And this var is not used in accumulators | no | no | no | several fixmes related to the search mechanism (VariablesSearch) and fixme for checking reassinment of this var | +| 4 | 4.2.1 | SMART_CAST_NEEDED | Check: warns if the casting can be omitted
Fix: Deletes casting | yes | no | - | | | 4 | 4.2.2 | TYPE_ALIAS | Check: if type reference of property is longer than expected | yes | typeReferenceLength | - | -| 4 | 4.2.2 | TYPE_ALIAS | Check: if type reference of property is longer than expected | yes | typeReferenceLength | - | -| 4 | 4.3.1 | NULLABLE_PROPERTY_TYPE | Check: warns if immutable property is initialized with null or if immutable property can have non-nullable type instead of nullable
Fix: suggests initial value instead of null or changes immutable property type | yes | no | - | -| 4 | 4.3.2 | GENERIC_VARIABLE_WRONG_DECLARATION | Check: warns if variables of generic types don't have explicit type declaration
Fix: fixes only variables that have generic declaration on both sides | yes | no | + | -| 4 | 4.3.3 | AVOID_NULL_CHECKS | Check: warns if null-check is used explicitly (for example: if (a == null)) | yes | no | no autofix by for now | -| 5 | 5.1.1 | TOO_LONG_FUNCTION | Check: if length of function is too long | no | maxFunctionLength isIncludeHeader | | -| 5 | 5.1.2 | NESTED_BLOCK | Check if function has more nested blocks than expected | no | maxNestedBlockQuantit | | -| 5 | 5.1.3 | AVOID_NESTED_FUNCTIONS | Check: if there are any nested functions
Fix: declare function in the outer scope | yes | no | + | -| 5 | 5.1.4 | INVERSE_FUNCTION_PREFERRED | Check: if function call with "!" can be rewritten to the inverse function (!isEmpty() -> isNotEmpty())
Fix: Rewrites function call | yes | - | - | -| 5 | 5.2.1 | LAMBDA_IS_NOT_LAST_PARAMETER | Checks that lambda inside function parameters isn't in the end | no | no | | -| 5 | 5.2.2 | TOO_MANY_PARAMETERS | Check: if function contains more parameters than allowed | no | maxParameterListSize | | -| 5 | 5.2.3 | WRONG_OVERLOADING_FUNCTION_ARGUMENTS | Check: function has overloading instead use default arguments | no | no | | -| 5 | 5.2.4 | RUN_BLOCKING_INSIDE_ASYNC | Check: using runBlocking inside async block code | no | no | - | -| 5 | 5.2.5 | TOO_MANY_LINES_IN_LAMBDA | Check: that the long lambda has parameters | no | maxLambdaLength | | -| 5 | 5.2.6 | CUSTOM_LABEL | Check: that using unnecessary, custom label | no | no | - | -| 5 | 5.2.7 | PARAMETER_NAME_IN_OUTER_LAMBDA | Check: warns if outer lambda uses implicit parameter `it` | no | no | - | +| 4 | 4.2.2 | TYPE_ALIAS | Check: if a type reference for property is longer than expected | yes | typeReferenceLength | - | +| 4 | 4.3.1 | NULLABLE_PROPERTY_TYPE | Check: warns if an immutable property is initialized with null or if the immutable property can have non-nullable type instead of nullable
Fix: suggests the initial value instead of null or changes in the immutable property type | yes | no | - | +| 4 | 4.3.2 | GENERIC_VARIABLE_WRONG_DECLARATION | Check: warns if variables of generic types don't have an explicit type declaration
Fix: fixes only the variables that have a generic declaration on both sides | yes | no | + | +| 4 | 4.3.3 | AVOID_NULL_CHECKS | Check: warns if null-check is used explicitly (for example: if (a == null)) | yes | no | currently, no autofix | +| 5 | 5.1.1 | TOO_LONG_FUNCTION | Check: warns if the length of the function is too long | no | maxFunctionLength isIncludeHeader | | +| 5 | 5.1.2 | NESTED_BLOCK | Warns if the function has more nested blocks than expected | no | maxNestedBlockQuantit | | +| 5 | 5.1.3 | AVOID_NESTED_FUNCTIONS | Check: Warns if there are nested functions
Fix: declare the function in the outer scope | yes | no | + | +| 5 | 5.1.4 | INVERSE_FUNCTION_PREFERRED | Check: Warns if a function call with "!" can be rewritten to the inverse function (!isEmpty() -> isNotEmpty())
Fix: Rewrites the function call | yes | - | - | +| 5 | 5.2.1 | LAMBDA_IS_NOT_LAST_PARAMETER | Checks that the lambda inside function parameters is not at the end | no | no | | +| 5 | 5.2.2 | TOO_MANY_PARAMETERS | Check: Warns if function contains more parameters than allowed | no | maxParameterListSize | | +| 5 | 5.2.3 | WRONG_OVERLOADING_FUNCTION_ARGUMENTS | Check: Warns if the function has overloading instead of using default arguments | no | no | | +| 5 | 5.2.4 | RUN_BLOCKING_INSIDE_ASYNC | Check: Warns if using runBlocking inside the async block code | no | no | - | +| 5 | 5.2.5 | TOO_MANY_LINES_IN_LAMBDA | Checks that the long lambda has parameters | no | maxLambdaLength | | +| 5 | 5.2.6 | CUSTOM_LABEL | Check: Warns if using an unnecessary, custom label | no | no | - | +| 5 | 5.2.7 | PARAMETER_NAME_IN_OUTER_LAMBDA | Check: warns if the outer lambda uses an implicit parameter `it` | no | no | - | | 6 | 6.1.1 | SINGLE_CONSTRUCTOR_SHOULD_BE_PRIMARY | Check: warns if there is only one secondary constructor in a class
Fix: converts it to a primary constructor | yes | no | Support more complicated logic of constructor conversion | | 6 | 6.1.2 | USE_DATA_CLASS | Check: if class can be made as data class | no | no | yes | -| 6 | 6.1.3 | EMPTY_PRIMARY_CONSTRUCTOR | Check: if there is empty primary constructor | yes | no | yes | -| 6 | 6.1.4 | MULTIPLE_INIT_BLOCKS | Checks that classes have only one init block | yes | no | - | -| 6 | 6.1.5 | USELESS_SUPERTYPE | Check: if override function can be removed | yes | no | | -| 6 | 6.1.6 | CLASS_SHOULD_NOT_BE_ABSTRACT | Checks: if abstract class has any abstract method. If not, warns that class should not be abstract
Fix: deletes abstract modifier | yes | no | - | -| 6 | 6.1.7 | NO_CORRESPONDING_PROPERTY | Checks: if in case of using "backing property" scheme, the name of real and back property are the same | no | no | - | -| 6 | 6.1.8 | CUSTOM_GETTERS_SETTERS | Check: Inspection that checks that no custom getters and setters are used for properties | no | no | - | -| 6 | 6.1.9 | WRONG_NAME_OF_VARIABLE_INSIDE_ACCESSOR | Check: used the name of a variable in the custom getter or setter | no | no | | -| 6 | 6.1.10 | TRIVIAL_ACCESSORS_ARE_NOT_RECOMMENDED | Check: if there are any trivial getters or setters
Fix: Delete trivial getter or setter | yes | no | - | -| 6 | 6.1.11 | COMPACT_OBJECT_INITIALIZATION | Checks if class instantiation can be wrapped in `apply` for better readability | | no | | -| 6 | 6.1.12 | INLINE_CLASS_CAN_BE_USED | Check: warns if class can be transferred to the inline class. | no | no | yes | -| 6 | 6.2.2 | EXTENSION_FUNCTION_SAME_SIGNATURE | Checks if extension function has the same signature as another extension function and their classes are related | no | no | + | -| 6 | 6.2.3 | EXTENSION_FUNCTION_WITH_CLASS | Check: if file contains class, then it can not have extension functions for the same class | no | no | - | -| 6 | 6.2.4 | USE_LAST_INDEX | Check: should change property length - 1 to property lastIndex | no | no | - | -| 6 | 6.4.1 | AVOID_USING_UTILITY_CLASS | Checks if there is class/object that can be replace with extension function | no | no | - | -| 6 | 6.4.2 | OBJECT_IS_PREFERRED | Checks: if class is stateless it is preferred to use `object` | yes | no | + | -| 6 | 6.5.1 | RUN_IN_SCRIPT | Checks : if kts script contains other functions except run code | yes | no | - | +| 6 | 6.1.3 | EMPTY_PRIMARY_CONSTRUCTOR | Check: warns if there is an empty primary constructor | yes | no | yes | +| 6 | 6.1.4 | MULTIPLE_INIT_BLOCKS | Checks that the classes have only one init block | yes | no | - | +| 6 | 6.1.5 | USELESS_SUPERTYPE | Checks if the override function can be removed | yes | no | | +| 6 | 6.1.6 | CLASS_SHOULD_NOT_BE_ABSTRACT | Checks if the abstract class has any abstract method. If not, it warns that the class should not be abstract
Fix: deletes the abstract modifier | yes | no | - | +| 6 | 6.1.7 | NO_CORRESPONDING_PROPERTY | Checks: warns if in the case of using "backing property" scheme, the name of real and back property are the same | no | no | - | +| 6 | 6.1.8 | CUSTOM_GETTERS_SETTERS | Check: Inspection that checks that no custom getters and setters are used for the properties | no | no | - | +| 6 | 6.1.9 | WRONG_NAME_OF_VARIABLE_INSIDE_ACCESSOR | Checks if the name of a variable is used in the custom getter or setter | no | no | | +| 6 | 6.1.10 | TRIVIAL_ACCESSORS_ARE_NOT_RECOMMENDED | Checks if there are trivial getters or setters
Fix: Delete the trivial getter or setter | yes | no | - | +| 6 | 6.1.11 | COMPACT_OBJECT_INITIALIZATION | Checks if the class instantiation can be wrapped in `apply` for better readability | | no | | +| 6 | 6.1.12 | INLINE_CLASS_CAN_BE_USED | Check: warns if the class can be transferred to the inline class. | no | no | yes | +| 6 | 6.2.2 | EXTENSION_FUNCTION_SAME_SIGNATURE | Checks if an extension function has the same signature as another extension function and their classes are related | no | no | + | +| 6 | 6.2.3 | EXTENSION_FUNCTION_WITH_CLASS | Check: if the file contains a class, then it can not have extension functions for the same class | no | no | - | +| 6 | 6.2.4 | USE_LAST_INDEX | Check: should change a property length - 1 to the property lastIndex | no | no | - | +| 6 | 6.4.1 | AVOID_USING_UTILITY_CLASS | Checks if there is a class/object that can be replaced with the extension function | no | no | - | +| 6 | 6.4.2 | OBJECT_IS_PREFERRED | Check: if class is stateless, then it is preferred to use `object` | yes | no | + | +| 6 | 6.5.1 | RUN_IN_SCRIPT | Checks : if the kts script contains other functions except the run code | yes | no | - | From bf0456fe1ea542c65607c955853b51deb6d1c5b5 Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Tue, 5 Jul 2022 00:32:32 +0300 Subject: [PATCH 02/31] Update available-rules.md --- info/available-rules.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/info/available-rules.md b/info/available-rules.md index 5964d120c9..faef966559 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -1,14 +1,15 @@ | Chap | Standard | Rule name | Description | Fix | Config | FixMe | |------|----------|-------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 1 | 1.1.1 | CONFUSING_IDENTIFIER_NAMING | Check: warns if the identifier has inappropriate name (See table of rule 1.2 part 6). | no | no | no | -| 1 | 1.1.1 | BACKTICKS_PROHIBITED | Check: warns if backticks (``) are used in the identifier name, except in the case when it is a test method (marked with @Test annotation) | no | no | - | | -| 1 | 1.1.1 | VARIABLE_NAME_INCORRECT | Check: warns if a variable contains one single letter; the only exceptions are fixed names that are used in industry like {i, j}
Fix: no fix is available to automatically create a name | no | no | Recursively update usages of this class in the projectMake exceptions configurable | -| 1 | 1.1.1 | EXCEPTION_SUFFIX | Check: warns if a class that extends any Exception class does not have an Exception suffix
Fix: Adding suffix "Exception" to a class name | yes | no | Need to add tests for this | -| 1 | 1.1.1 | IDENTIFIER_LENGTH | Check: identifier length should be in range [2,64] except names that are used in industry like {i, j} and 'e' for catching exceptions.
Fix: no fix is available to automatically create a name | no | no | May be make this rule configurable (length) | -| 1 | 1.1.1 | FILE_NAME_INCORRECT | Check: warns if a file name does not have an extension .kt/.kts
Fix: no | no | no | Extensions should be configurable; it can be autofixed | -| 1 | 1.1.1 | GENERIC_NAME | Check: warns if a generic name contains more than 1 letter (capital). It can be followed by numbers, for example: T12, T
Fix: | yes | no | Recursively update usages of this identifier in the project | -| 1 | 1.1.1 | VARIABLE_HAS_PREFIX | Check: warns if a variable has a prefix (like mVariable or M_VARIABLE), generally it is a bad code style (Android - is the only exception
Fix: no fix is available to automatically create a name | no | no | Maybe we can fix it, but I do not see any sense for it | -| 1 | 1.2.1 | PACKAGE_NAME_MISSING | Check: warns if the package name is missing in a file
Fix: automatically adds a package directive with the name that starts from the domain name (example - com.huawei) and contains the real directory | yes | no | Recursively fix all imports in the project.
Fix the directory where the code is stored.
Make this check isolated from the domain name addition. | +| 1 | 1.1.1 | BACKTICKS_PROHIBITED | Check: warns if backticks (``) are used in the identifier name, except in the case when it is a test method (marked with `@Test` annotation). | no | no | - | | +| 1 | 1.1.1 | VARIABLE_NAME_INCORRECT | Check: warns if a variable name consists of only a single character; the only exceptions are industry-standard fixed names, such as {`i`, `j`}
Fix: No fix is available, since it is the responsibility of a human to choose a meaningful identifier name. | no | no | Recursively update usages of this class in the projectMake exceptions configurable. | +| 1 | 1.1.1 | EXCEPTION_SUFFIX | Check: warns if a class that extends any `Exception` class does not have an "Exception" suffix
Fix: adding the "Exception" suffix to the class name. | yes | no | Need to add tests for this. | +| 1 | 1.1.1 | IDENTIFIER_LENGTH | Check: identifier length should be in range [2,64], except for industry-standard names, such as {`i`, `j`} and 'e' for catching exceptions.
Fix: Fix: no fix is available, since only a human can choose a meaningful identifier name depending on the context. | no | no | May be make this rule configurable (length) | +| 1 | 1.1.1 | FILE_NAME_INCORRECT | Check: warns if a file name does not have a `.kt`/`.kts` extension
Fix: no | no | no | Extensions should be configurable; it can be autofixed | +| 1 | 1.1.1 | GENERIC_NAME | Check: warns if the name of a [_generic type parameter_](https://kotlinlang.org/docs/generics.html) (e.g. `T`) consists of more than a single capital letter. The capital letter can be followed by numbers, though (e. g. T12, T).
Fix: | yes | no | Recursively update usages of this identifier in the project. | +| 1 | 1.1.1 | VARIABLE_HAS_PREFIX | Check: warns if the name of a variable has a [Hungarian notation](https://en.wikipedia.org/wiki/Hungarian_notation) specific prefix (like `mVariable` or `M_VARIABLE`); generally, it is **considered** a bad code style (_Android_ **being** the the only exception). +
Fix: none is available, as only a human can choose a meaningful name depending on the context. | no | no | Maybe we can fix it, but I do not see any sense for it. | +| 1 | 1.2.1 | PACKAGE_NAME_MISSING | Check: warns if a file is missing the package declaration.
Fix: automatically adds a package directive with the name that starts from the domain name (example - com.huawei) and contains the real directory. | yes | no | Recursively fix all imports in the project.
Fix the directory where the code is stored.
Make this check isolated from the domain name addition. | | 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_CASE | Check: warns if a package name is incorrect (non-lower) case
Fix: automatically update the case in package name | yes | no | Recursively update all imports in the project. | | 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_PREFIX | Check: warns if a package name does not start with the company's domain
Fix: automatically update the prefix in the package name | yes | no | Fix the directory where the code is stored.
Recursively update all imports in the project. | | 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_SYMBOLS | Check: warns if a package name has incorrect symbols like underscore or non-ASCII letters/digits.Exception: underscores that are used for differentiating of keywords in a name.
Fix: no fix currently; will be suggested later | no | no | Add autofix for at least converting underscore to a dot or replacing itFix the directory where the code is stored.Cover autofix with tests | From d5f3f206bdc7bca4d3dc26ad3edb72c499dc419d Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Tue, 5 Jul 2022 00:48:47 +0300 Subject: [PATCH 03/31] Update available-rules.md --- info/available-rules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info/available-rules.md b/info/available-rules.md index faef966559..27364336aa 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -1,6 +1,6 @@ | Chap | Standard | Rule name | Description | Fix | Config | FixMe | |------|----------|-------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| 1 | 1.1.1 | CONFUSING_IDENTIFIER_NAMING | Check: warns if the identifier has inappropriate name (See table of rule 1.2 part 6). | no | no | no | +| 1 | 1.1.1 | CONFUSING_IDENTIFIER_NAMING | Check: warns if the identifier has inappropriate name (See table of [rule 1.2 part 6] (guide/diktat-coding-convention.md#-111-identifiers-naming-conventions)). | no | no | no | | 1 | 1.1.1 | BACKTICKS_PROHIBITED | Check: warns if backticks (``) are used in the identifier name, except in the case when it is a test method (marked with `@Test` annotation). | no | no | - | | | 1 | 1.1.1 | VARIABLE_NAME_INCORRECT | Check: warns if a variable name consists of only a single character; the only exceptions are industry-standard fixed names, such as {`i`, `j`}
Fix: No fix is available, since it is the responsibility of a human to choose a meaningful identifier name. | no | no | Recursively update usages of this class in the projectMake exceptions configurable. | | 1 | 1.1.1 | EXCEPTION_SUFFIX | Check: warns if a class that extends any `Exception` class does not have an "Exception" suffix
Fix: adding the "Exception" suffix to the class name. | yes | no | Need to add tests for this. | From 7bb72a24910f4e08c0aebf7cd3685118734d26de Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Tue, 5 Jul 2022 00:50:14 +0300 Subject: [PATCH 04/31] Update available-rules.md --- info/available-rules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info/available-rules.md b/info/available-rules.md index 27364336aa..d538b3a03c 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -1,6 +1,6 @@ | Chap | Standard | Rule name | Description | Fix | Config | FixMe | |------|----------|-------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| 1 | 1.1.1 | CONFUSING_IDENTIFIER_NAMING | Check: warns if the identifier has inappropriate name (See table of [rule 1.2 part 6] (guide/diktat-coding-convention.md#-111-identifiers-naming-conventions)). | no | no | no | +| 1 | 1.1.1 | CONFUSING_IDENTIFIER_NAMING | Check: warns if the identifier has inappropriate name (See table of [rule 1.2 part 6](guide/diktat-coding-convention.md#-111-identifiers-naming-conventions)). | no | no | no | | 1 | 1.1.1 | BACKTICKS_PROHIBITED | Check: warns if backticks (``) are used in the identifier name, except in the case when it is a test method (marked with `@Test` annotation). | no | no | - | | | 1 | 1.1.1 | VARIABLE_NAME_INCORRECT | Check: warns if a variable name consists of only a single character; the only exceptions are industry-standard fixed names, such as {`i`, `j`}
Fix: No fix is available, since it is the responsibility of a human to choose a meaningful identifier name. | no | no | Recursively update usages of this class in the projectMake exceptions configurable. | | 1 | 1.1.1 | EXCEPTION_SUFFIX | Check: warns if a class that extends any `Exception` class does not have an "Exception" suffix
Fix: adding the "Exception" suffix to the class name. | yes | no | Need to add tests for this. | From 39077cc6c918f8cb9a947c5144cfaa321779901c Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Tue, 5 Jul 2022 20:39:50 +0300 Subject: [PATCH 05/31] Update available-rules.md --- info/available-rules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info/available-rules.md b/info/available-rules.md index d538b3a03c..6a9168e10a 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -1,6 +1,6 @@ | Chap | Standard | Rule name | Description | Fix | Config | FixMe | |------|----------|-------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| 1 | 1.1.1 | CONFUSING_IDENTIFIER_NAMING | Check: warns if the identifier has inappropriate name (See table of [rule 1.2 part 6](guide/diktat-coding-convention.md#-111-identifiers-naming-conventions)). | no | no | no | +| 1 | 1.1.1 | CONFUSING_IDENTIFIER_NAMING | Check: warns if the identifier has an inappropriate name (see table of [rule 1.2 part 6](guide/diktat-coding-convention.md#-111-identifiers-naming-conventions)). | no | no | no | | 1 | 1.1.1 | BACKTICKS_PROHIBITED | Check: warns if backticks (``) are used in the identifier name, except in the case when it is a test method (marked with `@Test` annotation). | no | no | - | | | 1 | 1.1.1 | VARIABLE_NAME_INCORRECT | Check: warns if a variable name consists of only a single character; the only exceptions are industry-standard fixed names, such as {`i`, `j`}
Fix: No fix is available, since it is the responsibility of a human to choose a meaningful identifier name. | no | no | Recursively update usages of this class in the projectMake exceptions configurable. | | 1 | 1.1.1 | EXCEPTION_SUFFIX | Check: warns if a class that extends any `Exception` class does not have an "Exception" suffix
Fix: adding the "Exception" suffix to the class name. | yes | no | Need to add tests for this. | From 20931c9c6bf332d4e72b9384c6ee5eedf7b95a96 Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Tue, 5 Jul 2022 21:21:52 +0300 Subject: [PATCH 06/31] Update available-rules.md --- info/available-rules.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/info/available-rules.md b/info/available-rules.md index 6a9168e10a..44790234c4 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -10,21 +10,21 @@ | 1 | 1.1.1 | VARIABLE_HAS_PREFIX | Check: warns if the name of a variable has a [Hungarian notation](https://en.wikipedia.org/wiki/Hungarian_notation) specific prefix (like `mVariable` or `M_VARIABLE`); generally, it is **considered** a bad code style (_Android_ **being** the the only exception).
Fix: none is available, as only a human can choose a meaningful name depending on the context. | no | no | Maybe we can fix it, but I do not see any sense for it. | | 1 | 1.2.1 | PACKAGE_NAME_MISSING | Check: warns if a file is missing the package declaration.
Fix: automatically adds a package directive with the name that starts from the domain name (example - com.huawei) and contains the real directory. | yes | no | Recursively fix all imports in the project.
Fix the directory where the code is stored.
Make this check isolated from the domain name addition. | -| 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_CASE | Check: warns if a package name is incorrect (non-lower) case
Fix: automatically update the case in package name | yes | no | Recursively update all imports in the project. | -| 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_PREFIX | Check: warns if a package name does not start with the company's domain
Fix: automatically update the prefix in the package name | yes | no | Fix the directory where the code is stored.
Recursively update all imports in the project. | -| 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_SYMBOLS | Check: warns if a package name has incorrect symbols like underscore or non-ASCII letters/digits.Exception: underscores that are used for differentiating of keywords in a name.
Fix: no fix currently; will be suggested later | no | no | Add autofix for at least converting underscore to a dot or replacing itFix the directory where the code is stored.Cover autofix with tests | -| 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_PATH | Check: warns if the path for a file does not match with a package name
Fix: replacing the incorrect package name with the name constructed from a path to the file. | yes | no | Make this check isolated from domain name creation.Recursively update all imports in the project.Fix the directory where the code is stored.Add a test mechanism to test checker. | -| 1 | 1.2.1 | INCORRECT_PACKAGE_SEPARATOR | Check: warns if the underscore is incorrectly used to split the package naming
Fix: fixing all nodes in AST and the package name to remove all underscores | no | no | Recursively update usages of this class in the project | -| 1 | 1.3.1 | CLASS_NAME_INCORRECT | Check: warns if the Class/Enum/Interface name does not match Pascal case ("([A-Z][a-z0-9]+)+")
Fix: fixing the case: if it is some fixed case (like snake/camel) - with word saving; if not - will restore PascalCase as is. | yes | no | Recursively update usages of this class in the projectCheck and decide the better way of converting the identifier to PascalCaseNeed to add checks using natural language processing to check that the class name contains only nouns | -| 1 | 1.3.1 | OBJECT_NAME_INCORRECT | Check: warns if the object does not match the Pascal case ("([A-Z][a-z0-9]+)+")
Fix: fixing the case in the same way as for the classes | yes | no | Recursively update usages of this class in the project | -| 1 | 1.3.1 | ENUM_VALUE | Check: checks if the enum value is in upper SNAKE_CASE or in PascalCase depending on the config. UPPER_SNAKE_CASE is the default configuration, but can be changed by 'enumStyle' config
Fix: automatically converting the enum case to a properly selected case | yes | enumStyle: snakeCase, pascalCase | Recursively update usages of this identifier in the project | -| 1 | 1.3.1 | TYPEALIAS_NAME_INCORRECT_CASE | Check: typealias name should be in pascalCase:
Fix: | yes | no | Recursively update usages of this typealias in the project | -| 1 | 1.4.1 | FUNCTION_NAME_INCORRECT_CASE | Check: function/method name should be in lowerCamelCase:
Fix: | yes | no | Recursively update usages of this function in the project | -| 1 | 1.5.1 | CONSTANT_UPPERCASE | Check: warns if CONSTANT (treated as const val from companion object or class level) is in non UPPER_SNAKE_CASE
Fix: name is changed to UPPER_SNAKE_CASE | yes | no | Recursively update usages of this identifier in the project | -| 1 | 1.6.1 | VARIABLE_NAME_INCORRECT_FORMAT | Check: warns if the name of the variable is not in lowerCamelCase or contains non-ASCII letters
Fix: fixing the case format to lowerCamelCase | | no | - | -| 1 | 1.6.2 | FUNCTION_BOOLEAN_PREFIX | Check: functions/methods that return boolean should have a special prefix, such as "is/should/e.t.c"
Fix: | yes | no | Recursively update usages of this function in the projectAggressive fix - what if the new name will not be valid? | -| 2 | 2.1.1 | MISSING_KDOC_TOP_LEVEL | Check: warns at file level internal or public class or if the function has a missing KDoc
Fix: no | no | no | Support extension for setters/gettersSupport extension for method "override" | -| 2 | 2.1.1 | KDOC_EXTRA_PROPERTY | Check: warn if there is a property in KDoc that is not present in the class | no | no | - | +| 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_CASE | Check: warns if a package name is incorrect (non-lower) case.
Fix: automatically update the case in package name. | yes | no | Recursively update all imports in the project. | +| 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_PREFIX | Check: warns if a package name does not start with the company's domain.
Fix: automatically update the prefix in the package name. | yes | no | Fix the directory where the code is stored.
Recursively update all imports in the project. | +| 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_SYMBOLS | Check: warns if a package name has incorrect symbols, such as underscore or non-ASCII letters/digits.Exception: underscores that are used for differentiating of keywords in a name.
Fix: no fix currently available; will be suggested later. | no | no | Add autofix for at least converting underscore to a dot or replacing itFix the directory where the code is stored. Cover autofix with tests. | +| 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_PATH | Check: warns if the path for a file does not match with a package name.
Fix: replacing the incorrect package name with the name constructed from a path to the file. | yes | no | Make this check isolated from domain name creation. Recursively update all imports in the project. Fix the directory where the code is stored. Add a test mechanism to test checker. | +| 1 | 1.2.1 | INCORRECT_PACKAGE_SEPARATOR | Check: warns if the underscore is incorrectly used to split the package naming.
Fix: fixing all nodes in AST and the package name to remove all underscores. | no | no | Recursively update usages of this class in the project. | +| 1 | 1.3.1 | CLASS_NAME_INCORRECT | Check: warns if the Class/Enum/Interface name does not match the Pascal case ("([A-Z][a-z0-9]+)+").
Fix: fixing the case. If it is some fixed case (like snake/camel) - with word saving; if not - will restore PascalCase as is. | yes | no | Recursively update usages of this class in the projectCheck and find the better way of converting the identifier to PascalCaseNeed to add checks using natural language processing and check that the class name contains only nouns. | +| 1 | 1.3.1 | OBJECT_NAME_INCORRECT | Check: warns if the object does not match the Pascal case ("([A-Z][a-z0-9]+)+").
Fix: fixing the case in the same way as for the classes. | yes | no | Recursively update usages of this class in the project. | +| 1 | 1.3.1 | ENUM_VALUE | Check: verifies if the enum value is in UPPER_SNAKE_CASE or in PascalCase depending on the configuration. UPPER_SNAKE_CASE is the default configuration, but can be changed by 'enumStyle' config.
Fix: automatically converting the enum case to a properly selected case | yes | enumStyle: snakeCase, pascalCase | Recursively update usages of this identifier in the project | +| 1 | 1.3.1 | TYPEALIAS_NAME_INCORRECT_CASE | Check: typealias name should be in pascalCase.
Fix: | yes | no | Recursively update usages of this typealias in the project. | +| 1 | 1.4.1 | FUNCTION_NAME_INCORRECT_CASE | Check: function/method name should be in lowerCamelCase.
Fix: | yes | no | Recursively update usages of this function in the project. | +| 1 | 1.5.1 | CONSTANT_UPPERCASE | Check: warns if CONSTANT (treated as const val from companion object or class level) is not in UPPER_SNAKE_CASE.
Fix: name is changed to UPPER_SNAKE_CASE. | yes | no | Recursively update usages of this identifier in the project. | +| 1 | 1.6.1 | VARIABLE_NAME_INCORRECT_FORMAT | Check: warns if the name of a variable is not in lowerCamelCase or contains non-ASCII letters.
Fix: fixing the case format to lowerCamelCase. | | no | - | +| 1 | 1.6.2 | FUNCTION_BOOLEAN_PREFIX | Check: functions/methods that return boolean should have a special prefix, such as "is/should/etc."
Fix: | yes | no | Recursively update usages of this function in the projectAggressive fix - what if the new name will not be valid? | +| 2 | 2.1.1 | MISSING_KDOC_TOP_LEVEL | Check: warns at a file level internal or public class or if the function has a missing KDoc.
Fix: no | no | no | Supports extension for setters/getters. Support extension for method "override". | +| 2 | 2.1.1 | KDOC_EXTRA_PROPERTY | Check: warn if there is a property in KDoc that is not present in the class. | no | no | - | | 2 | 2.1.1 | MISSING_KDOC_CLASS_ELEMENTS | Check: warns if accessible internal elements (protected, public, internal) in a class are not documented
Fix: no | no | no | Maybe need to add exception cases for setters and getters. There is no sense in adding KDoc to them. | | 2 | 2.1.1 | MISSING_KDOC_ON_FUNCTION | Check: warns if accessible function doesn't have KDoc
Fix: adds KDoc template if it is not empty | yes | no | | | 2 | 2.1.1 | KDOC_NO_CONSTRUCTOR_PROPERTY | Check: warns if there is no property tag inside KDoc before the constructor | yes | no | | From 8eaa1e2125df54ca5c9981949c9870e8c11a3cda Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Tue, 5 Jul 2022 22:24:01 +0300 Subject: [PATCH 07/31] Update available-rules.md --- info/available-rules.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/info/available-rules.md b/info/available-rules.md index 44790234c4..b9e509d265 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -23,15 +23,15 @@ | 1 | 1.5.1 | CONSTANT_UPPERCASE | Check: warns if CONSTANT (treated as const val from companion object or class level) is not in UPPER_SNAKE_CASE.
Fix: name is changed to UPPER_SNAKE_CASE. | yes | no | Recursively update usages of this identifier in the project. | | 1 | 1.6.1 | VARIABLE_NAME_INCORRECT_FORMAT | Check: warns if the name of a variable is not in lowerCamelCase or contains non-ASCII letters.
Fix: fixing the case format to lowerCamelCase. | | no | - | | 1 | 1.6.2 | FUNCTION_BOOLEAN_PREFIX | Check: functions/methods that return boolean should have a special prefix, such as "is/should/etc."
Fix: | yes | no | Recursively update usages of this function in the projectAggressive fix - what if the new name will not be valid? | -| 2 | 2.1.1 | MISSING_KDOC_TOP_LEVEL | Check: warns at a file level internal or public class or if the function has a missing KDoc.
Fix: no | no | no | Supports extension for setters/getters. Support extension for method "override". | +| 2 | 2.1.1 | MISSING_KDOC_TOP_LEVEL | Check: warns at a file level internal or public class or if the function has a missing KDoc.
Fix: no | no | no | Support extension for setters/getters. Support extension for method "override". | | 2 | 2.1.1 | KDOC_EXTRA_PROPERTY | Check: warn if there is a property in KDoc that is not present in the class. | no | no | - | -| 2 | 2.1.1 | MISSING_KDOC_CLASS_ELEMENTS | Check: warns if accessible internal elements (protected, public, internal) in a class are not documented
Fix: no | no | no | Maybe need to add exception cases for setters and getters. There is no sense in adding KDoc to them. | -| 2 | 2.1.1 | MISSING_KDOC_ON_FUNCTION | Check: warns if accessible function doesn't have KDoc
Fix: adds KDoc template if it is not empty | yes | no | | -| 2 | 2.1.1 | KDOC_NO_CONSTRUCTOR_PROPERTY | Check: warns if there is no property tag inside KDoc before the constructor | yes | no | | -| 2 | 2.1.1 | KDOC_NO_CLASS_BODY_PROPERTIES_IN_HEADER | Check: warns if property is declared in class body but documented with property tag inside KDoc before the constructor | yes | no | | -| 2 | 2.1.1 | KDOC_NO_CONSTRUCTOR_PROPERTY_WITH_COMMENT | Check: warns if there is a comment before the property in the constructor | yes | no | | -| 2 | 2.1.1 | COMMENTED_BY_KDOC | Check: warns if there is a kdoc comment in the code block | yes | no | replace "/**" to "/*" | -| 2 | 2.1.2 | KDOC_WITHOUT_PARAM_TAG | Check: warns if an accessible method has parameters and they are not documented in KDoc
Fix: If accessible method has no KDoc, the KDoc template is added | yes | no | Should also make a separate fix, even if there is already some Kdoc in place | +| 2 | 2.1.1 | MISSING_KDOC_CLASS_ELEMENTS | Check: warns if accessible internal elements (protected, public, internal) in a class are not documented.
Fix: no | no | no | Maybe exception cases for setters and getters are needed; no sense in adding KDoc to them. | +| 2 | 2.1.1 | MISSING_KDOC_ON_FUNCTION | Check: warns if accessible function doesn't have KDoc.
Fix: adds KDoc template if it is not empty. | yes | no | | +| 2 | 2.1.1 | KDOC_NO_CONSTRUCTOR_PROPERTY | Check: warns if there is no property tag inside KDoc before the constructor. | yes | no | | +| 2 | 2.1.1 | KDOC_NO_CLASS_BODY_PROPERTIES_IN_HEADER | Check: warns if the property is declared in a class body but documented with a property tag inside KDoc before the constructor. | yes | no | | +| 2 | 2.1.1 | KDOC_NO_CONSTRUCTOR_PROPERTY_WITH_COMMENT | Check: warns if there is a comment before the property in the constructor. | yes | no | | +| 2 | 2.1.1 | COMMENTED_BY_KDOC | Check: warns if there is a kdoc comment in the code block. | yes | no | replace "/**" to "/*" | +| 2 | 2.1.2 | KDOC_WITHOUT_PARAM_TAG | Check: warns if an accessible method has parameters and they are not documented in KDoc.
Fix: If accessible method has no KDoc, the KDoc template is added. | yes | no | Should also make a separate fix, even if there is already some Kdoc in place | | 2 | 2.1.2 | KDOC_WITHOUT_RETURN_TAG | Check: warns if accessible method has an explicit return type, then it is not documented in KDoc
Fix: If the accessible method has no KDoc, the KDoc template is added | yes | no | Should also make separate fix, even if there is already some Kdoc in place | | 2 | 2.1.2 | KDOC_WITHOUT_THROWS_TAG | Check: warns if the accessible method has a throw keyword and it is not documented in KDoc
Fix: If the accessible method has no KDoc, KDoc template is added | yes | no | Should also make separate fix, even if there is already some Kdoc in place | | 2 | 2.1.3 | KDOC_EMPTY_KDOC | Check: warns if the KDoc is empty
Fix: no | no | no | | From 157fc56d2eb3e7ccf0b326d1bf99e2d75d935eb9 Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Tue, 5 Jul 2022 22:35:05 +0300 Subject: [PATCH 08/31] Update available-rules.md --- info/available-rules.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/info/available-rules.md b/info/available-rules.md index b9e509d265..5f8998050c 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -31,14 +31,14 @@ | 2 | 2.1.1 | KDOC_NO_CLASS_BODY_PROPERTIES_IN_HEADER | Check: warns if the property is declared in a class body but documented with a property tag inside KDoc before the constructor. | yes | no | | | 2 | 2.1.1 | KDOC_NO_CONSTRUCTOR_PROPERTY_WITH_COMMENT | Check: warns if there is a comment before the property in the constructor. | yes | no | | | 2 | 2.1.1 | COMMENTED_BY_KDOC | Check: warns if there is a kdoc comment in the code block. | yes | no | replace "/**" to "/*" | -| 2 | 2.1.2 | KDOC_WITHOUT_PARAM_TAG | Check: warns if an accessible method has parameters and they are not documented in KDoc.
Fix: If accessible method has no KDoc, the KDoc template is added. | yes | no | Should also make a separate fix, even if there is already some Kdoc in place | -| 2 | 2.1.2 | KDOC_WITHOUT_RETURN_TAG | Check: warns if accessible method has an explicit return type, then it is not documented in KDoc
Fix: If the accessible method has no KDoc, the KDoc template is added | yes | no | Should also make separate fix, even if there is already some Kdoc in place | -| 2 | 2.1.2 | KDOC_WITHOUT_THROWS_TAG | Check: warns if the accessible method has a throw keyword and it is not documented in KDoc
Fix: If the accessible method has no KDoc, KDoc template is added | yes | no | Should also make separate fix, even if there is already some Kdoc in place | -| 2 | 2.1.3 | KDOC_EMPTY_KDOC | Check: warns if the KDoc is empty
Fix: no | no | no | | -| 2 | 2.1.3 | KDOC_WRONG_SPACES_AFTER_TAG | Check: warns if there is more than one space after the KDoc tag
Fix: removes redundant spaces | yes | no | | -| 2 | 2.1.3 | KDOC_WRONG_TAGS_ORDER | Check: warns if the basic KDoc tags are not ordered properly
Fix: reorders them (`@param`, `@return`, `@throws`) | yes | no | Ensure basic tags are at the end of KDoc | -| 2 | 2.1.3 | KDOC_NEWLINES_BEFORE_BASIC_TAGS | Check: warns if the block of tags @param, @return, @throws is not separated from the previous part of KDoc by exactly one empty line
Fix: adds an empty line or removes a redundant one | yes | no | | -| 2 | 2.1.3 | KDOC_NO_NEWLINES_BETWEEN_BASIC_TAGS | Check: if there is a newline of an empty KDoc line (with a leading asterisk) between `@param`, `@return`, `@throws` tags
Fix: removes line | yes | no | | +| 2 | 2.1.2 | KDOC_WITHOUT_PARAM_TAG | Check: warns if an accessible method has parameters and they are not documented in KDoc.
Fix: If accessible method has no KDoc, the KDoc template is added. | yes | no | Should also make a separate fix, even if there is already some Kdoc in place. | +| 2 | 2.1.2 | KDOC_WITHOUT_RETURN_TAG | Check: warns if the accessible method has an explicit return type. Then it is not documented in KDoc.
Fix: If the accessible method has no KDoc, the KDoc template is added. | yes | no | Should also make separate fix, even if there is already some Kdoc in place. | +| 2 | 2.1.2 | KDOC_WITHOUT_THROWS_TAG | Check: warns if the accessible method has the throw keyword and it is not documented in KDoc.
Fix: if the accessible method has no KDoc, KDoc template is added. | yes | no | Should also make separate fix, even if there is already some Kdoc in place. | +| 2 | 2.1.3 | KDOC_EMPTY_KDOC | Check: warns if the KDoc is empty.
Fix: no | no | no | | +| 2 | 2.1.3 | KDOC_WRONG_SPACES_AFTER_TAG | Check: warns if there is more than one space after the KDoc tag.
Fix: removes redundant spaces. | yes | no | | +| 2 | 2.1.3 | KDOC_WRONG_TAGS_ORDER | Check: warns if the basic KDoc tags are not ordered properly.
Fix: reorders tags (`@param`, `@return`, `@throws`). | yes | no | Ensure basic tags are at the end of KDoc. | +| 2 | 2.1.3 | KDOC_NEWLINES_BEFORE_BASIC_TAGS | Check: warns if the block of tags (@param, @return, @throws) is not separated from the previous part of KDoc by exactly one empty line.
Fix: adds an empty line or removes a redundant one. | yes | no | | +| 2 | 2.1.3 | KDOC_NO_NEWLINES_BETWEEN_BASIC_TAGS | Check: if there is a newline of an empty KDoc line (with a leading asterisk) between `@param`, `@return`, `@throws` tags.
Fix: removes the line. | yes | no | | | 2 | 2.1.3 | KDOC_NO_NEWLINE_AFTER_SPECIAL_TAGS | Check: warns if special tags `@apiNote`, `@implNote`, `@implSpec` don't have exactly one empty line after
Fix: removes redundant lines or adds one | yes | no | Handle empty lines without a leading asterisk | | 2 | 2.1.3 | KDOC_NO_DEPRECATED_TAG | Check: warns if `@deprecated` is used in KDoc
Fix: adds `@Deprecated` annotation with a message, removes tag | yes | no | The `replaceWith` field in the annotation can be filled too | | 2 | 2.2.1 | KDOC_NO_EMPTY_TAGS | Check: warns if the KDoc tags have empty content | no | no | | From 43dde282460db87dddea24a33dd07b21b0a1bd94 Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Tue, 5 Jul 2022 22:59:06 +0300 Subject: [PATCH 09/31] Update available-rules.md --- info/available-rules.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/info/available-rules.md b/info/available-rules.md index 5f8998050c..809e9c4206 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -39,11 +39,11 @@ | 2 | 2.1.3 | KDOC_WRONG_TAGS_ORDER | Check: warns if the basic KDoc tags are not ordered properly.
Fix: reorders tags (`@param`, `@return`, `@throws`). | yes | no | Ensure basic tags are at the end of KDoc. | | 2 | 2.1.3 | KDOC_NEWLINES_BEFORE_BASIC_TAGS | Check: warns if the block of tags (@param, @return, @throws) is not separated from the previous part of KDoc by exactly one empty line.
Fix: adds an empty line or removes a redundant one. | yes | no | | | 2 | 2.1.3 | KDOC_NO_NEWLINES_BETWEEN_BASIC_TAGS | Check: if there is a newline of an empty KDoc line (with a leading asterisk) between `@param`, `@return`, `@throws` tags.
Fix: removes the line. | yes | no | | -| 2 | 2.1.3 | KDOC_NO_NEWLINE_AFTER_SPECIAL_TAGS | Check: warns if special tags `@apiNote`, `@implNote`, `@implSpec` don't have exactly one empty line after
Fix: removes redundant lines or adds one | yes | no | Handle empty lines without a leading asterisk | -| 2 | 2.1.3 | KDOC_NO_DEPRECATED_TAG | Check: warns if `@deprecated` is used in KDoc
Fix: adds `@Deprecated` annotation with a message, removes tag | yes | no | The `replaceWith` field in the annotation can be filled too | -| 2 | 2.2.1 | KDOC_NO_EMPTY_TAGS | Check: warns if the KDoc tags have empty content | no | no | | -| 2 | 2.2.1 | KDOC_CONTAINS_DATE_OR_AUTHOR | Check: warns if the KDoc header contains `@author` tag.
Warns if `@since` tag contains a version and not a date. | no | no | Detect the author by other patterns (e.g. 'created by' etc.) | -| 2 | 2.2.1 | HEADER_WRONG_FORMAT | Checks: warns if there is no newline after the KDoc header
Fix: adds a newline | yes | no | Check if the header is on the very top of the file. It is hard to determine when it is not. | +| 2 | 2.1.3 | KDOC_NO_NEWLINE_AFTER_SPECIAL_TAGS | Check: warns if special tags `@apiNote`, `@implNote`, `@implSpec` don't have exactly one empty line after.
Fix: removes redundant lines or adds one. | yes | no | Handle empty lines without a leading asterisk. | +| 2 | 2.1.3 | KDOC_NO_DEPRECATED_TAG | Check: warns if `@deprecated` is used in KDoc.
Fix: adds `@Deprecated` annotation with a message; removes the tag. | yes | no | The `replaceWith` field in the annotation can be filled too. | +| 2 | 2.2.1 | KDOC_NO_EMPTY_TAGS | Check: warns if the KDoc tags have an empty content. | no | no | | +| 2 | 2.2.1 | KDOC_CONTAINS_DATE_OR_AUTHOR | Check: warns if the KDoc header contains the `@author` tag.
Warns if the `@since` tag contains a version and not a date. | no | no | Detect the author by other patterns (e.g. 'created by' etc.) | +| 2 | 2.2.1 | HEADER_WRONG_FORMAT | Checks: warns if there is no newline after the KDoc header.
Fix: adds a newline | yes | no | Check if the header is on the very top of the file. It is hard to determine when it is not. | | 2 | 2.2.1 | HEADER_MISSING_OR_WRONG_COPYRIGHT | Checks: copyright exists on top of the file and is properly formatted (as a block comment)
Fix: adds copyright if it is missing and required | yes | isCopyrightMandatory, copyrightText (sets the copyright pattern for your project, you also can use `;@currYear;` the key word in your text in aim to indicate the current year, instead of explicitly specifying) | | | 2 | 2.2.1 | WRONG_COPYRIGHT_YEAR | Checks: copyright has a valid year
Fix: makes the year valid | yes | no | - | | 2 | 2.2.1 | HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE | Check: warns if a file with zero or >1 classes doesn't have a KDoc header | no | no | | From a1ebab5bee775c2893b71e94e1dac5cd9da230cf Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Wed, 6 Jul 2022 20:30:51 +0300 Subject: [PATCH 10/31] Update available-rules.md --- info/available-rules.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/info/available-rules.md b/info/available-rules.md index 809e9c4206..47e268989c 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -44,13 +44,13 @@ | 2 | 2.2.1 | KDOC_NO_EMPTY_TAGS | Check: warns if the KDoc tags have an empty content. | no | no | | | 2 | 2.2.1 | KDOC_CONTAINS_DATE_OR_AUTHOR | Check: warns if the KDoc header contains the `@author` tag.
Warns if the `@since` tag contains a version and not a date. | no | no | Detect the author by other patterns (e.g. 'created by' etc.) | | 2 | 2.2.1 | HEADER_WRONG_FORMAT | Checks: warns if there is no newline after the KDoc header.
Fix: adds a newline | yes | no | Check if the header is on the very top of the file. It is hard to determine when it is not. | -| 2 | 2.2.1 | HEADER_MISSING_OR_WRONG_COPYRIGHT | Checks: copyright exists on top of the file and is properly formatted (as a block comment)
Fix: adds copyright if it is missing and required | yes | isCopyrightMandatory, copyrightText (sets the copyright pattern for your project, you also can use `;@currYear;` the key word in your text in aim to indicate the current year, instead of explicitly specifying) | | -| 2 | 2.2.1 | WRONG_COPYRIGHT_YEAR | Checks: copyright has a valid year
Fix: makes the year valid | yes | no | - | -| 2 | 2.2.1 | HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE | Check: warns if a file with zero or >1 classes doesn't have a KDoc header | no | no | | -| 2 | 2.2.1 | HEADER_NOT_BEFORE_PACKAGE | Check: warns if a KDoc file header is located not before package directive
Fix: moves this KDoc | yes | no | | -| 2 | 2.3.1 | KDOC_TRIVIAL_KDOC_ON_FUNCTION | Check: warns if KDoc contains single line with words 'return', 'get' or 'set' | no | no | | -| 2 | 2.4.1 | COMMENT_WHITE_SPACE | Check: warns if there is no space between // and comment, if there is no space between the code and the comment
Fix: adds a white space | yes | maxSpaces | - | -| 2 | 2.4.1 | WRONG_NEWLINES_AROUND_KDOC | Check: warns if there is no new line above and under the comment. Exception on the first comment
Fix: adds a new line | yes | no | - | +| 2 | 2.2.1 | HEADER_MISSING_OR_WRONG_COPYRIGHT | Checks: copyright exists on top of the file and is properly formatted (as a block comment)
Fix: adds copyright if it is missing and required | yes | isCopyrightMandatory, copyrightText (sets the copyright pattern for your project, you also can use `;@currYear;` the key word in your text in aim to indicate the current year, instead of explicitly specifying). | | +| 2 | 2.2.1 | WRONG_COPYRIGHT_YEAR | Checks: copyright has a valid year.
Fix: makes the year valid. | yes | no | - | +| 2 | 2.2.1 | HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE | Check: warns if a file with zero or >1 classes doesn't have a KDoc header. | no | no | | +| 2 | 2.2.1 | HEADER_NOT_BEFORE_PACKAGE | Check: warns if a KDoc file header is located not before a package directive.
Fix: moves this KDoc | yes | no | | +| 2 | 2.3.1 | KDOC_TRIVIAL_KDOC_ON_FUNCTION | Check: warns if KDoc contains a single line with words 'return', 'get' or 'set'. | no | no | | +| 2 | 2.4.1 | COMMENT_WHITE_SPACE | Check: warns if there is no space between // and comment, and if there is no space between the code and the comment
.Fix: adds a white space. | yes | maxSpaces | - | +| 2 | 2.4.1 | WRONG_NEWLINES_AROUND_KDOC | Check: warns if there is no new line above and under the comment. Exception on the first comment.
Fix: adds a new line. | yes | no | - | | 2 | 2.4.1 | FIRST_COMMENT_NO_BLANK_LINE | Check: warns if there is a new line before the first comment
Fix: deletes a new line | yes | no | - | | 2 | 2.4.1 | IF_ELSE_COMMENTS | Check: warns if there is a comment not in the else block
Fix: adds the comment to the first line in else block | yes | no | - | | 2 | 2.4.2 | COMMENTED_OUT_CODE | Check: warns if the commented code is detected (when uncommented, can be parsed) | no | no | Offset is lost when joined EOL comments are split again | From 24344a1cf4b4e8f6c33c51bbc767fcc986ebfb39 Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Wed, 6 Jul 2022 20:38:53 +0300 Subject: [PATCH 11/31] Update available-rules.md --- info/available-rules.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/info/available-rules.md b/info/available-rules.md index 47e268989c..ffc8d8f1cb 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -51,15 +51,15 @@ | 2 | 2.3.1 | KDOC_TRIVIAL_KDOC_ON_FUNCTION | Check: warns if KDoc contains a single line with words 'return', 'get' or 'set'. | no | no | | | 2 | 2.4.1 | COMMENT_WHITE_SPACE | Check: warns if there is no space between // and comment, and if there is no space between the code and the comment
.Fix: adds a white space. | yes | maxSpaces | - | | 2 | 2.4.1 | WRONG_NEWLINES_AROUND_KDOC | Check: warns if there is no new line above and under the comment. Exception on the first comment.
Fix: adds a new line. | yes | no | - | -| 2 | 2.4.1 | FIRST_COMMENT_NO_BLANK_LINE | Check: warns if there is a new line before the first comment
Fix: deletes a new line | yes | no | - | -| 2 | 2.4.1 | IF_ELSE_COMMENTS | Check: warns if there is a comment not in the else block
Fix: adds the comment to the first line in else block | yes | no | - | -| 2 | 2.4.2 | COMMENTED_OUT_CODE | Check: warns if the commented code is detected (when uncommented, can be parsed) | no | no | Offset is lost when joined EOL comments are split again | -| 3 | 3.1.1 | FILE_IS_TOO_LONG | Check: warns if the file has too many lines
Fix: no | no | maxSize | - | -| 1 | 3.1.2 | FILE_NAME_MATCH_CLASS | Check: warns
Fix: no | no | no | Probably it can be agressively autofixed | -| 3 | 3.1.2 | FILE_CONTAINS_ONLY_COMMENTS | Check: warns if the file contains only comments, imports and package directive. | no | no | - | -| 3 | 3.1.2 | FILE_INCORRECT_BLOCKS_ORDER | Check: warns if the general order of code parts is wrong.
Fix: rearranges them. | yes | no | handle other elements that could be present before the package directive (other comments) | -| 3 | 3.1.2 | FILE_NO_BLANK_LINE_BETWEEN_BLOCKS | Check: warns if there is not exactly one blank line between the code parts.
Fix: leaves a single empty line | yes | no | - | -| 3 | 3.1.2 | FILE_UNORDERED_IMPORTS | Check: warns if the imports are not sorted alphabetically or contain empty lines among them
Fix: reorders imports. | yes | no | - | +| 2 | 2.4.1 | FIRST_COMMENT_NO_BLANK_LINE | Check: warns if there is a new line before the first comment.
Fix: deletes a new line. | yes | no | - | +| 2 | 2.4.1 | IF_ELSE_COMMENTS | Check: warns if there is a comment outside of the else block.
Fix: adds the comment to the first line in else block. | yes | no | - | +| 2 | 2.4.2 | COMMENTED_OUT_CODE | Check: warns if the commented code is detected (when uncommented, can be parsed). | no | no | Offset is lost when the joined EOL comments are split again. | +| 3 | 3.1.1 | FILE_IS_TOO_LONG | Check: warns if the file has too many lines.
Fix: no | no | maxSize | - | +| 1 | 3.1.2 | FILE_NAME_MATCH_CLASS | Check: warns
Fix: no | no | no | Probably, it can be agressively autofixed. | +| 3 | 3.1.2 | FILE_CONTAINS_ONLY_COMMENTS | Check: warns if the file contains only comments, imports, and package directive. | no | no | - | +| 3 | 3.1.2 | FILE_INCORRECT_BLOCKS_ORDER | Check: warns if the general order of code parts is wrong.
Fix: rearranges parts of code. | yes | no | handle other elements that could be present before the package directive (other comments). | +| 3 | 3.1.2 | FILE_NO_BLANK_LINE_BETWEEN_BLOCKS | Check: warns if there is not exactly one blank line between the code parts.
Fix: leaves a single empty line. | yes | no | - | +| 3 | 3.1.2 | FILE_UNORDERED_IMPORTS | Check: warns if the imports are not sorted alphabetically, or there are empty lines among them.
Fix: reorders imports. | yes | no | - | | 3 | 3.1.2 | FILE_WILDCARD_IMPORTS | Check: warns if the wildcard imports are used except allows. | no | allowedWildcards | - | | 3 | 3.1.2 | UNUSED_IMPORT | Check: warns if import is unused. | no | deleteUnusedImport | - | | 3 | 3.1.4 | WRONG_ORDER_IN_CLASS_LIKE_STRUCTURES | Check: warns if the declaration part of a class, such as code structure (class/interface/etc.) is not in the proper order.
Fix: restores order according to the code style guide. | yes | no | - | From 113ae4d1d971cef53534db1aef50a86c9c5f3e57 Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Wed, 6 Jul 2022 21:08:55 +0300 Subject: [PATCH 12/31] Update available-rules.md --- info/available-rules.md | 48 ++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/info/available-rules.md b/info/available-rules.md index ffc8d8f1cb..281b79a510 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -61,33 +61,33 @@ | 3 | 3.1.2 | FILE_NO_BLANK_LINE_BETWEEN_BLOCKS | Check: warns if there is not exactly one blank line between the code parts.
Fix: leaves a single empty line. | yes | no | - | | 3 | 3.1.2 | FILE_UNORDERED_IMPORTS | Check: warns if the imports are not sorted alphabetically, or there are empty lines among them.
Fix: reorders imports. | yes | no | - | | 3 | 3.1.2 | FILE_WILDCARD_IMPORTS | Check: warns if the wildcard imports are used except allows. | no | allowedWildcards | - | -| 3 | 3.1.2 | UNUSED_IMPORT | Check: warns if import is unused. | no | deleteUnusedImport | - | -| 3 | 3.1.4 | WRONG_ORDER_IN_CLASS_LIKE_STRUCTURES | Check: warns if the declaration part of a class, such as code structure (class/interface/etc.) is not in the proper order.
Fix: restores order according to the code style guide. | yes | no | - | -| 3 | 3.1.4 | BLANK_LINE_BETWEEN_PROPERTIES | Check: warns if properties with comments are not separated by a blank line
Fix: fixes the number of blank lines | yes | no | - | -| 3 | 3.1.4 | WRONG_DECLARATIONS_ORDER | Check: if the order of enum values or constant property inside the companion is not correct | yes | no | - | -| 3 | 3.1.5 | TOP_LEVEL_ORDER | Check: warns if the top level order is incorrect | yes | no | - | -| 3 | 3.2.1 | NO_BRACES_IN_CONDITIONALS_AND_LOOPS | Check: warns if braces are not used in if, else, when, for, do, and while statements. Exception: single line if statement (ternary operator).
Fix: adds missing braces. | yes | no | - | -| 3 | 3.2.2 | BRACES_BLOCK_STRUCTURE_ERROR | Check: warns if non-empty code blocks with braces do not follow the K&R style (1TBS or OTBS style) | yes | openBraceNewline closeBraceNewline | - | -| 3 | 3.3.1 | WRONG_INDENTATION | Check: warns if an indentation is incorrect
Fix: corrects the indentation.

Basic cases are covered currently. | yes | extendedIndentOfParameters
alignedParameters
extendedIndentAfterOperators
extendedIndentBeforeDot
indentationSize | - | -| 3 | 3.4.1 | EMPTY_BLOCK_STRUCTURE_ERROR | Check: warns if an empty block exists or if its style is incorrect | yes | allowEmptyBlocks styleEmptyBlockWithNewline | - | -| 3 | 3.5.1 | LONG_LINE | Check: warns if the length doesn't exceed the specified length | no | lineLength | handle json method in KDoc | -| 3 | 3.6.1 | MORE_THAN_ONE_STATEMENT_PER_LINE | Check: warns if there is more than one statement per line | yes | no | - | +| 3 | 3.1.2 | UNUSED_IMPORT | Check: warns if an import is not used. | no | deleteUnusedImport | - | +| 3 | 3.1.4 | WRONG_ORDER_IN_CLASS_LIKE_STRUCTURES | Check: warns if the declaration part of a class, such as a code structure (class/interface/etc.) is not in the proper order.
Fix: restores the order according to the code style guide. | yes | no | - | +| 3 | 3.1.4 | BLANK_LINE_BETWEEN_PROPERTIES | Check: warns if properties with comments are not separated by a blank line.
Fix: fixes the number of blank lines. | yes | no | - | +| 3 | 3.1.4 | WRONG_DECLARATIONS_ORDER | Check: if the order of enum values or constant properties inside the companion is not correct. | yes | no | - | +| 3 | 3.1.5 | TOP_LEVEL_ORDER | Check: warns if the top level order is incorrect. | yes | no | - | +| 3 | 3.2.1 | NO_BRACES_IN_CONDITIONALS_AND_LOOPS | Check: warns if braces are not used in `if`, `else`, `when`, `for`, `do`, and `while` statements. Exception: single line if statement (ternary operator).
Fix: adds missing braces. | yes | no | - | +| 3 | 3.2.2 | BRACES_BLOCK_STRUCTURE_ERROR | Check: warns if non-empty code blocks with braces do not follow the K&R style (1TBS or OTBS style). | yes | openBraceNewline closeBraceNewline | - | +| 3 | 3.3.1 | WRONG_INDENTATION | Check: warns if an indentation is incorrect.
Fix: corrects the indentation.

Basic cases are covered currently. | yes | extendedIndentOfParameters
alignedParameters
extendedIndentAfterOperators
extendedIndentBeforeDot
indentationSize | - | +| 3 | 3.4.1 | EMPTY_BLOCK_STRUCTURE_ERROR | Check: warns if an empty block exists or if its style is incorrect. | yes | allowEmptyBlocks styleEmptyBlockWithNewline | - | +| 3 | 3.5.1 | LONG_LINE | Check: warns if the length doesn't exceed the specified length. | no | lineLength | Handle json method in KDoc. | +| 3 | 3.6.1 | MORE_THAN_ONE_STATEMENT_PER_LINE | Check: warns if there is more than one statement per line. | yes | no | - | | 3 | 3.6.2 | REDUNDANT_SEMICOLON | Check: warns if semicolons are used at the end of a line.
Fix: removes the semicolon. | yes | no | - | | 3 | 3.6.2 | WRONG_NEWLINES | Check: warns if line breaks do not follow the code style guide.
Fix: fixes incorrect line breaks. | yes | no | - | -| 3 | 3.6.2 | COMPLEX_EXPRESSION | Check: warns if a long dot qualified expression is used in a condition or as an argument | no | no | - | -| 3 | 3.6.2 | TRAILING_COMMA | Check: warns if missing a trailing comma | yes | valueArgument valueParameter indices whenConditions collectionLiteral typeArgument typeParameter destructuringDeclaration | - | +| 3 | 3.6.2 | COMPLEX_EXPRESSION | Check: warns if a long dot qualified expression is used in a condition or as an argument. | no | no | - | +| 3 | 3.6.2 | TRAILING_COMMA | Check: warns if a trailing comma is missing. | yes | valueArgument valueParameter indices whenConditions collectionLiteral typeArgument typeParameter destructuringDeclaration | - | | 3 | 3.7.1 | TOO_MANY_BLANK_LINES | Check: warns if blank lines are used or placed incorrectly.
Fix: removes redundant blank lines. | yes | no | | -| 3 | 3.8.1 | WRONG_WHITESPACE | Check: warns if usage of horizontal spaces violates the code style guide.
Fix: fixes incorrect whitespaces. | yes | no | - | -| 3 | 3.8.1 | TOO_MANY_CONSECUTIVE_SPACES | Check: warns if there are too many consecutive spaces in a line. Exception: in an enum if there is a configured and single eol comment
Fix: squeezes spaces to 1. | yes | maxSpaces saveInitialFormattingForEnums | - | -| 3 | 3.9.1 | ENUMS_SEPARATED | Check: warns if an enum structure is incorrect: the enum entries should be separated by a comma and line break and the last entry should have a semicolon in the end. | yes | no | Replace variable to enum if it possible | -| 3 | 3.10.2 | LOCAL_VARIABLE_EARLY_DECLARATION | Check: warns if a local variable is declared not immediately before its usage
Fix (not implemented yet): moves the variable declaration | no | no | add auto fix | -| 3 | 3.11.1 | WHEN_WITHOUT_ELSE | Check: warns if when a statement does not have else in the end.
Fix: adds else when a statement doesn't have it. | yes | no | - | If a when statement of type enum or sealed contains all values of a enum - there is no need to have "else" branch. | -| 3 | 3.12.1 | ANNOTATION_NEW_LINE | Check: warns if an annotation is not on a new single line | yes | no | - | -| 3 | 3.14.1 | WRONG_MULTIPLE_MODIFIERS_ORDER | Check: warns if the multiple modifiers sequence is in the wrong order. Value identifier supported in Kotlin 1.5 | yes | no | - | -| 3 | 3.14.2 | LONG_NUMERICAL_VALUES_SEPARATED | Check: warns if the value of the integer or float constant is too big | no | maxNumberLength maxBlockLength | - | -| 3 | 3.14.3 | MAGIC_NUMBER | Check: warns if there are magic numbers in the code | no | ignoreNumbers, ignoreHashCodeFunction, ignorePropertyDeclaration, ignoreLocalVariableDeclaration, ignoreConstantDeclaration, ignoreCompanionObjectPropertyDeclaration, ignoreEnums, ignoreRanges, ignoreExtensionFunctions | no | -| 3 | 3.15.1 | STRING_CONCATENATION | Check: warns if in a single line, the concatenation of strings is used | yes | no | - | -| 3 | 3.15.2 | STRING_TEMPLATE_CURLY_BRACES | Check: warns if there are redundant curly braces in the string template
Fix: deletes the curly braces | yes | no | + | +| 3 | 3.8.1 | WRONG_WHITESPACE | Check: warns if the usage of horizontal spaces violates the code style guide.
Fix: fixes incorrect whitespaces. | yes | no | - | +| 3 | 3.8.1 | TOO_MANY_CONSECUTIVE_SPACES | Check: warns if there are too many consecutive spaces in a line. Exception: in an enum if there is a configured and single eol comment.
Fix: squeezes spaces to 1. | yes | maxSpaces saveInitialFormattingForEnums | - | +| 3 | 3.9.1 | ENUMS_SEPARATED | Check: warns if an enum structure is incorrect: the enum entries should be separated by a comma and a line break, and the last entry should have a semicolon in the end. | yes | no | Replace variable to enum if it possible. | +| 3 | 3.10.2 | LOCAL_VARIABLE_EARLY_DECLARATION | Check: warns if a local variable is declared not immediately before its usage.
Fix (not implemented yet): moves the variable declaration. | no | no | add auto fix | +| 3 | 3.11.1 | WHEN_WITHOUT_ELSE | Check: warns if a `when` statement does not have `else` in the end.
Fix: adds `else` when a statement doesn't have it. | yes | no | - | If a `when` statement of the enum or sealed type contains all values of the enum, there is no need to have the "else" branch. | +| 3 | 3.12.1 | ANNOTATION_NEW_LINE | Check: warns if an annotation is not on a new single line. | yes | no | - | +| 3 | 3.14.1 | WRONG_MULTIPLE_MODIFIERS_ORDER | Check: warns if the multiple modifiers in the sequence are in the wrong order. Value identifier supported in Kotlin 1.5 | yes | no | - | +| 3 | 3.14.2 | LONG_NUMERICAL_VALUES_SEPARATED | Check: warns if the value of the integer or float constant is too big. | no | maxNumberLength maxBlockLength | - | +| 3 | 3.14.3 | MAGIC_NUMBER | Check: warns if there are magic numbers in the code. | no | ignoreNumbers, ignoreHashCodeFunction, ignorePropertyDeclaration, ignoreLocalVariableDeclaration, ignoreConstantDeclaration, ignoreCompanionObjectPropertyDeclaration, ignoreEnums, ignoreRanges, ignoreExtensionFunctions | no | +| 3 | 3.15.1 | STRING_CONCATENATION | Check: warns if the concatenation of strings is used in a single line. | yes | no | - | +| 3 | 3.15.2 | STRING_TEMPLATE_CURLY_BRACES | Check: warns if there are redundant curly braces in the string template.
Fix: deletes the curly braces. | yes | no | + | | 3 | 3.15.2 | STRING_TEMPLATE_QUOTES | Check: warns if there are redundant quotes in the string template
Fix: deletes the quotes and $ symbol | yes | no | + | | 3 | 3.16.1 | COLLAPSE_IF_STATEMENTS | Check: warns if there are redundant nested if-statements, which could be collapsed into a single statement by concatenating their conditions | yes | no | - | | 3 | 3.16.2 | COMPLEX_BOOLEAN_EXPRESSION | Check: warns if the boolean expression is complex and can be simplified.
Fix: replaces the boolean expression with a simpler one | yes | no | + | From 36d808cd38983297fe5270b2accd82a21edb1572 Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Wed, 6 Jul 2022 22:28:54 +0300 Subject: [PATCH 13/31] Update available-rules.md --- info/available-rules.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/info/available-rules.md b/info/available-rules.md index 281b79a510..f50aa1304d 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -88,26 +88,26 @@ | 3 | 3.14.3 | MAGIC_NUMBER | Check: warns if there are magic numbers in the code. | no | ignoreNumbers, ignoreHashCodeFunction, ignorePropertyDeclaration, ignoreLocalVariableDeclaration, ignoreConstantDeclaration, ignoreCompanionObjectPropertyDeclaration, ignoreEnums, ignoreRanges, ignoreExtensionFunctions | no | | 3 | 3.15.1 | STRING_CONCATENATION | Check: warns if the concatenation of strings is used in a single line. | yes | no | - | | 3 | 3.15.2 | STRING_TEMPLATE_CURLY_BRACES | Check: warns if there are redundant curly braces in the string template.
Fix: deletes the curly braces. | yes | no | + | -| 3 | 3.15.2 | STRING_TEMPLATE_QUOTES | Check: warns if there are redundant quotes in the string template
Fix: deletes the quotes and $ symbol | yes | no | + | -| 3 | 3.16.1 | COLLAPSE_IF_STATEMENTS | Check: warns if there are redundant nested if-statements, which could be collapsed into a single statement by concatenating their conditions | yes | no | - | -| 3 | 3.16.2 | COMPLEX_BOOLEAN_EXPRESSION | Check: warns if the boolean expression is complex and can be simplified.
Fix: replaces the boolean expression with a simpler one | yes | no | + | -| 3 | 3.17.1 | CONVENTIONAL_RANGE | Check: warns if possible to replace the range with until or replace the `rangeTo` function with a range.
Fix: replace range with until or replace the `rangeTo` function with a range | yes | no | - | -| 3 | 3.18.1 | DEBUG_PRINT | Check: warns if there is a printing to console. Assumption that it's a debug logging | no | no | - | -| 4 | 4.1.1 | FLOAT_IN_ACCURATE_CALCULATIONS | Checks that the floating-point values are not used in the arithmetic expressions
Fix: no | no | no | Current implementation detects only floating-point constants | -| 4 | 4.1.3 | SAY_NO_TO_VAR | Check: warns if `var` modifier is used for a local variable (not in a class, not at file level). And this var is not used in accumulators | no | no | no | several fixmes related to the search mechanism (VariablesSearch) and fixme for checking reassinment of this var | -| 4 | 4.2.1 | SMART_CAST_NEEDED | Check: warns if the casting can be omitted
Fix: Deletes casting | yes | no | - | | -| 4 | 4.2.2 | TYPE_ALIAS | Check: if type reference of property is longer than expected | yes | typeReferenceLength | - | -| 4 | 4.2.2 | TYPE_ALIAS | Check: if a type reference for property is longer than expected | yes | typeReferenceLength | - | +| 3 | 3.15.2 | STRING_TEMPLATE_QUOTES | Check: warns if there are redundant quotes in the string template.
Fix: deletes the quotes and $ symbol. | yes | no | + | +| 3 | 3.16.1 | COLLAPSE_IF_STATEMENTS | Check: warns if there are redundant nested if-statements, which could be collapsed into a single statement by concatenating their conditions. | yes | no | - | +| 3 | 3.16.2 | COMPLEX_BOOLEAN_EXPRESSION | Check: warns if the boolean expression is complex and can be simplified.
Fix: replaces the boolean expression with a simpler one. | yes | no | + | +| 3 | 3.17.1 | CONVENTIONAL_RANGE | Check: warns if it is possible to replace the range with `until` or replace the `rangeTo` function with a range.
Fix: replace range with `until` or replace the `rangeTo` function with a range. | yes | no | - | +| 3 | 3.18.1 | DEBUG_PRINT | Check: warns if there is a printing to console (assumption that it's a debug logging). | no | no | - | +| 4 | 4.1.1 | FLOAT_IN_ACCURATE_CALCULATIONS | Checks that floating-point values are not used in the arithmetic expressions.
Fix: no | no | no | Current implementation detects only floating-point constants. | +| 4 | 4.1.3 | SAY_NO_TO_VAR | Check: warns if the `var` modifier is used for a local variable (not in a class or at file level), and this var is not used in accumulators. | no | no | no | several fixmes related to the search mechanism (VariablesSearch) and fixme for checking reassinment of this var | +| 4 | 4.2.1 | SMART_CAST_NEEDED | Check: warns if the casting can be omitted.
Fix: Deletes casting. | yes | no | - | | +| 4 | 4.2.2 | TYPE_ALIAS | Check: if the type reference of a property is longer than expected. | yes | typeReferenceLength | - | +| 4 | 4.2.2 | TYPE_ALIAS | Check: if the type reference for a property is longer than expected | yes | typeReferenceLength | - | | 4 | 4.3.1 | NULLABLE_PROPERTY_TYPE | Check: warns if an immutable property is initialized with null or if the immutable property can have non-nullable type instead of nullable
Fix: suggests the initial value instead of null or changes in the immutable property type | yes | no | - | -| 4 | 4.3.2 | GENERIC_VARIABLE_WRONG_DECLARATION | Check: warns if variables of generic types don't have an explicit type declaration
Fix: fixes only the variables that have a generic declaration on both sides | yes | no | + | -| 4 | 4.3.3 | AVOID_NULL_CHECKS | Check: warns if null-check is used explicitly (for example: if (a == null)) | yes | no | currently, no autofix | -| 5 | 5.1.1 | TOO_LONG_FUNCTION | Check: warns if the length of the function is too long | no | maxFunctionLength isIncludeHeader | | -| 5 | 5.1.2 | NESTED_BLOCK | Warns if the function has more nested blocks than expected | no | maxNestedBlockQuantit | | -| 5 | 5.1.3 | AVOID_NESTED_FUNCTIONS | Check: Warns if there are nested functions
Fix: declare the function in the outer scope | yes | no | + | -| 5 | 5.1.4 | INVERSE_FUNCTION_PREFERRED | Check: Warns if a function call with "!" can be rewritten to the inverse function (!isEmpty() -> isNotEmpty())
Fix: Rewrites the function call | yes | - | - | -| 5 | 5.2.1 | LAMBDA_IS_NOT_LAST_PARAMETER | Checks that the lambda inside function parameters is not at the end | no | no | | -| 5 | 5.2.2 | TOO_MANY_PARAMETERS | Check: Warns if function contains more parameters than allowed | no | maxParameterListSize | | -| 5 | 5.2.3 | WRONG_OVERLOADING_FUNCTION_ARGUMENTS | Check: Warns if the function has overloading instead of using default arguments | no | no | | +| 4 | 4.3.2 | GENERIC_VARIABLE_WRONG_DECLARATION | Check: warns if variables of generic types don't have an explicit type declaration.
Fix: fixes only the variables that have a generic declaration on both sides. | yes | no | + | +| 4 | 4.3.3 | AVOID_NULL_CHECKS | Check: warns if null-check is used explicitly (for example: if (a == null)). | yes | no | Currently, no autofix. | +| 5 | 5.1.1 | TOO_LONG_FUNCTION | Check: warns if the length of a function is too long. | no | maxFunctionLength isIncludeHeader | | +| 5 | 5.1.2 | NESTED_BLOCK | Warns if a function has more nested blocks than expected. | no | maxNestedBlockQuantit | | +| 5 | 5.1.3 | AVOID_NESTED_FUNCTIONS | Check: Warns if there are nested functions.
Fix: declare the function in the outer scope. | yes | no | + | +| 5 | 5.1.4 | INVERSE_FUNCTION_PREFERRED | Check: Warns if a function call with "!" can be rewritten to the inverse function (!isEmpty() -> isNotEmpty()).
Fix: Rewrites the function call. | yes | - | - | +| 5 | 5.2.1 | LAMBDA_IS_NOT_LAST_PARAMETER | Checks that the lambda inside function parameters is not at the end. | no | no | | +| 5 | 5.2.2 | TOO_MANY_PARAMETERS | Check: Warns if a function contains more parameters than allowed. | no | maxParameterListSize | | +| 5 | 5.2.3 | WRONG_OVERLOADING_FUNCTION_ARGUMENTS | Check: Warns if a function has overloading instead of using default arguments. | no | no | | | 5 | 5.2.4 | RUN_BLOCKING_INSIDE_ASYNC | Check: Warns if using runBlocking inside the async block code | no | no | - | | 5 | 5.2.5 | TOO_MANY_LINES_IN_LAMBDA | Checks that the long lambda has parameters | no | maxLambdaLength | | | 5 | 5.2.6 | CUSTOM_LABEL | Check: Warns if using an unnecessary, custom label | no | no | - | From 35adda3307a90f337d2b93089f39c75fbf5fc54d Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Wed, 6 Jul 2022 23:16:57 +0300 Subject: [PATCH 14/31] Update available-rules.md --- info/available-rules.md | 50 ++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/info/available-rules.md b/info/available-rules.md index f50aa1304d..14d1e4fd05 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -97,36 +97,36 @@ | 4 | 4.1.3 | SAY_NO_TO_VAR | Check: warns if the `var` modifier is used for a local variable (not in a class or at file level), and this var is not used in accumulators. | no | no | no | several fixmes related to the search mechanism (VariablesSearch) and fixme for checking reassinment of this var | | 4 | 4.2.1 | SMART_CAST_NEEDED | Check: warns if the casting can be omitted.
Fix: Deletes casting. | yes | no | - | | | 4 | 4.2.2 | TYPE_ALIAS | Check: if the type reference of a property is longer than expected. | yes | typeReferenceLength | - | -| 4 | 4.2.2 | TYPE_ALIAS | Check: if the type reference for a property is longer than expected | yes | typeReferenceLength | - | -| 4 | 4.3.1 | NULLABLE_PROPERTY_TYPE | Check: warns if an immutable property is initialized with null or if the immutable property can have non-nullable type instead of nullable
Fix: suggests the initial value instead of null or changes in the immutable property type | yes | no | - | +| 4 | 4.2.2 | TYPE_ALIAS | Check: if the type reference for a property is longer than expected. | yes | typeReferenceLength | - | +| 4 | 4.3.1 | NULLABLE_PROPERTY_TYPE | Check: warns if an immutable property is initialized with null, or if the immutable property can have non-nullable type instead of nullable.
Fix: suggests the initial value instead of null or changes in the immutable property type. | yes | no | - | | 4 | 4.3.2 | GENERIC_VARIABLE_WRONG_DECLARATION | Check: warns if variables of generic types don't have an explicit type declaration.
Fix: fixes only the variables that have a generic declaration on both sides. | yes | no | + | -| 4 | 4.3.3 | AVOID_NULL_CHECKS | Check: warns if null-check is used explicitly (for example: if (a == null)). | yes | no | Currently, no autofix. | +| 4 | 4.3.3 | AVOID_NULL_CHECKS | Check: warns if the null-check is used explicitly (for example: if (a == null)). | yes | no | Currently, no autofix. | | 5 | 5.1.1 | TOO_LONG_FUNCTION | Check: warns if the length of a function is too long. | no | maxFunctionLength isIncludeHeader | | | 5 | 5.1.2 | NESTED_BLOCK | Warns if a function has more nested blocks than expected. | no | maxNestedBlockQuantit | | | 5 | 5.1.3 | AVOID_NESTED_FUNCTIONS | Check: Warns if there are nested functions.
Fix: declare the function in the outer scope. | yes | no | + | | 5 | 5.1.4 | INVERSE_FUNCTION_PREFERRED | Check: Warns if a function call with "!" can be rewritten to the inverse function (!isEmpty() -> isNotEmpty()).
Fix: Rewrites the function call. | yes | - | - | -| 5 | 5.2.1 | LAMBDA_IS_NOT_LAST_PARAMETER | Checks that the lambda inside function parameters is not at the end. | no | no | | +| 5 | 5.2.1 | LAMBDA_IS_NOT_LAST_PARAMETER | Checks that the lambda inside function parameters block is not at the end. | no | no | | | 5 | 5.2.2 | TOO_MANY_PARAMETERS | Check: Warns if a function contains more parameters than allowed. | no | maxParameterListSize | | | 5 | 5.2.3 | WRONG_OVERLOADING_FUNCTION_ARGUMENTS | Check: Warns if a function has overloading instead of using default arguments. | no | no | | -| 5 | 5.2.4 | RUN_BLOCKING_INSIDE_ASYNC | Check: Warns if using runBlocking inside the async block code | no | no | - | -| 5 | 5.2.5 | TOO_MANY_LINES_IN_LAMBDA | Checks that the long lambda has parameters | no | maxLambdaLength | | -| 5 | 5.2.6 | CUSTOM_LABEL | Check: Warns if using an unnecessary, custom label | no | no | - | -| 5 | 5.2.7 | PARAMETER_NAME_IN_OUTER_LAMBDA | Check: warns if the outer lambda uses an implicit parameter `it` | no | no | - | -| 6 | 6.1.1 | SINGLE_CONSTRUCTOR_SHOULD_BE_PRIMARY | Check: warns if there is only one secondary constructor in a class
Fix: converts it to a primary constructor | yes | no | Support more complicated logic of constructor conversion | -| 6 | 6.1.2 | USE_DATA_CLASS | Check: if class can be made as data class | no | no | yes | -| 6 | 6.1.3 | EMPTY_PRIMARY_CONSTRUCTOR | Check: warns if there is an empty primary constructor | yes | no | yes | -| 6 | 6.1.4 | MULTIPLE_INIT_BLOCKS | Checks that the classes have only one init block | yes | no | - | -| 6 | 6.1.5 | USELESS_SUPERTYPE | Checks if the override function can be removed | yes | no | | -| 6 | 6.1.6 | CLASS_SHOULD_NOT_BE_ABSTRACT | Checks if the abstract class has any abstract method. If not, it warns that the class should not be abstract
Fix: deletes the abstract modifier | yes | no | - | -| 6 | 6.1.7 | NO_CORRESPONDING_PROPERTY | Checks: warns if in the case of using "backing property" scheme, the name of real and back property are the same | no | no | - | -| 6 | 6.1.8 | CUSTOM_GETTERS_SETTERS | Check: Inspection that checks that no custom getters and setters are used for the properties | no | no | - | -| 6 | 6.1.9 | WRONG_NAME_OF_VARIABLE_INSIDE_ACCESSOR | Checks if the name of a variable is used in the custom getter or setter | no | no | | -| 6 | 6.1.10 | TRIVIAL_ACCESSORS_ARE_NOT_RECOMMENDED | Checks if there are trivial getters or setters
Fix: Delete the trivial getter or setter | yes | no | - | -| 6 | 6.1.11 | COMPACT_OBJECT_INITIALIZATION | Checks if the class instantiation can be wrapped in `apply` for better readability | | no | | +| 5 | 5.2.4 | RUN_BLOCKING_INSIDE_ASYNC | Check: Warns if the runBlocking is used inside the async block code. | no | no | - | +| 5 | 5.2.5 | TOO_MANY_LINES_IN_LAMBDA | Checks that the long lambda has parameters. | no | maxLambdaLength | | +| 5 | 5.2.6 | CUSTOM_LABEL | Check: Warns if using an unnecessary custom label. | no | no | - | +| 5 | 5.2.7 | PARAMETER_NAME_IN_OUTER_LAMBDA | Check: warns if the outer lambda uses an implicit parameter `it`. | no | no | - | +| 6 | 6.1.1 | SINGLE_CONSTRUCTOR_SHOULD_BE_PRIMARY | Check: warns if there is only one secondary constructor in a class.
Fix: converts it to a primary constructor. | yes | no | Support the more complicated logic of the constructor conversion. | +| 6 | 6.1.2 | USE_DATA_CLASS | Check: if the class can be made as a data class. | no | no | yes | +| 6 | 6.1.3 | EMPTY_PRIMARY_CONSTRUCTOR | Check: warns if there is an empty primary constructor. | yes | no | yes | +| 6 | 6.1.4 | MULTIPLE_INIT_BLOCKS | Checks that the classes have only one init block. | yes | no | - | +| 6 | 6.1.5 | USELESS_SUPERTYPE | Checks if the override function can be removed. | yes | no | | +| 6 | 6.1.6 | CLASS_SHOULD_NOT_BE_ABSTRACT | Checks if the abstract class has any abstract method. If not, it warns that the class must not be abstract.
Fix: deletes the abstract modifier | yes | no | - | +| 6 | 6.1.7 | NO_CORRESPONDING_PROPERTY | Checks: warns if with using "backing property" scheme, the name of a real and a back property are the same. | no | no | - | +| 6 | 6.1.8 | CUSTOM_GETTERS_SETTERS | Check that no custom getters and setters are used for the properties. | no | no | - | +| 6 | 6.1.9 | WRONG_NAME_OF_VARIABLE_INSIDE_ACCESSOR | Checks if the name of a variable is used in the custom getter or setter. | no | no | | +| 6 | 6.1.10 | TRIVIAL_ACCESSORS_ARE_NOT_RECOMMENDED | Checks if there are trivial getters or setters.
Fix: Delete the trivial getter or setter. | yes | no | - | +| 6 | 6.1.11 | COMPACT_OBJECT_INITIALIZATION | Checks if the class instantiation can be wrapped in `apply` for better readability. | | no | | | 6 | 6.1.12 | INLINE_CLASS_CAN_BE_USED | Check: warns if the class can be transferred to the inline class. | no | no | yes | -| 6 | 6.2.2 | EXTENSION_FUNCTION_SAME_SIGNATURE | Checks if an extension function has the same signature as another extension function and their classes are related | no | no | + | -| 6 | 6.2.3 | EXTENSION_FUNCTION_WITH_CLASS | Check: if the file contains a class, then it can not have extension functions for the same class | no | no | - | -| 6 | 6.2.4 | USE_LAST_INDEX | Check: should change a property length - 1 to the property lastIndex | no | no | - | -| 6 | 6.4.1 | AVOID_USING_UTILITY_CLASS | Checks if there is a class/object that can be replaced with the extension function | no | no | - | -| 6 | 6.4.2 | OBJECT_IS_PREFERRED | Check: if class is stateless, then it is preferred to use `object` | yes | no | + | -| 6 | 6.5.1 | RUN_IN_SCRIPT | Checks : if the kts script contains other functions except the run code | yes | no | - | +| 6 | 6.2.2 | EXTENSION_FUNCTION_SAME_SIGNATURE | Checks if an extension function has the same signature as another extension function, and their classes are related. | no | no | + | +| 6 | 6.2.3 | EXTENSION_FUNCTION_WITH_CLASS | Check: if the file contains a class, then it can not have extension functions for the same class. | no | no | - | +| 6 | 6.2.4 | USE_LAST_INDEX | Check: change a property length - 1 to the property lastIndex. | no | no | - | +| 6 | 6.4.1 | AVOID_USING_UTILITY_CLASS | Checks if there is a class/object that can be replaced with the extension function. | no | no | - | +| 6 | 6.4.2 | OBJECT_IS_PREFERRED | Check: if class is stateless, then it is preferred to use `object.` | yes | no | + | +| 6 | 6.5.1 | RUN_IN_SCRIPT | Checks : if the kts script contains other functions except the run code. | yes | no | - | From a9e2356c7cf618a8a4dfa23f231fd70f7c5475c1 Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Wed, 6 Jul 2022 23:32:49 +0300 Subject: [PATCH 15/31] Update available-rules.md --- info/available-rules.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/info/available-rules.md b/info/available-rules.md index 14d1e4fd05..92e3328271 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -2,14 +2,14 @@ |------|----------|-------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | 1 | 1.1.1 | CONFUSING_IDENTIFIER_NAMING | Check: warns if the identifier has an inappropriate name (see table of [rule 1.2 part 6](guide/diktat-coding-convention.md#-111-identifiers-naming-conventions)). | no | no | no | | 1 | 1.1.1 | BACKTICKS_PROHIBITED | Check: warns if backticks (``) are used in the identifier name, except in the case when it is a test method (marked with `@Test` annotation). | no | no | - | | -| 1 | 1.1.1 | VARIABLE_NAME_INCORRECT | Check: warns if a variable name consists of only a single character; the only exceptions are industry-standard fixed names, such as {`i`, `j`}
Fix: No fix is available, since it is the responsibility of a human to choose a meaningful identifier name. | no | no | Recursively update usages of this class in the projectMake exceptions configurable. | -| 1 | 1.1.1 | EXCEPTION_SUFFIX | Check: warns if a class that extends any `Exception` class does not have an "Exception" suffix
Fix: adding the "Exception" suffix to the class name. | yes | no | Need to add tests for this. | -| 1 | 1.1.1 | IDENTIFIER_LENGTH | Check: identifier length should be in range [2,64], except for industry-standard names, such as {`i`, `j`} and 'e' for catching exceptions.
Fix: Fix: no fix is available, since only a human can choose a meaningful identifier name depending on the context. | no | no | May be make this rule configurable (length) | -| 1 | 1.1.1 | FILE_NAME_INCORRECT | Check: warns if a file name does not have a `.kt`/`.kts` extension
Fix: no | no | no | Extensions should be configurable; it can be autofixed | +| 1 | 1.1.1 | VARIABLE_NAME_INCORRECT | Check: warns if a variable name consists of only a single character; the only exceptions are industry-standard fixed names, such as {`i`, `j`}.
Fix: No fix is available, since it is the responsibility of a human to choose a meaningful identifier name. | no | no | Recursively update usages of this class in the projectMake exceptions configurable. | +| 1 | 1.1.1 | EXCEPTION_SUFFIX | Check: warns if a class that extends any `Exception` class does not have an "Exception" suffix.
Fix: adding the "Exception" suffix to the class name. | yes | no | Need to add tests for this. | +| 1 | 1.1.1 | IDENTIFIER_LENGTH | Check: identifier length should be in the [2,64] range , except for industry-standard names, such as {`i`, `j`} and 'e' for catching exceptions.
Fix: Fix: no fix is available, since only a human can choose a meaningful identifier name, depending on the context. | no | no | May be make this rule configurable (length) | +| 1 | 1.1.1 | FILE_NAME_INCORRECT | Check: warns if a file name does not have a `.kt`/`.kts` extension.
Fix: no | no | no | Extensions should be configurable; it can be autofixed. | | 1 | 1.1.1 | GENERIC_NAME | Check: warns if the name of a [_generic type parameter_](https://kotlinlang.org/docs/generics.html) (e.g. `T`) consists of more than a single capital letter. The capital letter can be followed by numbers, though (e. g. T12, T).
Fix: | yes | no | Recursively update usages of this identifier in the project. | -| 1 | 1.1.1 | VARIABLE_HAS_PREFIX | Check: warns if the name of a variable has a [Hungarian notation](https://en.wikipedia.org/wiki/Hungarian_notation) specific prefix (like `mVariable` or `M_VARIABLE`); generally, it is **considered** a bad code style (_Android_ **being** the the only exception). -
Fix: none is available, as only a human can choose a meaningful name depending on the context. | no | no | Maybe we can fix it, but I do not see any sense for it. | -| 1 | 1.2.1 | PACKAGE_NAME_MISSING | Check: warns if a file is missing the package declaration.
Fix: automatically adds a package directive with the name that starts from the domain name (example - com.huawei) and contains the real directory. | yes | no | Recursively fix all imports in the project.
Fix the directory where the code is stored.
Make this check isolated from the domain name addition. | +| 1 | 1.1.1 | VARIABLE_HAS_PREFIX | Check: warns if the name of a variable has a [Hungarian notation](https://en.wikipedia.org/wiki/Hungarian_notation) specific prefix (like `mVariable` or `M_VARIABLE`); generally, it is considered a bad code style (_Android_ is the only exception). +
Fix: none is available, as only a human can choose a meaningful name, depending on a particular context. | no | no | Maybe we can fix it, but I do not see any sense for it. | +| 1 | 1.2.1 | PACKAGE_NAME_MISSING | Check: warns if a package declaration is missing in the file.
Fix: automatically adds a package directive with the name that starts from the domain name (example - com.huawei) and contains the real directory. | yes | no | Recursively fix all imports in the project.
Fix the directory where the code is stored.
Make this check isolated from the domain name addition. | | 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_CASE | Check: warns if a package name is incorrect (non-lower) case.
Fix: automatically update the case in package name. | yes | no | Recursively update all imports in the project. | | 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_PREFIX | Check: warns if a package name does not start with the company's domain.
Fix: automatically update the prefix in the package name. | yes | no | Fix the directory where the code is stored.
Recursively update all imports in the project. | | 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_SYMBOLS | Check: warns if a package name has incorrect symbols, such as underscore or non-ASCII letters/digits.Exception: underscores that are used for differentiating of keywords in a name.
Fix: no fix currently available; will be suggested later. | no | no | Add autofix for at least converting underscore to a dot or replacing itFix the directory where the code is stored. Cover autofix with tests. | From 5432ba5e66c175644ac224cafafde17bf71c2e21 Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Wed, 6 Jul 2022 23:34:12 +0300 Subject: [PATCH 16/31] Update available-rules.md --- info/available-rules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info/available-rules.md b/info/available-rules.md index 92e3328271..065110680e 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -12,7 +12,7 @@ | 1 | 1.2.1 | PACKAGE_NAME_MISSING | Check: warns if a package declaration is missing in the file.
Fix: automatically adds a package directive with the name that starts from the domain name (example - com.huawei) and contains the real directory. | yes | no | Recursively fix all imports in the project.
Fix the directory where the code is stored.
Make this check isolated from the domain name addition. | | 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_CASE | Check: warns if a package name is incorrect (non-lower) case.
Fix: automatically update the case in package name. | yes | no | Recursively update all imports in the project. | | 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_PREFIX | Check: warns if a package name does not start with the company's domain.
Fix: automatically update the prefix in the package name. | yes | no | Fix the directory where the code is stored.
Recursively update all imports in the project. | -| 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_SYMBOLS | Check: warns if a package name has incorrect symbols, such as underscore or non-ASCII letters/digits.Exception: underscores that are used for differentiating of keywords in a name.
Fix: no fix currently available; will be suggested later. | no | no | Add autofix for at least converting underscore to a dot or replacing itFix the directory where the code is stored. Cover autofix with tests. | +| 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_SYMBOLS | Check: warns if a package name has incorrect symbols, such as underscore or non-ASCII letters/digits. Exception: underscores that are used for differentiating of keywords in a name.
Fix: no fix currently available; will be suggested later. | no | no | Add autofix for at least converting underscore to a dot or replacing itFix the directory where the code is stored. Cover autofix with tests. | | 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_PATH | Check: warns if the path for a file does not match with a package name.
Fix: replacing the incorrect package name with the name constructed from a path to the file. | yes | no | Make this check isolated from domain name creation. Recursively update all imports in the project. Fix the directory where the code is stored. Add a test mechanism to test checker. | | 1 | 1.2.1 | INCORRECT_PACKAGE_SEPARATOR | Check: warns if the underscore is incorrectly used to split the package naming.
Fix: fixing all nodes in AST and the package name to remove all underscores. | no | no | Recursively update usages of this class in the project. | | 1 | 1.3.1 | CLASS_NAME_INCORRECT | Check: warns if the Class/Enum/Interface name does not match the Pascal case ("([A-Z][a-z0-9]+)+").
Fix: fixing the case. If it is some fixed case (like snake/camel) - with word saving; if not - will restore PascalCase as is. | yes | no | Recursively update usages of this class in the projectCheck and find the better way of converting the identifier to PascalCaseNeed to add checks using natural language processing and check that the class name contains only nouns. | From 20582ba987fcf7bd68d2c9ea72c91b598b061386 Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Thu, 7 Jul 2022 23:43:32 +0300 Subject: [PATCH 17/31] Update available-rules.md --- info/available-rules.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/info/available-rules.md b/info/available-rules.md index 065110680e..00a65e6890 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -17,7 +17,7 @@ | 1 | 1.2.1 | INCORRECT_PACKAGE_SEPARATOR | Check: warns if the underscore is incorrectly used to split the package naming.
Fix: fixing all nodes in AST and the package name to remove all underscores. | no | no | Recursively update usages of this class in the project. | | 1 | 1.3.1 | CLASS_NAME_INCORRECT | Check: warns if the Class/Enum/Interface name does not match the Pascal case ("([A-Z][a-z0-9]+)+").
Fix: fixing the case. If it is some fixed case (like snake/camel) - with word saving; if not - will restore PascalCase as is. | yes | no | Recursively update usages of this class in the projectCheck and find the better way of converting the identifier to PascalCaseNeed to add checks using natural language processing and check that the class name contains only nouns. | | 1 | 1.3.1 | OBJECT_NAME_INCORRECT | Check: warns if the object does not match the Pascal case ("([A-Z][a-z0-9]+)+").
Fix: fixing the case in the same way as for the classes. | yes | no | Recursively update usages of this class in the project. | -| 1 | 1.3.1 | ENUM_VALUE | Check: verifies if the enum value is in UPPER_SNAKE_CASE or in PascalCase depending on the configuration. UPPER_SNAKE_CASE is the default configuration, but can be changed by 'enumStyle' config.
Fix: automatically converting the enum case to a properly selected case | yes | enumStyle: snakeCase, pascalCase | Recursively update usages of this identifier in the project | +| 1 | 1.3.1 | ENUM_VALUE | Check: verifies if the enum value is in UPPER_SNAKE_CASE or in PascalCase depending on the configuration. UPPER_SNAKE_CASE is the default configuration, but can be changed by 'enumStyle' config.
Fix: automatically converting the enum case to a properly selected case | yes | enumStyle: snakeCase, pascalCase | Recursively update usages of this identifier in the project. | | 1 | 1.3.1 | TYPEALIAS_NAME_INCORRECT_CASE | Check: typealias name should be in pascalCase.
Fix: | yes | no | Recursively update usages of this typealias in the project. | | 1 | 1.4.1 | FUNCTION_NAME_INCORRECT_CASE | Check: function/method name should be in lowerCamelCase.
Fix: | yes | no | Recursively update usages of this function in the project. | | 1 | 1.5.1 | CONSTANT_UPPERCASE | Check: warns if CONSTANT (treated as const val from companion object or class level) is not in UPPER_SNAKE_CASE.
Fix: name is changed to UPPER_SNAKE_CASE. | yes | no | Recursively update usages of this identifier in the project. | @@ -44,7 +44,7 @@ | 2 | 2.2.1 | KDOC_NO_EMPTY_TAGS | Check: warns if the KDoc tags have an empty content. | no | no | | | 2 | 2.2.1 | KDOC_CONTAINS_DATE_OR_AUTHOR | Check: warns if the KDoc header contains the `@author` tag.
Warns if the `@since` tag contains a version and not a date. | no | no | Detect the author by other patterns (e.g. 'created by' etc.) | | 2 | 2.2.1 | HEADER_WRONG_FORMAT | Checks: warns if there is no newline after the KDoc header.
Fix: adds a newline | yes | no | Check if the header is on the very top of the file. It is hard to determine when it is not. | -| 2 | 2.2.1 | HEADER_MISSING_OR_WRONG_COPYRIGHT | Checks: copyright exists on top of the file and is properly formatted (as a block comment)
Fix: adds copyright if it is missing and required | yes | isCopyrightMandatory, copyrightText (sets the copyright pattern for your project, you also can use `;@currYear;` the key word in your text in aim to indicate the current year, instead of explicitly specifying). | | +| 2 | 2.2.1 | HEADER_MISSING_OR_WRONG_COPYRIGHT | Checks: copyright exists on top of the file and is properly formatted (as a block comment).
Fix: adds copyright if it is missing and required. | yes | isCopyrightMandatory, copyrightText (sets the copyright pattern for your project, you also can use `;@currYear;` the key word in your text in aim to indicate the current year, instead of explicitly specifying). | | | 2 | 2.2.1 | WRONG_COPYRIGHT_YEAR | Checks: copyright has a valid year.
Fix: makes the year valid. | yes | no | - | | 2 | 2.2.1 | HEADER_MISSING_IN_NON_SINGLE_CLASS_FILE | Check: warns if a file with zero or >1 classes doesn't have a KDoc header. | no | no | | | 2 | 2.2.1 | HEADER_NOT_BEFORE_PACKAGE | Check: warns if a KDoc file header is located not before a package directive.
Fix: moves this KDoc | yes | no | | @@ -62,7 +62,7 @@ | 3 | 3.1.2 | FILE_UNORDERED_IMPORTS | Check: warns if the imports are not sorted alphabetically, or there are empty lines among them.
Fix: reorders imports. | yes | no | - | | 3 | 3.1.2 | FILE_WILDCARD_IMPORTS | Check: warns if the wildcard imports are used except allows. | no | allowedWildcards | - | | 3 | 3.1.2 | UNUSED_IMPORT | Check: warns if an import is not used. | no | deleteUnusedImport | - | -| 3 | 3.1.4 | WRONG_ORDER_IN_CLASS_LIKE_STRUCTURES | Check: warns if the declaration part of a class, such as a code structure (class/interface/etc.) is not in the proper order.
Fix: restores the order according to the code style guide. | yes | no | - | +| 3 | 3.1.4 | WRONG_ORDER_IN_CLASS_LIKE_STRUCTURES | Check: warns if the declaration part of a class, such as a code structure (class, interface, etc.) is not in the proper order.
Fix: restores the order according to the code style guide. | yes | no | - | | 3 | 3.1.4 | BLANK_LINE_BETWEEN_PROPERTIES | Check: warns if properties with comments are not separated by a blank line.
Fix: fixes the number of blank lines. | yes | no | - | | 3 | 3.1.4 | WRONG_DECLARATIONS_ORDER | Check: if the order of enum values or constant properties inside the companion is not correct. | yes | no | - | | 3 | 3.1.5 | TOP_LEVEL_ORDER | Check: warns if the top level order is incorrect. | yes | no | - | @@ -117,7 +117,7 @@ | 6 | 6.1.3 | EMPTY_PRIMARY_CONSTRUCTOR | Check: warns if there is an empty primary constructor. | yes | no | yes | | 6 | 6.1.4 | MULTIPLE_INIT_BLOCKS | Checks that the classes have only one init block. | yes | no | - | | 6 | 6.1.5 | USELESS_SUPERTYPE | Checks if the override function can be removed. | yes | no | | -| 6 | 6.1.6 | CLASS_SHOULD_NOT_BE_ABSTRACT | Checks if the abstract class has any abstract method. If not, it warns that the class must not be abstract.
Fix: deletes the abstract modifier | yes | no | - | +| 6 | 6.1.6 | CLASS_SHOULD_NOT_BE_ABSTRACT | Checks if the abstract class has any abstract method. If not, it warns that the class must not be abstract.
Fix: deletes the abstract modifier. | yes | no | - | | 6 | 6.1.7 | NO_CORRESPONDING_PROPERTY | Checks: warns if with using "backing property" scheme, the name of a real and a back property are the same. | no | no | - | | 6 | 6.1.8 | CUSTOM_GETTERS_SETTERS | Check that no custom getters and setters are used for the properties. | no | no | - | | 6 | 6.1.9 | WRONG_NAME_OF_VARIABLE_INSIDE_ACCESSOR | Checks if the name of a variable is used in the custom getter or setter. | no | no | | From c00bada967b682ebee3194a838d7430ec1b89724 Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Fri, 8 Jul 2022 00:19:19 +0300 Subject: [PATCH 18/31] Update available-rules.md --- info/available-rules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info/available-rules.md b/info/available-rules.md index 00a65e6890..2eb1bc45db 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -60,7 +60,7 @@ | 3 | 3.1.2 | FILE_INCORRECT_BLOCKS_ORDER | Check: warns if the general order of code parts is wrong.
Fix: rearranges parts of code. | yes | no | handle other elements that could be present before the package directive (other comments). | | 3 | 3.1.2 | FILE_NO_BLANK_LINE_BETWEEN_BLOCKS | Check: warns if there is not exactly one blank line between the code parts.
Fix: leaves a single empty line. | yes | no | - | | 3 | 3.1.2 | FILE_UNORDERED_IMPORTS | Check: warns if the imports are not sorted alphabetically, or there are empty lines among them.
Fix: reorders imports. | yes | no | - | -| 3 | 3.1.2 | FILE_WILDCARD_IMPORTS | Check: warns if the wildcard imports are used except allows. | no | allowedWildcards | - | +| 3 | 3.1.2 | FILE_WILDCARD_IMPORTS | Check: warns if the wildcard imports are used except the cases when allowed. | no | allowedWildcards | - | | 3 | 3.1.2 | UNUSED_IMPORT | Check: warns if an import is not used. | no | deleteUnusedImport | - | | 3 | 3.1.4 | WRONG_ORDER_IN_CLASS_LIKE_STRUCTURES | Check: warns if the declaration part of a class, such as a code structure (class, interface, etc.) is not in the proper order.
Fix: restores the order according to the code style guide. | yes | no | - | | 3 | 3.1.4 | BLANK_LINE_BETWEEN_PROPERTIES | Check: warns if properties with comments are not separated by a blank line.
Fix: fixes the number of blank lines. | yes | no | - | From 4fd169130343f6711a6d61fd3d71173203569277 Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Tue, 12 Jul 2022 00:32:14 +0300 Subject: [PATCH 19/31] Update available-rules.md --- info/available-rules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info/available-rules.md b/info/available-rules.md index 2eb1bc45db..2263fc97bb 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -6,7 +6,7 @@ | 1 | 1.1.1 | EXCEPTION_SUFFIX | Check: warns if a class that extends any `Exception` class does not have an "Exception" suffix.
Fix: adding the "Exception" suffix to the class name. | yes | no | Need to add tests for this. | | 1 | 1.1.1 | IDENTIFIER_LENGTH | Check: identifier length should be in the [2,64] range , except for industry-standard names, such as {`i`, `j`} and 'e' for catching exceptions.
Fix: Fix: no fix is available, since only a human can choose a meaningful identifier name, depending on the context. | no | no | May be make this rule configurable (length) | | 1 | 1.1.1 | FILE_NAME_INCORRECT | Check: warns if a file name does not have a `.kt`/`.kts` extension.
Fix: no | no | no | Extensions should be configurable; it can be autofixed. | -| 1 | 1.1.1 | GENERIC_NAME | Check: warns if the name of a [_generic type parameter_](https://kotlinlang.org/docs/generics.html) (e.g. `T`) consists of more than a single capital letter. The capital letter can be followed by numbers, though (e. g. T12, T).
Fix: | yes | no | Recursively update usages of this identifier in the project. | +| 1 | 1.1.1 | GENERIC_NAME | Check: warns if the name of a [_generic type parameter_](https://kotlinlang.org/docs/generics.html) (e.g. `T`) consists of more than a single capital letter. The capital letter can be followed by numbers, though (e. g. `T12`).
Fix: | yes | no | Recursively update usages of this identifier in the project. | | 1 | 1.1.1 | VARIABLE_HAS_PREFIX | Check: warns if the name of a variable has a [Hungarian notation](https://en.wikipedia.org/wiki/Hungarian_notation) specific prefix (like `mVariable` or `M_VARIABLE`); generally, it is considered a bad code style (_Android_ is the only exception).
Fix: none is available, as only a human can choose a meaningful name, depending on a particular context. | no | no | Maybe we can fix it, but I do not see any sense for it. | | 1 | 1.2.1 | PACKAGE_NAME_MISSING | Check: warns if a package declaration is missing in the file.
Fix: automatically adds a package directive with the name that starts from the domain name (example - com.huawei) and contains the real directory. | yes | no | Recursively fix all imports in the project.
Fix the directory where the code is stored.
Make this check isolated from the domain name addition. | From 85744235badf4b1d849fbb96ad200e02617a105d Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Tue, 12 Jul 2022 00:33:06 +0300 Subject: [PATCH 20/31] Update available-rules.md --- info/available-rules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info/available-rules.md b/info/available-rules.md index 2263fc97bb..99773d430e 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -6,7 +6,7 @@ | 1 | 1.1.1 | EXCEPTION_SUFFIX | Check: warns if a class that extends any `Exception` class does not have an "Exception" suffix.
Fix: adding the "Exception" suffix to the class name. | yes | no | Need to add tests for this. | | 1 | 1.1.1 | IDENTIFIER_LENGTH | Check: identifier length should be in the [2,64] range , except for industry-standard names, such as {`i`, `j`} and 'e' for catching exceptions.
Fix: Fix: no fix is available, since only a human can choose a meaningful identifier name, depending on the context. | no | no | May be make this rule configurable (length) | | 1 | 1.1.1 | FILE_NAME_INCORRECT | Check: warns if a file name does not have a `.kt`/`.kts` extension.
Fix: no | no | no | Extensions should be configurable; it can be autofixed. | -| 1 | 1.1.1 | GENERIC_NAME | Check: warns if the name of a [_generic type parameter_](https://kotlinlang.org/docs/generics.html) (e.g. `T`) consists of more than a single capital letter. The capital letter can be followed by numbers, though (e. g. `T12`).
Fix: | yes | no | Recursively update usages of this identifier in the project. | +| 1 | 1.1.1 | GENERIC_NAME | Check: warns if the name of a [_generic type parameter_](https://kotlinlang.org/docs/generics.html) (e.g. `T`) consists of more than a single capital letter. The capital letter can be followed by numbers, though (e.g. `T12`).
Fix: | yes | no | Recursively update usages of this identifier in the project. | | 1 | 1.1.1 | VARIABLE_HAS_PREFIX | Check: warns if the name of a variable has a [Hungarian notation](https://en.wikipedia.org/wiki/Hungarian_notation) specific prefix (like `mVariable` or `M_VARIABLE`); generally, it is considered a bad code style (_Android_ is the only exception).
Fix: none is available, as only a human can choose a meaningful name, depending on a particular context. | no | no | Maybe we can fix it, but I do not see any sense for it. | | 1 | 1.2.1 | PACKAGE_NAME_MISSING | Check: warns if a package declaration is missing in the file.
Fix: automatically adds a package directive with the name that starts from the domain name (example - com.huawei) and contains the real directory. | yes | no | Recursively fix all imports in the project.
Fix the directory where the code is stored.
Make this check isolated from the domain name addition. | From 7e4807dc04910ce8e54e3183e138d74499841fa0 Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Tue, 12 Jul 2022 00:47:03 +0300 Subject: [PATCH 21/31] Update available-rules.md --- info/available-rules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info/available-rules.md b/info/available-rules.md index 99773d430e..78f8d7e7ed 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -7,7 +7,7 @@ | 1 | 1.1.1 | IDENTIFIER_LENGTH | Check: identifier length should be in the [2,64] range , except for industry-standard names, such as {`i`, `j`} and 'e' for catching exceptions.
Fix: Fix: no fix is available, since only a human can choose a meaningful identifier name, depending on the context. | no | no | May be make this rule configurable (length) | | 1 | 1.1.1 | FILE_NAME_INCORRECT | Check: warns if a file name does not have a `.kt`/`.kts` extension.
Fix: no | no | no | Extensions should be configurable; it can be autofixed. | | 1 | 1.1.1 | GENERIC_NAME | Check: warns if the name of a [_generic type parameter_](https://kotlinlang.org/docs/generics.html) (e.g. `T`) consists of more than a single capital letter. The capital letter can be followed by numbers, though (e.g. `T12`).
Fix: | yes | no | Recursively update usages of this identifier in the project. | -| 1 | 1.1.1 | VARIABLE_HAS_PREFIX | Check: warns if the name of a variable has a [Hungarian notation](https://en.wikipedia.org/wiki/Hungarian_notation) specific prefix (like `mVariable` or `M_VARIABLE`); generally, it is considered a bad code style (_Android_ is the only exception). +| 1 | 1.1.1 | VARIABLE_HAS_PREFIX | Check: warns if the name of a variable has a [Hungarian notation](https://en.wikipedia.org/wiki/Hungarian_notation) specific prefix (like `mVariable` or `M_VARIABLE`), which is considered a bad code style (_Android_ is the only exception).
Fix: none is available, as only a human can choose a meaningful name, depending on a particular context. | no | no | Maybe we can fix it, but I do not see any sense for it. | | 1 | 1.2.1 | PACKAGE_NAME_MISSING | Check: warns if a package declaration is missing in the file.
Fix: automatically adds a package directive with the name that starts from the domain name (example - com.huawei) and contains the real directory. | yes | no | Recursively fix all imports in the project.
Fix the directory where the code is stored.
Make this check isolated from the domain name addition. | | 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_CASE | Check: warns if a package name is incorrect (non-lower) case.
Fix: automatically update the case in package name. | yes | no | Recursively update all imports in the project. | From 56d29b6c8d62c8a0112298eeeb5d155ec0ec70a9 Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Tue, 12 Jul 2022 00:49:57 +0300 Subject: [PATCH 22/31] Update available-rules.md --- info/available-rules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info/available-rules.md b/info/available-rules.md index 78f8d7e7ed..592b016c80 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -8,7 +8,7 @@ | 1 | 1.1.1 | FILE_NAME_INCORRECT | Check: warns if a file name does not have a `.kt`/`.kts` extension.
Fix: no | no | no | Extensions should be configurable; it can be autofixed. | | 1 | 1.1.1 | GENERIC_NAME | Check: warns if the name of a [_generic type parameter_](https://kotlinlang.org/docs/generics.html) (e.g. `T`) consists of more than a single capital letter. The capital letter can be followed by numbers, though (e.g. `T12`).
Fix: | yes | no | Recursively update usages of this identifier in the project. | | 1 | 1.1.1 | VARIABLE_HAS_PREFIX | Check: warns if the name of a variable has a [Hungarian notation](https://en.wikipedia.org/wiki/Hungarian_notation) specific prefix (like `mVariable` or `M_VARIABLE`), which is considered a bad code style (_Android_ is the only exception). -
Fix: none is available, as only a human can choose a meaningful name, depending on a particular context. | no | no | Maybe we can fix it, but I do not see any sense for it. | +
Fix: none is available, as only a human can choose a meaningful name, depending on a particular context. | no | no | | | 1 | 1.2.1 | PACKAGE_NAME_MISSING | Check: warns if a package declaration is missing in the file.
Fix: automatically adds a package directive with the name that starts from the domain name (example - com.huawei) and contains the real directory. | yes | no | Recursively fix all imports in the project.
Fix the directory where the code is stored.
Make this check isolated from the domain name addition. | | 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_CASE | Check: warns if a package name is incorrect (non-lower) case.
Fix: automatically update the case in package name. | yes | no | Recursively update all imports in the project. | | 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_PREFIX | Check: warns if a package name does not start with the company's domain.
Fix: automatically update the prefix in the package name. | yes | no | Fix the directory where the code is stored.
Recursively update all imports in the project. | From 6d569dece5784bb09a1abcd7024c47dd0836657a Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Tue, 12 Jul 2022 00:58:11 +0300 Subject: [PATCH 23/31] Update available-rules.md --- info/available-rules.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/info/available-rules.md b/info/available-rules.md index 592b016c80..f8ea2477f7 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -7,8 +7,7 @@ | 1 | 1.1.1 | IDENTIFIER_LENGTH | Check: identifier length should be in the [2,64] range , except for industry-standard names, such as {`i`, `j`} and 'e' for catching exceptions.
Fix: Fix: no fix is available, since only a human can choose a meaningful identifier name, depending on the context. | no | no | May be make this rule configurable (length) | | 1 | 1.1.1 | FILE_NAME_INCORRECT | Check: warns if a file name does not have a `.kt`/`.kts` extension.
Fix: no | no | no | Extensions should be configurable; it can be autofixed. | | 1 | 1.1.1 | GENERIC_NAME | Check: warns if the name of a [_generic type parameter_](https://kotlinlang.org/docs/generics.html) (e.g. `T`) consists of more than a single capital letter. The capital letter can be followed by numbers, though (e.g. `T12`).
Fix: | yes | no | Recursively update usages of this identifier in the project. | -| 1 | 1.1.1 | VARIABLE_HAS_PREFIX | Check: warns if the name of a variable has a [Hungarian notation](https://en.wikipedia.org/wiki/Hungarian_notation) specific prefix (like `mVariable` or `M_VARIABLE`), which is considered a bad code style (_Android_ is the only exception). -
Fix: none is available, as only a human can choose a meaningful name, depending on a particular context. | no | no | | +| 1 | 1.1.1 | VARIABLE_HAS_PREFIX | Check: warns if the name of a variable has a [Hungarian notation](https://en.wikipedia.org/wiki/Hungarian_notation) specific prefix (like `mVariable` or `M_VARIABLE`), which is considered a bad code style (_Android_ is the only exception).
Fix: none is available, as only a human can choose a meaningful name, depending on a particular context. | no | no | | | 1 | 1.2.1 | PACKAGE_NAME_MISSING | Check: warns if a package declaration is missing in the file.
Fix: automatically adds a package directive with the name that starts from the domain name (example - com.huawei) and contains the real directory. | yes | no | Recursively fix all imports in the project.
Fix the directory where the code is stored.
Make this check isolated from the domain name addition. | | 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_CASE | Check: warns if a package name is incorrect (non-lower) case.
Fix: automatically update the case in package name. | yes | no | Recursively update all imports in the project. | | 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_PREFIX | Check: warns if a package name does not start with the company's domain.
Fix: automatically update the prefix in the package name. | yes | no | Fix the directory where the code is stored.
Recursively update all imports in the project. | From 58f8111ebe25073d2ee77aeac1970586e1d98a47 Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Tue, 12 Jul 2022 01:13:24 +0300 Subject: [PATCH 24/31] Update available-rules.md --- info/available-rules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info/available-rules.md b/info/available-rules.md index f8ea2477f7..a5ccca9261 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -13,7 +13,7 @@ | 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_PREFIX | Check: warns if a package name does not start with the company's domain.
Fix: automatically update the prefix in the package name. | yes | no | Fix the directory where the code is stored.
Recursively update all imports in the project. | | 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_SYMBOLS | Check: warns if a package name has incorrect symbols, such as underscore or non-ASCII letters/digits. Exception: underscores that are used for differentiating of keywords in a name.
Fix: no fix currently available; will be suggested later. | no | no | Add autofix for at least converting underscore to a dot or replacing itFix the directory where the code is stored. Cover autofix with tests. | | 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_PATH | Check: warns if the path for a file does not match with a package name.
Fix: replacing the incorrect package name with the name constructed from a path to the file. | yes | no | Make this check isolated from domain name creation. Recursively update all imports in the project. Fix the directory where the code is stored. Add a test mechanism to test checker. | -| 1 | 1.2.1 | INCORRECT_PACKAGE_SEPARATOR | Check: warns if the underscore is incorrectly used to split the package naming.
Fix: fixing all nodes in AST and the package name to remove all underscores. | no | no | Recursively update usages of this class in the project. | +| 1 | 1.2.1 | INCORRECT_PACKAGE_SEPARATOR | Check: warns if the underscore is incorrectly used in package naming to split name parts.
Fix: fixing all nodes in AST and the package name to remove all underscores. | no | no | Recursively update usages of this class in the project. | | 1 | 1.3.1 | CLASS_NAME_INCORRECT | Check: warns if the Class/Enum/Interface name does not match the Pascal case ("([A-Z][a-z0-9]+)+").
Fix: fixing the case. If it is some fixed case (like snake/camel) - with word saving; if not - will restore PascalCase as is. | yes | no | Recursively update usages of this class in the projectCheck and find the better way of converting the identifier to PascalCaseNeed to add checks using natural language processing and check that the class name contains only nouns. | | 1 | 1.3.1 | OBJECT_NAME_INCORRECT | Check: warns if the object does not match the Pascal case ("([A-Z][a-z0-9]+)+").
Fix: fixing the case in the same way as for the classes. | yes | no | Recursively update usages of this class in the project. | | 1 | 1.3.1 | ENUM_VALUE | Check: verifies if the enum value is in UPPER_SNAKE_CASE or in PascalCase depending on the configuration. UPPER_SNAKE_CASE is the default configuration, but can be changed by 'enumStyle' config.
Fix: automatically converting the enum case to a properly selected case | yes | enumStyle: snakeCase, pascalCase | Recursively update usages of this identifier in the project. | From b64e8dce9f8351f07eabad6152dc5a46f61c3111 Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Tue, 12 Jul 2022 01:17:58 +0300 Subject: [PATCH 25/31] Update available-rules.md --- info/available-rules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info/available-rules.md b/info/available-rules.md index a5ccca9261..15aaac6757 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -14,7 +14,7 @@ | 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_SYMBOLS | Check: warns if a package name has incorrect symbols, such as underscore or non-ASCII letters/digits. Exception: underscores that are used for differentiating of keywords in a name.
Fix: no fix currently available; will be suggested later. | no | no | Add autofix for at least converting underscore to a dot or replacing itFix the directory where the code is stored. Cover autofix with tests. | | 1 | 1.2.1 | PACKAGE_NAME_INCORRECT_PATH | Check: warns if the path for a file does not match with a package name.
Fix: replacing the incorrect package name with the name constructed from a path to the file. | yes | no | Make this check isolated from domain name creation. Recursively update all imports in the project. Fix the directory where the code is stored. Add a test mechanism to test checker. | | 1 | 1.2.1 | INCORRECT_PACKAGE_SEPARATOR | Check: warns if the underscore is incorrectly used in package naming to split name parts.
Fix: fixing all nodes in AST and the package name to remove all underscores. | no | no | Recursively update usages of this class in the project. | -| 1 | 1.3.1 | CLASS_NAME_INCORRECT | Check: warns if the Class/Enum/Interface name does not match the Pascal case ("([A-Z][a-z0-9]+)+").
Fix: fixing the case. If it is some fixed case (like snake/camel) - with word saving; if not - will restore PascalCase as is. | yes | no | Recursively update usages of this class in the projectCheck and find the better way of converting the identifier to PascalCaseNeed to add checks using natural language processing and check that the class name contains only nouns. | +| 1 | 1.3.1 | CLASS_NAME_INCORRECT | Check: warns if the Class/Enum/Interface name does not match the Pascal case ("([A-Z][a-z0-9]+)+").
Fix: fixing the case. If it is some fixed case (like Snake or Camel) - with word saving; if not - will restore PascalCase as is. | yes | no | Recursively update usages of this class in the projectCheck and find the better way of converting the identifier to PascalCaseNeed to add checks using natural language processing and check that the class name contains only nouns. | | 1 | 1.3.1 | OBJECT_NAME_INCORRECT | Check: warns if the object does not match the Pascal case ("([A-Z][a-z0-9]+)+").
Fix: fixing the case in the same way as for the classes. | yes | no | Recursively update usages of this class in the project. | | 1 | 1.3.1 | ENUM_VALUE | Check: verifies if the enum value is in UPPER_SNAKE_CASE or in PascalCase depending on the configuration. UPPER_SNAKE_CASE is the default configuration, but can be changed by 'enumStyle' config.
Fix: automatically converting the enum case to a properly selected case | yes | enumStyle: snakeCase, pascalCase | Recursively update usages of this identifier in the project. | | 1 | 1.3.1 | TYPEALIAS_NAME_INCORRECT_CASE | Check: typealias name should be in pascalCase.
Fix: | yes | no | Recursively update usages of this typealias in the project. | From e510c859756a8ac9b55d11dff9b1bf4ca331631f Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Tue, 12 Jul 2022 01:20:42 +0300 Subject: [PATCH 26/31] Update available-rules.md --- info/available-rules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info/available-rules.md b/info/available-rules.md index 15aaac6757..d1e5758d83 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -21,7 +21,7 @@ | 1 | 1.4.1 | FUNCTION_NAME_INCORRECT_CASE | Check: function/method name should be in lowerCamelCase.
Fix: | yes | no | Recursively update usages of this function in the project. | | 1 | 1.5.1 | CONSTANT_UPPERCASE | Check: warns if CONSTANT (treated as const val from companion object or class level) is not in UPPER_SNAKE_CASE.
Fix: name is changed to UPPER_SNAKE_CASE. | yes | no | Recursively update usages of this identifier in the project. | | 1 | 1.6.1 | VARIABLE_NAME_INCORRECT_FORMAT | Check: warns if the name of a variable is not in lowerCamelCase or contains non-ASCII letters.
Fix: fixing the case format to lowerCamelCase. | | no | - | -| 1 | 1.6.2 | FUNCTION_BOOLEAN_PREFIX | Check: functions/methods that return boolean should have a special prefix, such as "is/should/etc."
Fix: | yes | no | Recursively update usages of this function in the projectAggressive fix - what if the new name will not be valid? | +| 1 | 1.6.2 | FUNCTION_BOOLEAN_PREFIX | Check: functions/methods that return boolean should have a special prefix, such as "is/should/etc."
Fix: | yes | no | Recursively update usages of this function in the project. Aggressive fix - what if the new name will not be valid? | | 2 | 2.1.1 | MISSING_KDOC_TOP_LEVEL | Check: warns at a file level internal or public class or if the function has a missing KDoc.
Fix: no | no | no | Support extension for setters/getters. Support extension for method "override". | | 2 | 2.1.1 | KDOC_EXTRA_PROPERTY | Check: warn if there is a property in KDoc that is not present in the class. | no | no | - | | 2 | 2.1.1 | MISSING_KDOC_CLASS_ELEMENTS | Check: warns if accessible internal elements (protected, public, internal) in a class are not documented.
Fix: no | no | no | Maybe exception cases for setters and getters are needed; no sense in adding KDoc to them. | From ef408ec9c3618c26e4ff9e655ec0f9b0b73fd14f Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Tue, 12 Jul 2022 01:28:25 +0300 Subject: [PATCH 27/31] Update available-rules.md --- info/available-rules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info/available-rules.md b/info/available-rules.md index d1e5758d83..0282995283 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -39,7 +39,7 @@ | 2 | 2.1.3 | KDOC_NEWLINES_BEFORE_BASIC_TAGS | Check: warns if the block of tags (@param, @return, @throws) is not separated from the previous part of KDoc by exactly one empty line.
Fix: adds an empty line or removes a redundant one. | yes | no | | | 2 | 2.1.3 | KDOC_NO_NEWLINES_BETWEEN_BASIC_TAGS | Check: if there is a newline of an empty KDoc line (with a leading asterisk) between `@param`, `@return`, `@throws` tags.
Fix: removes the line. | yes | no | | | 2 | 2.1.3 | KDOC_NO_NEWLINE_AFTER_SPECIAL_TAGS | Check: warns if special tags `@apiNote`, `@implNote`, `@implSpec` don't have exactly one empty line after.
Fix: removes redundant lines or adds one. | yes | no | Handle empty lines without a leading asterisk. | -| 2 | 2.1.3 | KDOC_NO_DEPRECATED_TAG | Check: warns if `@deprecated` is used in KDoc.
Fix: adds `@Deprecated` annotation with a message; removes the tag. | yes | no | The `replaceWith` field in the annotation can be filled too. | +| 2 | 2.1.3 | KDOC_NO_DEPRECATED_TAG | Check: warns if `@deprecated` is used in KDoc.
Fix: adds `@Deprecated` annotation with a message; removes the tag. | yes | no | The `replaceWith` field in the annotation can also be filled with a meaningful value. | | 2 | 2.2.1 | KDOC_NO_EMPTY_TAGS | Check: warns if the KDoc tags have an empty content. | no | no | | | 2 | 2.2.1 | KDOC_CONTAINS_DATE_OR_AUTHOR | Check: warns if the KDoc header contains the `@author` tag.
Warns if the `@since` tag contains a version and not a date. | no | no | Detect the author by other patterns (e.g. 'created by' etc.) | | 2 | 2.2.1 | HEADER_WRONG_FORMAT | Checks: warns if there is no newline after the KDoc header.
Fix: adds a newline | yes | no | Check if the header is on the very top of the file. It is hard to determine when it is not. | From 25bff4a2605f56f30b6313f4684d27246a6824a0 Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Tue, 12 Jul 2022 01:36:22 +0300 Subject: [PATCH 28/31] Update available-rules.md --- info/available-rules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info/available-rules.md b/info/available-rules.md index 0282995283..48269a63c4 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -60,7 +60,7 @@ | 3 | 3.1.2 | FILE_NO_BLANK_LINE_BETWEEN_BLOCKS | Check: warns if there is not exactly one blank line between the code parts.
Fix: leaves a single empty line. | yes | no | - | | 3 | 3.1.2 | FILE_UNORDERED_IMPORTS | Check: warns if the imports are not sorted alphabetically, or there are empty lines among them.
Fix: reorders imports. | yes | no | - | | 3 | 3.1.2 | FILE_WILDCARD_IMPORTS | Check: warns if the wildcard imports are used except the cases when allowed. | no | allowedWildcards | - | -| 3 | 3.1.2 | UNUSED_IMPORT | Check: warns if an import is not used. | no | deleteUnusedImport | - | +| 3 | 3.1.2 | UNUSED_IMPORT | Check: warns if an import is not used. | no | deleteUnusedImport | - | | 3 | 3.1.4 | WRONG_ORDER_IN_CLASS_LIKE_STRUCTURES | Check: warns if the declaration part of a class, such as a code structure (class, interface, etc.) is not in the proper order.
Fix: restores the order according to the code style guide. | yes | no | - | | 3 | 3.1.4 | BLANK_LINE_BETWEEN_PROPERTIES | Check: warns if properties with comments are not separated by a blank line.
Fix: fixes the number of blank lines. | yes | no | - | | 3 | 3.1.4 | WRONG_DECLARATIONS_ORDER | Check: if the order of enum values or constant properties inside the companion is not correct. | yes | no | - | From cc2377116903bcc38459f59497eb5a70b3b54c13 Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Tue, 12 Jul 2022 01:38:42 +0300 Subject: [PATCH 29/31] Update available-rules.md --- info/available-rules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info/available-rules.md b/info/available-rules.md index 48269a63c4..50a979d96c 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -59,7 +59,7 @@ | 3 | 3.1.2 | FILE_INCORRECT_BLOCKS_ORDER | Check: warns if the general order of code parts is wrong.
Fix: rearranges parts of code. | yes | no | handle other elements that could be present before the package directive (other comments). | | 3 | 3.1.2 | FILE_NO_BLANK_LINE_BETWEEN_BLOCKS | Check: warns if there is not exactly one blank line between the code parts.
Fix: leaves a single empty line. | yes | no | - | | 3 | 3.1.2 | FILE_UNORDERED_IMPORTS | Check: warns if the imports are not sorted alphabetically, or there are empty lines among them.
Fix: reorders imports. | yes | no | - | -| 3 | 3.1.2 | FILE_WILDCARD_IMPORTS | Check: warns if the wildcard imports are used except the cases when allowed. | no | allowedWildcards | - | +| 3 | 3.1.2 | FILE_WILDCARD_IMPORTS | Check: warns if the wildcard imports are used except the cases when they are allowed. | no | allowedWildcards | - | | 3 | 3.1.2 | UNUSED_IMPORT | Check: warns if an import is not used. | no | deleteUnusedImport | - | | 3 | 3.1.4 | WRONG_ORDER_IN_CLASS_LIKE_STRUCTURES | Check: warns if the declaration part of a class, such as a code structure (class, interface, etc.) is not in the proper order.
Fix: restores the order according to the code style guide. | yes | no | - | | 3 | 3.1.4 | BLANK_LINE_BETWEEN_PROPERTIES | Check: warns if properties with comments are not separated by a blank line.
Fix: fixes the number of blank lines. | yes | no | - | From 8328d153528d6a26fe360b00948b335b452ee240 Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Tue, 12 Jul 2022 01:40:43 +0300 Subject: [PATCH 30/31] Update available-rules.md --- info/available-rules.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/info/available-rules.md b/info/available-rules.md index 50a979d96c..7b07af2c46 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -73,7 +73,7 @@ | 3 | 3.6.1 | MORE_THAN_ONE_STATEMENT_PER_LINE | Check: warns if there is more than one statement per line. | yes | no | - | | 3 | 3.6.2 | REDUNDANT_SEMICOLON | Check: warns if semicolons are used at the end of a line.
Fix: removes the semicolon. | yes | no | - | | 3 | 3.6.2 | WRONG_NEWLINES | Check: warns if line breaks do not follow the code style guide.
Fix: fixes incorrect line breaks. | yes | no | - | -| 3 | 3.6.2 | COMPLEX_EXPRESSION | Check: warns if a long dot qualified expression is used in a condition or as an argument. | no | no | - | +| 3 | 3.6.2 | COMPLEX_EXPRESSION | Check: warns if a long dot-qualified expression is used in a condition or as an argument. | no | no | - | | 3 | 3.6.2 | TRAILING_COMMA | Check: warns if a trailing comma is missing. | yes | valueArgument valueParameter indices whenConditions collectionLiteral typeArgument typeParameter destructuringDeclaration | - | | 3 | 3.7.1 | TOO_MANY_BLANK_LINES | Check: warns if blank lines are used or placed incorrectly.
Fix: removes redundant blank lines. | yes | no | | | 3 | 3.8.1 | WRONG_WHITESPACE | Check: warns if the usage of horizontal spaces violates the code style guide.
Fix: fixes incorrect whitespaces. | yes | no | - | From 5990e873cfa32d2b2e55e9293414a62b947e0dcc Mon Sep 17 00:00:00 2001 From: vtchem <74022270+vtchem@users.noreply.github.com> Date: Tue, 12 Jul 2022 01:44:03 +0300 Subject: [PATCH 31/31] Update available-rules.md --- info/available-rules.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/info/available-rules.md b/info/available-rules.md index 7b07af2c46..6eafa692d3 100644 --- a/info/available-rules.md +++ b/info/available-rules.md @@ -95,8 +95,7 @@ | 4 | 4.1.1 | FLOAT_IN_ACCURATE_CALCULATIONS | Checks that floating-point values are not used in the arithmetic expressions.
Fix: no | no | no | Current implementation detects only floating-point constants. | | 4 | 4.1.3 | SAY_NO_TO_VAR | Check: warns if the `var` modifier is used for a local variable (not in a class or at file level), and this var is not used in accumulators. | no | no | no | several fixmes related to the search mechanism (VariablesSearch) and fixme for checking reassinment of this var | | 4 | 4.2.1 | SMART_CAST_NEEDED | Check: warns if the casting can be omitted.
Fix: Deletes casting. | yes | no | - | | -| 4 | 4.2.2 | TYPE_ALIAS | Check: if the type reference of a property is longer than expected. | yes | typeReferenceLength | - | -| 4 | 4.2.2 | TYPE_ALIAS | Check: if the type reference for a property is longer than expected. | yes | typeReferenceLength | - | +| 4 | 4.2.2 | TYPE_ALIAS | Check: if the type reference of a property is longer than expected. | yes | typeReferenceLength | - | | | 4 | 4.3.1 | NULLABLE_PROPERTY_TYPE | Check: warns if an immutable property is initialized with null, or if the immutable property can have non-nullable type instead of nullable.
Fix: suggests the initial value instead of null or changes in the immutable property type. | yes | no | - | | 4 | 4.3.2 | GENERIC_VARIABLE_WRONG_DECLARATION | Check: warns if variables of generic types don't have an explicit type declaration.
Fix: fixes only the variables that have a generic declaration on both sides. | yes | no | + | | 4 | 4.3.3 | AVOID_NULL_CHECKS | Check: warns if the null-check is used explicitly (for example: if (a == null)). | yes | no | Currently, no autofix. |