rspec/rules/S1467/flex/rule.adoc

42 lines
917 B
Plaintext
Raw Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
A listener can be attached to an object only after it has been constructed. So dispatching an event in a constructor is useless and error prone.
=== Noncompliant code example
2021-04-28 16:49:39 +02:00
2022-02-04 17:28:24 +01:00
[source,flex]
2021-04-28 16:49:39 +02:00
----
public class MyClass
{
public function MyClass()
{
dispatchEvent( new Event( "uselessEvent" ) );
}
}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Remove this event dispatch from the "XXXX" constructor
'''
== Comments And Links
(visible only on this page)
=== on 22 Nov 2013, 12:28:48 Freddy Mallet wrote:
Is implemented by \http://jira.codehaus.org/browse/SONARPLUGINS-3279
=== on 24 Nov 2013, 19:04:22 Ann Campbell wrote:
I'm tempted to add a Compliant Solution using [PostConstruct], but I'm afraid my 3-minute skim of Flex sites doesn't adequately qualify me...
endif::env-github,rspecator-view[]