From 53b9cbee72733cc995aa3fea601c9fe6ec9f962d Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 23 Jun 2016 17:21:18 +0800 Subject: [PATCH] added hightcharts and added some api for sonar --- .../quality_analysis_controller.rb | 2 +- .../quality_analysis/_hightchars.html.erb | 376 ++++++++++++++++++ app/views/quality_analysis/_show.html.erb | 174 ++------ 3 files changed, 411 insertions(+), 141 deletions(-) create mode 100644 app/views/quality_analysis/_hightchars.html.erb diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index fd000aa72..58ae02add 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -60,7 +60,7 @@ class QualityAnalysisController < ApplicationController else @name_flag = false resource_id = params[:resource_id] - complexity_date = open("http://123.59.135.93:8891/api/resources/index?resource=139&depth=0&metrics=complexity,function_complexity,class_complexity,file_complexity,lines,file_line,files,functions,classes,directories").read + complexity_date = open("http://123.59.135.93:8891/api/resources/index?resource=139&depth=0&metrics=sqale_rating,function_complexity,duplicated_lines_density,comment_lines_density,sqale_index,lines,file_line,files,functions,classes,directories").read @complexity =JSON.parse(complexity_date).first end end diff --git a/app/views/quality_analysis/_hightchars.html.erb b/app/views/quality_analysis/_hightchars.html.erb new file mode 100644 index 000000000..5acb0e20f --- /dev/null +++ b/app/views/quality_analysis/_hightchars.html.erb @@ -0,0 +1,376 @@ + \ No newline at end of file diff --git a/app/views/quality_analysis/_show.html.erb b/app/views/quality_analysis/_show.html.erb index cf81680b0..674507c4c 100644 --- a/app/views/quality_analysis/_show.html.erb +++ b/app/views/quality_analysis/_show.html.erb @@ -1,132 +1,19 @@

lines: <%= @complexity["msr"][0]["frmt_val"] %>

+

classes: <%= @complexity["msr"][1]["frmt_val"] %>

files: <%= @complexity["msr"][2]["frmt_val"] %>

directories: <%= @complexity["msr"][3]["frmt_val"] %>

-

classes: <%= @complexity["msr"][1]["frmt_val"] %>

function: <%= @complexity["msr"][4]["frmt_val"] %>

-

total Complexity: <%= @complexity["msr"][5]["frmt_val"] %>

-

file_complexity: <%= @complexity["msr"][6]["frmt_val"] %>

-

class_complexity: <%= @complexity["msr"][7]["frmt_val"] %>

-

function_complexity: <%= @complexity["msr"][8]["frmt_val"] %>

+

comment_lines_density: <%= @complexity["msr"][5]["frmt_val"] %>

+

function_complexity: <%= @complexity["msr"][6]["frmt_val"] %>

+

duplicated_lines_density: <%= @complexity["msr"][7]["frmt_val"] %>

+

sqale_index: <%= @complexity["msr"][8]["frmt_val"] %>

+

sqale_rating: <%= @complexity["msr"][9]["frmt_val"] %>

+ +<%dd %> + + <%= javascript_include_tag 'highcharts','highcharts-more' %> - - - - + <%= render :partial => "hightchars" %>

SonarQube质量分析

@@ -134,23 +21,30 @@
项目代码质量分析报告
概要信息
-
-
-

质量等级

-

A正常

+
+
+
+

+

质量等级

+

A正常

+
+
+

+

复杂度

+

44正常

+
-
-

复杂度

-

复杂度

-

44正常

-
-
-

重复

-

44%正常

-
-
-

注释率

-

12%偏低

+
+
+

+

重复

+

44%正常

+
+
+

+

注释率

+

12%偏低

+
质量等级2/5分可定性评价为:质量中等