rspec/rules/S1170/flex/rule.adoc
2022-02-04 16:28:24 +00:00

37 lines
716 B
Plaintext

Making a public constant just ``++const++`` as opposed to ``++static const++`` leads to duplicating its value for every instance of the class, uselessly increasing the amount of memory required to execute the application.
== Noncompliant Code Example
[source,flex]
----
public class Myclass
{
public const THRESHOLD:int = 3;
}
----
== Compliant Solution
[source,flex]
----
public class Myclass
{
public static const THRESHOLD:int = 3;
}
----
ifdef::env-github,rspecator-view[]
'''
== Implementation Specification
(visible only on this page)
include::../message.adoc[]
'''
== Comments And Links
(visible only on this page)
include::../comments-and-links.adoc[]
endif::env-github,rspecator-view[]