gpt4 book ai didi

ndepend - ndepend 和 cppdepend 中的 CQL 可查看各个修订版本中指标的变化

转载 作者:行者123 更新时间:2023-12-02 12:10:18 25 4
gpt4 key购买 nike

CQL 可以轻松找到 CodeWasChanged 的方法但我还需要比较指标 - 我想找到修改后的代码,看看它是否有所改进。

我正在评估ndependcppdepend对于混合代码库。两者都给我留下了深刻的印象,尤其是 cppdepend 似乎能够很好地应对我们的传统和现代 C++。

如果我能弄清楚如何做到这一点,那么我就可以在 CQL 中完成我需要的所有操作,但否则必须执行诸如在外部合并报告之类的操作。因此,我希望获得有关从 CQL 自动化和比较报告生成的提示作为后备。显然,我会更高兴在 VisualCppDepend 或 VisualNDepend 中使用 CQL,这样我就可以在指标 View 中看到查询结果。与其他工具相比,对结果的实时探索是这些工具的重要

对 CodeWasChanged 和其他条款(如 IsInOlderBuild)的注释假设强制针对旧版本运行 CQL,这表明您无法跨修订版本进行查询。

我想要的查询类型类似于想象语法:

SELECT METHODS WHERE CodeWasChanged and MethodCe > 10

通用化以跨版本工作

SELECT METHODS WHERE CodeWasChanged and MethodCe > 10 and BaseMethodCe < 10

或者也许

SELECT METHODS WHERE CodeWasChanged and MethodCe > 10 and Older(MethodCe < 10)

最佳答案

安迪,与 CQLinq (Code Query and Rule over LINQ)查看代码指标的趋势是可能的,并且希望很容易实现。例如,请参阅默认代码规则 Avoid making complex methods even more complex (Source CC) :

// <Name>Avoid making complex methods even more complex (Source CC)</Name>
// To visualize changes in code, right-click a matched method and select:
// - Compare older and newer versions of source file
// - Compare older and newer versions disassembled with Reflector

warnif count > 0
from m in JustMyCode.Methods where
!m.IsAbstract &&
m.IsPresentInBothBuilds() &&
m.CodeWasChanged()

let oldCC = m.OlderVersion().CyclomaticComplexity
where oldCC > 6 && m.CyclomaticComplexity > oldCC

select new { m,
oldCC ,
newCC = m.CyclomaticComplexity ,
oldLoc = m.OlderVersion().NbLinesOfCode,
newLoc = m.NbLinesOfCode,
}

我们建议在默认组中浏览相关的默认代码规则:代码质量回归

关于ndepend - ndepend 和 cppdepend 中的 CQL 可查看各个修订版本中指标的变化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4455451/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com