Commit ba8e93fd authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'empty-lambda-cop' into 'master'

Fix Style/EmptyLambdaParameter cop

See merge request gitlab-org/gitlab!41248
parents 5c96eb9a 7dac1fa9
...@@ -548,13 +548,6 @@ Style/EachWithObject: ...@@ -548,13 +548,6 @@ Style/EachWithObject:
Style/EmptyElse: Style/EmptyElse:
Enabled: false Enabled: false
# Offense count: 11
# Cop supports --auto-correct.
Style/EmptyLambdaParameter:
Exclude:
- 'app/models/ci/build.rb'
- 'app/models/ci/runner.rb'
# Offense count: 170 # Offense count: 170
# Cop supports --auto-correct. # Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle. # Configuration parameters: EnforcedStyle.
......
...@@ -90,9 +90,9 @@ module Ci ...@@ -90,9 +90,9 @@ module Ci
Ci::BuildMetadata.scoped_build.with_interruptible.select(:id)) Ci::BuildMetadata.scoped_build.with_interruptible.select(:id))
end end
scope :unstarted, ->() { where(runner_id: nil) } scope :unstarted, -> { where(runner_id: nil) }
scope :ignore_failures, ->() { where(allow_failure: false) } scope :ignore_failures, -> { where(allow_failure: false) }
scope :with_downloadable_artifacts, ->() do scope :with_downloadable_artifacts, -> do
where('EXISTS (?)', where('EXISTS (?)',
Ci::JobArtifact.select(1) Ci::JobArtifact.select(1)
.where('ci_builds.id = ci_job_artifacts.job_id') .where('ci_builds.id = ci_job_artifacts.job_id')
...@@ -104,11 +104,11 @@ module Ci ...@@ -104,11 +104,11 @@ module Ci
where('EXISTS (?)', ::Ci::JobArtifact.select(1).where('ci_builds.id = ci_job_artifacts.job_id').merge(query)) where('EXISTS (?)', ::Ci::JobArtifact.select(1).where('ci_builds.id = ci_job_artifacts.job_id').merge(query))
end end
scope :with_archived_trace, ->() do scope :with_archived_trace, -> do
with_existing_job_artifacts(Ci::JobArtifact.trace) with_existing_job_artifacts(Ci::JobArtifact.trace)
end end
scope :without_archived_trace, ->() do scope :without_archived_trace, -> do
where('NOT EXISTS (?)', Ci::JobArtifact.select(1).where('ci_builds.id = ci_job_artifacts.job_id').trace) where('NOT EXISTS (?)', Ci::JobArtifact.select(1).where('ci_builds.id = ci_job_artifacts.job_id').trace)
end end
...@@ -139,11 +139,11 @@ module Ci ...@@ -139,11 +139,11 @@ module Ci
.includes(:metadata, :job_artifacts_metadata) .includes(:metadata, :job_artifacts_metadata)
end end
scope :with_artifacts_not_expired, ->() { with_downloadable_artifacts.where('artifacts_expire_at IS NULL OR artifacts_expire_at > ?', Time.current) } scope :with_artifacts_not_expired, -> { with_downloadable_artifacts.where('artifacts_expire_at IS NULL OR artifacts_expire_at > ?', Time.current) }
scope :with_expired_artifacts, ->() { with_downloadable_artifacts.where('artifacts_expire_at < ?', Time.current) } scope :with_expired_artifacts, -> { with_downloadable_artifacts.where('artifacts_expire_at < ?', Time.current) }
scope :last_month, ->() { where('created_at > ?', Date.today - 1.month) } scope :last_month, -> { where('created_at > ?', Date.today - 1.month) }
scope :manual_actions, ->() { where(when: :manual, status: COMPLETED_STATUSES + %i[manual]) } scope :manual_actions, -> { where(when: :manual, status: COMPLETED_STATUSES + %i[manual]) }
scope :scheduled_actions, ->() { where(when: :delayed, status: COMPLETED_STATUSES + %i[scheduled]) } scope :scheduled_actions, -> { where(when: :delayed, status: COMPLETED_STATUSES + %i[scheduled]) }
scope :ref_protected, -> { where(protected: true) } scope :ref_protected, -> { where(protected: true) }
scope :with_live_trace, -> { where('EXISTS (?)', Ci::BuildTraceChunk.where('ci_builds.id = ci_build_trace_chunks.build_id').select(1)) } scope :with_live_trace, -> { where('EXISTS (?)', Ci::BuildTraceChunk.where('ci_builds.id = ci_build_trace_chunks.build_id').select(1)) }
scope :with_stale_live_trace, -> { with_live_trace.finished_before(12.hours.ago) } scope :with_stale_live_trace, -> { with_live_trace.finished_before(12.hours.ago) }
......
...@@ -52,7 +52,7 @@ module Ci ...@@ -52,7 +52,7 @@ module Ci
has_many :runner_namespaces, inverse_of: :runner has_many :runner_namespaces, inverse_of: :runner
has_many :groups, through: :runner_namespaces has_many :groups, through: :runner_namespaces
has_one :last_build, ->() { order('id DESC') }, class_name: 'Ci::Build' has_one :last_build, -> { order('id DESC') }, class_name: 'Ci::Build'
before_save :ensure_token before_save :ensure_token
......
---
title: Fix Style/EmptyLambdaParameter cop
merge_request: 41248
author: Rajendra Kadam
type: fixed
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