gpt4 book ai didi

java - 使用 SonarQube 计算设计违规技术债务

转载 作者:行者123 更新时间:2023-11-30 04:01:27 25 4
gpt4 key购买 nike

我想知道是否可以使用最新版本的 Sonar 或通过某些插件计算架构违规(来自 java 项目)的技术债务,例如:“'X' 类应该位于 com.domain 中.classes 包”或“类“X”必须扩展类“Y””?或者“‘X’类必须具有‘public static Y someAttribute’属性”?

如果没有插件,如何开发一个插件来自动化此操作?我已经阅读了 Java API、REST、如何开发插件的文档并尝试对其进行编码,但还没有找到一种方法。

最佳答案

可能的路线是使用 PMD代码检查器。您可以添加自己的custom rules到PMD,有一个PMD plugin用于 Sonar 。

<小时/>

But in that case, Sonar can calculate the debt (through SQALE or another plugin) for me? In another case, how i can calculate the debt?

我认为您误解了“技术债务”一词。维基百科是这样描述的:

Technical debt (also known as design debt[citation needed] or code debt) is a neologistic metaphor referring to the eventual consequences of poor software architecture and software development within a codebase. The debt can be thought of as work that needs to be done before a particular job can be considered complete. If the debt is not repaid, then it will keep on accumulating interest, making it hard to implement changes later on. Unaddressed technical debt increases software entropy.

需要注意的关键是技术债务是一个隐喻

例如,PMD 可以告诉您您的代码违反了某些规则多少次,但它无法告诉您修复这些规则需要做多少工作,或者因为您没有这样做而在未来会产生多少额外工作现在不修复它。

基本上,您无法衡量技术债务,因为真正衡量技术债务需要知道 future 会发生什么。另请阅读:https://softwareengineering.stackexchange.com/questions/167080/how-is-technical-debt-best-measured-what-metrics-are-most-useful

关于java - 使用 SonarQube 计算设计违规技术债务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21906671/

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