Corrected with rubocop cop 'Style/RedundantReturn'.

This commit is contained in:
Thorsten Eckel 2015-04-30 19:20:27 +02:00
parent 19feb32c7b
commit 69a16ee2c5
26 changed files with 51 additions and 58 deletions

View file

@ -491,7 +491,7 @@ class Channel::EmailParser
} }
# return new objects # return new objects
return ticket, article, user [ticket, article, user]
end end
def user_create(data) def user_create(data)

View file

@ -134,7 +134,7 @@ class Channel::TWITTER2
ticket = fetch_ticket_create(user, tweet, sender, channel, group) ticket = fetch_ticket_create(user, tweet, sender, channel, group)
end end
article = fetch_article_create(user, ticket, tweet, sender) article = fetch_article_create(user, ticket, tweet, sender)
return user, ticket, article [user, ticket, article]
end end
def fetch_user_create(tweet, sender) def fetch_user_create(tweet, sender)
@ -177,7 +177,7 @@ class Channel::TWITTER2
# set current user # set current user
UserInfo.current_user_id = user.id UserInfo.current_user_id = user.id
return user user
end end
def fetch_ticket_create(user, tweet, sender, channel, group) def fetch_ticket_create(user, tweet, sender, channel, group)
@ -298,6 +298,6 @@ class Channel::TWITTER2
} }
) )
# puts message.inspect # puts message.inspect
return message message
end end
end end

View file

@ -223,7 +223,7 @@ returns
# lookup # lookup
history_type = History::Type.lookup( id: id ) history_type = History::Type.lookup( id: id )
@@cache_type[ id ] = history_type @@cache_type[ id ] = history_type
return history_type history_type
end end
def self.type_lookup( name ) def self.type_lookup( name )
@ -243,7 +243,7 @@ returns
name: name name: name
) )
@@cache_type[ name ] = history_type @@cache_type[ name ] = history_type
return history_type history_type
end end
def self.object_lookup_id( id ) def self.object_lookup_id( id )
@ -254,7 +254,7 @@ returns
# lookup # lookup
history_object = History::Object.lookup( id: id ) history_object = History::Object.lookup( id: id )
@@cache_object[ id ] = history_object @@cache_object[ id ] = history_object
return history_object history_object
end end
def self.object_lookup( name ) def self.object_lookup( name )
@ -274,7 +274,7 @@ returns
name: name name: name
) )
@@cache_object[ name ] = history_object @@cache_object[ name ] = history_object
return history_object history_object
end end
def self.attribute_lookup_id( id ) def self.attribute_lookup_id( id )
@ -285,7 +285,7 @@ returns
# lookup # lookup
history_attribute = History::Attribute.lookup( id: id ) history_attribute = History::Attribute.lookup( id: id )
@@cache_attribute[ id ] = history_attribute @@cache_attribute[ id ] = history_attribute
return history_attribute history_attribute
end end
def self.attribute_lookup( name ) def self.attribute_lookup( name )
@ -305,7 +305,7 @@ returns
name: name name: name
) )
@@cache_attribute[ name ] = history_attribute @@cache_attribute[ name ] = history_attribute
return history_attribute history_attribute
end end
private private

View file

@ -49,7 +49,7 @@ class Link < ApplicationModel
items.push link items.push link
} }
return items items
end end
=begin =begin
@ -159,7 +159,7 @@ class Link < ApplicationModel
name: data[:name] name: data[:name]
) )
end end
return linktype linktype
end end
def self.link_object_get(data) def self.link_object_get(data)
@ -169,7 +169,7 @@ class Link < ApplicationModel
name: data[:name] name: data[:name]
) )
end end
return linkobject linkobject
end end
end end

View file

@ -171,7 +171,7 @@ returns:
notifications = OnlineNotification.list(user, limit) notifications = OnlineNotification.list(user, limit)
assets = ApplicationModel.assets_of_object_list(notifications) assets = ApplicationModel.assets_of_object_list(notifications)
return { {
stream: notifications, stream: notifications,
assets: assets assets: assets
} }

View file

@ -67,7 +67,7 @@ class RecentView < ApplicationModel
# get related object # get related object
assets = ApplicationModel.assets_of_object_list(recent_viewed) assets = ApplicationModel.assets_of_object_list(recent_viewed)
return { {
stream: recent_viewed, stream: recent_viewed,
assets: assets, assets: assets,
} }

View file

@ -32,7 +32,7 @@ class Setting < ApplicationModel
# store for class requests # store for class requests
@@current[:settings_config] = config @@current[:settings_config] = config
return config config
end end
def self.set(name, value) def self.set(name, value)
@ -47,7 +47,7 @@ class Setting < ApplicationModel
def self.get(name) def self.get(name)
self.load self.load
return @@current[:settings_config][name] @@current[:settings_config][name]
end end
private private

View file

@ -82,7 +82,7 @@ returns
store_object_id = Store::Object.lookup( name: data[:object] ) store_object_id = Store::Object.lookup( name: data[:object] )
stores = Store.where( store_object_id: store_object_id, o_id: data[:o_id].to_i ). stores = Store.where( store_object_id: store_object_id, o_id: data[:o_id].to_i ).
order('created_at ASC, id ASC') order('created_at ASC, id ASC')
return stores stores
end end
=begin =begin
@ -111,7 +111,7 @@ returns
# check backend for references # check backend for references
Store.remove_item( store.id ) Store.remove_item( store.id )
end end
return true true
end end
=begin =begin
@ -136,7 +136,7 @@ returns
end end
store.destroy store.destroy
return true true
end end
def content def content

View file

@ -24,7 +24,7 @@ class Tag < ApplicationModel
o_id: data[:o_id], o_id: data[:o_id],
created_by_id: data[:created_by_id], created_by_id: data[:created_by_id],
) )
return true true
end end
def self.tag_remove(data) def self.tag_remove(data)
@ -46,7 +46,7 @@ class Tag < ApplicationModel
result.each { |item| result.each { |item|
item.destroy item.destroy
} }
return true true
end end
def self.tag_list( data ) def self.tag_list( data )
@ -59,7 +59,7 @@ class Tag < ApplicationModel
tag_search.each {|tag| tag_search.each {|tag|
tags.push self.tag_item_lookup_id( tag.tag_item_id ) tags.push self.tag_item_lookup_id( tag.tag_item_id )
} }
return tags tags
end end
private private
@ -72,7 +72,7 @@ class Tag < ApplicationModel
# lookup # lookup
tag_item = Tag::Item.find(id) tag_item = Tag::Item.find(id)
@@cache_item[ id ] = tag_item.name @@cache_item[ id ] = tag_item.name
return tag_item.name tag_item.name
end end
def self.tag_item_lookup( name ) def self.tag_item_lookup( name )
@ -94,7 +94,7 @@ class Tag < ApplicationModel
name: name name: name
) )
@@cache_item[ name ] = tag_item.id @@cache_item[ name ] = tag_item.id
return tag_item.id tag_item.id
end end
def self.tag_object_lookup_id( id ) def self.tag_object_lookup_id( id )
@ -105,7 +105,7 @@ class Tag < ApplicationModel
# lookup # lookup
tag_object = Tag::Object.find(id) tag_object = Tag::Object.find(id)
@@cache_object[ id ] = tag_object.name @@cache_object[ id ] = tag_object.name
return tag_object.name tag_object.name
end end
def self.tag_object_lookup( name ) def self.tag_object_lookup( name )
@ -125,7 +125,7 @@ class Tag < ApplicationModel
name: name name: name
) )
@@cache_object[ name ] = tag_object.id @@cache_object[ name ] = tag_object.id
return tag_object.id tag_object.id
end end
class Object < ActiveRecord::Base class Object < ActiveRecord::Base

View file

@ -34,7 +34,7 @@ returns
end end
# left position # left position
return "[#{ticket_hook}#{ticket_hook_divider}#{self.number}] " + subject "[#{ticket_hook}#{ticket_hook_divider}#{self.number}] " + subject
end end
=begin =begin

View file

@ -22,7 +22,7 @@ class Token < ActiveRecord::Base
end end
# return token if valid # return token if valid
return token.user token.user
end end
private private

View file

@ -136,7 +136,7 @@ get list of translations
end end
end end
return { {
list: list, list: list,
} }
end end
@ -163,7 +163,7 @@ translate strings in ruby context, e. g. for notifications
return record.target if record.source == string return record.target if record.source == string
} }
return string string
end end
private private

View file

@ -159,7 +159,7 @@ returns
# get related objects # get related objects
assets = ApplicationModel.assets_of_object_list(activity_stream) assets = ApplicationModel.assets_of_object_list(activity_stream)
return { {
activity_stream: activity_stream, activity_stream: activity_stream,
assets: assets, assets: assets,
} }

View file

@ -54,7 +54,5 @@ returns
return user_auth return user_auth
end end
} }
return
end end
end end

View file

@ -8,6 +8,6 @@ module Auth::Developer
return user if password == 'test' return user if password == 'test'
end end
return false false
end end
end end

View file

@ -15,6 +15,6 @@ module Auth::Internal
# plain auth check # plain auth check
return user if user.password == password return user if user.password == password
return false false
end end
end end

View file

@ -119,6 +119,6 @@ module Auth::Ldap
# take session down # take session down
# - not needed, done by Net::LDAP - # - not needed, done by Net::LDAP -
return user user
end end
end end

View file

@ -23,6 +23,6 @@ module Auth::Otrs
# sync / check permissions # sync / check permissions
Import::OTRS.permission_sync( user, result, config ) Import::OTRS.permission_sync( user, result, config )
return user user
end end
end end

View file

@ -26,6 +26,6 @@ class GeoLocation::Gmaps
result = JSON.parse( response.body ) result = JSON.parse( response.body )
address = result['results'].first['address_components'].first['long_name'] address = result['results'].first['address_components'].first['long_name']
return address address
end end
end end

View file

@ -15,7 +15,7 @@ module Import::OTRS
puts "ERROR: #{response.error}" puts "ERROR: #{response.error}"
return return
end end
return response response
end end
def self.post(base, data) def self.post(base, data)
url = Setting.get('import_otrs_endpoint') + '/' + base url = Setting.get('import_otrs_endpoint') + '/' + base
@ -34,7 +34,7 @@ module Import::OTRS
puts "ERROR: #{response.error}" puts "ERROR: #{response.error}"
return return
end end
return response response
end end
def self.json(response) def self.json(response)
@ -48,7 +48,7 @@ module Import::OTRS
return if !response.success? return if !response.success?
result = json(response) result = json(response)
return result result
end end
def self.session(session_id) def self.session(session_id)
@ -57,7 +57,7 @@ module Import::OTRS
return if !response.success? return if !response.success?
result = json(response) result = json(response)
return result result
end end
def self.permission_sync(user, result, config) def self.permission_sync(user, result, config)
@ -167,7 +167,6 @@ module Import::OTRS
threads[thread].join threads[thread].join
} }
return
end end
def self.diff_worker def self.diff_worker
@ -198,7 +197,6 @@ module Import::OTRS
self.ticket_diff() self.ticket_diff()
return
end end
def self.ticket_diff() def self.ticket_diff()

View file

@ -143,7 +143,7 @@ module Import::OTRS2
return if !response.success? return if !response.success?
result = json(response) result = json(response)
return result result
end end
=begin =begin
@ -165,7 +165,7 @@ module Import::OTRS2
return if !response return if !response
return if !response.success? return if !response.success?
result = json(response) result = json(response)
return result result
end end
=begin =begin
@ -201,7 +201,7 @@ module Import::OTRS2
=end =end
def self.connection_test def self.connection_test
return self.request_json({}) self.request_json({})
end end
=begin =begin
@ -439,7 +439,6 @@ module Import::OTRS2
# get changed tickets # get changed tickets
self.ticket_diff self.ticket_diff
return
end end
def self.ticket_diff def self.ticket_diff

View file

@ -34,6 +34,6 @@ module Rss
return return
end end
return items items
end end
end end

View file

@ -13,7 +13,7 @@ module SessionHelper
(default_collection, assets ) = ExtraCollection.session( default_collection, assets, user ) (default_collection, assets ) = ExtraCollection.session( default_collection, assets, user )
end end
return default_collection, assets [default_collection, assets]
end end
def self.models(user = nil) def self.models(user = nil)

View file

@ -468,7 +468,7 @@ returns
to_delete.each {|file| to_delete.each {|file|
File.delete(file) File.delete(file)
} }
return data data
end end
def self.jobs def self.jobs

View file

@ -65,7 +65,5 @@ returns
return user_auth return user_auth
end end
} }
return
end end
end end

View file

@ -93,7 +93,7 @@ put working hours matrix and timezone in function, returns UTC working hours mat
} }
} }
end end
return working_hours working_hours
end end
=begin =begin
@ -350,7 +350,7 @@ put working hours matrix and timezone in function, returns UTC working hours mat
start_time = start_time.beginning_of_day + 86_400 start_time = start_time.beginning_of_day + 86_400
end end
return start_time start_time
end end
end end