我试图根据以下因素生成月度报告
> LoC(代码行)
>规则合规性%
>评论%
>公开记录的API%
>安全违规
>违规(不包括信息)
>重复行%
我试图检查声纳数据库中的实体关系船,所有表都是独立的.
我不知道从哪个表中我应该得到价值,以便生成报告.
对于下面的提示,提到了
暗示:
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
解决方法
您可以使用下表获得上述信息.
1)项目,快照,指标和project_measures.其中项目表包含项目名称.并且对于每个项目,在快照表中的特定时间段内创建一个快照ID.然后从快照表获取快照ID并搜索它projects_measure表.并使用度量标准ID搜索descibed属性的值.
select distinct proj.name NAME_OF_PROJ,metric.description Description,projdesc.value,snap.created_at CREATED_DATE from projects proj inner join snapshots snap on snap.project_id=proj.id inner join (select max(snap2.created_at) as date_of_creation,id from snapshots snap2 where Date(snap2.created_at) in ('2011-12-20','2012-02-21') and snap2.project_id in (5507,35252,9807,38954,23018,32390) GROUP BY DAY(snap2.created_at),snap2.project_id ) as Lookup on Lookup.id=snap.id inner join project_measures projdesc on projdesc.snapshot_id=snap.id inner join metrics metric on projdesc.metric_id =metric.id where metric.id in( 1,2...)