Merge branch 'rep_quality' into develop

This commit is contained in:
huang 2016-08-24 15:13:37 +08:00
commit f0ed380002
3 changed files with 14 additions and 1 deletions

View File

@ -237,6 +237,11 @@ class QualityAnalysisController < ApplicationController
arr = JSON.parse(projects_date).map {|m| m["nm"]} # eg: ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"] arr = JSON.parse(projects_date).map {|m| m["nm"]} # eg: ["Hjqreturn:cc_rep", "Hjqreturn:putong", "Hjqreturn:sonar_rep2", "shitou:sonar_rep"]
@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
languate_arr = ['ruby', 'c#', 'c++', 'c']
qa_language = QualityAnalysis.where(:sonar_name => @resource_id).first.try(:language)
if !qa_language.blank? && languate_arr.include?(qa_language)
@language_flag = true
end
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" 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 =JSON.parse(complexity_date).first @complexity =JSON.parse(complexity_date).first

View File

@ -14,7 +14,7 @@
<li class="analysis-result-edit fl fontBlue2" ></li> <li class="analysis-result-edit fl fontBlue2" ></li>
<div class="cl"></div> <div class="cl"></div>
</ul> </ul>
<% if @quality_analyses.count >0 %> <% if @quality_analyses && @quality_analyses.count >0 %>
<% @quality_analyses.each do |qa| %> <% @quality_analyses.each do |qa| %>
<ul class="analysis-result-list"> <ul class="analysis-result-list">
<li title="<%= qa.author_login+ ':' +qa.rep_identifier %>"><%=link_to "#{qa.author_login}:#{qa.rep_identifier}", project_quality_analysis_path(:resource_id => qa.sonar_name, :branch => (qa.branch.nil? ? "master" : qa.branch)), :class => "analysis-result-name fl fontBlue2 hidden" %></li> <li title="<%= qa.author_login+ ':' +qa.rep_identifier %>"><%=link_to "#{qa.author_login}:#{qa.rep_identifier}", project_quality_analysis_path(:resource_id => qa.sonar_name, :branch => (qa.branch.nil? ? "master" : qa.branch)), :class => "analysis-result-name fl fontBlue2 hidden" %></li>

View File

@ -2,6 +2,14 @@
<div class="project_r_h"> <div class="project_r_h">
<h2 class="project_h2" style="width:180px;">质量分析</h2> <h2 class="project_h2" style="width:180px;">质量分析</h2>
</div> </div>
<% if @language_flag %>
<div class="flash warning">
本平台使用的代码质量分析工具是sonar开源质量数据报告工具目前ruby、c++、c#语言的分析结果可能存在一定的偏差,
建议结合其他数据质量分析工具进行综合判断。
</div>
<% end %>
<div class="button-rep">当前分支:<%= params[:branch] %></div> <div class="button-rep">当前分支:<%= params[:branch] %></div>
<div class="cl"></div> <div class="cl"></div>
<div class="tac f20 fb mt35 mb30">项目代码质量分析报告</div> <div class="tac f20 fb mt35 mb30">项目代码质量分析报告</div>