Skip to content
Snippets Groups Projects
Commit 2b075f16 authored by Guilherme Garnier's avatar Guilherme Garnier
Browse files

Fix rubocop warnings in app

parent 0406455c
No related branches found
No related tags found
1 merge request!9690Fix "useless assignment" Rubocop warnings
Loading
Loading
@@ -18,7 +18,7 @@ module Ci
rescue Ci::GitlabCiYamlProcessor::ValidationError => e
@error = e.message
@status = false
rescue Exception => e
rescue Exception
@error = "Undefined error"
@status = false
end
Loading
Loading
Loading
Loading
@@ -71,7 +71,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
redirect_to omniauth_error_path(oauth['provider'], error: error_message) and return
end
end
rescue Gitlab::OAuth::SignupDisabledError => e
rescue Gitlab::OAuth::SignupDisabledError
label = Gitlab::OAuth::Provider.label_for(oauth['provider'])
message = "Signing in using your #{label} account without a pre-existing GitLab account is not allowed."
 
Loading
Loading
@@ -80,7 +80,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
end
 
flash[:notice] = message
redirect_to new_user_session_path
end
 
Loading
Loading
Loading
Loading
@@ -98,7 +98,7 @@ class Projects::WikisController < Projects::ApplicationController
 
# Call #wiki to make sure the Wiki Repo is initialized
@project_wiki.wiki
rescue ProjectWiki::CouldNotCreateWikiError => ex
rescue ProjectWiki::CouldNotCreateWikiError
flash[:notice] = "Could not create Wiki Repository at this time. Please try again later."
redirect_to project_path(@project)
return false
Loading
Loading
Loading
Loading
@@ -39,7 +39,7 @@ class IssuableFinder
items = by_assignee(items)
items = by_author(items)
items = by_label(items)
items = sort(items)
sort(items)
end
 
def group
Loading
Loading
Loading
Loading
@@ -35,7 +35,7 @@ module ApplicationHelper
def project_icon(project_id, options = {})
project =
if project_id.is_a?(Project)
project = project_id
project_id
else
Project.find_with_namespace(project_id)
end
Loading
Loading
Loading
Loading
@@ -26,7 +26,7 @@
module Ci
class Build < ActiveRecord::Base
extend Ci::Model
LAZY_ATTRIBUTES = ['trace']
 
belongs_to :commit, class_name: 'Ci::Commit'
Loading
Loading
@@ -140,7 +140,7 @@ module Ci
 
def trace_html
html = Ci::Ansi2html::convert(trace) if trace.present?
html ||= ''
html || ''
end
 
def started?
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
 
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -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)
Loading
Loading
@@ -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]
Loading
Loading
@@ -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]
Loading
Loading
Loading
Loading
@@ -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)
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
Loading
Loading
@@ -21,7 +21,7 @@ module Files
create_target_branch
end
 
if sha = commit
if commit
success
else
error("Something went wrong. Your changes were not committed")
Loading
Loading
Loading
Loading
@@ -62,7 +62,7 @@ module Projects
after_create_actions if @project.persisted?
 
@project
rescue => ex
rescue
@project.errors.add(:base, "Can't save project. Please try again later")
@project
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment