commit
05f09c4595
@ -0,0 +1,3 @@
|
|||||||
|
# Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
# All this logic will automatically be available in application.js.
|
||||||
|
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
@ -0,0 +1,3 @@
|
|||||||
|
// Place all the styles related to the QualityAnalyses controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
@ -0,0 +1,99 @@
|
|||||||
|
class QualityAnalysisController < ApplicationController
|
||||||
|
before_filter :find_project_by_project_id#, :except => [:getattachtype]
|
||||||
|
before_filter :authorize
|
||||||
|
layout "base_projects"
|
||||||
|
include ApplicationHelper
|
||||||
|
require 'jenkins_api_client'
|
||||||
|
require 'nokogiri'
|
||||||
|
require 'json'
|
||||||
|
require 'open-uri'
|
||||||
|
|
||||||
|
def show
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
gitlab_address = Redmine::Configuration['gitlab_address']
|
||||||
|
jenkins_address = Redmine::Configuration['jenkins_address']
|
||||||
|
@client = JenkinsApi::Client.new(:server_url => jenkins_address,
|
||||||
|
:username => "temp",
|
||||||
|
:password => '123123')
|
||||||
|
#@client.exists?(job_name)
|
||||||
|
@g = Gitlab.client
|
||||||
|
user_name = User.find(params[:user_id]).try(:login)
|
||||||
|
branch = params[:branch].nil? ? "master" : params[:branch]
|
||||||
|
language = params[:language]
|
||||||
|
path = params[:path]
|
||||||
|
identifier = params[:identifier]
|
||||||
|
qa = QualityAnalysis.where(:project_id => @project.id, :author_login => user_name).first
|
||||||
|
version = qa.nil? ? 1 : qa.sonar_version + 1
|
||||||
|
properties = "sonar.projectKey=#{user_name}:#{identifier}
|
||||||
|
sonar.projectName=#{user_name}:#{identifier}
|
||||||
|
sonar.projectVersion=#{version}
|
||||||
|
sonar.sources=#{path}
|
||||||
|
sonar.language=#{language.downcase}
|
||||||
|
sonar.sourceEncoding=utf-8"
|
||||||
|
git_url = gitlab_address.to_s+"/"+@project.owner.to_s+"/"+ identifier + "."+"git"
|
||||||
|
|
||||||
|
# # # modify config
|
||||||
|
@doc = Nokogiri::XML(File.open(File.join(Rails.root, 'tmp', 'config.xml')))
|
||||||
|
@doc.at_xpath("//hudson.plugins.git.UserRemoteConfig/url").content = git_url
|
||||||
|
@doc.at_xpath("//hudson.plugins.git.BranchSpec/name").content = "*/#{branch}"
|
||||||
|
@doc.at_xpath("//hudson.plugins.sonar.SonarRunnerBuilder/properties").content = properties #sonar-properties
|
||||||
|
#
|
||||||
|
# replace config.xml of jenkins
|
||||||
|
@client = @client.job.create("#{user_name}_#{identifier}", @doc.to_xml)
|
||||||
|
# relace gitlab hook
|
||||||
|
# genkins address
|
||||||
|
@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, :sonar_version => version, :path => path, :branch => branch, :language => language)
|
||||||
|
|
||||||
|
else
|
||||||
|
qa.update_attribute(:sonar_version, version)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
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
|
||||||
|
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]
|
||||||
|
def find_project_by_project_id
|
||||||
|
@project = Project.find(params[:project_id])
|
||||||
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
render_404
|
||||||
|
end
|
||||||
|
|
||||||
|
# Authorize the user for the requested action
|
||||||
|
def authorize(ctrl = params[:controller], action = params[:action], global = false)
|
||||||
|
unless @project.archived? && @project.gpid.nil?
|
||||||
|
true
|
||||||
|
else
|
||||||
|
render_403 :message => :notice_not_authorized_archived_project
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -0,0 +1,97 @@
|
|||||||
|
# encoding: utf-8
|
||||||
|
module QualityAnalysisHelper
|
||||||
|
|
||||||
|
def sqale_rating_status val
|
||||||
|
arr = []
|
||||||
|
if val.to_i > 0 && val.to_i < 5
|
||||||
|
arr << "很好"
|
||||||
|
arr << "b_green2"
|
||||||
|
elsif val.to_i > 5 && val.to_i < 10
|
||||||
|
arr << "较好"
|
||||||
|
arr << "b_slow_yellow"
|
||||||
|
elsif val.to_i > 10 && val.to_i < 20
|
||||||
|
arr << "中等"
|
||||||
|
arr << "b_yellow"
|
||||||
|
elsif val.to_i > 20 && val.to_i < 50
|
||||||
|
arr << "较差"
|
||||||
|
arr << "b_slow_red"
|
||||||
|
elsif val.to_i > 20
|
||||||
|
arr << "很差"
|
||||||
|
arr << "b_red"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def complexity_status val
|
||||||
|
arr = []
|
||||||
|
if val.to_i < 10
|
||||||
|
arr << "良好"
|
||||||
|
arr << "b_green2"
|
||||||
|
elsif val.to_i > 10 && val.to_i < 15
|
||||||
|
arr << "较高"
|
||||||
|
arr << "b_yellow"
|
||||||
|
elsif val.to_i > 15
|
||||||
|
arr << "很高"
|
||||||
|
arr << "b_red"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def duplicated_lines_density_status val
|
||||||
|
arr = []
|
||||||
|
if val.to_i < 30
|
||||||
|
arr << "良好"
|
||||||
|
arr << "b_green2"
|
||||||
|
elsif val.to_i > 30 && val.to_i < 50
|
||||||
|
arr << "较高"
|
||||||
|
arr << "b_yellow"
|
||||||
|
elsif val.to_i > 50
|
||||||
|
arr << "很高"
|
||||||
|
arr << "b_red"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def comment_lines_density_status val
|
||||||
|
arr = []
|
||||||
|
if val.to_i < 20
|
||||||
|
arr << "较低"
|
||||||
|
arr << "b_yellow"
|
||||||
|
elsif val.to_i > 20 && val.to_i < 50
|
||||||
|
arr << "正常"
|
||||||
|
arr << "b_green2"
|
||||||
|
elsif val.to_i > 50
|
||||||
|
arr << "较高"
|
||||||
|
arr << "b_red"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def score_sqale_rating val
|
||||||
|
if val.to_i > 0 && val.to_i < 5
|
||||||
|
"5"
|
||||||
|
elsif val.to_i > 5 && val.to_i < 10
|
||||||
|
"4"
|
||||||
|
elsif val.to_i > 10 && val.to_i < 20
|
||||||
|
"3"
|
||||||
|
elsif val.to_i > 20 && val.to_i < 50
|
||||||
|
"2"
|
||||||
|
elsif val.to_i > 20
|
||||||
|
"1"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def lines_scale val
|
||||||
|
if val.to_i < 5000
|
||||||
|
"小型"
|
||||||
|
elsif val.to_i >5000 && val.to_i < 50000
|
||||||
|
"中型"
|
||||||
|
else
|
||||||
|
"大型"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
#统计答题百分比,统计结果保留两位小数
|
||||||
|
def statistics_result_percentage(e, t)
|
||||||
|
e = e.to_f
|
||||||
|
t = t.to_f
|
||||||
|
t == 0 ? 0 : format("%.2f", e*100/t)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
@ -0,0 +1,7 @@
|
|||||||
|
class QualityAnalysis < ActiveRecord::Base
|
||||||
|
attr_accessible :author_login, :project_id, :rep_identifier, :sonar_version, :branch, :path, :rep_identifier, :language
|
||||||
|
|
||||||
|
def user_rep_name
|
||||||
|
self.author_login+":"+self.rep_identifier
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,3 @@
|
|||||||
|
class SonarAnalysis < ActiveRecord::Base
|
||||||
|
attr_accessible :author_login, :project_id, :rep_identifier
|
||||||
|
end
|
@ -0,0 +1,483 @@
|
|||||||
|
<script>
|
||||||
|
// sqale_rating
|
||||||
|
$(function () {
|
||||||
|
$('#container_sqale_rating').highcharts({
|
||||||
|
|
||||||
|
chart: {
|
||||||
|
type: 'gauge',
|
||||||
|
plotBackgroundColor: null,
|
||||||
|
plotBackgroundImage: null,
|
||||||
|
plotBorderWidth: 0,
|
||||||
|
plotShadow: false
|
||||||
|
},
|
||||||
|
title: false,
|
||||||
|
pane: {
|
||||||
|
startAngle: -150,
|
||||||
|
endAngle: 150,
|
||||||
|
background: [{
|
||||||
|
backgroundColor: {
|
||||||
|
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
||||||
|
stops: [
|
||||||
|
[0, '#FFF'],
|
||||||
|
[1, '#333']
|
||||||
|
]
|
||||||
|
},
|
||||||
|
borderWidth: 0,
|
||||||
|
outerRadius: '109%'
|
||||||
|
}, {
|
||||||
|
backgroundColor: {
|
||||||
|
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
||||||
|
stops: [
|
||||||
|
[0, '#333'],
|
||||||
|
[1, '#FFF']
|
||||||
|
]
|
||||||
|
},
|
||||||
|
borderWidth: 1,
|
||||||
|
outerRadius: '107%'
|
||||||
|
}, {
|
||||||
|
// default background
|
||||||
|
}, {
|
||||||
|
backgroundColor: '#DDD',
|
||||||
|
borderWidth: 0,
|
||||||
|
outerRadius: '105%',
|
||||||
|
innerRadius: '103%'
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
|
||||||
|
// the value axis
|
||||||
|
yAxis: {
|
||||||
|
min: 0,
|
||||||
|
max: 100,
|
||||||
|
minorTickInterval: 'auto',
|
||||||
|
minorTickWidth: 1,
|
||||||
|
minorTickLength: 10,
|
||||||
|
minorTickPosition: 'inside',
|
||||||
|
minorTickColor: '#666',
|
||||||
|
tickPixelInterval: 30,
|
||||||
|
tickWidth: 2,
|
||||||
|
tickPosition: 'inside',
|
||||||
|
tickLength: 10,
|
||||||
|
tickColor: '#666',
|
||||||
|
labels: {
|
||||||
|
step: 2,
|
||||||
|
rotation: 'auto'
|
||||||
|
},
|
||||||
|
// title: {
|
||||||
|
// text: 'km/h'
|
||||||
|
// },
|
||||||
|
plotBands: [{
|
||||||
|
from: 0,
|
||||||
|
to: 5,
|
||||||
|
color: '#55BF3B' // green
|
||||||
|
}, {
|
||||||
|
from: 6,
|
||||||
|
to: 10,
|
||||||
|
color: '#adde18' // yellow
|
||||||
|
}, {
|
||||||
|
from: 11,
|
||||||
|
to: 20,
|
||||||
|
color: '#DDDF0D' // red
|
||||||
|
}, {
|
||||||
|
from: 21,
|
||||||
|
to: 50,
|
||||||
|
color: '#df8538' // yellow
|
||||||
|
}, {
|
||||||
|
from: 51,
|
||||||
|
to: 100,
|
||||||
|
color: '#DF5353' // yellow
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
|
||||||
|
// delete hightcharts.com
|
||||||
|
credits:{
|
||||||
|
enabled: false
|
||||||
|
},
|
||||||
|
series: [{
|
||||||
|
name: '代码质量',
|
||||||
|
data: [<%= @complexity["msr"][9]["val"] %>]
|
||||||
|
// tooltip: {
|
||||||
|
// valueSuffix: ' km/h'
|
||||||
|
// }
|
||||||
|
}]
|
||||||
|
|
||||||
|
},
|
||||||
|
// Add some life
|
||||||
|
function (chart) {
|
||||||
|
// if (!chart.renderer.forExport) {
|
||||||
|
// setInterval(function () {
|
||||||
|
// var point = chart.series[0].points[0],
|
||||||
|
// newVal,
|
||||||
|
// inc = Math.round((Math.random() - 0.5) * 20);
|
||||||
|
//
|
||||||
|
// newVal = point.y + inc;
|
||||||
|
// if (newVal < 0 || newVal > 200) {
|
||||||
|
// newVal = point.y - inc;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// point.update(newVal);
|
||||||
|
//
|
||||||
|
// }, 3000);
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// function_complexity
|
||||||
|
$(function () {
|
||||||
|
$('#container_function_complexity').highcharts({
|
||||||
|
|
||||||
|
chart: {
|
||||||
|
type: 'gauge',
|
||||||
|
plotBackgroundColor: null,
|
||||||
|
plotBackgroundImage: null,
|
||||||
|
plotBorderWidth: 0,
|
||||||
|
plotShadow: false
|
||||||
|
},
|
||||||
|
title: false,
|
||||||
|
pane: {
|
||||||
|
startAngle: -150,
|
||||||
|
endAngle: 150,
|
||||||
|
background: [{
|
||||||
|
backgroundColor: {
|
||||||
|
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
||||||
|
stops: [
|
||||||
|
[0, '#FFF'],
|
||||||
|
[1, '#333']
|
||||||
|
]
|
||||||
|
},
|
||||||
|
borderWidth: 0,
|
||||||
|
outerRadius: '109%'
|
||||||
|
}, {
|
||||||
|
backgroundColor: {
|
||||||
|
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
||||||
|
stops: [
|
||||||
|
[0, '#333'],
|
||||||
|
[1, '#FFF']
|
||||||
|
]
|
||||||
|
},
|
||||||
|
borderWidth: 1,
|
||||||
|
outerRadius: '107%'
|
||||||
|
}, {
|
||||||
|
// default background
|
||||||
|
}, {
|
||||||
|
backgroundColor: '#DDD',
|
||||||
|
borderWidth: 0,
|
||||||
|
outerRadius: '105%',
|
||||||
|
innerRadius: '103%'
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
|
||||||
|
// the value axis
|
||||||
|
yAxis: {
|
||||||
|
min: 0,
|
||||||
|
max: 30,
|
||||||
|
minorTickInterval: 'auto',
|
||||||
|
minorTickWidth: 1,
|
||||||
|
minorTickLength: 10,
|
||||||
|
minorTickPosition: 'inside',
|
||||||
|
minorTickColor: '#666',
|
||||||
|
tickPixelInterval: 30,
|
||||||
|
tickWidth: 2,
|
||||||
|
tickPosition: 'inside',
|
||||||
|
tickLength: 10,
|
||||||
|
tickColor: '#666',
|
||||||
|
labels: {
|
||||||
|
step: 2,
|
||||||
|
rotation: 'auto'
|
||||||
|
},
|
||||||
|
// title: {
|
||||||
|
// text: 'km/h'
|
||||||
|
// },
|
||||||
|
plotBands: [{
|
||||||
|
from: 0,
|
||||||
|
to: 10,
|
||||||
|
color: '#55BF3B' // green
|
||||||
|
}, {
|
||||||
|
from: 11,
|
||||||
|
to: 15,
|
||||||
|
color: '#DDDF0D' // yellow
|
||||||
|
}, {
|
||||||
|
from: 16,
|
||||||
|
to: 30,
|
||||||
|
color: '#DF5353' // red
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
|
||||||
|
// delete hightcharts.com
|
||||||
|
credits:{
|
||||||
|
enabled: false
|
||||||
|
},
|
||||||
|
series: [{
|
||||||
|
name: '复杂度',
|
||||||
|
data: [<%= @complexity["msr"][6]["val"] %>]
|
||||||
|
// tooltip: {
|
||||||
|
// valueSuffix: ' km/h'
|
||||||
|
// }
|
||||||
|
}]
|
||||||
|
|
||||||
|
},
|
||||||
|
// Add some life
|
||||||
|
function (chart) {
|
||||||
|
// if (!chart.renderer.forExport) {
|
||||||
|
// setInterval(function () {
|
||||||
|
// var point = chart.series[0].points[0],
|
||||||
|
//// newVal,
|
||||||
|
//// inc = Math.round((Math.random() - 0.5) * 20);
|
||||||
|
//
|
||||||
|
//// newVal = point.y + inc;
|
||||||
|
//// if (newVal < 0 || newVal > 200) {
|
||||||
|
//// newVal = point.y - inc;
|
||||||
|
//// }
|
||||||
|
//
|
||||||
|
//// point.update(newVal);
|
||||||
|
//
|
||||||
|
// }, 3000);
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// duplicated_lines_density
|
||||||
|
$(function () {
|
||||||
|
$('#container_duplicated_lines_density').highcharts({
|
||||||
|
|
||||||
|
chart: {
|
||||||
|
type: 'gauge',
|
||||||
|
plotBackgroundColor: null,
|
||||||
|
plotBackgroundImage: null,
|
||||||
|
plotBorderWidth: 0,
|
||||||
|
plotShadow: false
|
||||||
|
},
|
||||||
|
title: false,
|
||||||
|
pane: {
|
||||||
|
startAngle: -150,
|
||||||
|
endAngle: 150,
|
||||||
|
background: [{
|
||||||
|
backgroundColor: {
|
||||||
|
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
||||||
|
stops: [
|
||||||
|
[0, '#FFF'],
|
||||||
|
[1, '#333']
|
||||||
|
]
|
||||||
|
},
|
||||||
|
borderWidth: 0,
|
||||||
|
outerRadius: '109%'
|
||||||
|
}, {
|
||||||
|
backgroundColor: {
|
||||||
|
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
||||||
|
stops: [
|
||||||
|
[0, '#333'],
|
||||||
|
[1, '#FFF']
|
||||||
|
]
|
||||||
|
},
|
||||||
|
borderWidth: 1,
|
||||||
|
outerRadius: '107%'
|
||||||
|
}, {
|
||||||
|
// default background
|
||||||
|
}, {
|
||||||
|
backgroundColor: '#DDD',
|
||||||
|
borderWidth: 0,
|
||||||
|
outerRadius: '105%',
|
||||||
|
innerRadius: '103%'
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
|
||||||
|
xAxis: {
|
||||||
|
style:{
|
||||||
|
fontSize: '18px'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// the value axis
|
||||||
|
yAxis: {
|
||||||
|
min: 0,
|
||||||
|
max: 100,
|
||||||
|
minorTickInterval: 'auto',
|
||||||
|
minorTickWidth: 1,
|
||||||
|
minorTickLength: 10,
|
||||||
|
minorTickPosition: 'inside',
|
||||||
|
minorTickColor: '#666',
|
||||||
|
tickPixelInterval: 30,
|
||||||
|
tickWidth: 2,
|
||||||
|
tickPosition: 'inside',
|
||||||
|
tickLength: 10,
|
||||||
|
tickColor: '#666',
|
||||||
|
labels: {
|
||||||
|
step: 2,
|
||||||
|
rotation: 'auto'
|
||||||
|
},
|
||||||
|
// title: {
|
||||||
|
// text: 'km/h'
|
||||||
|
// },
|
||||||
|
plotBands: [{
|
||||||
|
from: 0,
|
||||||
|
to: 30,
|
||||||
|
color: '#55BF3B' // green
|
||||||
|
}, {
|
||||||
|
from: 31,
|
||||||
|
to: 50,
|
||||||
|
color: '#DDDF0D' // red
|
||||||
|
}, {
|
||||||
|
from: 51,
|
||||||
|
to: 100,
|
||||||
|
color: '#DF5353' // yellow
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
|
||||||
|
// delete hightcharts.com
|
||||||
|
credits:{
|
||||||
|
enabled: false
|
||||||
|
},
|
||||||
|
series: [{
|
||||||
|
name: '重复率',
|
||||||
|
data: [<%= @complexity["msr"][7]["val"] %>]
|
||||||
|
// tooltip: {
|
||||||
|
// valueSuffix: ' km/h'
|
||||||
|
// }
|
||||||
|
}]
|
||||||
|
|
||||||
|
},
|
||||||
|
// Add some life
|
||||||
|
function (chart) {
|
||||||
|
// if (!chart.renderer.forExport) {
|
||||||
|
// setInterval(function () {
|
||||||
|
// var point = chart.series[0].points[0],
|
||||||
|
// newVal,
|
||||||
|
// inc = Math.round((Math.random() - 0.5) * 20);
|
||||||
|
//
|
||||||
|
// newVal = point.y + inc;
|
||||||
|
// if (newVal < 0 || newVal > 200) {
|
||||||
|
// newVal = point.y - inc;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// point.update(newVal);
|
||||||
|
//
|
||||||
|
// }, 3000);
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// comment_lines_density
|
||||||
|
$(function () {
|
||||||
|
$('#container_comment_lines_density').highcharts({
|
||||||
|
|
||||||
|
chart: {
|
||||||
|
type: 'gauge',
|
||||||
|
plotBackgroundColor: null,
|
||||||
|
plotBackgroundImage: null,
|
||||||
|
plotBorderWidth: 0,
|
||||||
|
plotShadow: false
|
||||||
|
},
|
||||||
|
title: false,
|
||||||
|
pane: {
|
||||||
|
startAngle: -150,
|
||||||
|
endAngle: 150,
|
||||||
|
background: [{
|
||||||
|
backgroundColor: {
|
||||||
|
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
||||||
|
stops: [
|
||||||
|
[0, '#FFF'],
|
||||||
|
[1, '#333']
|
||||||
|
]
|
||||||
|
},
|
||||||
|
borderWidth: 0,
|
||||||
|
outerRadius: '109%'
|
||||||
|
}, {
|
||||||
|
backgroundColor: {
|
||||||
|
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 },
|
||||||
|
stops: [
|
||||||
|
[0, '#333'],
|
||||||
|
[1, '#FFF']
|
||||||
|
]
|
||||||
|
},
|
||||||
|
borderWidth: 1,
|
||||||
|
outerRadius: '107%'
|
||||||
|
}, {
|
||||||
|
// default background
|
||||||
|
}, {
|
||||||
|
backgroundColor: '#DDD',
|
||||||
|
borderWidth: 0,
|
||||||
|
outerRadius: '105%',
|
||||||
|
innerRadius: '103%'
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
|
||||||
|
xAxis: {
|
||||||
|
title: {
|
||||||
|
text: '复杂度',
|
||||||
|
x: -23, //center设置标题的位置
|
||||||
|
y: 6
|
||||||
|
},
|
||||||
|
style:{
|
||||||
|
fontSize: '18px'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// the value axis
|
||||||
|
yAxis: {
|
||||||
|
min: 0,
|
||||||
|
max: 100,
|
||||||
|
minorTickInterval: 'auto',
|
||||||
|
minorTickWidth: 1,
|
||||||
|
minorTickLength: 10,
|
||||||
|
minorTickPosition: 'inside',
|
||||||
|
minorTickColor: '#666',
|
||||||
|
tickPixelInterval: 30,
|
||||||
|
tickWidth: 2,
|
||||||
|
tickPosition: 'inside',
|
||||||
|
tickLength: 10,
|
||||||
|
tickColor: '#666',
|
||||||
|
labels: {
|
||||||
|
step: 2,
|
||||||
|
rotation: 'auto'
|
||||||
|
},
|
||||||
|
// title: {
|
||||||
|
// text: 'km/h'
|
||||||
|
// },
|
||||||
|
plotBands: [{
|
||||||
|
from: 0,
|
||||||
|
to: 20,
|
||||||
|
color: '#DDDF0D' // green
|
||||||
|
}, {
|
||||||
|
from: 21,
|
||||||
|
to: 50,
|
||||||
|
color: '#55BF3B' // red
|
||||||
|
}, {
|
||||||
|
from: 51,
|
||||||
|
to: 100,
|
||||||
|
color: '#DF5353' // yellow
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
|
||||||
|
// delete hightcharts.com
|
||||||
|
credits:{
|
||||||
|
enabled: false
|
||||||
|
},
|
||||||
|
series: [{
|
||||||
|
name: '质量等级',
|
||||||
|
data: [<%= @complexity["msr"][5]["val"] %>]
|
||||||
|
// tooltip: {
|
||||||
|
// valueSuffix: ' km/h'
|
||||||
|
// }
|
||||||
|
}]
|
||||||
|
|
||||||
|
},
|
||||||
|
// Add some life
|
||||||
|
function (chart) {
|
||||||
|
// if (!chart.renderer.forExport) {
|
||||||
|
// setInterval(function () {
|
||||||
|
// var point = chart.series[0].points[0],
|
||||||
|
// newVal,
|
||||||
|
// inc = Math.round((Math.random() - 0.5) * 20);
|
||||||
|
//
|
||||||
|
// newVal = point.y + inc;
|
||||||
|
// if (newVal < 0 || newVal > 200) {
|
||||||
|
// newVal = point.y - inc;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// point.update(newVal);
|
||||||
|
//
|
||||||
|
// }, 3000);
|
||||||
|
// }
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
@ -0,0 +1,25 @@
|
|||||||
|
<div class="project_r_h">
|
||||||
|
<h2 class="project_h2">分析结果</h2>
|
||||||
|
</div>
|
||||||
|
<ul class="analysis-result-list">
|
||||||
|
<li class="analysis-result-name fl fontBlue2" >名称</li>
|
||||||
|
<li class="analysis-result-version fl fontBlue2" >版本</li>
|
||||||
|
<li class="analysis-result-loc fl fontBlue2" >分支</li>
|
||||||
|
<li class="analysis-result-debt fl fontBlue2" >语言</li>
|
||||||
|
<li class="analysis-result-time fl fontBlue2" >时间</li>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</ul>
|
||||||
|
<% if @quality_analyses.count >0 %>
|
||||||
|
<% @quality_analyses.each do |qa| %>
|
||||||
|
<ul class="analysis-result-list">
|
||||||
|
<li title="Name" title="名称"><%=link_to "#{qa.author_login}:#{qa.rep_identifier}", project_quality_analysis_path(:resource_id => qa.author_login+":"+qa.rep_identifier, :branch => qa.branch.nil? ? "master" : qa.branch), :class => "analysis-result-name fl fontBlue2" %></li>
|
||||||
|
<li class="analysis-result-version fl fontBlue2" title="版本">1.0</li>
|
||||||
|
<li class="analysis-result-loc fl fontBlue2" title="分支名"><%= qa.branch %></li>
|
||||||
|
<li class="analysis-result-debt fl fontBlue2" title="语言"><%= qa.language %></li>
|
||||||
|
<li class="analysis-result-time fl fontBlue2" title="时间"><%= format_time(qa.created_at) %></li>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</ul>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
@ -0,0 +1,114 @@
|
|||||||
|
<%= javascript_include_tag 'highcharts','highcharts-more' %>
|
||||||
|
<%= render :partial => "hightchars" %>
|
||||||
|
<div class="project_r_h">
|
||||||
|
<h2 class="project_h2" style="width:180px;">质量分析</h2>
|
||||||
|
</div>
|
||||||
|
<div class="button-rep">当前分支:<%= params[:branch] %></div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
<div class="tac f20 fb mt35 mb30">项目代码质量分析报告</div>
|
||||||
|
<div class="analysis-tag-wrap f16"> <span class="analysis-tag fl mr15"></span> <span class="fb fl">概要信息</span></div>
|
||||||
|
<div class="analysis-block mt10 mb40 f14">
|
||||||
|
<div class="flex">
|
||||||
|
<div class="analysis-genral">
|
||||||
|
<p id="container_sqale_rating" style="max-width:200px;min-height:200px;width:200px; margin:0 auto;"></p>
|
||||||
|
<p class="fontGrey3">质量等级</p>
|
||||||
|
<p class="fontBlue2 pr"><%= @complexity["msr"][9]["frmt_val"] %><span class="f8 c_white analysis-genral-icon <%= sqale_rating_status(@complexity["msr"][9]["val"])[1] %> borderRadius"><%= sqale_rating_status(@complexity["msr"][9]["val"])[0] %></span></p>
|
||||||
|
</div>
|
||||||
|
<div class="analysis-genral" >
|
||||||
|
<p id="container_function_complexity" style="max-width:200px;min-height:200px;width:200px; margin:0 auto;"></p>
|
||||||
|
<p class="fontGrey3">复杂度</p>
|
||||||
|
<p class="fontBlue2 pr"><%= @complexity["msr"][6]["val"] %><span class="f8 c_white analysis-genral-icon <%= complexity_status(@complexity["msr"][6]["val"])[1] %> borderRadius"><%= complexity_status(@complexity["msr"][6]["val"])[0] %></span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="flex">
|
||||||
|
<div class="analysis-genral">
|
||||||
|
<p id="container_duplicated_lines_density" style="max-width:200px;min-height:200px;width:200px; margin:0 auto;"></p>
|
||||||
|
<p class="fontGrey3">代码重复度</p>
|
||||||
|
<p class="fontBlue2 pr"><%= @complexity["msr"][7]["frmt_val"] %><span class="f8 c_white analysis-genral-icon <%= duplicated_lines_density_status(@complexity["msr"][7]["val"])[1] %> borderRadius"><%= duplicated_lines_density_status(@complexity["msr"][7]["val"])[0] %></span></p>
|
||||||
|
</div>
|
||||||
|
<div class="analysis-genral">
|
||||||
|
<p id="container_comment_lines_density" style="max-width:200px;min-height:200px;width:200px; margin:0 auto;"></p>
|
||||||
|
<p class="fontGrey3">注释率</p>
|
||||||
|
<p class="fontBlue2 pr"><%= @complexity["msr"][5]["frmt_val"] %><span class="f8 c_white analysis-genral-icon <%= comment_lines_density_status(@complexity["msr"][5]["val"])[1] %> borderRadius"><%=comment_lines_density_status(@complexity["msr"][5]["val"])[0] %></span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="analysis-tag-wrap f16"> <span class="analysis-tag fl mr15"></span> <span class="fb fl mr10">质量等级</span><span class="mr10 fontGrey2"><span class="c_red f18" style="margin-top:-5px; display:inline-block;"><%= score_sqale_rating(@complexity["msr"][9]["val"]) %></span>/5分</span><span class="fontGrey2">可定性评价为:<span class="c_red">质量<%= sqale_rating_status(@complexity["msr"][9]["val"])[0] %></span></span></div>
|
||||||
|
<div class="analysis-block mt10 mb40 f14">
|
||||||
|
<div><span class="fontGrey3 mr30">技术债务</span><span class="fontBlue2 w70 pInline"><%= @complexity["msr"][8]["frmt_val"] %></span><span class="fontGrey2"><a target="_blank" href="<%= @sonar_address %>/drilldown/measures/<%= @resource_id %>?metric=sqale_index">查看详情</a></span></div>
|
||||||
|
<div><span class="fontGrey3 mr30">质量问题</span>
|
||||||
|
<span class="fontBlue2 w70 pInline"><a class="fontBlue2 w70 pInline" target="_blank" href="<%= @sonar_address %>/component_issues?id=<%= @resource_id %>#resolved=false"><%= @sonar_issues["msr"][0]["frmt_val"] %></a></span><span class="fontGrey2">问题分类如下:</span></div>
|
||||||
|
<div class="ml90 mt15">
|
||||||
|
<div class="mb10"><span class="analysis-block-icon mr5"></span><span class="fontGrey3 mr45">阻断</span><span class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][1]["frmt_val"] %></span><span class="quality-percentage"><span class="quality-percentage-rate" style="width:<%= statistics_result_percentage(@sonar_issues["msr"][1]["frmt_val"].to_i, 200) %>%;"></span></span></div>
|
||||||
|
<div class="mb10"><span class="analysis-serious-icon mr5"></span><span class="fontGrey3 mr45">严重</span><span class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][2]["frmt_val"] %></span><span class="quality-percentage"><span class="quality-percentage-rate" style="width:<%= statistics_result_percentage(@sonar_issues["msr"][2]["frmt_val"].to_i, 200) %>%;"></span></span></div>
|
||||||
|
<div class="mb10"><span class="analysis-main-icon mr5"></span><span class="fontGrey3 mr45">主要</span><span class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][3]["frmt_val"] %></span><span class="quality-percentage"><span class="quality-percentage-rate" style="width:<%= statistics_result_percentage(@sonar_issues["msr"][3]["frmt_val"].to_i, 200) %>%;"></span></span></div>
|
||||||
|
<div class="mb10"><span class="analysis-secondary-icon mr5"></span><span class="fontGrey3 mr45">次要</span><span class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][4]["frmt_val"] %></span><span class="quality-percentage"><span class="quality-percentage-rate" style="width:<%= statistics_result_percentage(@sonar_issues["msr"][4]["frmt_val"].to_i, 200) %>%;"></span></span></div>
|
||||||
|
<div><span class="analysis-info-icon mr5"></span><span class="fontGrey3 mr45">信息</span><span class="fontBlue2 w70 pInline"><%= @sonar_issues["msr"][5]["frmt_val"] %></span><span class="quality-percentage"><span class="quality-percentage-rate" style="width:<%= statistics_result_percentage(@sonar_issues["msr"][5]["frmt_val"].to_i, 200) %>%;"></span></span></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="analysis-tag-wrap f16"> <span class="analysis-tag fl mr15"></span> <span class="fb fl mr10">代码规模</span><span class="fontGrey2">可定性评价为:<span class="c_red"><%= lines_scale(@complexity["msr"][0]["frmt_val"]) %></span></span></div>
|
||||||
|
<div class="analysis-block mt10 mb40 flex f14">
|
||||||
|
<div class="analysis-genral">
|
||||||
|
<p class="fontGrey3">代码行数</p>
|
||||||
|
<p class="fontBlue2"><%= @complexity["msr"][0]["frmt_val"] %></p>
|
||||||
|
</div>
|
||||||
|
<div class="analysis-genral">
|
||||||
|
<p class="fontGrey3">文件</p>
|
||||||
|
<p class="fontBlue2"><%= @complexity["msr"][2]["frmt_val"] %></p>
|
||||||
|
</div>
|
||||||
|
<div class="analysis-genral">
|
||||||
|
<p class="fontGrey3">目录</p>
|
||||||
|
<p class="fontBlue2"><%= @complexity["msr"][3]["frmt_val"] %></p>
|
||||||
|
</div>
|
||||||
|
<div class="analysis-genral">
|
||||||
|
<p class="fontGrey3">类</p>
|
||||||
|
<p class="fontBlue2"><%= @complexity["msr"][1]["frmt_val"] %></p>
|
||||||
|
</div>
|
||||||
|
<div class="analysis-genral">
|
||||||
|
<p class="fontGrey3">方法</p>
|
||||||
|
<p class="fontBlue2"><%= @complexity["msr"][4]["frmt_val"] %></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--<div class="analysis-tag-wrap f16"> <span class="analysis-tag fl mr15"></span> <span class="fb fl">贡献统计</span></div>-->
|
||||||
|
<!--<div class="analysis-block mt10 f12">-->
|
||||||
|
<!--<ul class="contribute-list">-->
|
||||||
|
<!--<li class="fl fontGrey2 contribute-list-avatar"> </li>-->
|
||||||
|
<!--<li class="fl fontGrey2 contribute-list-code">代码行数</li>-->
|
||||||
|
<!--<li class="fl fontGrey2 contribute-list-problem">引入质量问题数</li>-->
|
||||||
|
<!--<li class="fl fontGrey2 contribute-list-rate">引入质量问题数/代码行数</li>-->
|
||||||
|
<!--<div class="cl"></div>-->
|
||||||
|
<!--</ul>-->
|
||||||
|
<!--<ul class="contribute-list">-->
|
||||||
|
<!--<li class="fl fontGrey2 contribute-list-avatar contribute-list-height">-->
|
||||||
|
<!--<div class="mt8"><img src="images/homepageImage.jpg" width="50" class="image-cir" />-->
|
||||||
|
<!--<p class="fontGrey2 hidden">小明</p>-->
|
||||||
|
<!--</div>-->
|
||||||
|
<!--</li>-->
|
||||||
|
<!--<li class="fl fontGrey2 contribute-list-code contribute-list-height contribute-list-line-height">18340</li>-->
|
||||||
|
<!--<li class="fl fontGrey2 contribute-list-problem contribute-list-height contribute-list-line-height">230</li>-->
|
||||||
|
<!--<li class="fl contribute-list-rate fontBlue2 contribute-list-height contribute-list-line-height">.012540</li>-->
|
||||||
|
<!--<div class="cl"></div>-->
|
||||||
|
<!--</ul>-->
|
||||||
|
<!--<ul class="contribute-list">-->
|
||||||
|
<!--<li class="fl fontGrey2 contribute-list-avatar contribute-list-height">-->
|
||||||
|
<!--<div class="mt8"><img src="images/homepageImage.jpg" width="50" class="image-cir" />-->
|
||||||
|
<!--<p class="fontGrey2 hidden">小王</p>-->
|
||||||
|
<!--</div>-->
|
||||||
|
<!--</li>-->
|
||||||
|
<!--<li class="fl fontGrey2 contribute-list-code contribute-list-height contribute-list-line-height">834</li>-->
|
||||||
|
<!--<li class="fl fontGrey2 contribute-list-problem contribute-list-height contribute-list-line-height">34</li>-->
|
||||||
|
<!--<li class="fl contribute-list-rate fontBlue2 contribute-list-height contribute-list-line-height">.04077</li>-->
|
||||||
|
<!--<div class="cl"></div>-->
|
||||||
|
<!--</ul>-->
|
||||||
|
<!--<ul class="contribute-list">-->
|
||||||
|
<!--<li class="fl fontGrey2 contribute-list-avatar contribute-list-height">-->
|
||||||
|
<!--<div class="mt8"><img src="images/homepageImage.jpg" width="50" class="image-cir" />-->
|
||||||
|
<!--<p class="fontGrey2 hidden">小亮</p>-->
|
||||||
|
<!--</div>-->
|
||||||
|
<!--</li>-->
|
||||||
|
<!--<li class="fl fontGrey2 contribute-list-code contribute-list-height contribute-list-line-height">134</li>-->
|
||||||
|
<!--<li class="fl fontGrey2 contribute-list-problem contribute-list-height contribute-list-line-height">10</li>-->
|
||||||
|
<!--<li class="fl contribute-list-rate fontBlue2 contribute-list-height contribute-list-line-height">.07462</li>-->
|
||||||
|
<!--<div class="cl"></div>-->
|
||||||
|
<!--</ul>-->
|
||||||
|
<!--</div>-->
|
@ -0,0 +1,6 @@
|
|||||||
|
<% if @name_flag %>
|
||||||
|
<%= render :partial => "result_list" %>
|
||||||
|
<% else %>
|
||||||
|
<%= render "show" %>
|
||||||
|
<% end %>
|
||||||
|
|
@ -0,0 +1,23 @@
|
|||||||
|
<div class="f16 fb fontBlue mb10">代码质量分析</div>
|
||||||
|
<div>
|
||||||
|
<%= form_tag( url_for(:controller => 'quality_analysis', :action => 'create', :project_id => @project.id, :user_id => User.current.id, :identifier => @repository.identifier), :remote => true, :id => 'quality_analyses_form') do %>
|
||||||
|
<div class="ui form">
|
||||||
|
<div class="mb10" style="margin-right:13px;">
|
||||||
|
<textarea id="path_description" name="path" rows="8" placeholder="目录相对于根目录,用半角逗号隔开。如:src/main/java,libs,res/script" style="height: 87px; resize:vertical;" class="analysis-option-box"></textarea>
|
||||||
|
</div>
|
||||||
|
<div class="mb10">
|
||||||
|
<div>
|
||||||
|
<%= select_tag :branch, options_for_select(["#{@gitlab_default_branch}"]+ @branch_names, @rev), :id => 'branch', :class => "analysis-option-box" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="mb10">
|
||||||
|
<div>
|
||||||
|
<%= select_tag :language, options_for_select(["java","python","ruby","c++","c#", "Web"]), :id => 'branch', :class => "analysis-option-box" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="courseSendSubmit mr15"><a href="javascript:void(0);" class="sendSourceText" onclick="$('#quality_analyses_form').submit();hideModal()">提交</a></div>
|
||||||
|
<div class="courseSendCancel"><a href="javascript:void(0);" class="sendSourceText" onclick="hideModal()">取消</a></div>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
@ -0,0 +1,76 @@
|
|||||||
|
<%= javascript_include_tag 'highcharts','highcharts-more' %>
|
||||||
|
<div class="project_r_h">
|
||||||
|
<h2 class="project_h2"><%= l(:label_quality_analyses) %></h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="repository_con " style="line-height:1.9;">
|
||||||
|
<%#= render :partial => 'navigation' %>
|
||||||
|
<div class="cl"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id = "container">
|
||||||
|
</div>
|
||||||
|
<div id = "container_quality" class="mt30">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(function () {
|
||||||
|
$('#container').highcharts({
|
||||||
|
chart: {
|
||||||
|
type: 'pie',
|
||||||
|
options3d: {
|
||||||
|
enabled: true,
|
||||||
|
alpha: 45,
|
||||||
|
beta: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
text: 'Browser market shares at a specific website, 2014'
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
|
||||||
|
},
|
||||||
|
plotOptions: {
|
||||||
|
pie: {
|
||||||
|
allowPointSelect: true,
|
||||||
|
cursor: 'pointer',
|
||||||
|
depth: 35,
|
||||||
|
dataLabels: {
|
||||||
|
enabled: true,
|
||||||
|
format: '{point.name}'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
series: [{
|
||||||
|
type: 'pie',
|
||||||
|
name: 'Browser share',
|
||||||
|
data: [
|
||||||
|
['Firefox', 45.0],
|
||||||
|
['IE', 26.8],
|
||||||
|
{
|
||||||
|
name: 'Chrome',
|
||||||
|
y: 12.8,
|
||||||
|
sliced: true,
|
||||||
|
selected: true
|
||||||
|
},
|
||||||
|
['Safari', 8.5],
|
||||||
|
['Opera', 6.2],
|
||||||
|
['Others', 0.7]
|
||||||
|
],
|
||||||
|
dataLabels: {
|
||||||
|
enabled: true,
|
||||||
|
style: {
|
||||||
|
fontSize: '13px',
|
||||||
|
color: '#aaa',
|
||||||
|
fontFamily: 'Arial',
|
||||||
|
textShadow: '0px 0px 6px rgb(0, 0, 0), 0px 0px 3px rgb(f, f, f)',
|
||||||
|
fontWeight: 'normal'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<p><%= link_to l(:button_back), :action => 'show', :id => @project %></p>
|
||||||
|
<% html_title(l(:label_repository), l(:label_statistics)) -%>
|
@ -0,0 +1,8 @@
|
|||||||
|
$('#ajax-modal').html('<%= escape_javascript( render :partial => 'repositories/quality_analysis', :locals => {}) %>');
|
||||||
|
showModal('ajax-modal', '615px');
|
||||||
|
$('#ajax-modal').siblings().remove();
|
||||||
|
$('#ajax-modal').before("<a href='javascript:void(0)' onclick='hideModal()' style='margin-left: 580px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
|
||||||
|
$('#ajax-modal').parent().css("top","20%").css("left","32%").css("border","3px solid #269ac9");
|
||||||
|
$('#ajax-modal').parent().addClass("popbox_polls");
|
||||||
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
class CreateQualityAnalyses < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :quality_analyses do |t|
|
||||||
|
t.integer :project_id
|
||||||
|
t.string :author_login
|
||||||
|
t.string :rep_identifier
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
class AddJkVersionToQualityAnalysis < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :quality_analyses, :sonar_version, :integer, :default => false
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,6 @@
|
|||||||
|
class AddColumnToQualityAnalyses < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :quality_analyses, :path, :string
|
||||||
|
add_column :quality_analyses, :branch, :string
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
class AddLanguaeToQualityAnalyses < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :quality_analyses, :language, :string
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
class AddNameToQualityAnalyses < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
# add_column :quality_analyses, :language, :string
|
||||||
|
end
|
||||||
|
end
|
After Width: | Height: | Size: 1.6 KiB |
@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe QualityAnalysisController, :type => :controller do
|
||||||
|
|
||||||
|
end
|
@ -0,0 +1,7 @@
|
|||||||
|
FactoryGirl.define do
|
||||||
|
factory :quality_analyasis, class: 'QualityAnalysis' do
|
||||||
|
project_id 1
|
||||||
|
author_login "MyString"
|
||||||
|
rep_identifier "MyString"
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe QualityAnalysis, :type => :model do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
Loading…
Reference in new issue