This commit is contained in:
Your Name 2016-06-24 11:20:39 +08:00
parent 580b232d62
commit e17aa4c5d8
3 changed files with 50 additions and 25 deletions

View File

@ -1,47 +1,69 @@
module QualityAnalysisHelper
def sqale_rating_status val
arr = []
if val.to_i > 0 && val.to_i < 5
"很好"
arr << "很好"
arr << "b_green2"
elsif val.to_i > 5 && val.to_i < 10
"较好"
arr << "较好"
arr << "b_slow_yellow"
elsif val.to_i > 10 && val.to_i < 20
"中等"
arr << "中等"
arr << "b_yellow"
elsif val.to_i > 20 && val.to_i < 50
"较差"
arr << "较差"
arr << "b_slow_red"
elsif val.to_i > 20
"很差"
arr << "很差"
arr << "b_red"
end
arr.first
end
def complexity_status val
arr = []
if val.to_i < 10
"良好"
arr << "良好"
arr << "b_green2"
elsif val.to_i > 10 && val.to_i < 15
"较高"
arr << "较高"
arr << "b_yellow"
elsif val.to_i > 15
"很高"
arr << "很高"
arr << "b_red"
end
arr.first
end
def duplicated_lines_density_status val
arr = []
if val.to_i < 30
"良好"
arr << "良好"
arr << "b_green2"
elsif val.to_i > 30 && val.to_i < 50
"较高"
arr << "较高"
arr << "b_yellow"
elsif val.to_i > 50
"很高"
arr << "很高"
arr << "b_red"
end
arr.first
end
def comment_lines_density_status val
arr = []
if val.to_i < 20
"较低"
arr << "较低"
arr << "b_yellow"
elsif val.to_i > 20 && val.to_i < 50
"正常"
arr << "正常"
arr << "b_green2"
elsif val.to_i > 50
"较高"
arr << "较高"
arr << "b_red"
end
arr.first
end
def score_sqale_rating val

View File

@ -10,39 +10,39 @@
<div class="analysis-block mt10 mb40 f14">
<div class="flex">
<div class="analysis-genral">
<p id="container_sqale_rating" style="max-width:260px;min-height:260px;width:260px; margin:0 auto;"></p>
<p id="container_sqale_rating" style="max-width:200px;min-height:200px;width:200px; margin:0 auto;"></p>
<p class="fontGrey3">质量等级</p>
<p class="fontBlue2 pr"><%= @complexity["msr"][9]["frmt_val"] %><span class="f8 c_white analysis-genral-icon b_green2 borderRadius"><%= sqale_rating_status(@complexity["msr"][9]["val"]) %></span></p>
<p class="fontBlue2 pr"><%= @complexity["msr"][9]["frmt_val"] %><span class="f8 c_white analysis-genral-icon #{<%= sqale_rating_status(@complexity["msr"][9]["val"])[1] %>} borderRadius"><%= sqale_rating_status(@complexity["msr"][9]["val"]) %></span></p>
</div>
<div class="analysis-genral" >
<p id="container_function_complexity" style="max-width:260px;min-height:260px;width:260px; margin:0 auto;"></p>
<p id="container_function_complexity" style="max-width:200px;min-height:200px;width:200px; margin:0 auto;"></p>
<p class="fontGrey3">复杂度</p>
<p class="fontBlue2 pr"><%= @complexity["msr"][6]["val"] %><span class="f8 c_white analysis-genral-icon b_green2 borderRadius"><%= complexity_status(@complexity["msr"][6]["val"]) %></span></p>
</div>
</div>
<div class="flex">
<div class="analysis-genral">
<p id="container_duplicated_lines_density" style="max-width:260px;min-height:260px;width:260px; margin:0 auto;"></p>
<p id="container_duplicated_lines_density" style="max-width:200px;min-height:200px;width:200px; margin:0 auto;"></p>
<p class="fontGrey3">重复</p>
<p class="fontBlue2 pr"><%= @complexity["msr"][7]["frmt_val"] %><span class="f8 c_white analysis-genral-icon b_green2 borderRadius"><%= duplicated_lines_density_status(@complexity["msr"][7]["val"]) %></span></p>
</div>
<div class="analysis-genral">
<p id="container_comment_lines_density" style="max-width:260px;min-height:260px;width:260px; margin:0 auto;"></p>
<p id="container_comment_lines_density" style="max-width:200px;min-height:200px;width:200px; margin:0 auto;"></p>
<p class="fontGrey3">注释率</p>
<p class="fontBlue2 pr"><%= @complexity["msr"][5]["frmt_val"] %><span class="f8 c_white analysis-genral-icon b_red borderRadius"><%=comment_lines_density_status(@complexity["msr"][5]["val"]) %></span></p>
</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;"><%= 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-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"])[0] %></span></span></div>
<div class="analysis-block mt10 mb40 f14">
<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"><%= @sonar_issues["msr"][1]["frmt_val"] %></span><span class="quality-percentage"><span class="quality-percentage-rate" style="width:<%= statistics_result_percentage(@sonar_issues["msr"][1]["frmt_val"], 200) %>%;"></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 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" style="width:<%= statistics_result_percentage(@sonar_issues["msr"][1]["frmt_val"].to_i, 200) %>%;"></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" style="width:<%= statistics_result_percentage(@sonar_issues["msr"][2]["frmt_val"].to_i, 200) %>%;"></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" style="width:<%= statistics_result_percentage(@sonar_issues["msr"][3]["frmt_val"].to_i, 200) %>%;"></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" style="width:<%= statistics_result_percentage(@sonar_issues["msr"][4]["frmt_val"].to_i, 200) %>%;"></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" style="width:<%= statistics_result_percentage(@sonar_issues["msr"][5]["frmt_val"].to_i, 200) %>%;"></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"><%= lines_scale(@complexity["msr"][0]["frmt_val"]) %></span></span></div>

View File

@ -244,6 +244,9 @@ a.c_green{ color:#28be6c;}
.c_dblue{ color:#09658c;}
.b_blue{background:#64bdd9;}
.b_green{background:#28be6c;}
.b_slow_yellow{background:#adde18;}
.b_yellow{background:#DDDF0D;}
.b_slow_red{background:#df8538;}
.b_green2 {background:#63c360;}
.b_red {background:#d60308;}
.b_w{ background:#fff !important;}