Maintenance: Applied rubocop Performance/Casecmp.

This commit is contained in:
Thorsten Eckel 2019-09-05 15:51:13 +02:00
parent f50c079df9
commit 9c76def19d
4 changed files with 3 additions and 11 deletions

View file

@ -47,14 +47,6 @@ Metrics/ModuleLength:
Metrics/PerceivedComplexity:
Max: 115
# Offense count: 3
# Cop supports --auto-correct.
Performance/Casecmp:
Exclude:
- 'app/models/channel/email_parser.rb'
- 'app/models/channel/filter/database.rb'
- 'lib/tasks/zammad/setup/db_config.rake'
# Offense count: 3
# Cop supports --auto-correct.
Rails/ApplicationRecord:

View file

@ -331,7 +331,7 @@ returns
end
return true if !class_name
if class_name.downcase == 'article'
if class_name.casecmp('article').zero?
class_name = 'Ticket::Article'
end
return true if !attribute

View file

@ -48,7 +48,7 @@ module Channel::Filter::Database
Rails.logger.info " perform '#{key.downcase}' = '#{meta.inspect}'"
if key.downcase == 'x-zammad-ticket-tags' && meta['value'].present? && meta['operator'].present?
if key.casecmp('x-zammad-ticket-tags').zero? && meta['value'].present? && meta['operator'].present?
mail[ 'x-zammad-ticket-tags'.downcase.to_sym ] ||= []
tags = meta['value'].split(',')

View file

@ -15,7 +15,7 @@ namespace :zammad do
next if FileUtils.identical?(template, destination)
printf 'config/database.yml: File exists. Overwrite? [y/N] '
next if STDIN.gets.chomp.downcase != 'y'
next if !STDIN.gets.chomp.casecmp('y').zero?
end
FileUtils.cp(template, destination)