Terms
Description
Linting issues have been identified by Detekt due to Magic Numbers across the codebase. Magic numbers are when numbers are used in certain code lines within the definition of what that number means.
Example:
Before fixing:
fun isOverSpeeding(speed: Int): Boolean {
return speed > 60 // Magic number 60 lacks clarity
}
After fixing:
const val SPEED_LIMIT = 60 // Named constant provides context
fun isOverSpeeding(speed: Int): Boolean {
return speed > SPEED_LIMIT
}
These can be identified across the code by the following steps:
- Enable the MagicNumber detection from the detekt.yml file.
- Run the command ./gradlew detekt
- You would be able to see all the files where Linting issues are caused due to Magic Numbers
Contribution
I would love to work on this and am more than willing to help anyone solve this issue. 😄
Terms
Description
Linting issues have been identified by Detekt due to Magic Numbers across the codebase. Magic numbers are when numbers are used in certain code lines within the definition of what that number means.
Example:
Before fixing:
After fixing:
These can be identified across the code by the following steps:
Contribution
I would love to work on this and am more than willing to help anyone solve this issue. 😄