Commit b283c32a authored by Jarka Košanová's avatar Jarka Košanová

Merge branch 'improve-vulnerability-findinds-quality' into 'master'

Improve Vulnerability Findings code quality

See merge request gitlab-org/gitlab!25770
parents dd72c5da eaf2607e
......@@ -3,15 +3,20 @@
module API
class VulnerabilityFindings < Grape::API
include PaginationParams
include ::Gitlab::Utils::StrongMemoize
helpers do
def vulnerability_occurrences_by(params)
pipeline = if params[:pipeline_id]
user_project.all_pipelines.find_by(id: params[:pipeline_id]) # rubocop:disable CodeReuse/ActiveRecord
def pipeline
strong_memoize(:pipeline) do
if params[:pipeline_id]
user_project.all_pipelines.for_id(params[:pipeline_id]).first
else
user_project.latest_pipeline_with_security_reports
end
end
end
def vulnerability_occurrences_by(params)
return [] unless pipeline
aggregated_report = Security::PipelineVulnerabilitiesFinder.new(pipeline: pipeline, params: params).execute
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment