|
|
|
@ -56,27 +56,28 @@ class QualityAnalysisController < ApplicationController
|
|
|
|
|
|
|
|
|
|
def index
|
|
|
|
|
@sonar_address = Redmine::Configuration['sonar_address']
|
|
|
|
|
if params[:resource_id].nil?
|
|
|
|
|
@name_flag = true
|
|
|
|
|
@quality_analyses = QualityAnalysis.where(:project_id => @project.id)
|
|
|
|
|
# @quality_analyses.map {|qa| qa.}
|
|
|
|
|
# if @quality_analyses.count > 0
|
|
|
|
|
# @quality_analyses.each do |qa|
|
|
|
|
|
# ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"]
|
|
|
|
|
#
|
|
|
|
|
# end
|
|
|
|
|
# end
|
|
|
|
|
# projects_date = open(@sonar_address + "/api/projects/index").read
|
|
|
|
|
# arr = JSON.parse(projects_date).map {|m| m["nm"]}
|
|
|
|
|
# arr.map
|
|
|
|
|
else
|
|
|
|
|
@name_flag = false
|
|
|
|
|
@resource_id = params[:resource_id]
|
|
|
|
|
complexity_date = open(@sonar_address + "/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(@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
|
|
|
|
|
# if params[:resource_id].nil?
|
|
|
|
|
# @name_flag = true
|
|
|
|
|
# @quality_analyses = QualityAnalysis.where(:project_id => @project.id)
|
|
|
|
|
# # @quality_analyses.map {|qa| qa.}
|
|
|
|
|
# # if @quality_analyses.count > 0
|
|
|
|
|
# # @quality_analyses.each do |qa|
|
|
|
|
|
# # ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"]
|
|
|
|
|
# #
|
|
|
|
|
# # end
|
|
|
|
|
# # end
|
|
|
|
|
# # projects_date = open(@sonar_address + "/api/projects/index").read
|
|
|
|
|
# # arr = JSON.parse(projects_date).map {|m| m["nm"]}
|
|
|
|
|
# # arr.map
|
|
|
|
|
# else
|
|
|
|
|
qa = QualityAnalysis.where(:project_id => @project.id).first
|
|
|
|
|
@resource_id = qa.author_login+":"+qa.rep_identifier
|
|
|
|
|
@name_flag = false
|
|
|
|
|
complexity_date = open(@sonar_address + "/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(@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
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# Find project of id params[:project_id]
|
|
|
|
|