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