summaryrefslogtreecommitdiff
path: root/app/models/commit_status.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/commit_status.rb')
-rw-r--r--app/models/commit_status.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb
index 7f6562b63e5..012085bebd8 100644
--- a/app/models/commit_status.rb
+++ b/app/models/commit_status.rb
@@ -7,12 +7,12 @@ class CommitStatus < ActiveRecord::Base
include Presentable
include EnumWithNil
- self.table_name = 'ci_builds'
+ self.table_name = "ci_builds"
belongs_to :user
belongs_to :project
- belongs_to :pipeline, class_name: 'Ci::Pipeline', foreign_key: :commit_id
- belongs_to :auto_canceled_by, class_name: 'Ci::Pipeline'
+ belongs_to :pipeline, class_name: "Ci::Pipeline", foreign_key: :commit_id
+ belongs_to :auto_canceled_by, class_name: "Ci::Pipeline"
delegate :commit, to: :pipeline
delegate :sha, :short_sha, to: :pipeline
@@ -40,7 +40,7 @@ class CommitStatus < ActiveRecord::Base
scope :ordered, -> { order(:name) }
scope :latest_ordered, -> { latest.ordered.includes(project: :namespace) }
scope :retried_ordered, -> { retried.ordered.includes(project: :namespace) }
- scope :after_stage, -> (index) { where('stage_idx > ?', index) }
+ scope :after_stage, ->(index) { where("stage_idx > ?", index) }
scope :processables, -> { where(type: %w[Ci::Build Ci::Bridge]) }
# We use `CommitStatusEnums.failure_reasons` here so that EE can more easily
@@ -55,7 +55,7 @@ class CommitStatus < ActiveRecord::Base
before_create unless: :importing? do
# rubocop: disable CodeReuse/ServiceClass
Ci::EnsureStageService.new(project, user).execute(self) do |stage|
- self.run_after_commit { StageUpdateWorker.perform_async(stage.id) }
+ run_after_commit { StageUpdateWorker.perform_async(stage.id) }
end
# rubocop: enable CodeReuse/ServiceClass
end
@@ -145,7 +145,7 @@ class CommitStatus < ActiveRecord::Base
end
def group_name
- name.to_s.gsub(%r{\d+[\s:/\\]+\d+\s*}, '').strip
+ name.to_s.gsub(%r{\d+[\s:/\\]+\d+\s*}, "").strip
end
def failed_but_allowed?
@@ -192,7 +192,7 @@ class CommitStatus < ActiveRecord::Base
def sortable_name
name.to_s.split(/(\d+)/).map do |v|
- v =~ /\d+/ ? v.to_i : v
+ /\d+/.match?(v) ? v.to_i : v
end
end
end