Corrected with rubocop cop 'Style/ClassVars'.

This commit is contained in:
Thorsten Eckel 2015-05-08 15:47:27 +02:00
parent a4ebf8ab9b
commit 8b822a7ddc
10 changed files with 17 additions and 11 deletions

View file

@ -187,7 +187,5 @@ Style/Documentation:
Lint/RescueException: Lint/RescueException:
Enabled: false Enabled: false
Style/ClassVars:
Enabled: false
Lint/UselessAssignment: Lint/UselessAssignment:
Enabled: false Enabled: false

View file

@ -41,12 +41,13 @@ class ApplicationModel < ActiveRecord::Base
attr_accessor :history_changes_last_done attr_accessor :history_changes_last_done
@@import_class_list = ['Ticket', 'Ticket::Article', 'History', 'Ticket::State', 'Ticket::StateType', 'Ticket::Priority', 'Group', 'User', 'Role' ]
def check_attributes_protected def check_attributes_protected
import_class_list = ['Ticket', 'Ticket::Article', 'History', 'Ticket::State', 'Ticket::StateType', 'Ticket::Priority', 'Group', 'User', 'Role' ]
# do noting, use id as it is # do noting, use id as it is
return if !Setting.get('system_init_done') || ( Setting.get('import_mode') && @@import_class_list.include?( self.class.to_s ) ) return if !Setting.get('system_init_done')
return if Setting.get('import_mode') && import_class_list.include?( self.class.to_s )
self[:id] = nil self[:id] = nil
end end

View file

@ -11,9 +11,11 @@ class History < ApplicationModel
# before_validation :check_type, :check_object # before_validation :check_type, :check_object
# attr_writer :history_type, :history_object # attr_writer :history_type, :history_object
# rubocop:disable Style/ClassVars
@@cache_type = {} @@cache_type = {}
@@cache_object = {} @@cache_object = {}
@@cache_attribute = {} @@cache_attribute = {}
# rubocop:enable Style/ClassVars
=begin =begin

View file

@ -1,7 +1,7 @@
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class ObjectLookup < ApplicationModel class ObjectLookup < ApplicationModel
@@cache_object = {} @@cache_object = {} # rubocop:disable Style/ClassVars
def self.by_id( id ) def self.by_id( id )

View file

@ -2,7 +2,7 @@
require 'rexml/document' require 'rexml/document'
class Package < ApplicationModel class Package < ApplicationModel
@@root = Rails.root.to_s @@root = Rails.root.to_s # rubocop:disable Style/ClassVars
# build package based on .szpm # build package based on .szpm
# Package.build( # Package.build(
@ -437,7 +437,7 @@ class Package < ApplicationModel
end end
class Migration < ApplicationModel class Migration < ApplicationModel
@@root = Rails.root.to_s @@root = Rails.root.to_s # rubocop:disable Style/ClassVars
def self.migrate( package, direction = 'normal' ) def self.migrate( package, direction = 'normal' )
location = @@root + '/db/addon/' + package.underscore location = @@root + '/db/addon/' + package.underscore

View file

@ -9,7 +9,7 @@ class Setting < ApplicationModel
after_create :delete_cache after_create :delete_cache
after_update :delete_cache after_update :delete_cache
@@current = {} @@current = {} # rubocop:disable Style/ClassVars
def self.load def self.load

View file

@ -4,8 +4,10 @@ class Tag < ApplicationModel
belongs_to :tag_object, class_name: 'Tag::Object' belongs_to :tag_object, class_name: 'Tag::Object'
belongs_to :tag_item, class_name: 'Tag::Item' belongs_to :tag_item, class_name: 'Tag::Item'
# rubocop:disable Style/ClassVars
@@cache_item = {} @@cache_item = {}
@@cache_object = {} @@cache_object = {}
# rubocop:enable Style/ClassVars
def self.tag_add(data) def self.tag_add(data)

View file

@ -1,7 +1,7 @@
# Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/ # Copyright (C) 2012-2014 Zammad Foundation, http://zammad-foundation.org/
class TypeLookup < ApplicationModel class TypeLookup < ApplicationModel
@@cache_object = {} @@cache_object = {} # rubocop:disable Style/ClassVars
def self.by_id( id ) def self.by_id( id )

View file

@ -13,7 +13,7 @@ module Sessions
@path = "#{@root}/tmp/websocket" @path = "#{@root}/tmp/websocket"
# create global vars for threads # create global vars for threads
@@client_threads = {} @@client_threads = {} # rubocop:disable Style/ClassVars
=begin =begin

View file

@ -1,8 +1,11 @@
module Sessions::CacheIn module Sessions::CacheIn
# rubocop:disable Style/ClassVars
@@data = {} @@data = {}
@@data_time = {} @@data_time = {}
@@expires_in = {} @@expires_in = {}
@@expires_in_ttl = {} @@expires_in_ttl = {}
# rubocop:enable Style/ClassVars
def self.delete( key ) def self.delete( key )
@@data.delete( key ) @@data.delete( key )