{"id":694,"date":"2020-01-08T13:20:08","date_gmt":"2020-01-08T13:20:08","guid":{"rendered":"https:\/\/sdf-docs.mansystems.com\/docs\/acr-rules\/reliability\/identical-expressions-should-not-be-used-on-both-sides-of-a-binary-operator\/"},"modified":"2020-03-20T08:44:58","modified_gmt":"2020-03-20T08:44:58","slug":"identicalexpressionsbinary","status":"publish","type":"docs","link":"https:\/\/sdf-docs.clevr.com\/?docs=acr-rules\/reliability\/identicalexpressionsbinary","title":{"rendered":"Identical expressions should not be used on both sides of a binary operator"},"content":{"rendered":"\n<p style=\"text-align:center\">Introduced in version: 1.3 (29 Jan 2020)<\/p>\n\n\n\n<p> Using the same value on either side of a binary operator is almost always a mistake. <\/p>\n\n\n\n<p>In the case of logical operators (<code>and\/or<\/code>), it is either a copy\/paste error and therefore a bug, or it is simply wasted code and should be simplified.<\/p>\n\n\n\n<p>In the case of most binary mathematical operators (<code>-\/:\/div\/mod<\/code>), having the same value on both sides of an operator yields predictable results, and should be simplified. Plus and multiply operators are excluded from this check.<\/p>\n\n\n\n<p><strong>Noncompliant example:<\/strong><\/p>\n\n\n\n<p><code>if $Variable1 != empty and $Variable1 != empty<\/code><\/p>\n\n\n\n<p><strong>Compliant example<\/strong>:<\/p>\n\n\n\n<p><code> if $Variable1 != empty and $Variable2 != empty <\/code><\/p>\n","protected":false},"featured_media":0,"parent":97,"menu_order":13,"comment_status":"open","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-694","docs","type-docs","status-publish","hentry"],"comment_count":0,"_links":{"self":[{"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/694"}],"collection":[{"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/types\/docs"}],"replies":[{"embeddable":true,"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=694"}],"version-history":[{"count":3,"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/694\/revisions"}],"predecessor-version":[{"id":697,"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/694\/revisions\/697"}],"up":[{"embeddable":true,"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/97"}],"next":[{"title":"Lists operations should be passed different arguments","link":"https:\/\/sdf-docs.clevr.com\/?docs=acr-rules\/reliability\/identicallistarguments","href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/583"}],"prev":[{"title":"Hour format should be specified correctly in parse\/format date-time functions","link":"https:\/\/sdf-docs.clevr.com\/?docs=acr-rules\/reliability\/hourformat","href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=\/wp\/v2\/docs\/1177"}],"wp:attachment":[{"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=694"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/sdf-docs.clevr.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdoc_tag&post=694"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}