Skip to content

Commit

Permalink
Modify rule S1126: Use the terms 'truthy' and 'falsy' (#3548)
Browse files Browse the repository at this point in the history
  • Loading branch information
yassin-kammoun-sonarsource authored Jan 24, 2024
1 parent 0ed2d95 commit bc7b04a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rules/S1126/javascript/rule.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
== Why is this an issue?

The ``++if...else++`` statement is used to make decisions based on the truthiness of a boolean expression, and the ``++if++`` block executes when the expression is ``++true++``, while the ``++else++`` block executes when the expression is false.
The ``++if...else++`` statement is used to make decisions based on the truthiness of a boolean expression, and the ``++if++`` block executes when the expression is truthy, while the ``++else++`` block executes when the expression is falsy.

Wrapping a boolean expression in an ``++if...else++`` statement and returning ``++true++`` or ``++false++`` in the respective blocks is redundant and unnecessary. It can also make the code harder to maintain, as it adds unnecessary lines of code that need to be read and understood.

Expand Down

0 comments on commit bc7b04a

Please sign in to comment.