49 lines
1014 B
Plaintext
Raw Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
The meaning of a boolean parameter may seem perfectly clear when you first write a method call, but that meaning is likely to fade for you over time, and could be completely opaque to those who come behind you.
Instead, object literals should be used.
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,javascript]
2021-04-28 16:49:39 +02:00
----
widget.repaint(false); // Noncompliant; does this mean never repaint?
----
=== Compliant solution
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,javascript]
2021-04-28 16:49:39 +02:00
----
widget.repaint({immediate: false});
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Use an object literal instead.
'''
== Comments And Links
(visible only on this page)
=== relates to: S2495
=== on 29 Jan 2015, 18:48:41 Ann Campbell wrote:
Appropriate for any of your other langauges, [~linda.martin]?
=== on 13 Nov 2015, 14:48:41 Linda Martin wrote:
\[~ann.campbell.2] Sorry for the delay, I would say yes as it is a general pattern.
endif::env-github,rspecator-view[]