diff options
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/ci/build.rb | 6 | ||||
-rw-r--r-- | app/models/ci/project.rb | 2 | ||||
-rw-r--r-- | app/models/merge_request_diff.rb | 8 | ||||
-rw-r--r-- | app/models/project.rb | 4 | ||||
-rw-r--r-- | app/models/project_services/hipchat_service.rb | 25 | ||||
-rw-r--r-- | app/models/repository.rb | 2 | ||||
-rw-r--r-- | app/models/user.rb | 8 |
7 files changed, 21 insertions, 34 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index 19f957eb965..645ad68e1b3 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -26,7 +26,7 @@ module Ci class Build < ActiveRecord::Base extend Ci::Model - + LAZY_ATTRIBUTES = ['trace'] belongs_to :commit, class_name: 'Ci::Commit' @@ -140,7 +140,7 @@ module Ci def trace_html html = Ci::Ansi2html::convert(trace) if trace.present? - html ||= '' + html || '' end def started? @@ -211,7 +211,7 @@ module Ci if coverage.present? coverage.to_f end - rescue => ex + rescue # if bad regex or something goes wrong we dont want to interrupt transition # so we just silentrly ignore error for now end diff --git a/app/models/ci/project.rb b/app/models/ci/project.rb index 24f70171094..88ba933a434 100644 --- a/app/models/ci/project.rb +++ b/app/models/ci/project.rb @@ -184,7 +184,7 @@ module Ci # If service is available but missing in db # we should create an instance. Ex `create_gitlab_ci_service` - service = self.send :"create_#{service_name}_service" if service.nil? + self.send :"create_#{service_name}_service" if service.nil? end end diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb index f75f999b0d0..c9ef8023aea 100644 --- a/app/models/merge_request_diff.rb +++ b/app/models/merge_request_diff.rb @@ -144,12 +144,10 @@ class MergeRequestDiff < ActiveRecord::Base # Collect array of Git::Diff objects # between target and source branches def unmerged_diffs - diffs = compare_result.diffs - diffs ||= [] - diffs - rescue Gitlab::Git::Diff::TimeoutError => ex + compare_result.diffs || [] + rescue Gitlab::Git::Diff::TimeoutError self.state = :timeout - diffs = [] + [] end def repository diff --git a/app/models/project.rb b/app/models/project.rb index 8527fa29808..06a66bbf494 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -413,7 +413,7 @@ class Project < ActiveRecord::Base if template.nil? # If no template, we should create an instance. Ex `create_gitlab_ci_service` - service = self.send :"create_#{service_name}_service" + self.send :"create_#{service_name}_service" else Service.create_from_template(self.id, template) end @@ -738,7 +738,7 @@ class Project < ActiveRecord::Base def create_wiki ProjectWiki.new(self, self.owner).wiki true - rescue ProjectWiki::CouldNotCreateWikiError => ex + rescue ProjectWiki::CouldNotCreateWikiError errors.add(:base, 'Failed create wiki') false end diff --git a/app/models/project_services/hipchat_service.rb b/app/models/project_services/hipchat_service.rb index 7a15a861abc..af2840a57f0 100644 --- a/app/models/project_services/hipchat_service.rb +++ b/app/models/project_services/hipchat_service.rb @@ -85,17 +85,16 @@ class HipchatService < Service def create_message(data) object_kind = data[:object_kind] - message = \ - case object_kind - when "push", "tag_push" - create_push_message(data) - when "issue" - create_issue_message(data) unless is_update?(data) - when "merge_request" - create_merge_request_message(data) unless is_update?(data) - when "note" - create_note_message(data) - end + case object_kind + when "push", "tag_push" + create_push_message(data) + when "issue" + create_issue_message(data) unless is_update?(data) + when "merge_request" + create_merge_request_message(data) unless is_update?(data) + when "note" + create_note_message(data) + end end def create_push_message(push) @@ -167,8 +166,6 @@ class HipchatService < Service obj_attr = data[:object_attributes] obj_attr = HashWithIndifferentAccess.new(obj_attr) merge_request_id = obj_attr[:iid] - source_branch = obj_attr[:source_branch] - target_branch = obj_attr[:target_branch] state = obj_attr[:state] description = obj_attr[:description] title = obj_attr[:title] @@ -194,8 +191,6 @@ class HipchatService < Service data = HashWithIndifferentAccess.new(data) user_name = data[:user][:name] - repo_attr = HashWithIndifferentAccess.new(data[:repository]) - obj_attr = HashWithIndifferentAccess.new(data[:object_attributes]) note = obj_attr[:note] note_url = obj_attr[:url] diff --git a/app/models/repository.rb b/app/models/repository.rb index 79b48ebfedf..2c5ab62d22c 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -549,7 +549,7 @@ class Repository # Run GitLab post receive hook post_receive_hook = Gitlab::Git::Hook.new('post-receive', path_to_repo) - status = post_receive_hook.trigger(gl_id, oldrev, newrev, ref) + post_receive_hook.trigger(gl_id, oldrev, newrev, ref) else # Remove tmp ref and return error to user rugged.references.delete(tmp_ref) diff --git a/app/models/user.rb b/app/models/user.rb index 9ea7cabff15..ef687f737cc 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -701,13 +701,7 @@ class User < ActiveRecord::Base end def manageable_namespaces - @manageable_namespaces ||= - begin - namespaces = [] - namespaces << namespace - namespaces += owned_groups - namespaces += masters_groups - end + @manageable_namespaces ||= [namespace] + owned_groups + masters_groups end def namespaces |