rspec/rules/S3375/comments-and-links.adoc

25 lines
1.6 KiB
Plaintext

=== on 12 Oct 2015, 17:18:12 Ann Campbell wrote:
\[~freddy.mallet] because this rule is related to memory leaks, I have made it a security rule. However, since you could be using a ``++static++`` collection on purpose and managing it well, I have only made it Major/suspicious. I would be interested to hear your thoughts if you disagree.
=== on 12 Oct 2015, 17:18:27 Ann Campbell wrote:
\[~tamas.vajk] this might apply to you...
=== on 15 Oct 2015, 06:46:06 Tamas Vajk wrote:
\[~ann.campbell.2] This is also applicable to C#. But I have the feeling that it will report many false positives. An examples of valid usages of static lists is storing a list of constants in a list is achieved by having a ``++static readonly++`` array or collection and initializing it inline or in the constructor with the constant values.
----
private static readonly IImmutableSet<string> AsyncOrAwait = ImmutableHashSet.Create("async", "await");
----
And of course as the description says it is possible to use the static collections correctly by maintaining their content properly.
=== on 15 Oct 2015, 11:37:12 Ann Campbell wrote:
\[~tamas.vajk] I have similar fears about FP's; that's why it's off by default. Organizations with long-running apps and/or memory concerns can turn it on.
It sounds like a C# exception about ``++readonly++`` collections would be appropriate...?
=== on 15 Oct 2015, 13:04:44 Tamas Vajk wrote:
\[~ann.campbell.2] Okay, I see. No, we shouldn't add the exception for the ``++readonly++``, because only the instance of the collection can't be changed, the content can. But you have no way of specifying a real constant array with a fixed content.