我正在尝试根据以下因素生成月度报告
- LoC(代码行数)
- 规则合规率%
- 评论百分比
- 公开记录的 API %
- 安全违规
- 违规行为(不包括信息)
- 重复行%
我尝试检查 Sonar 数据库中的实体关系,所有表都是独立的。 我不确定应该从哪个表获取值以生成报告。
对于下面的提示,提到了查询
提示:
select proj.name as ClassName, -- Class Name for which violation has been found out
proj.long_name as LongName, -- Long Class Name i.e. with package for which violation has been found out
rf.failure_level as ErrorLevel, -- Error level of the violation
rf.message as Violation, -- Cause of Violation
rf.line as LineNumber, -- Line number of the class file
ru.name ViolationName, -- Violation Description
ru.plugin_name PluginType -- Plugin tool by which this error has been detected i.e. findbug, PMD, etc.
-- ,ru.description -- (if violation description is required we can add this column) from projects proj inner join snapshots snap on proj.id = snap.project_id inner join rule_failures rf on rf.snapshot_id = snap.id inner join rules ru on ru.id = rf.rule_id
最佳答案
我建议使用 Sonar REST API检索统计数据。
开发团队故意未记录数据库架构。这使他们能够进行不会破坏相关报告应用程序的更改。 (显然这并不能阻止有人运行 SQL 查询)
<小时/>示例
使用CXF project in nemo举个例子。
“资源”REST API 返回您请求的指标的最新值
“timemachine”REST API 返回数据的原始 CSV 转储:
(我的浏览器将方便地启动电子表格来读取 CSV 数据)
关于sonarqube - Sonar 数据库结构是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9193749/