Browse Source

Maintenance: Activated rubocop rule Layout/ExtraSpacing.

Thorsten Eckel 4 years ago
parent
commit
9d4aff5eb0

+ 8 - 0
.rubocop.yml

@@ -139,6 +139,14 @@ Layout/EmptyLinesAroundModuleBody:
   Description: "Keeps track of empty lines around module bodies."
   Enabled: false
 
+Layout/ExtraSpacing:
+  Description: 'Do not use unnecessary spacing.'
+  Enabled: true
+  Exclude:
+    - 'config/routes/**/*'
+    - 'db/migrate/20120101000001_create_base.rb'
+    - 'db/migrate/20120101000010_create_ticket.rb'
+
 Style/MultilineBlockChain:
   Description: 'Avoid multi-line chains of blocks.'
   StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'

+ 0 - 6
.rubocop_todo.yml

@@ -6,12 +6,6 @@
 # Note that changes in the inspected code, or installation of new
 # versions of RuboCop, may require this file to be generated again.
 
-# Offense count: 163
-# Cop supports --auto-correct.
-# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
-Layout/ExtraSpacing:
-  Enabled: false
-
 # Offense count: 8
 # Configuration parameters: MaximumRangeSize.
 Lint/MissingCopEnableDirective:

+ 2 - 2
app/jobs/checks_kb_client_notification_job.rb

@@ -53,9 +53,9 @@ class ChecksKbClientNotificationJob < ApplicationJob
       .sessions
       .map { |client_id| Sessions.get(client_id)&.dig(:user, 'id') }
       .compact
-      .map { |user_id|   User.find_by(id: user_id) }
+      .map { |user_id| User.find_by(id: user_id) }
       .compact
-      .select   { |user|      user.permissions? "knowledge_base.#{permission_suffix}" }
+      .select { |user| user.permissions? "knowledge_base.#{permission_suffix}" }
   end
 
   def self.notify_later(object, event)

+ 1 - 1
app/jobs/ticket_article_communicate_email_job.rb

@@ -12,7 +12,7 @@ class TicketArticleCommunicateEmailJob < ApplicationJob
 
     subject_prefix_mode = record.preferences[:subtype]
 
-    subject = ticket.subject_build(record.subject,  subject_prefix_mode)
+    subject = ticket.subject_build(record.subject, subject_prefix_mode)
 
     # set retry count
     record.preferences['delivery_retry'] ||= 0

+ 1 - 1
app/models/application_model/can_creates_and_updates.rb

@@ -163,7 +163,7 @@ returns
 
         # do lookup with == to handle case insensitive databases
         records = if Rails.application.config.db_case_sensitive
-                    where('LOWER(email) = LOWER(?)',  data[:email])
+                    where('LOWER(email) = LOWER(?)', data[:email])
                   else
                     where(email: data[:email])
                   end

+ 2 - 2
app/models/application_model/can_lookup.rb

@@ -48,8 +48,8 @@ returns
 
     def find_and_save_to_cache_by(attr)
       record = find_by(attr)
-      return nil if string_key?(attr.keys.first) && (record&.send(attr.keys.first) != attr.values.first)  # enforce case-sensitivity on MySQL
-      return record if ActiveRecord::Base.connection.transaction_open?  # rollbacks can invalidate cache entries
+      return nil if string_key?(attr.keys.first) && (record&.send(attr.keys.first) != attr.values.first) # enforce case-sensitivity on MySQL
+      return record if ActiveRecord::Base.connection.transaction_open? # rollbacks can invalidate cache entries
 
       cache_set(attr.values.first, record)
       record

+ 1 - 1
app/models/email_address.rb

@@ -4,7 +4,7 @@ class EmailAddress < ApplicationModel
   include ChecksLatestChangeObserved
   include HasCollectionUpdate
 
-  has_many        :groups,   after_add: :cache_update, after_remove: :cache_update
+  has_many        :groups, after_add: :cache_update, after_remove: :cache_update
   belongs_to      :channel, optional: true
   validates       :realname, presence: true
   validates       :email,    presence: true

+ 1 - 1
app/models/karma/activity.rb

@@ -2,5 +2,5 @@
 
 class Karma::Activity < ApplicationModel
   self.table_name = 'karma_activities'
-  validates :name,      presence: true
+  validates :name, presence: true
 end

+ 1 - 1
app/models/knowledge_base/answer.rb

@@ -10,7 +10,7 @@ class KnowledgeBase::Answer < ApplicationModel
   AGENT_ALLOWED_ATTRIBUTES       = %i[category_id promoted internal_note].freeze
   AGENT_ALLOWED_NESTED_RELATIONS = %i[translations].freeze
 
-  belongs_to :category, class_name: 'KnowledgeBase::Category',                  inverse_of: :answers,  touch: true
+  belongs_to :category, class_name: 'KnowledgeBase::Category', inverse_of: :answers, touch: true
 
   scope :include_contents, -> { eager_load(translations: :content) }
   scope :sorted,           -> { order(position: :asc) }

+ 1 - 1
app/models/knowledge_base/answer/translation.rb

@@ -16,7 +16,7 @@ class KnowledgeBase::Answer::Translation < ApplicationModel
   belongs_to                    :content, class_name: 'KnowledgeBase::Answer::Translation::Content', inverse_of: :translation, dependent: :destroy
   accepts_nested_attributes_for :content, update_only: true
 
-  validates :title,        presence: true,            length: { maximum: 250 }
+  validates :title,        presence: true, length: { maximum: 250 }
   validates :content,      presence: true
   validates :kb_locale_id, uniqueness: { scope: :answer_id }
 

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