rspec/rules/S2589/how-to-fix-it.adoc
nicolas-gauthier-sonarsource ab6d0f08b7
Modify S2589: Migrate to LaYC (#3297)
## Review

A dedicated reviewer checked the rule description successfully for:

- [ ] logical errors and incorrect information
- [ ] information gaps and missing content
- [ ] text style and tone
- [ ] PR summary and labels follow [the
guidelines](https://github.com/SonarSource/rspec/#to-modify-an-existing-rule)
2023-10-18 14:26:59 +02:00

10 lines
534 B
Plaintext

== How to fix it
Gratuitous boolean expressions are suspicious and should be carefully removed from the code.
First, the boolean expression in question should be closely inspected for logical errors.
If a mistake was made, it can be corrected so the condition is no longer gratuitous.
If it becomes apparent that the condition is actually unnecessary, it can be removed. The associated control flow construct
(e.g., the `if`-statement containing the condition) will be adapted or even removed, leaving only the necessary branches.