Browse Source

Moved to rubocop Style/NumericLiterals.

Martin Edenhofer 10 years ago
parent
commit
a299f79598

+ 1 - 1
app/controllers/getting_started_controller.rb

@@ -609,7 +609,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password}
 
     # send verify email to inbox
     if !params[:subject]
-      subject = '#' + rand(99999999999).to_s
+      subject = '#' + rand(99_999_999_999).to_s
     else
       subject = params[:subject]
     end

+ 1 - 1
app/controllers/long_polling_controller.rb

@@ -149,7 +149,7 @@ class LongPollingController < ApplicationController
   private
 
   def client_id_gen
-    rand(9999999999).to_s
+    rand(9_999_999_999).to_s
   end
 
   def client_id_verify

+ 1 - 1
app/controllers/sessions_controller.rb

@@ -45,7 +45,7 @@ class SessionsController < ApplicationController
     # check logon session
     logon_session_key = nil
     if params['logon_session']
-      logon_session_key = Digest::MD5.hexdigest( rand(999999).to_s + Time.new.to_s )
+      logon_session_key = Digest::MD5.hexdigest( rand(999_999).to_s + Time.new.to_s )
       #      session = ActiveRecord::SessionStore::Session.create(
       #        :session_id => logon_session_key,
       #        :data => {

+ 1 - 1
app/models/observer/ticket/article/fillup_from_email.rb

@@ -28,7 +28,7 @@ class Observer::Ticket::Article::FillupFromEmail < ActiveRecord::Observer
 
     # generate message id
     fqdn = Setting.get('fqdn')
-    record.message_id = '<' + DateTime.current.to_s(:number) + '.' + record.ticket_id.to_s + '.' + rand(999999).to_s() + '@' + fqdn + '>'
+    record.message_id = '<' + DateTime.current.to_s(:number) + '.' + record.ticket_id.to_s + '.' + rand(999_999).to_s() + '@' + fqdn + '>'
 
     # set sender
     email_address = ticket.group.email_address

+ 7 - 7
app/models/store.rb

@@ -57,8 +57,8 @@ returns
 get attachment of object
 
   list = Store.list(
-    :object       => 'Ticket::Article',
-    :o_id         => 4711,
+    :object => 'Ticket::Article',
+    :o_id   => 4711,
   )
 
 returns
@@ -66,9 +66,9 @@ returns
   result = [store1, store2]
 
   store1 = {
-    :size         => 94123,
-    :filename     => 'image.png',
-    :preferences  => {
+    :size        => 94123,
+    :filename    => 'image.png',
+    :preferences => {
       :content_type => 'image/png',
       :content_id   => 234,
     }
@@ -90,8 +90,8 @@ returns
 remove attachments of object from storage
 
   result = Store.remove(
-    :object       => 'Ticket::Article',
-    :o_id         => 4711,
+    :object => 'Ticket::Article',
+    :o_id   => 4711,
   )
 
 returns

+ 1 - 1
config/environments/development.rb

@@ -34,7 +34,7 @@ Zammad::Application.configure do
   config.middleware.use(Rack::LiveReload,
     :min_delay        => 500,    # default 1000
     :max_delay        => 10_000, # default 60_000
-    :live_reload_port => 35738,
+    :live_reload_port => 35_738,
     :source => :vendored
   )
 

+ 2 - 2
db/migrate/20120101000020_create_network.rb

@@ -51,7 +51,7 @@ class CreateNetwork < ActiveRecord::Migration
     create_table :network_items do |t|
       t.references :network_category,                     :null => false
       t.column :title,                :string, :limit => 200,   :null => false
-      t.column :body,                 :string, :limit => 20000, :null => false
+      t.column :body,                 :string, :limit => 20_000, :null => false
       t.column :updated_by_id,        :integer,                 :null => false
       t.column :created_by_id,        :integer,                 :null => false
       t.timestamps
@@ -60,7 +60,7 @@ class CreateNetwork < ActiveRecord::Migration
 
     create_table :network_item_comments do |t|
       t.references :network_item,                               :null => false
-      t.column :body,                 :string, :limit => 20000, :null => false
+      t.column :body,                 :string, :limit => 20_000, :null => false
       t.column :updated_by_id,        :integer,               :null => false
       t.column :created_by_id,        :integer,               :null => false
       t.timestamps

+ 1 - 1
db/migrate/20140831000001_create_object_manager.rb

@@ -454,7 +454,7 @@ class CreateObjectManager < ActiveRecord::Migration
       :data_type  => 'richtext',
       :data_option => {
         :type      => 'richtext',
-        :maxlength => 20000,
+        :maxlength => 20_000,
         :upload    => true,
         :rows      => 8,
         :null      => true,

+ 7 - 7
lib/fill_db.rb

@@ -14,7 +14,7 @@ module FillDB
     organization_pool = []
     if organizations && !organizations.zero?
       (1..organizations).each {|count|
-        organization = Organization.create( :name => 'FillOrganization::' + rand(999999).to_s, :active => true )
+        organization = Organization.create( :name => 'FillOrganization::' + rand(999_999).to_s, :active => true )
         organization_pool.push organization
       }
     else
@@ -27,7 +27,7 @@ module FillDB
       roles  = Role.where( :name => [ 'Agent'] )
       groups_all = Group.all
       (1..agents).each {|count|
-        suffix = rand(99999).to_s
+        suffix = rand(99_999).to_s
         user = User.create_or_update(
           :login         => "filldb-agent-#{suffix}",
           :firstname     => "agent #{suffix}",
@@ -51,7 +51,7 @@ module FillDB
       roles  = Role.where( :name => [ 'Customer'] )
       groups_all = Group.all
       (1..customers).each {|count|
-        suffix = rand(99999).to_s
+        suffix = rand(99_999).to_s
         organization = nil
         if !organization_pool.empty? && rand(2) == 1
           organization = organization_pool[ organization_pool.length-1 ]
@@ -77,7 +77,7 @@ module FillDB
     if groups && !groups.zero?
       puts "1..#{groups}"
       (1..groups).each {|count|
-        group = Group.create( :name => 'FillGroup::' + rand(999999).to_s, :active => true )
+        group = Group.create( :name => 'FillGroup::' + rand(999_999).to_s, :active => true )
         group_pool.push group
         Role.where(:name => 'Agent').first.users.where(:active => true).each {|user|
           user_groups = user.groups
@@ -98,7 +98,7 @@ module FillDB
         customer = customer_pool[ rand(customer_pool.length-1) ]
         agent    = agent_pool[ rand(agent_pool.length-1) ]
         ticket = Ticket.create(
-          :title          => 'some title äöüß' + rand(999999).to_s,
+          :title          => 'some title äöüß' + rand(999_999).to_s,
           :group          => group_pool[ rand(group_pool.length-1) ],
           :customer       => customer,
           :owner          => agent,
@@ -112,8 +112,8 @@ module FillDB
           :ticket_id      => ticket.id,
           :from           => customer.email,
           :to             => 'some_recipient@example.com',
-          :subject        => 'some subject' + rand(999999).to_s,
-          :message_id     => 'some@id-' + rand(999999).to_s,
+          :subject        => 'some subject' + rand(999_999).to_s,
+          :message_id     => 'some@id-' + rand(999_999).to_s,
           :body           => 'some message ...',
           :internal       => false,
           :sender         => Ticket::Article::Sender.where(:name => 'Customer').first,

+ 1 - 1
lib/session_helper.rb

@@ -39,7 +39,7 @@ module SessionHelper
     ActiveRecord::SessionStore::Session.where( :id => id ).first
   end
 
-  def self.list(limit = 10000)
+  def self.list(limit = 10_000)
     ActiveRecord::SessionStore::Session.order('updated_at DESC').limit(limit)
   end
 

Some files were not shown because too many files changed in this diff