2023-05-03 11:06:20 +02:00
== Why is this an issue?
2020-06-30 12:47:33 +02:00
include::../description.adoc[]
2023-05-03 11:06:20 +02:00
=== Noncompliant code example
2020-06-30 12:47:33 +02:00
With a threshold of 5:
2020-06-30 14:49:38 +02:00
2022-02-04 17:28:24 +01:00
[source,csharp]
2020-06-30 12:47:33 +02:00
----
public class Foo // Noncompliant - Foo depends on too many classes: T1, T2, T3, T4, T5, T6 and T7
{
private T1 a1; // Foo is coupled to T1
private T2 a2; // Foo is coupled to T2
private T3 a3; // Foo is coupled to T3
public T4 Compute(T5 a, T6 b) // Foo is coupled to T4, T5 and T6
{
T7 result = a.Process(b); // Foo is coupled to T7
return result;
}
public static class Bar // Compliant - Bar depends on 2 classes: T8 and T9
{
public T8 a8;
public T9 a9;
}
}
----
2021-06-02 20:44:38 +02:00
2021-06-03 09:05:38 +02:00
ifdef::env-github,rspecator-view[]
2021-09-20 15:38:42 +02:00
'''
== Implementation Specification
(visible only on this page)
2023-05-25 14:18:12 +02:00
=== Message
Split this (class|record) into smaller and more specialized ones to reduce its dependencies on other types from {} to the maximum authorized {} or less.
=== Parameters
.max
****
----
30
----
Maximum number of types a single type is allowed to depend upon
****
2021-09-20 15:38:42 +02:00
2021-06-08 15:52:13 +02:00
'''
2021-06-02 20:44:38 +02:00
== Comments And Links
(visible only on this page)
2023-05-25 14:18:12 +02:00
=== on 13 Jun 2018, 16:16:48 Valeri Hristov wrote:
Changing the default value for C# to 30, to comply with the one from FxCop
include::../comments-and-links.adoc[]
2021-06-03 09:05:38 +02:00
endif::env-github,rspecator-view[]