|
|
|
@ -19,6 +19,7 @@ class QualityAnalysisController < ApplicationController
|
|
|
|
|
#@client.exists?(job_name)
|
|
|
|
|
@g = Gitlab.client
|
|
|
|
|
gitlab_address = Redmine::Configuration['gitlab_address']
|
|
|
|
|
jenkins_address = Redmine::Configuration['jenkins_address']
|
|
|
|
|
user_name = User.find(params[:user_id]).try(:login)
|
|
|
|
|
branch = params[:branch].nil? ? "master" : params[:branch]
|
|
|
|
|
language = params[:language]
|
|
|
|
@ -44,7 +45,7 @@ class QualityAnalysisController < ApplicationController
|
|
|
|
|
@client = @client.job.create("#{user_name}_#{identifier}", @doc.to_xml)
|
|
|
|
|
# relace gitlab hook
|
|
|
|
|
# genkins address
|
|
|
|
|
@g.add_project_hook(@project.gpid,"http://123.59.135.93:8890/project/#{user_name}_#{identifier}")
|
|
|
|
|
@g.add_project_hook(@project.gpid, (jenkins_address + "/project/#{user_name}_#{identifier}"))
|
|
|
|
|
if qa.nil?
|
|
|
|
|
QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier, :version => version)
|
|
|
|
|
else
|
|
|
|
@ -53,16 +54,17 @@ class QualityAnalysisController < ApplicationController
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def index
|
|
|
|
|
@sonar_address = Redmine::Configuration['sonar_address']
|
|
|
|
|
if params[:resource_id].nil?
|
|
|
|
|
@name_flag = true
|
|
|
|
|
projects_date = open("http://123.59.135.93:8891/api/projects/index").read
|
|
|
|
|
projects_date = open(sonar_address + "/api/projects/index").read
|
|
|
|
|
@results = JSON.parse(projects_date)
|
|
|
|
|
else
|
|
|
|
|
@name_flag = false
|
|
|
|
|
resource_id = params[:resource_id]
|
|
|
|
|
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_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("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
|
|
|
|
|
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
|
|
|
|
|