diff --git a/.rubocop.yml b/.rubocop.yml index 36ac3d1f7..3b8a84515 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -252,8 +252,6 @@ Lint/UselessAssignment: Enabled: false Lint/NonLocalExitFromIterator: Enabled: false -Style/ColonMethodCall: - Enabled: false Rails/Date: Enabled: false Lint/UnreachableCode: diff --git a/app/controllers/getting_started_controller.rb b/app/controllers/getting_started_controller.rb index f9cffaad5..6ad348a94 100644 --- a/app/controllers/getting_started_controller.rb +++ b/app/controllers/getting_started_controller.rb @@ -891,7 +891,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} begin mxs = Resolv::DNS.open do |dns| 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 rescue Exception => e logger.error e.message diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 75acdd1d7..ae1eb22b1 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -34,13 +34,13 @@ class SessionsController < ApplicationController user.activity_stream_log( 'session started', user.id, true ) # auto population of default collections - collections, assets = SessionHelper::default_collections(user) + collections, assets = SessionHelper.default_collections(user) # add session user assets assets = user.assets(assets) # get models - models = SessionHelper::models(user) + models = SessionHelper.models(user) # check logon session logon_session_key = nil @@ -76,7 +76,7 @@ class SessionsController < ApplicationController # check logon session if params['logon_session'] - session = SessionHelper::get( params['logon_session'] ) + session = SessionHelper.get( params['logon_session'] ) if session user_id = session.data[:user_id] end @@ -84,7 +84,7 @@ class SessionsController < ApplicationController if !user_id # get models - models = SessionHelper::models() + models = SessionHelper.models() render json: { error: 'no valid session', @@ -102,13 +102,13 @@ class SessionsController < ApplicationController user = User.find( user_id ) # auto population of default collections - collections, assets = SessionHelper::default_collections(user) + collections, assets = SessionHelper.default_collections(user) # add session user assets assets = user.assets(assets) # get models - models = SessionHelper::models(user) + models = SessionHelper.models(user) # return current session render json: { @@ -278,7 +278,7 @@ class SessionsController < ApplicationController def delete return if deny_if_not_role(Z_ROLENAME_ADMIN) - SessionHelper::destroy( params[:id] ) + SessionHelper.destroy( params[:id] ) render json: {} end diff --git a/lib/geo_ip/zammad_geo_ip.rb b/lib/geo_ip/zammad_geo_ip.rb index 9259ae35e..8fb1285c0 100644 --- a/lib/geo_ip/zammad_geo_ip.rb +++ b/lib/geo_ip/zammad_geo_ip.rb @@ -12,7 +12,7 @@ class GeoIp::ZammadGeoIp # do lookup host = 'https://geo.zammad.com' - url = "/lookup?ip=#{CGI::escape address}" + url = "/lookup?ip=#{CGI.escape address}" data = {} begin response = UserAgent.get( diff --git a/lib/geo_location/gmaps.rb b/lib/geo_location/gmaps.rb index a96b32a8e..59a61ec1a 100644 --- a/lib/geo_location/gmaps.rb +++ b/lib/geo_location/gmaps.rb @@ -3,7 +3,7 @@ class GeoLocation::Gmaps 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) return if !response.success? diff --git a/lib/import/otrs.rb b/lib/import/otrs.rb index af8735a98..220a3f2d2 100644 --- a/lib/import/otrs.rb +++ b/lib/import/otrs.rb @@ -211,7 +211,7 @@ module Import::OTRS def self.ticket(ticket_ids) url = 'public.pl?Action=Export;Type=Ticket;' ticket_ids.each {|ticket_id| - url = url + "TicketID=#{CGI::escape ticket_id};" + url = url + "TicketID=#{CGI.escape ticket_id};" } response = request( url ) return if !response diff --git a/lib/sessions.rb b/lib/sessions.rb index a40482698..2568f5a63 100644 --- a/lib/sessions.rb +++ b/lib/sessions.rb @@ -47,7 +47,7 @@ returns } # destory old session if needed - if File::exist?( path ) + if File.exist?( path ) Sessions.destory(client_id) end @@ -82,7 +82,7 @@ returns path = "#{@path}/" # just make sure that spool path exists - if !File::exist?( path ) + if !File.exist?( path ) FileUtils.mkpath path end @@ -293,7 +293,7 @@ returns check = true count = 0 while check - if File::exist?( path + filename ) + if File.exist?( path + filename ) count += 1 filename = "#{filename}-#{count}" else @@ -445,7 +445,7 @@ returns } files.sort.each {|entry| filename = "#{path}/#{entry}" - next if !File::exist?( filename ) + next if !File.exist?( filename ) File.open( filename, 'rb' ) { |file| all = file.read spool = JSON.parse( all ) @@ -500,7 +500,7 @@ returns def self.jobs # just make sure that spool path exists - if !File::exist?( @path ) + if !File.exist?( @path ) FileUtils.mkpath @path end