如何将代码分析错误 CA1506 class 耦合更改为 "moderate maintainability"
How to change Code analysis error CA1506 class coupling to "moderate maintainability"
我收到 class 耦合的代码分析错误。错误消息说:
'xxxxx' is coupled with 32 different types from 12 different
namespaces. Rewrite or refactor the method to decrease its class
coupling, or consider moving the method to one of the other types it
is tightly coupled with. A class coupling above 40 indicates poor
mainainability, a class coupling between 40 and 30 indicates
moderate maintainability, and a class coupling below 30 indicates good
maintainability.
目前我收到此错误是因为它试图强制执行“...低于 30 表示良好的可维护性”。
现在我想将其更改为 "moderate maintainability",我最多可以有 40 class 个耦合,但不能再多了。
现在我该如何改变呢?
我到处搜索,找不到如何更改它。
我认为这是不可配置的。我强烈建议简化您的代码。如果你真的不想这样做,你可以用
抑制特定类型的警告
#pragma warning disable CA1506
// My type
#pragma warning restore CA1506
我收到 class 耦合的代码分析错误。错误消息说:
'xxxxx' is coupled with 32 different types from 12 different namespaces. Rewrite or refactor the method to decrease its class coupling, or consider moving the method to one of the other types it is tightly coupled with. A class coupling above 40 indicates poor mainainability, a class coupling between 40 and 30 indicates moderate maintainability, and a class coupling below 30 indicates good maintainability.
目前我收到此错误是因为它试图强制执行“...低于 30 表示良好的可维护性”。 现在我想将其更改为 "moderate maintainability",我最多可以有 40 class 个耦合,但不能再多了。
现在我该如何改变呢? 我到处搜索,找不到如何更改它。
我认为这是不可配置的。我强烈建议简化您的代码。如果你真的不想这样做,你可以用
抑制特定类型的警告#pragma warning disable CA1506
// My type
#pragma warning restore CA1506