From 68d9cc0b0592e665578616fe356a95425f2f006e Mon Sep 17 00:00:00 2001 From: MAEDA Go Date: Sun, 28 Aug 2022 13:24:55 +0900 Subject: [PATCH 3/5] Fix RuboCop offense Style/IfUnlessModifier --- app/models/repository/git.rb | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/app/models/repository/git.rb b/app/models/repository/git.rb index 66dea18d9..ed0ce7b57 100644 --- a/app/models/repository/git.rb +++ b/app/models/repository/git.rb @@ -27,9 +27,7 @@ class Repository::Git < Repository def self.human_attribute_name(attribute_key_name, *args) attr_name = attribute_key_name.to_s - if attr_name == "url" - attr_name = "path_to_repository" - end + attr_name = 'path_to_repository' if attr_name == 'url' super(attr_name, *args) end @@ -140,9 +138,7 @@ class Repository::Git < Repository repo_heads = scm_brs.map(&:scmid) h["heads"] ||= [] prev_db_heads = h["heads"].dup - if prev_db_heads.empty? - prev_db_heads += heads_from_branches_hash - end + prev_db_heads += heads_from_branches_hash if prev_db_heads.empty? return if prev_db_heads.sort == repo_heads.sort h["db_consistent"] ||= {} @@ -230,9 +226,7 @@ class Repository::Git < Repository :comments => rev.message, :parents => parents ) - unless changeset.new_record? - rev.paths.each {|change| changeset.create_change(change)} - end + rev.paths.each {|change| changeset.create_change(change)} unless changeset.new_record? changeset end private :save_revision -- 2.34.1