Fixed rubocop checks.

This commit is contained in:
Martin Edenhofer 2015-08-22 00:40:32 +02:00
parent 21aa91969b
commit e1aae93269
10 changed files with 10 additions and 18 deletions

2
.gitignore vendored
View file

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

View file

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

View file

@ -146,7 +146,7 @@ returns
# do query # do query
# - stip out * we already search for *query* - # - stip out * we already search for *query* -
if query if query
query.gsub! '*', '' query.delete! '*', ''
tickets_all = Ticket.select('DISTINCT(tickets.id)') tickets_all = Ticket.select('DISTINCT(tickets.id)')
.where(access_condition) .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}%" ) .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}%" )

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
class Sessions::Backend::Collections::Base class Sessions::Backend::Collections::Base
class << self; attr_accessor :model, :roles, :not_roles end 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 @user = user
@client = client @client = client
@client_id = client_id @client_id = client_id

View file

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

View file

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

View file

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