Commit 9fb6efff authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'multiline-if-modifier' into 'master'

Fix Style/MultilineIfModifier cop

See merge request gitlab-org/gitlab!41113
parents 9fabc30b 07ec6037
......@@ -621,13 +621,6 @@ Style/MixinUsage:
- 'spec/factories/notes.rb'
- 'spec/lib/gitlab/import_export/version_checker_spec.rb'
# Offense count: 2
# Cop supports --auto-correct.
Style/MultilineIfModifier:
Exclude:
- 'app/services/ci/process_pipeline_service.rb'
- 'lib/api/commit_statuses.rb'
# Offense count: 29
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, MinBodyLength.
......
......@@ -37,10 +37,12 @@ module Ci
.pluck(Arel.sql('MAX(id)'), 'name')
# mark builds that are retried
pipeline.statuses.latest
.where(name: latest_statuses.map(&:second))
.where.not(id: latest_statuses.map(&:first))
.update_all(retried: true) if latest_statuses.any?
if latest_statuses.any?
pipeline.statuses.latest
.where(name: latest_statuses.map(&:second))
.where.not(id: latest_statuses.map(&:first))
.update_all(retried: true)
end
end
# rubocop: enable CodeReuse/ActiveRecord
......
---
title: Fix Style/MultilineIfModifier cop
merge_request: 41113
author: Rajendra Kadam
type: fixed
......@@ -117,8 +117,10 @@ module API
render_api_error!('invalid state', 400)
end
MergeRequest.where(source_project: user_project, source_branch: ref)
.update_all(head_pipeline_id: pipeline.id) if pipeline.latest?
if pipeline.latest?
MergeRequest.where(source_project: user_project, source_branch: ref)
.update_all(head_pipeline_id: pipeline.id)
end
present status, with: Entities::CommitStatus
rescue StateMachines::InvalidTransition => e
......
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