issues from sonar
This commit is contained in:
parent
0dc1a1c047
commit
e6b263feb5
|
@ -60,8 +60,10 @@ 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=sqale_rating,function_complexity,duplicated_lines_density,comment_lines_density,sqale_index,lines,file_line,files,functions,classes,directories").read
|
||||
complexity_date = open("http://123.59.135.93:8891/api/resources/index?resource=#{resource_id}&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
|
||||
issue_date = open("http://123.59.135.93:8891/api/resources/index?resource=#{resource_id}&depth=0&metrics=blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations").read
|
||||
@sonar_issues = JSON.parse(issue_date).first
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -4,12 +4,13 @@ module QualityAnalysisHelper
|
|||
if val.to_i > 0 && val.to_i < 5
|
||||
"henhao"
|
||||
elsif val.to_i > 5 && val.to_i < 10
|
||||
|
||||
"jiaohao"
|
||||
elsif val.to_i > 10 && val.to_i < 20
|
||||
"zhongdeng"
|
||||
elsif val.to_i > 20 && val.to_i < 50
|
||||
"yiban"
|
||||
"jiaocha"
|
||||
elsif val.to_i > 20
|
||||
"cha"
|
||||
"hencha"
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -42,4 +43,29 @@ module QualityAnalysisHelper
|
|||
"hao"
|
||||
end
|
||||
end
|
||||
|
||||
def score_sqale_rating val
|
||||
if val.to_i > 0 && val.to_i < 5
|
||||
"5"
|
||||
elsif val.to_i > 5 && val.to_i < 10
|
||||
"4"
|
||||
elsif val.to_i > 10 && val.to_i < 20
|
||||
"3"
|
||||
elsif val.to_i > 20 && val.to_i < 50
|
||||
"2"
|
||||
elsif val.to_i > 20
|
||||
"1"
|
||||
end
|
||||
end
|
||||
|
||||
def lines_scale val
|
||||
if val.to_i < 5000
|
||||
"zhongdeng"
|
||||
elsif val.to_i >5000 && val.to_i < 50000
|
||||
"zhongdneg"
|
||||
else
|
||||
"da"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
<p> duplicated_lines_density: <%= @complexity["msr"][7]["frmt_val"] %></p>
|
||||
<p> sqale_index: <%= @complexity["msr"][8]["frmt_val"] %></p>
|
||||
<p> sqale_rating: <%= @complexity["msr"][9]["frmt_val"] %></p>
|
||||
|
||||
<p> issues: <%= @sonar_issues["msr"][0]["frmt_val"] %></p>
|
||||
<%# DD %>
|
||||
|
||||
|
||||
|
@ -48,19 +50,19 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="analysis-tag-wrap f16"> <span class="analysis-tag fl mr15"></span> <span class="fb fl mr10">质量等级</span><span class="mr10 fontGrey2"><span class="c_red f18" style="margin-top:-5px; display:inline-block;">2</span>/5分</span><span class="fontGrey2">可定性评价为:<span class="c_red">质量中等</span></span></div>
|
||||
<div class="analysis-tag-wrap f16"> <span class="analysis-tag fl mr15"></span> <span class="fb fl mr10">质量等级</span><span class="mr10 fontGrey2"><span class="c_red f18" style="margin-top:-5px; display:inline-block;"><%= score_sqale_rating(@complexity["msr"][9]["val"]) %></span>/5分</span><span class="fontGrey2">可定性评价为:<span class="c_red">质量<%= sqale_rating_status(@complexity["msr"][9]["val"]) %></span></span></div>
|
||||
<div class="analysis-block mt10 mb40 f14">
|
||||
<div><span class="fontGrey3 mr30">技术债务</span><span class="fontBlue2 w70 pInline">14天</span><span class="fontGrey2">查看详情</span></div>
|
||||
<div><span class="fontGrey3 mr30">质量问题</span><span class="fontBlue2 w70 pInline">130</span><span class="fontGrey2">问题分类如下:</span></div>
|
||||
<div><span class="fontGrey3 mr30">技术债务</span><span class="fontBlue2 w70 pInline"><%= @complexity["msr"][8]["frmt_val"] %></span><span class="fontGrey2">查看详情</span></div>
|
||||
<div><span class="fontGrey3 mr30">质量问题</span><span class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][0]["frmt_val"] %></span><span class="fontGrey2">问题分类如下:</span></div>
|
||||
<div class="ml90 mt15">
|
||||
<div class="mb10"><span class="analysis-block-icon mr5"></span><span class="fontGrey3 mr45">阻断</span><span class="fontBlue2 w70 pInline">4</span><span class="quality-percentage"><span class="quality-percentage-rate"></span></span></div>
|
||||
<div class="mb10"><span class="analysis-serious-icon mr5"></span><span class="fontGrey3 mr45">严重</span><span class="fontBlue2 w70 pInline">75</span><span class="quality-percentage"><span class="quality-percentage-rate"></span></span></div>
|
||||
<div class="mb10"><span class="analysis-main-icon mr5"></span><span class="fontGrey3 mr45">主要</span><span class="fontBlue2 w70 pInline">428</span><span class="quality-percentage"><span class="quality-percentage-rate"></span></span></div>
|
||||
<div class="mb10"><span class="analysis-secondary-icon mr5"></span><span class="fontGrey3 mr45">次要</span><span class="fontBlue2 w70 pInline">225</span><span class="quality-percentage"><span class="quality-percentage-rate"></span></span></div>
|
||||
<div><span class="analysis-info-icon mr5"></span><span class="fontGrey3 mr45">信息</span><span class="fontBlue2 w70 pInline">114</span><span class="quality-percentage"><span class="quality-percentage-rate"></span></span></div>
|
||||
<div class="mb10"><span class="analysis-block-icon mr5"></span><span class="fontGrey3 mr45">阻断</span><span class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][1]["frmt_val"] %></span><span class="quality-percentage"><span class="quality-percentage-rate"></span></span></div>
|
||||
<div class="mb10"><span class="analysis-serious-icon mr5"></span><span class="fontGrey3 mr45">严重</span><span class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][2]["frmt_val"] %></span><span class="quality-percentage"><span class="quality-percentage-rate"></span></span></div>
|
||||
<div class="mb10"><span class="analysis-main-icon mr5"></span><span class="fontGrey3 mr45">主要</span><span class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][3]["frmt_val"] %></span><span class="quality-percentage"><span class="quality-percentage-rate"></span></span></div>
|
||||
<div class="mb10"><span class="analysis-secondary-icon mr5"></span><span class="fontGrey3 mr45">次要</span><span class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][4]["frmt_val"] %></span><span class="quality-percentage"><span class="quality-percentage-rate"></span></span></div>
|
||||
<div><span class="analysis-info-icon mr5"></span><span class="fontGrey3 mr45">信息</span><span class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][5]["frmt_val"] %></span><span class="quality-percentage"><span class="quality-percentage-rate"></span></span></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="analysis-tag-wrap f16"> <span class="analysis-tag fl mr15"></span> <span class="fb fl mr10">代码规模</span><span class="fontGrey2">可定性评价为:<span class="c_red">规模中等</span></span></div>
|
||||
<div class="analysis-tag-wrap f16"> <span class="analysis-tag fl mr15"></span> <span class="fb fl mr10">代码规模</span><span class="fontGrey2">可定性评价为:<span class="c_red"><%= lines_scale(@complexity["msr"][0]["frmt_val"]) %></span></span></div>
|
||||
<div class="analysis-block mt10 mb40 flex f14">
|
||||
<div class="analysis-genral">
|
||||
<p class="fontGrey3">代码行数</p>
|
||||
|
|
Loading…
Reference in New Issue