diff --git a/app/controllers/quality_analysis_controller.rb b/app/controllers/quality_analysis_controller.rb index a0b275dc7..11aa57c9f 100644 --- a/app/controllers/quality_analysis_controller.rb +++ b/app/controllers/quality_analysis_controller.rb @@ -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"] @quality_analyses = QualityAnalysis.where(:project_id => @project.id).select{|qa| arr.include?(qa.sonar_name)} 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" complexity_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=#{filter}").read @complexity =JSON.parse(complexity_date).first diff --git a/app/views/quality_analysis/_result_list.html.erb b/app/views/quality_analysis/_result_list.html.erb index 5b4e4f5a0..0c2bc9497 100644 --- a/app/views/quality_analysis/_result_list.html.erb +++ b/app/views/quality_analysis/_result_list.html.erb @@ -14,7 +14,7 @@
-<% if @quality_analyses.count >0 %> +<% if @quality_analyses && @quality_analyses.count >0 %> <% @quality_analyses.each do |qa| %>