From bc7b04a2e15fa9a045785a12cbbf7280282c9ad8 Mon Sep 17 00:00:00 2001 From: Yassin Kammoun <52890329+yassin-kammoun-sonarsource@users.noreply.github.com> Date: Wed, 24 Jan 2024 16:40:36 +0100 Subject: [PATCH] Modify rule S1126: Use the terms 'truthy' and 'falsy' (#3548) --- rules/S1126/javascript/rule.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules/S1126/javascript/rule.adoc b/rules/S1126/javascript/rule.adoc index 19c72317dca..805627121e7 100644 --- a/rules/S1126/javascript/rule.adoc +++ b/rules/S1126/javascript/rule.adoc @@ -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.