Corrected with rubocop cop 'Style/ColonMethodCall'.

This commit is contained in:
Thorsten Eckel 2015-05-05 16:25:28 +02:00
parent 50806a4b5e
commit b08a817e3d
7 changed files with 16 additions and 18 deletions

View file

@ -252,8 +252,6 @@ Lint/UselessAssignment:
Enabled: false Enabled: false
Lint/NonLocalExitFromIterator: Lint/NonLocalExitFromIterator:
Enabled: false Enabled: false
Style/ColonMethodCall:
Enabled: false
Rails/Date: Rails/Date:
Enabled: false Enabled: false
Lint/UnreachableCode: Lint/UnreachableCode:

View file

@ -891,7 +891,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
begin begin
mxs = Resolv::DNS.open do |dns| mxs = Resolv::DNS.open do |dns|
ress = dns.getresources(domain, Resolv::DNS::Resource::IN::MX) ress = dns.getresources(domain, Resolv::DNS::Resource::IN::MX)
ress.map { |r| [r.exchange.to_s, IPSocket::getaddress(r.exchange.to_s), r.preference] } ress.map { |r| [r.exchange.to_s, IPSocket.getaddress(r.exchange.to_s), r.preference] }
end end
rescue Exception => e rescue Exception => e
logger.error e.message logger.error e.message

View file

@ -34,13 +34,13 @@ class SessionsController < ApplicationController
user.activity_stream_log( 'session started', user.id, true ) user.activity_stream_log( 'session started', user.id, true )
# auto population of default collections # auto population of default collections
collections, assets = SessionHelper::default_collections(user) collections, assets = SessionHelper.default_collections(user)
# add session user assets # add session user assets
assets = user.assets(assets) assets = user.assets(assets)
# get models # get models
models = SessionHelper::models(user) models = SessionHelper.models(user)
# check logon session # check logon session
logon_session_key = nil logon_session_key = nil
@ -76,7 +76,7 @@ class SessionsController < ApplicationController
# check logon session # check logon session
if params['logon_session'] if params['logon_session']
session = SessionHelper::get( params['logon_session'] ) session = SessionHelper.get( params['logon_session'] )
if session if session
user_id = session.data[:user_id] user_id = session.data[:user_id]
end end
@ -84,7 +84,7 @@ class SessionsController < ApplicationController
if !user_id if !user_id
# get models # get models
models = SessionHelper::models() models = SessionHelper.models()
render json: { render json: {
error: 'no valid session', error: 'no valid session',
@ -102,13 +102,13 @@ class SessionsController < ApplicationController
user = User.find( user_id ) user = User.find( user_id )
# auto population of default collections # auto population of default collections
collections, assets = SessionHelper::default_collections(user) collections, assets = SessionHelper.default_collections(user)
# add session user assets # add session user assets
assets = user.assets(assets) assets = user.assets(assets)
# get models # get models
models = SessionHelper::models(user) models = SessionHelper.models(user)
# return current session # return current session
render json: { render json: {
@ -278,7 +278,7 @@ class SessionsController < ApplicationController
def delete def delete
return if deny_if_not_role(Z_ROLENAME_ADMIN) return if deny_if_not_role(Z_ROLENAME_ADMIN)
SessionHelper::destroy( params[:id] ) SessionHelper.destroy( params[:id] )
render json: {} render json: {}
end end

View file

@ -12,7 +12,7 @@ class GeoIp::ZammadGeoIp
# do lookup # do lookup
host = 'https://geo.zammad.com' host = 'https://geo.zammad.com'
url = "/lookup?ip=#{CGI::escape address}" url = "/lookup?ip=#{CGI.escape address}"
data = {} data = {}
begin begin
response = UserAgent.get( response = UserAgent.get(

View file

@ -3,7 +3,7 @@
class GeoLocation::Gmaps class GeoLocation::Gmaps
def self.geocode(address) def self.geocode(address)
url = "http://maps.googleapis.com/maps/api/geocode/json?address=#{CGI::escape address}&sensor=true" url = "http://maps.googleapis.com/maps/api/geocode/json?address=#{CGI.escape address}&sensor=true"
response = UserAgent.get(url) response = UserAgent.get(url)
return if !response.success? return if !response.success?

View file

@ -211,7 +211,7 @@ module Import::OTRS
def self.ticket(ticket_ids) def self.ticket(ticket_ids)
url = 'public.pl?Action=Export;Type=Ticket;' url = 'public.pl?Action=Export;Type=Ticket;'
ticket_ids.each {|ticket_id| ticket_ids.each {|ticket_id|
url = url + "TicketID=#{CGI::escape ticket_id};" url = url + "TicketID=#{CGI.escape ticket_id};"
} }
response = request( url ) response = request( url )
return if !response return if !response

View file

@ -47,7 +47,7 @@ returns
} }
# destory old session if needed # destory old session if needed
if File::exist?( path ) if File.exist?( path )
Sessions.destory(client_id) Sessions.destory(client_id)
end end
@ -82,7 +82,7 @@ returns
path = "#{@path}/" path = "#{@path}/"
# just make sure that spool path exists # just make sure that spool path exists
if !File::exist?( path ) if !File.exist?( path )
FileUtils.mkpath path FileUtils.mkpath path
end end
@ -293,7 +293,7 @@ returns
check = true check = true
count = 0 count = 0
while check while check
if File::exist?( path + filename ) if File.exist?( path + filename )
count += 1 count += 1
filename = "#{filename}-#{count}" filename = "#{filename}-#{count}"
else else
@ -445,7 +445,7 @@ returns
} }
files.sort.each {|entry| files.sort.each {|entry|
filename = "#{path}/#{entry}" filename = "#{path}/#{entry}"
next if !File::exist?( filename ) next if !File.exist?( filename )
File.open( filename, 'rb' ) { |file| File.open( filename, 'rb' ) { |file|
all = file.read all = file.read
spool = JSON.parse( all ) spool = JSON.parse( all )
@ -500,7 +500,7 @@ returns
def self.jobs def self.jobs
# just make sure that spool path exists # just make sure that spool path exists
if !File::exist?( @path ) if !File.exist?( @path )
FileUtils.mkpath @path FileUtils.mkpath @path
end end