Browse Source

Fixed rubocop checks.

Martin Edenhofer 9 years ago
parent
commit
e1aae93269

+ 0 - 2
.gitignore

@@ -25,8 +25,6 @@
 # Ignore local database settings
 /config/database.yml
 
-Gemfile.lock
-
 # Ignore mac stuff
 .DS_Store
 

+ 1 - 1
app/models/organization/search.rb

@@ -68,7 +68,7 @@ returns
 
       # fallback do sql query
       # - stip out * we already search for *query* -
-      query.gsub! '*', ''
+      query.delete! '*', ''
       organizations = Organization.where(
         'name LIKE ? OR note LIKE ?', "%#{query}%", "%#{query}%"
       ).order('name').limit(limit)

+ 1 - 1
app/models/ticket/search.rb

@@ -146,7 +146,7 @@ returns
     # do query
     # - stip out * we already search for *query* -
     if query
-      query.gsub! '*', ''
+      query.delete! '*', ''
       tickets_all = Ticket.select('DISTINCT(tickets.id)')
                     .where(access_condition)
                     .where( '( `tickets`.`title` LIKE ? OR `tickets`.`number` LIKE ? OR `ticket_articles`.`body` LIKE ? OR `ticket_articles`.`from` LIKE ? OR `ticket_articles`.`to` LIKE ? OR `ticket_articles`.`subject` LIKE ?)', "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%", "%#{query}%" )

+ 1 - 1
app/models/user/search.rb

@@ -68,7 +68,7 @@ returns
 
       # fallback do sql query
       # - stip out * we already search for *query* -
-      query.gsub! '*', ''
+      query.delete! '*', ''
       if params[:role_ids]
         users = User.joins(:roles).where( 'roles.id' => params[:role_ids] ).where(
           '(users.firstname LIKE ? or users.lastname LIKE ? or users.email LIKE ?) AND users.id != 1', "%#{query}%", "%#{query}%", "%#{query}%",

+ 0 - 4
lib/calendar_subscriptions/tickets.rb

@@ -120,10 +120,8 @@ class CalendarSubscriptions::Tickets
 
       translated_state = Translation.translate(user_locale, ticket.state.name)
 
-      # rubocop:disable Rails/TimeZone
       event_data[:dtstart]     = Icalendar::Values::DateTime.new( pending_time )
       event_data[:dtend]       = Icalendar::Values::DateTime.new( pending_time )
-      # rubocop:enable Rails/TimeZone
       event_data[:summary]     = "#{translated_state} #{translated_ticket}: '#{ticket.title}'"
       event_data[:description] = "T##{ticket.number}"
 
@@ -162,10 +160,8 @@ class CalendarSubscriptions::Tickets
         escalation_time = Time.zone.today
       end
 
-      # rubocop:disable Rails/TimeZone
       event_data[:dtstart]     = Icalendar::Values::DateTime.new( escalation_time )
       event_data[:dtend]       = Icalendar::Values::DateTime.new( escalation_time )
-      # rubocop:enable Rails/TimeZone
       event_data[:summary]     = "#{translated_ticket_escalation}: '#{ticket.title}'"
       event_data[:description] = "T##{ticket.number}"
 

+ 0 - 2
lib/sessions.rb

@@ -1,5 +1,3 @@
-# rubocop:disable Rails/TimeZone
-
 require 'json'
 require 'session_helper'
 

+ 1 - 1
lib/sessions/backend/collections/base.rb

@@ -1,7 +1,7 @@
 class Sessions::Backend::Collections::Base
   class << self; attr_accessor :model, :roles, :not_roles end
 
-  def initialize( user, client = nil, client_id = nil, ttl )
+  def initialize( user, client, client_id, ttl )
     @user        = user
     @client      = client
     @client_id   = client_id

+ 4 - 4
lib/time_calculation.rb

@@ -23,10 +23,10 @@ put working hours matrix and timezone in function, returns UTC working hours mat
     if timezone
       begin
         time_diff = Time.zone.parse(start_time.to_s).in_time_zone(timezone).utc_offset
-     rescue => e
-       Rails.logger.error "Can't fine tomezone #{timezone}"
-       Rails.logger.error e.inspect
-       Rails.logger.error e.backtrace
+      rescue => e
+        Rails.logger.error "Can't fine tomezone #{timezone}"
+        Rails.logger.error e.inspect
+        Rails.logger.error e.backtrace
       end
     end
     beginning_of_workday = Time.zone.parse("1977-10-27 #{config['beginning_of_workday']}")

+ 2 - 1
lib/user_agent.rb

@@ -402,7 +402,8 @@ returns
     end
 
     def success?
-      @success
+      return true if @success
+      false
     end
   end
 end

+ 0 - 1
script/websocket-server.rb

@@ -1,6 +1,5 @@
 #!/usr/bin/env ruby
 # Copyright (C) 2012-2013 Zammad Foundation, http://zammad-foundation.org/
-# rubocop:disable Rails/TimeZone
 
 $LOAD_PATH << './lib'
 require 'rubygems'