Skip to content

Commit 6cda199

Browse files
committed
Unsigned integer literal is perhaps incorrectly marked as a MAGIC_NUMBER
### What's done: * fixed ignore number in MAGIC_NUMBER rule Closes #1224
1 parent d8c4cea commit 6cda199

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/chapter3/MagicNumberRule.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class MagicNumberRule(configRules: List<RulesConfig>) : DiktatRule(
108108
companion object {
109109
const val IGNORE_TEST = true
110110
const val NAME_ID = "aca-magic-number"
111-
val ignoreNumbersList = listOf("-1", "1", "0", "2")
111+
val ignoreNumbersList = listOf("-1", "1", "0", "2", "0U", "1U", "2U", "0L", "1L", "2L", "0UL", "1UL", "2UL")
112112
val mapConfiguration = mapOf(
113113
"ignoreHashCodeFunction" to true,
114114
"ignorePropertyDeclaration" to false,

diktat-rules/src/test/kotlin/org/cqfn/diktat/ruleset/chapter3/MagicNumberRuleWarnTest.kt

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ class MagicNumberRuleWarnTest : LintTestBase(::MagicNumberRule) {
4444
| val b = 128L
4545
| val e = 3.4f
4646
| val g = 4/3
47+
| val h = 0U
4748
| val f = "qwe\$\{12\}hhe"
4849
|}
4950
|

0 commit comments

Comments
 (0)