
## Review A dedicated reviewer checked the rule description successfully for: - [x] logical errors and incorrect information - [x] information gaps and missing content - [x] text style and tone - [x] PR summary and labels follow [the guidelines](https://github.com/SonarSource/rspec/#to-modify-an-existing-rule)
8 lines
553 B
Plaintext
8 lines
553 B
Plaintext
A magic number is a hard-coded numerical value that may lack context or meaning. They should not be used because they can make the code less readable and maintainable.
|
|
|
|
== Why is this an issue?
|
|
|
|
Magic numbers make the code more complex to understand as it requires the reader to have knowledge about the global context to understand the number itself.
|
|
Their usage may seem obvious at the moment you're writing the code, but it may not be the case for another developer or later once the context faded away.
|
|
-1, 0 and 1 are not considered magic numbers.
|