From a45953d350333e20c093bde4bda426cd16e80399 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Wed, 4 Jun 2025 15:36:40 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fixed=20=E6=B5=81=E6=B0=B4=E7=BA=BF?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E5=8F=82=E6=95=B0=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/api/v1/projects/pipelines_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/v1/projects/pipelines_controller.rb b/app/controllers/api/v1/projects/pipelines_controller.rb index 305cc974f..6985e8b05 100644 --- a/app/controllers/api/v1/projects/pipelines_controller.rb +++ b/app/controllers/api/v1/projects/pipelines_controller.rb @@ -96,7 +96,7 @@ class Api::V1::Projects::PipelinesController < Api::V1::BaseController def save_yaml @pipeline = params[:id].present? ? Action::Pipeline.find(params[:id]) : Action::Pipeline.find_or_initialize_by(pipeline_name: params[:pipeline_name], project_id: @project.id) @pipeline.file_name = ".gitea/workflows/#{@pipeline.pipeline_name}.yml" - @pipeline.branch = params[:branch].to_json if params[:branch].present? + @pipeline.branch = params[:branch] if params[:branch].present? @pipeline.json = params[:pipeline_json].to_json if params[:pipeline_json].present? @pipeline.pipeline_name = params[:pipeline_name] if params[:pipeline_name].present? pipeline_yaml = params[:pipeline_yaml].present? ? params[:pipeline_yaml] : build_pipeline_yaml_new(@pipeline.pipeline_name, params[:pipeline_json]) From d80d1514604bfb8c18f4cefa129f1db92bfe38a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=B1=E5=91=B1=E5=91=B1?= Date: Thu, 5 Jun 2025 10:01:14 +0800 Subject: [PATCH 2/2] add analyze_doxygen --- app/controllers/api/v1/sonarqubes_controller.rb | 17 +++++++++++++++++ config/routes/api.rb | 1 + 2 files changed, 18 insertions(+) diff --git a/app/controllers/api/v1/sonarqubes_controller.rb b/app/controllers/api/v1/sonarqubes_controller.rb index cf5437f02..4e69111dd 100644 --- a/app/controllers/api/v1/sonarqubes_controller.rb +++ b/app/controllers/api/v1/sonarqubes_controller.rb @@ -168,6 +168,23 @@ class Api::V1::SonarqubesController < Api::V1::BaseController render_ok data 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 params_data = { from: params[:form], diff --git a/config/routes/api.rb b/config/routes/api.rb index aff2f5de0..f36d4b949 100644 --- a/config/routes/api.rb +++ b/config/routes/api.rb @@ -119,6 +119,7 @@ defaults format: :json do post :sonar_initialize post :insert_file get :doxygen_url + get :analyze_doxygen end end