add analyze_doxygen

This commit is contained in:
呱呱呱 2025-06-05 10:01:14 +08:00
parent a45953d350
commit d80d151460
2 changed files with 18 additions and 0 deletions

View File

@ -168,6 +168,23 @@ class Api::V1::SonarqubesController < Api::V1::BaseController
render_ok data render_ok data
end end
def analyze_doxygen
config = Rails.application.config_for(:configuration)
sonarqube_config = config.dig('sonarqube')
doxygen_url = sonarqube_config['doxygen']
url = "#{doxygen_url}/files/#{@project.owner.login}/#{@project.identifier}/html/analyze_doxygen.json"
uri = URI.parse(url)
response = Net::HTTP.get_response(uri)
if response.code.to_i != 200
puts "======= 接口请求失败!"
data = { data: nil, msg: '文件不存在' }
else
data = { data: JSON.parse(response.body), msg: 'ok' }
end
render_ok data
end
def measures_search_history def measures_search_history
params_data = { params_data = {
from: params[:form], from: params[:form],

View File

@ -119,6 +119,7 @@ defaults format: :json do
post :sonar_initialize post :sonar_initialize
post :insert_file post :insert_file
get :doxygen_url get :doxygen_url
get :analyze_doxygen
end end
end end