add sonarqube for projects
This commit is contained in:
parent
ed4b4062e0
commit
983edca9a3
2
Gemfile
2
Gemfile
|
@ -26,7 +26,7 @@ gem 'roo-xls'
|
|||
gem 'simple_xlsx_reader', '~>1.0.4'
|
||||
|
||||
gem 'rubyzip'
|
||||
|
||||
gem 'sonarqube', :git => 'https://gitlink.org.cn/KingChan/sonarqube.git'
|
||||
gem 'spreadsheet'
|
||||
gem 'ruby-ole'
|
||||
# 导出为xlsx
|
||||
|
|
34
Gemfile.lock
34
Gemfile.lock
|
@ -1,3 +1,11 @@
|
|||
GIT
|
||||
remote: https://gitlink.org.cn/KingChan/sonarqube.git
|
||||
revision: 80f07d427322ef02c0714c77a382e87aed0bef81
|
||||
specs:
|
||||
sonarqube (1.3.0)
|
||||
httparty (~> 0.14, >= 0.14.0)
|
||||
terminal-table (~> 1.5, >= 1.5.1)
|
||||
|
||||
GEM
|
||||
remote: https://mirrors.cloud.tencent.com/rubygems/
|
||||
specs:
|
||||
|
@ -135,7 +143,7 @@ GEM
|
|||
fugit (1.4.1)
|
||||
et-orbi (~> 1.1, >= 1.1.8)
|
||||
raabro (~> 1.4)
|
||||
gitea-client (1.4.2)
|
||||
gitea-client (1.5.7)
|
||||
rest-client (~> 2.1.0)
|
||||
globalid (0.4.2)
|
||||
activesupport (>= 4.2.0)
|
||||
|
@ -150,6 +158,9 @@ GEM
|
|||
http-accept (1.7.0)
|
||||
http-cookie (1.0.5)
|
||||
domain_name (~> 0.5)
|
||||
httparty (0.21.0)
|
||||
mini_mime (>= 1.0.0)
|
||||
multi_xml (>= 0.5.2)
|
||||
i18n (1.8.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
io-like (0.3.1)
|
||||
|
@ -187,9 +198,9 @@ GEM
|
|||
mimemagic (~> 0.3.2)
|
||||
maruku (0.7.3)
|
||||
method_source (0.9.2)
|
||||
mime-types (3.4.1)
|
||||
mime-types (3.5.2)
|
||||
mime-types-data (~> 3.2015)
|
||||
mime-types-data (3.2023.0218.1)
|
||||
mime-types-data (3.2024.0507)
|
||||
mimemagic (0.3.10)
|
||||
nokogiri (~> 1)
|
||||
rake
|
||||
|
@ -245,13 +256,12 @@ GEM
|
|||
powerpack (0.1.2)
|
||||
prettier (0.18.2)
|
||||
public_suffix (4.0.3)
|
||||
puma (3.12.2)
|
||||
puma (5.6.8)
|
||||
nio4r (~> 2.0)
|
||||
raabro (1.4.0)
|
||||
rack (2.0.9)
|
||||
rack-cors (1.1.1)
|
||||
rack (>= 2.0.0)
|
||||
rack-mini-profiler (2.0.1)
|
||||
rack (>= 1.2.0)
|
||||
rack-protection (2.0.8.1)
|
||||
rack
|
||||
rack-test (1.1.0)
|
||||
|
@ -438,6 +448,8 @@ GEM
|
|||
actionpack (>= 4.0)
|
||||
activesupport (>= 4.0)
|
||||
sprockets (>= 3.0.0)
|
||||
terminal-table (1.8.0)
|
||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||
thor (1.0.1)
|
||||
thread_safe (0.3.6)
|
||||
tilt (2.0.10)
|
||||
|
@ -450,7 +462,7 @@ GEM
|
|||
execjs (>= 0.3.0, < 3)
|
||||
unf (0.1.4)
|
||||
unf_ext
|
||||
unf_ext (0.0.8.2)
|
||||
unf_ext (0.0.9.1)
|
||||
unicode-display_width (1.6.1)
|
||||
web-console (3.7.0)
|
||||
actionview (>= 5.0)
|
||||
|
@ -492,7 +504,7 @@ DEPENDENCIES
|
|||
enumerize
|
||||
faraday (~> 0.15.4)
|
||||
font-awesome-sass (= 4.7.0)
|
||||
gitea-client (~> 1.4.2)
|
||||
gitea-client (~> 1.5.7)
|
||||
grape-entity (~> 0.7.1)
|
||||
groupdate (~> 4.1.0)
|
||||
harmonious_dictionary (~> 0.0.1)
|
||||
|
@ -514,9 +526,8 @@ DEPENDENCIES
|
|||
parallel (~> 1.19, >= 1.19.1)
|
||||
pdfkit
|
||||
prettier
|
||||
puma (~> 3.11)
|
||||
puma (~> 5.6.5)
|
||||
rack-cors
|
||||
rack-mini-profiler
|
||||
rails (~> 5.2.0)
|
||||
rails-i18n (~> 5.1)
|
||||
ransack
|
||||
|
@ -538,9 +549,10 @@ DEPENDENCIES
|
|||
sidekiq-cron (= 1.2.0)
|
||||
sidekiq-failures
|
||||
simple_form
|
||||
simple_xlsx_reader
|
||||
simple_xlsx_reader (~> 1.0.4)
|
||||
sinatra
|
||||
solargraph (~> 0.38.0)
|
||||
sonarqube!
|
||||
spreadsheet
|
||||
spring
|
||||
spring-watcher-listen (~> 2.0.0)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class Api::V1::ProjectsController < Api::V1::BaseController
|
||||
before_action :require_public_and_member_above, only: [:show, :compare, :blame]
|
||||
before_action :require_public_and_member_above, only: [:show, :compare, :blame, :sonar_search]
|
||||
|
||||
def index
|
||||
render_ok
|
||||
|
@ -9,6 +9,11 @@ class Api::V1::ProjectsController < Api::V1::BaseController
|
|||
@result_object = Api::V1::Projects::GetService.call(@project, current_user.gitea_token)
|
||||
end
|
||||
|
||||
def sonar_search
|
||||
data = Sonarqube.client.get("/api/issues/search", { components:"#{@project.owner.login}-#{@project.identifier}" })
|
||||
render_ok data
|
||||
end
|
||||
|
||||
def compare
|
||||
@result_object = Api::V1::Projects::CompareService.call(@project, params[:from], params[:to], current_user&.gitea_token)
|
||||
end
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
Sonarqube.configure do |config|
|
||||
config.endpoint = 'http://172.20.32.202:9999' # API endpoint URL, default: ENV['SONARQUBE_API_ENDPOINT']
|
||||
config.private_token = 'squ_fb81f52a7b2c2db00c71c29f71c9595f48c2ff3f' # user's private token, default: ENV['SONARQUBE_API_PRIVATE_TOKEN']
|
||||
# Optional
|
||||
# config.user_agent = 'Custom User Agent' # user agent, default: 'Sonarqube Ruby Gem [version]'
|
||||
end
|
|
@ -76,6 +76,7 @@ defaults format: :json do
|
|||
collection do
|
||||
get :compare
|
||||
get :blame
|
||||
get :sonar_search
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue