Type | Scope | Severity | Activated by default |
Minutes to fix |
Tags |
---|---|---|---|---|---|
Code smell |
BSL OS |
Minor |
Yes |
1 |
badpractice |
Name | Type | Description | Default value |
---|---|---|---|
authorizedNumbers |
String |
allowed numbers, coma separated. Example:-1,0,1,60 |
-1,0,1 |
allowMagicIndexes |
Boolean |
allow magic indexes |
true |
Magic numbers are any number in your code that does not immediately become apparent without being immersed in context.
Bad
Function GetsTheInterval(Duration)
Return Duration < 10 * 60 * 60;
End Function
Good
Function GetsTheInterval (Duration in Seconds)
MinutesHour = 60;
SecondsMinute = 60;
SecondsHour = SecondsMinute * MinutesHour;
HoursIninterval = 10;
Return Duration < HoursWininterval * SecondsHour;
End Function
// BSLLS:MagicNumber-off
// BSLLS:MagicNumber-on
"MagicNumber": {
"authorizedNumbers": "-1,0,1",
"allowMagicIndexes": true
}