|
|
@ -2,7 +2,7 @@ class QualityAnalysisController < ApplicationController
|
|
|
|
before_filter :find_project_by_project_id#, :except => [:getattachtype]
|
|
|
|
before_filter :find_project_by_project_id#, :except => [:getattachtype]
|
|
|
|
before_filter :find_quality_analysis, :only => [:edit, :update_jenkins_job]
|
|
|
|
before_filter :find_quality_analysis, :only => [:edit, :update_jenkins_job]
|
|
|
|
before_filter :authorize
|
|
|
|
before_filter :authorize
|
|
|
|
before_filter :connect_jenkins, :only => [:create, :edit, :update_jenkins_job]
|
|
|
|
before_filter :connect_jenkins, :only => [:create, :edit, :update_jenkins_job, :index]
|
|
|
|
layout "base_projects"
|
|
|
|
layout "base_projects"
|
|
|
|
include ApplicationHelper
|
|
|
|
include ApplicationHelper
|
|
|
|
include QualityAnalysisHelper
|
|
|
|
include QualityAnalysisHelper
|
|
|
@ -78,7 +78,7 @@ class QualityAnalysisController < ApplicationController
|
|
|
|
|
|
|
|
|
|
|
|
d = @client.job.delete("#{job_name}") if jenkins_job == '200' && code != '201'
|
|
|
|
d = @client.job.delete("#{job_name}") if jenkins_job == '200' && code != '201'
|
|
|
|
logger.error("delete result ==> #{code}")
|
|
|
|
logger.error("delete result ==> #{code}")
|
|
|
|
if qa.blank? && code == '201'
|
|
|
|
if qa.blank? && @current_build_status == "success"
|
|
|
|
QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier,
|
|
|
|
QualityAnalysis.create(:project_id => @project.id, :author_login => user_name, :rep_identifier => identifier,
|
|
|
|
:sonar_version => version, :path => path, :branch => branch, :language => language, :sonar_name => "#{user_name}:#{rep_id}")
|
|
|
|
:sonar_version => version, :path => path, :branch => branch, :language => language, :sonar_name => "#{user_name}:#{rep_id}")
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -89,7 +89,7 @@ class QualityAnalysisController < ApplicationController
|
|
|
|
puts e
|
|
|
|
puts e
|
|
|
|
end
|
|
|
|
end
|
|
|
|
respond_to do |format|
|
|
|
|
respond_to do |format|
|
|
|
|
format.html{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch)}
|
|
|
|
format.html{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch, :current_build_status => @current_build_status, :job_name => job_name)}
|
|
|
|
# format.js{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch)}
|
|
|
|
# format.js{redirect_to project_quality_analysis_path(:project_id => @project.id, :resource_id => sonar_name, :branch => branch)}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -167,6 +167,7 @@ class QualityAnalysisController < ApplicationController
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
@resource_id = params[:resource_id]
|
|
|
|
@resource_id = params[:resource_id]
|
|
|
|
@sonar_address = Redmine::Configuration['sonar_address']
|
|
|
|
@sonar_address = Redmine::Configuration['sonar_address']
|
|
|
|
|
|
|
|
@jenkins_address = Redmine::Configuration['jenkins_address']
|
|
|
|
if params[:resource_id].nil?
|
|
|
|
if params[:resource_id].nil?
|
|
|
|
@name_flag = true
|
|
|
|
@name_flag = true
|
|
|
|
projects_date = open(@sonar_address + "/api/projects/index").read
|
|
|
|
projects_date = open(@sonar_address + "/api/projects/index").read
|
|
|
@ -174,6 +175,10 @@ class QualityAnalysisController < ApplicationController
|
|
|
|
@quality_analyses = QualityAnalysis.where(:project_id => @project.id).select{|qa| arr.include?(qa.sonar_name)}
|
|
|
|
@quality_analyses = QualityAnalysis.where(:project_id => @project.id).select{|qa| arr.include?(qa.sonar_name)}
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
|
|
|
|
if params[:current_build_status] == "failure"
|
|
|
|
|
|
|
|
job_name = params[:job_name]
|
|
|
|
|
|
|
|
@console_build = @client.job.get_console_output("#{job_name}", build_num = 0, start = 0, mode = 'text')
|
|
|
|
|
|
|
|
end
|
|
|
|
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_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
|
|
|
|
@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
|
|
|
|
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
|
|
|
|