- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
根据代码分析结果,以下是警告信息,
CA1502 Avoid excessive complexity 'METHOD()' has a cyclomatic complexity of 27. Rewrite or refactor the method to reduce complexity to 25.
BusinessServices ReportService.cs 310
什么是圈复杂度以及如何解决这个问题?
最佳答案
来自 Wikipedia :
The cyclomatic complexity of a section of source code is the count of the number of linearly independent paths through the source code. For instance, if the source code contained no decision points such as IF statements or FOR loops, the complexity would be 1, since there is only a single path through the code. If the code had a single IF statement containing a single condition, there would be two paths through the code: one path where the IF statement is evaluated as TRUE and one path where the IF statement is evaluated as FALSE.
解决这个问题的最简单方法是将方法分解为两个或更多更小的方法。 Visual Studio 的内置重构工具(例如 Refactor -> Extract Method
)可用于将选定的代码部分提取到另一个方法中。
关于c# - 如何解析CA1502 : Avoid excessive complexity?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21231259/
我正在尝试使用 Kotlin 上的 Exposed 编写 CRUD 服务。我有一张包含多对一引用的表格。当我尝试插入时,我得到 java.lang.IllegalStateException: No
我正在尝试使用 Kotlin 上的 Exposed 编写 CRUD 服务。我有一张包含多对一引用的表格。当我尝试插入时,我得到 java.lang.IllegalStateException: No
在阅读了 Douglas Crockford 的“JavaScript:The Good Parts”和 Stoyan Stevanov 的“JavaScript Patterns”之后,我试图确定“
使用 8 位符号大小、一个补码、二进制补码和 excess-127 表示法以二进制表示以下十进制数。 一)77 b) –42 c) 119 d) –107 我已经将它们转换为其他表示形式,只需要知道如
根据代码分析结果,以下是警告信息, CA1502 Avoid excessive complexity 'METHOD()' has a cyclomatic complexity of 27. Re
关闭。这个问题是not reproducible or was caused by typos .它目前不接受答案。 这个问题是由于错别字或无法再重现的问题引起的。虽然类似的问题可能是on-topi
这是一个由两部分组成的问题,但对于单独的部分来说没有意义。字节码输出中的大量 dup 指令是否表示代码编写不当?其中 large 由所有字节码指令的一定百分比定义。此外,如何重写生成 dup 指令的代
我正在使用从 Kafka 读取消息并将其推送到 Cassandra 的服务。 我正在为此使用线程架构。 据说有 k 个线程 从 Kafka 主题中消费。这些写入队列,声明为: public stati
我有一个已分配 85GB 空间的数据库。我使用 show dbs 命令得到了这个大小。但是当我使用 db.stats() 时,我得到的存储大小为 63GB。在浏览完文档后,我发现 dat mongo
有没有理由添加注解。而不是。除了数据库架构生成之外?无论如何,值将由DB设置。。此外,CreationTimestamp与不可变不可分,并导致错误JpaSystemException:不支持锁定模式
我想使用中间相遇攻击来暴力破解 64 位 RSA 加密文本(这适用于大学,没有恶意)。 为此,我基本上创建了一个具有 2^34 个 BigInt 值的 Julia 向量,并在其上广播了 powermo
我刚刚在服务器上设置了 Apache modsecurity,原则上它运行良好,但我得到了相当多的误报。 我正在使用 OWASP ModSecurity 核心规则集 (CRS),本质上是“开箱即用”。
早起的人们, 我在 COALESCE 方面遇到了一个小问题,导致将数据写入表的存储过程过度运行。 (不使用 COALESCE 需要 4 分钟,使用 COALESCE 则需要 1 小时 30 分钟左右)
我的项目必须使用两个不同的编译器进行编译。一个创建DLL(用于PC模拟,Mingw32-gcc-4.7.2),另一个创建ELF(用于真实硬件)。两种编译器的行为都有部分不同,但是我们希望它们至少在出现
我想在 c(gcc) 中使用关键字参数,我遵循 this link 如下所示: #include // printf #include // bool - there's a bo
我正在使用 DllImport 编写与遗留(2012 年 2 月)C 程序接口(interface)的 C# 代码。它工作正常,但我需要调用 30 多个不同的函数,将我通常无可挑剔、精致的代码变成近乎
我已经开始使用非常酷的新 IOS Swift AutoLayout 库:Stevia出于同样的原因,该项目已启动。但是,我一直遇到过度约束的问题。 在下面的示例中,我将 2 个具有固定宽度和高度的 V
我正在尝试处理我的应用程序中的 IE7 错误。这是 HTML/CSS 代码 在 Firefox/Opera/Webkit/IE6 中是可以的,但在 IE7 中
我有以下Jenkinsfile: #!groovy def projectPath = "${projectPath}" def specPath = "${specPath}" int number
我编写了一个简短的脚本,可以让我下载文件。 Invoke-WebRequest -Uri $r2.Forms.Action -WebSession $myWebSession -OutFile $de
我是一名优秀的程序员,十分优秀!