Merge branch 'develop' of github.com:martini/zammad into develop

This commit is contained in:
Martin Edenhofer 2015-05-04 20:58:42 +02:00
commit 700616f5e2
10 changed files with 116 additions and 31 deletions

View file

@ -1,12 +1,16 @@
AllCops:
RunRailsCops: true
# Default enabled
# Default enabled cops
# https://github.com/bbatsov/rubocop/blob/master/config/enabled.yml
# TODO:
# https://github.com/bbatsov/rubocop#includingexcluding-files
AllCops:
RunRailsCops: true
Exclude:
- 'bin/rails'
- 'bin/rake'
- 'bin/spring'
- 'db/schema.rb'
Metrics/LineLength:
Description: 'Limit lines to 80 characters.'
@ -131,7 +135,6 @@ Style/SelfAssignment:
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
Enabled: false
# [Corrected] Redundant curly braces around a hash parameter.
Style/BracesAroundHashParameters:
Description: 'Enforce braces style around hash parameters.'
Enabled: false
@ -141,10 +144,7 @@ Rails/FindEach:
Enabled: false
# TODO
Style/Documentation:
Description: 'Document classes and non-namespace modules.'
@ -202,3 +202,88 @@ Metrics/AbcSize:
A calculated magnitude based on number of assignments,
branches, and conditions.
Enabled: false
Style/RedundantSelf:
Enabled: false
Style/Next:
Enabled: false
Rails/Output:
Enabled: false
Lint/UselessAccessModifier:
Enabled: false
Style/CommentIndentation:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false
Lint/StringConversionInInterpolation:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
Style/FileName:
Enabled: false
Style/GlobalVars:
Enabled: false
Rails/TimeZone:
Enabled: false
Rails/TimeZone:
Enabled: false
Metrics/BlockNesting:
Enabled: false
Lint/RescueException:
Enabled: false
Style/EachWithObject:
Enabled: false
Style/PredicateName:
Enabled: false
Style/ClassVars:
Enabled: false
Lint/LiteralInCondition:
Enabled: false
Style/PredicateName:
Enabled: false
Style/SpaceBeforeComment:
Enabled: false
Lint/UselessAssignment:
Enabled: false
Lint/NonLocalExitFromIterator:
Enabled: false
Style/ColonMethodCall:
Enabled: false
Rails/Date:
Enabled: false
Style/VariableName:
Enabled: false
Lint/UnreachableCode:
Enabled: false
Lint/ShadowingOuterLocalVariable:
Enabled: false
Style/InfiniteLoop:
Enabled: false
Lint/AmbiguousRegexpLiteral:
Enabled: false
Rails/Validation:
Enabled: false
Style/MultilineOperationIndentation:
Enabled: false
Style/OneLineConditional:
Enabled: false
Style/ClassMethods:
Enabled: false
Lint/Eval:
Enabled: false
Rails/HasAndBelongsToMany:
Enabled: false
Style/MethodName:
Enabled: false
Style/ModuleFunction:
Enabled: false
Style/AccessModifierIndentation:
Enabled: false
Lint/Loop:
Enabled: false
Style/For:
Enabled: false
Style/WhileUntilDo:
Enabled: false

View file

@ -93,7 +93,7 @@ class ImportOtrsController < ApplicationController
def import_status
return if setup_done_response
state = Import::OTRS2.get_current_state
state = Import::OTRS2.current_state
render json: {
data: state,

View file

@ -116,7 +116,7 @@ class Scheduler < ApplicationModel
sleep(wait)
logger.info '*** worker loop'
else
printf "*** #{count} jobs processed at %.4f j/s, %d failed ...\n" % [count / realtime, result.last]
format "*** #{count} jobs processed at %.4f j/s, %d failed ...\n", count / realtime, result.last
end
end
end

View file

@ -33,7 +33,7 @@ module Ticket::Number::Date
end
system_id = Setting.get('system_id') || ''
number = t.strftime('%Y%m%d') + system_id.to_s + sprintf( '%04d', counter_increment)
number = t.strftime('%Y%m%d') + system_id.to_s + format('%04d', counter_increment)
# calculate a checksum
# The algorithm to calculate the checksum is derived from the one

View file

@ -2,7 +2,7 @@ Rails.application.config.middleware.use OmniAuth::Builder do
# twitter database connect
provider :twitter_database, 'not_change_will_be_set_by_databse', 'not_change_will_be_set_by_databse',
client_options: { authorize_path: '/oauth/authorize', site: 'https://api.twitter.com' }
client_options: { authorize_path: '/oauth/authorize', site: 'https://api.twitter.com' }
# facebook database connect
provider :facebook_database, 'not_change_will_be_set_by_databse', 'not_change_will_be_set_by_databse'
@ -12,6 +12,6 @@ Rails.application.config.middleware.use OmniAuth::Builder do
# google database connect
provider :google_oauth2_database, 'not_change_will_be_set_by_databse', 'not_change_will_be_set_by_databse',
authorize_options: { access_type: 'online', approval_prompt: '' }
authorize_options: { access_type: 'online', approval_prompt: '' }
end

View file

@ -167,7 +167,7 @@ module Import::OTRS
threads[thread].join
}
end
end
def self.diff_worker
return if !Setting.get('import_mode')

View file

@ -212,9 +212,9 @@ module Import::OTRS2
=begin
get object statisitic from server ans save it in cache
get object statistic from server ans save it in cache
result = get_statisitic('Subaction=List')
result = statistic('Subaction=List')
return
@ -226,7 +226,7 @@ module Import::OTRS2
=end
def self.get_statisitic
def self.statistic
# check cache
cache = Cache.get('import_otrs_stats')
@ -246,7 +246,7 @@ module Import::OTRS2
return current import state
result = get_current_state
result = current_state
return
@ -263,8 +263,8 @@ module Import::OTRS2
=end
def self.get_current_state
data = self.get_statisitic
def self.current_state
data = self.statistic
base = Group.count + Ticket::State.count + Ticket::Priority.count
base_total = data['Queue'] + data['State'] + data['Priority']
user = User.count

View file

@ -77,8 +77,8 @@ class TestCase < Test::Unit::TestCase
def screenshot(params)
instance = params[:browser] || @browser
comment = params[:comment] || ''
filename = "tmp/#{Time.zone.now.strftime("screenshot_%Y_%m_%d__%H_%M_%S")}_#{comment}_#{instance.hash}.png"
log('screenshot', {filename: filename})
filename = "tmp/#{Time.zone.now.strftime('screenshot_%Y_%m_%d__%H_%M_%S')}_#{comment}_#{instance.hash}.png"
log('screenshot', { filename: filename })
instance.save_screenshot(filename)
end

View file

@ -45,12 +45,12 @@ class ActiveSupport::TestCase
puts 'teardown'
# check if jobs are proccessed
if !Delayed::Job.all.empty?
Delayed::Job.where('failed_at != NULL').each {|job|
assert( false, "not processable job #{jobs.inspect}" )
}
Delayed::Job.all.destroy_all
end
return if Delayed::Job.all.empty?
Delayed::Job.where('failed_at != NULL').each {|job|
assert( false, "not processable job #{jobs.inspect}" )
}
Delayed::Job.all.destroy_all
end
# Add more helper methods to be used by all tests here...

View file

@ -6,8 +6,8 @@ class TwitterDatabase < OmniAuth::Strategies::Twitter
# database lookup
# puts 'TwitterDatabase -> initialize'
config = Setting.get('auth_twitter_credentials') || {}
args[0] = config['key']
args[1] = config['secret']
args[0] = config['key']
args[1] = config['secret']
super
end