rspec/rules/S1446/flex/rule.adoc

49 lines
1.0 KiB
Plaintext
Raw Permalink Normal View History

== Why is this an issue?
2021-04-28 16:49:39 +02:00
A dynamic class defines an object that can be altered at run time by adding or changing properties and methods. This extremely powerful mechanism should be used very carefully, and only in very limited use cases.
Indeed, by definition dynamic classes make refactoring difficult and prevent the compiler from raising potential errors at compile time.
=== 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
----
dynamic public class DynamicFoo
{...}
----
=== Compliant solution
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 Foo //Note that the class has been renamed to avoid confusion
{...}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
=== Message
Make this "XXXX" class non-dynamic
'''
== Comments And Links
(visible only on this page)
=== on 31 Oct 2013, 15:39:24 Freddy Mallet wrote:
Is implemented by \http://jira.codehaus.org/browse/SONARPLUGINS-3225 for Flex
=== on 3 Nov 2013, 09:38:58 Ann Campbell wrote:
Double-check my Compliant Solution
endif::env-github,rspecator-view[]