Commit 0be61da3 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'pl-rubocop-inline-association-security' into 'master'

Fix cop FactoryBot/InlineAssociation for security findings/reports

See merge request gitlab-org/gitlab!45527
parents 0745b989 44e783bb
......@@ -1307,8 +1307,6 @@ Graphql/IDType:
FactoryBot/InlineAssociation:
Exclude:
- 'ee/spec/factories/analytics/cycle_analytics/group_stages.rb'
- 'ee/spec/factories/ci/reports/security/findings.rb'
- 'ee/spec/factories/ci/reports/security/reports.rb'
- 'ee/spec/factories/geo/event_log.rb'
- 'ee/spec/factories/groups.rb'
- 'ee/spec/factories/merge_request_blocks.rb'
......
......@@ -4,7 +4,7 @@ FactoryBot.define do
factory :ci_reports_security_finding, class: '::Gitlab::Ci::Reports::Security::Finding' do
compare_key { "#{identifiers.first&.external_type}:#{identifiers.first&.external_id}:#{location.fingerprint}" }
confidence { :medium }
identifiers { Array.new(1) { FactoryBot.build(:ci_reports_security_identifier) } }
identifiers { Array.new(1) { association(:ci_reports_security_identifier) } }
location factory: :ci_reports_security_locations_sast
metadata_version { 'sast:1.0' }
name { 'Cipher with no integrity' }
......@@ -36,7 +36,7 @@ FactoryBot.define do
skip_create
trait :dynamic do
location { FactoryBot.build(:ci_reports_security_locations_sast, :dynamic) }
location { association(:ci_reports_security_locations_sast, :dynamic) }
end
initialize_with do
......
......@@ -3,7 +3,7 @@
FactoryBot.define do
factory :ci_reports_security_report, class: '::Gitlab::Ci::Reports::Security::Report' do
type { :sast }
pipeline { build(:ci_pipeline) }
pipeline { association(:ci_pipeline) }
created_at { 2.weeks.ago }
scanned_resources { [] }
......
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