调整 #478

Merged
KingChan merged 2 commits from KingChan/forgeplus:huawei_code_check into dev_osredm_server 2025-11-26 14:55:32 +08:00
2 changed files with 20 additions and 20 deletions

View File

@ -11,19 +11,19 @@ class Api::V1::Projects::CodeChecksController < Api::V1::BaseController
end
def create
render_client do
@result = @client.create_task(params["branch"])
@client.create_task(params["branch"])
end
end
def run_task
render_client do
@result = @client.run_task(params["branch"],params["task_id"])
@client.run_task(params["branch"],params["task_id"])
end
end
def query_task
render_client do
@result = @client.query_task(params["task_id"])
@client.query_task(params["task_id"])
end
render :index
end
@ -32,13 +32,13 @@ class Api::V1::Projects::CodeChecksController < Api::V1::BaseController
allowed_query = %w[job_id merge_id]
query_params, _ = filter_params(allowed_query_keys: allowed_query)
render_client do
@result = @client.defects_summary(query_params)
@client.defects_summary(query_params)
end
end
def metrics_summary
render_client do
@result = @client.metrics_summary
@client.metrics_summary
end
end
@ -47,13 +47,13 @@ class Api::V1::Projects::CodeChecksController < Api::V1::BaseController
query_params, _ = filter_params(allowed_query_keys: allowed_query)
render_client do
@result = @client.defects_detail(query_params)
@client.defects_detail(query_params)
end
end
def defects_statistic
render_client do
@result = @client.defects_statistic
@client.defects_statistic
end
end
@ -61,7 +61,7 @@ class Api::V1::Projects::CodeChecksController < Api::V1::BaseController
allowed_body = %w[defect_id defect_status]
_, body_params = filter_params(allowed_body_keys: allowed_body)
render_client do
@result = @client.defect_status(body_params)
@client.defect_status(body_params)
end
end
#------ 代码问题 ----
@ -69,7 +69,7 @@ class Api::V1::Projects::CodeChecksController < Api::V1::BaseController
allowed_body = %w[mergeId jobId status comment mergeKey operator]
_, body_params = filter_params(allowed_body_keys: allowed_body)
render_client do
@result = @client.issue_status(body_params)
@client.issue_status(body_params)
end
end
@ -77,7 +77,7 @@ class Api::V1::Projects::CodeChecksController < Api::V1::BaseController
allowed_body = %w[mergeId jobId pageSize page languages ruleIds authors isNew statusIds severities delayStatus fileNames userTags cwes]
_, body_params = filter_params(allowed_body_keys: allowed_body)
render_client do
@result = @client.issue_list_by_filter(body_params)
@client.issue_list_by_filter(body_params)
end
end
@ -85,7 +85,7 @@ class Api::V1::Projects::CodeChecksController < Api::V1::BaseController
allowed_body = %w[mergeId jobId facets languages ruleIds authors isNew statusIds severities delayStatus fileNames userTags cwes]
_, body_params = filter_params(allowed_body_keys: allowed_body)
render_client do
@result = @client.issue_filter(body_params)
@client.issue_filter(body_params)
end
end
@ -93,7 +93,7 @@ class Api::V1::Projects::CodeChecksController < Api::V1::BaseController
allowed_query = %w[start_date end_date dimension]
query_params, _ = filter_params(allowed_query_keys: allowed_query)
render_client do
@result = @client.defect_metric_trend(query_params)
@client.defect_metric_trend(query_params)
end
end
@ -101,19 +101,19 @@ class Api::V1::Projects::CodeChecksController < Api::V1::BaseController
allowed_query = %w[criterion_rule_id]
query_params, _ = filter_params(allowed_query_keys: allowed_query)
render_client do
@result = @client.criterion_rule(query_params)
@client.criterion_rule(query_params)
end
end
def generate_pdf
render_client do
@result = @client.generate_pdf
@client.generate_pdf
end
end
def query_generate_pdf
render_client do
@result = @client.query_generate_pdf(params[:async_job_id])
@client.query_generate_pdf(params[:async_job_id])
end
end
@ -133,7 +133,7 @@ class Api::V1::Projects::CodeChecksController < Api::V1::BaseController
allowed_body = %w[jobId search]
_, body_params = filter_params(allowed_body_keys: allowed_body)
render_client do
@result = @client.measure_total(body_params)
@client.measure_total(body_params)
end
end
@ -141,7 +141,7 @@ class Api::V1::Projects::CodeChecksController < Api::V1::BaseController
allowed_query = %w[job_id file_path block_id duplication_type]
query_params, _ = filter_params(allowed_query_keys: allowed_query)
render_client do
@result = @client.related_duplicate_blocks(query_params)
@client.related_duplicate_blocks(query_params)
end
end
@ -149,7 +149,7 @@ class Api::V1::Projects::CodeChecksController < Api::V1::BaseController
allowed_body = %w[filterType page pageSize]
_, body_params = filter_params(allowed_body_keys: allowed_body)
render_client do
@result = @client.measure_list(body_params)
@client.measure_list(body_params)
end
end
private

View File

@ -30,11 +30,11 @@ class Api::V1::Projects::CodecheckService < ApplicationService
end
def query_task(task_id)
result = @client.query_task(task_id)
code, result = @client.query_task(task_id)
if result["task_status"] == 2
@project.update(huawei_code_check_task_id: task_id)
end
result
[code, result]
end
def defects_summary(query)