fixed 500
This commit is contained in:
parent
62cb7d4568
commit
cb148c3b9c
|
@ -213,7 +213,8 @@ class QualityAnalysisController < ApplicationController
|
|||
@quality_analyses = QualityAnalysis.where(:project_id => @project.id).select{|qa| arr.include?(qa.sonar_name)}
|
||||
else
|
||||
filter = "sqale_rating,function_complexity,duplicated_lines_density,comment_lines_density,sqale_index,lines,files,functions,classes,directories,blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations"
|
||||
complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=#{filter}").read
|
||||
# complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=#{filter}").read
|
||||
complexity_date = open("http://sonar.trustie.net" + "/api/resources/index?resource=947&depth=0&metrics=#{filter}").read
|
||||
@complexity =JSON.parse(complexity_date).first
|
||||
|
||||
# 按名称转换成hash键值对
|
||||
|
@ -227,9 +228,6 @@ class QualityAnalysisController < ApplicationController
|
|||
end
|
||||
@ha.store(key,value)
|
||||
end
|
||||
|
||||
issue_date = open(@sonar_address + "/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
|
||||
rescue => e
|
||||
puts e
|
||||
|
|
|
@ -3,16 +3,16 @@ module QualityAnalysisHelper
|
|||
|
||||
def sqale_rating_status val
|
||||
arr = []
|
||||
if val < 5
|
||||
if val <= 5
|
||||
arr << "很好"
|
||||
arr << "b_green2"
|
||||
elsif val. > 5 && val < 10
|
||||
elsif val. > 5 && val <= 10
|
||||
arr << "较好"
|
||||
arr << "b_slow_yellow"
|
||||
elsif val > 10 && val < 20
|
||||
elsif val > 10 && val <= 20
|
||||
arr << "中等"
|
||||
arr << "b_yellow"
|
||||
elsif val > 20 && val < 50
|
||||
elsif val > 20 && val <= 50
|
||||
arr << "较差"
|
||||
arr << "b_slow_red"
|
||||
elsif val > 20
|
||||
|
@ -23,10 +23,10 @@ module QualityAnalysisHelper
|
|||
|
||||
def complexity_status val
|
||||
arr = []
|
||||
if val < 10
|
||||
if val <= 10
|
||||
arr << "良好"
|
||||
arr << "b_green2"
|
||||
elsif val > 10 && val < 15
|
||||
elsif val > 10 && val <= 15
|
||||
arr << "较高"
|
||||
arr << "b_yellow"
|
||||
elsif val > 15
|
||||
|
@ -37,10 +37,10 @@ module QualityAnalysisHelper
|
|||
|
||||
def duplicated_lines_density_status val
|
||||
arr = []
|
||||
if val < 30
|
||||
if val <= 30
|
||||
arr << "良好"
|
||||
arr << "b_green2"
|
||||
elsif val > 30 && val < 50
|
||||
elsif val > 30 && val <= 50
|
||||
arr << "较高"
|
||||
arr << "b_yellow"
|
||||
elsif val > 50
|
||||
|
@ -51,10 +51,10 @@ module QualityAnalysisHelper
|
|||
|
||||
def comment_lines_density_status val
|
||||
arr = []
|
||||
if val < 20
|
||||
if val <= 20
|
||||
arr << "较低"
|
||||
arr << "b_yellow"
|
||||
elsif val > 20 && val < 50
|
||||
elsif val > 20 && val <= 50
|
||||
arr << "正常"
|
||||
arr << "b_green2"
|
||||
elsif val > 50
|
||||
|
@ -64,15 +64,15 @@ module QualityAnalysisHelper
|
|||
end
|
||||
|
||||
def score_sqale_rating val
|
||||
if val > 0 && val < 5
|
||||
if val >= 0 && val <= 5
|
||||
"5"
|
||||
elsif val > 5 && val < 10
|
||||
elsif val > 5 && val <= 10
|
||||
"4"
|
||||
elsif val > 10 && val < 20
|
||||
elsif val > 10 && val <= 20
|
||||
"3"
|
||||
elsif val > 20 && val < 50
|
||||
elsif val > 20 && val <= 50
|
||||
"2"
|
||||
elsif val > 20
|
||||
elsif val > 50
|
||||
"1"
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue