Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/maven/com.github.ozsie-detekt-m…
Browse files Browse the repository at this point in the history
…aven-plugin-1.15.0
  • Loading branch information
petertrr authored Dec 28, 2020
2 parents 7525d79 + 2faaefc commit 06bed3c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class LongNumericalValuesSeparatedRule(private val configRules: List<RulesConfig
return text
.split(".")
.map { removePrefixSuffix(it) }
.all { it.length < configuration.maxLength }
.all { it.length <= configuration.maxLength }
}

private fun checkBlocks(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class LongNumericalValuesSeparatedWarnTest : LintTestBase(::LongNumericalValuesS
| val bytes = 0b110100110_01101001_10010100_10010010
| val flo = 192.312341341344355345
| val flo2 = 192.31234134134435_5345
| val hundred = 100
|}
""".trimMargin(),
LintError(2, 21, ruleId, "${Warnings.LONG_NUMERICAL_VALUES_SEPARATED.warnText()} 100000000000", true),
Expand All @@ -45,6 +46,7 @@ class LongNumericalValuesSeparatedWarnTest : LintTestBase(::LongNumericalValuesS
LintError(8, 14, ruleId, "${Warnings.LONG_NUMERICAL_VALUES_SEPARATED.warnText()} 192.312341341344355345", true),
LintError(9, 15, ruleId, "${Warnings.LONG_NUMERICAL_VALUES_SEPARATED.warnText()} this block is too long 31234134134435", false),
LintError(9, 15, ruleId, "${Warnings.LONG_NUMERICAL_VALUES_SEPARATED.warnText()} this block is too long 5345", false)

)
}

Expand All @@ -60,6 +62,7 @@ class LongNumericalValuesSeparatedWarnTest : LintTestBase(::LongNumericalValuesS
| val hexBytes = 0xFF_EC_DE_5E
| val bytes = 0b11_010_010_011_010_011_001_010_010_010_010
| val flo = 192.312_341_341_345
| val ten = 10
|}
""".trimMargin()
)
Expand Down
6 changes: 3 additions & 3 deletions info/available-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
| 3 | 3.9 | 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 | WHEN_WITHOUT_ELSE | Check: warns if when statement don't have else in the end.<br>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.10 | LOCAL_VARIABLE_EARLY_DECLARATION | Check: warns if local variable is declared not immediately before it's usage<br>Fix (not implemented yet): moves variable declaration | no | no | add auto fix |
| 3 | 3.13 | LONG_NUMERICAL_VALUES_SEPARATED | Check: warns if value on integer or float constant is too big | no | maxLength | - |
| 3 | 3.13 | LONG_NUMERICAL_VALUES_SEPARATED | Check: warns if value on integer or float constant is too big | no | maxNumberLength maxBlockLength | - |
| 3 | 3.2 | WRONG_DECLARATIONS_ORDER | Check: if order of enum values or constant property inside companion isn't correct | yes | no | - |
| 3 | 3.11 | ANNOTATION_NEW_LINE | Check: warns if annotation not on a new single line | yes | no | - |
| 3 | 3.2 | WRONG_MULTIPLE_MODIFIERS_ORDER | Check: if multiple modifiers sequence is in the wrong order | yes | no | - |
Expand All @@ -88,7 +88,7 @@
| 4 | 4.2.2 | TYPE_ALIAS | Check: if type reference of property is longer than expected | yes | typeReferenceLength | -|
| 4 | 4.3.2 | GENERIC_VARIABLE_WRONG_DECLARATION | Check: warns if variables of generic types don't have explicit type declaration<br>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.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<br>Fix: declare function in the outer scope | yes | no | + |
| 5 | 5.2.1 | LAMBDA_IS_NOT_LAST_PARAMETER | Checks that lambda inside function parameters isn't in the end | no | no |
Expand All @@ -107,4 +107,4 @@
| 6 | 6.1.11 | COMPACT_OBJECT_INITIALIZATION | Checks if class instantiation can be wrapped in `apply` for better readability | | no | |
| 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.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.4.2 | OBJECT_IS_PREFERRED | Checks: if class is stateless it is preferred to use `object` | yes | no | + |

0 comments on commit 06bed3c

Please sign in to comment.