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: # Default enabled cops
RunRailsCops: true
# Default enabled
# https://github.com/bbatsov/rubocop/blob/master/config/enabled.yml # https://github.com/bbatsov/rubocop/blob/master/config/enabled.yml
# TODO: # TODO:
# https://github.com/bbatsov/rubocop#includingexcluding-files # https://github.com/bbatsov/rubocop#includingexcluding-files
AllCops:
RunRailsCops: true
Exclude:
- 'bin/rails'
- 'bin/rake'
- 'bin/spring'
- 'db/schema.rb'
Metrics/LineLength: Metrics/LineLength:
Description: 'Limit lines to 80 characters.' Description: 'Limit lines to 80 characters.'
@ -131,7 +135,6 @@ Style/SelfAssignment:
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment' StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
Enabled: false Enabled: false
# [Corrected] Redundant curly braces around a hash parameter.
Style/BracesAroundHashParameters: Style/BracesAroundHashParameters:
Description: 'Enforce braces style around hash parameters.' Description: 'Enforce braces style around hash parameters.'
Enabled: false Enabled: false
@ -141,10 +144,7 @@ Rails/FindEach:
Enabled: false Enabled: false
# TODO
Style/Documentation: Style/Documentation:
Description: 'Document classes and non-namespace modules.' Description: 'Document classes and non-namespace modules.'
@ -202,3 +202,88 @@ Metrics/AbcSize:
A calculated magnitude based on number of assignments, A calculated magnitude based on number of assignments,
branches, and conditions. branches, and conditions.
Enabled: false 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 def import_status
return if setup_done_response return if setup_done_response
state = Import::OTRS2.get_current_state state = Import::OTRS2.current_state
render json: { render json: {
data: state, data: state,

View file

@ -116,7 +116,7 @@ class Scheduler < ApplicationModel
sleep(wait) sleep(wait)
logger.info '*** worker loop' logger.info '*** worker loop'
else 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 end
end end

View file

@ -33,7 +33,7 @@ module Ticket::Number::Date
end end
system_id = Setting.get('system_id') || '' 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 # calculate a checksum
# The algorithm to calculate the checksum is derived from the one # 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 # twitter database connect
provider :twitter_database, 'not_change_will_be_set_by_databse', 'not_change_will_be_set_by_databse', 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 # facebook database connect
provider :facebook_database, 'not_change_will_be_set_by_databse', 'not_change_will_be_set_by_databse' 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 # google database connect
provider :google_oauth2_database, 'not_change_will_be_set_by_databse', 'not_change_will_be_set_by_databse', 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 end

View file

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

View file

@ -212,9 +212,9 @@ module Import::OTRS2
=begin =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 return
@ -226,7 +226,7 @@ module Import::OTRS2
=end =end
def self.get_statisitic def self.statistic
# check cache # check cache
cache = Cache.get('import_otrs_stats') cache = Cache.get('import_otrs_stats')
@ -246,7 +246,7 @@ module Import::OTRS2
return current import state return current import state
result = get_current_state result = current_state
return return
@ -263,8 +263,8 @@ module Import::OTRS2
=end =end
def self.get_current_state def self.current_state
data = self.get_statisitic data = self.statistic
base = Group.count + Ticket::State.count + Ticket::Priority.count base = Group.count + Ticket::State.count + Ticket::Priority.count
base_total = data['Queue'] + data['State'] + data['Priority'] base_total = data['Queue'] + data['State'] + data['Priority']
user = User.count user = User.count

View file

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

View file

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