== Why is this an issue?

Using the output of a non-boolean assignment as a condition is highly suspicious. Either it was done accidentally, and the assignment operator ``++=++`` was used in place of the equality operator ``++==++``, or it was done with the intent to rely on the automatic conversion of the non-boolean value to a boolean, which could be confusing for maintainers.


=== Noncompliant code example

[source,javascript]
----
function process(var a) {
  var BAD_OPS = 3;
  if( a = BAD_OPS) {...}
}
----

[source,javascript]
----
function process(var a) {
  var BAD_OPS = "UNKNOWN";
  if( a = BAD_OPS) {...}
}
----


ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Refactor this suspicious code to not use the result of this non-boolean assignment as a condition


=== Highlighting

The overall non-boolean assignment


'''
== Comments And Links
(visible only on this page)

=== relates to: S1121

=== on 21 Mar 2017, 09:50:54 Freddy Mallet wrote:
Before C99, the C language didn't have any boolean type so applying this rule on C might raise a lot of false-positives.


endif::env-github,rspecator-view[]
