我现在正在尝试NDepend 2周。我仍然无法弄清楚如何降低ILNestingDepth
。我没有几个方法标记为"方法太复杂 - 关键"。作为一种修复方法,他们建议将方法分成更小的方法。但我无法以这种方式修复它。我来告诉你一个方法:
第一版: ILNesting适当深度= 7
public bool Appropriate ( CompanyQuota available, CompanyQuota used )
{
/// - larger than available or
/// - less than already used area
return !( DiskQuota > available.DiskQuota || DiskQuota < used.DiskUsage ||
UploadQuota > available.UploadQuota || UploadQuota < used.UploadUsage ||
DownloadQuota > available.DownloadQuota || DownloadQuota < used.DownloadUsage ||
PersonnelQuota > available.PersonnelQuota || PersonnelQuota < used.PersonnelUsage );
}
第二版: ILNesting适当深度= 7
public bool Appropriate ( CompanyQuota available, CompanyQuota used )
{
/// - larger than available or
/// - less than already used area
return AvailableFromTop(available) || AvailableFromBottom(used);
}
bool AvailableFromTop ( CompanyQuota available )
{
return !( DiskQuota > available.DiskQuota ||
UploadQuota > available.UploadQuota ||
DownloadQuota > available.DownloadQuota ||
PersonnelQuota > available.PersonnelQuota );
}
bool AvailableFromBottom ( CompanyQuota used )
{
return !( DiskQuota < used.DiskUsage ||
UploadQuota < used.UploadUsage ||
DownloadQuota < used.DownloadUsage ||
PersonnelQuota < used.PersonnelUsage );
}
它是如何运作的?
我该怎么做?
答案 0 :(得分:0)
正如来自NDepend团队的@Patrick在评论中所说,这是一个误报。因此这个问题不需要答案。
为了社区的缘故,我在这里提出这个问题的答案仅包含Patrick的评论,因为这些评论太过于懒惰,不能阅读评论&#34;人。