Browse Source

Updated rubocop(-* gems) to latest version (0.87.0).

Thorsten Eckel 4 years ago
parent
commit
b37e80df9a

+ 7 - 7
Gemfile.lock

@@ -451,24 +451,24 @@ GEM
       rspec-support (~> 3.8.0)
     rspec-support (3.8.0)
     rszr (0.5.2)
-    rubocop (0.86.0)
+    rubocop (0.87.0)
       parallel (~> 1.10)
-      parser (>= 2.7.0.1)
+      parser (>= 2.7.1.1)
       rainbow (>= 2.2.2, < 4.0)
       regexp_parser (>= 1.7)
       rexml
-      rubocop-ast (>= 0.0.3, < 1.0)
+      rubocop-ast (>= 0.1.0, < 1.0)
       ruby-progressbar (~> 1.7)
       unicode-display_width (>= 1.4.0, < 2.0)
-    rubocop-ast (0.0.3)
+    rubocop-ast (0.1.0)
       parser (>= 2.7.0.1)
-    rubocop-performance (1.6.1)
-      rubocop (>= 0.71.0)
+    rubocop-performance (1.7.0)
+      rubocop (>= 0.82.0)
     rubocop-rails (2.6.0)
       activesupport (>= 4.2.0)
       rack (>= 1.1)
       rubocop (>= 0.82.0)
-    rubocop-rspec (1.40.0)
+    rubocop-rspec (1.41.0)
       rubocop (>= 0.68.1)
     ruby-progressbar (1.10.1)
     ruby-saml (1.10.2)

+ 1 - 1
app/controllers/form_controller.rb

@@ -61,7 +61,7 @@ class FormController < ApplicationController
         Rails.logger.info "Can't verify email #{params[:email]}: #{message}"
 
         # ignore 450, graylistings
-        errors['email'] = message if !message.match?(/450/)
+        errors['email'] = message if !message.include?('450')
       end
     end
 

+ 1 - 1
app/controllers/import_otrs_controller.rb

@@ -39,7 +39,7 @@ class ImportOtrsController < ApplicationController
     end
 
     result = {}
-    if response.body.match?(/zammad migrator/)
+    if response.body.include?('zammad migrator')
 
       migrator_response = JSON.parse(response.body)
 

+ 1 - 2
app/helpers/knowledge_base_rich_text_helper.rb

@@ -22,9 +22,8 @@ module KnowledgeBaseRichTextHelper
       end
     end
 
-    parsed = Loofah.scrub_fragment(input, scrubber).to_s.html_safe # rubocop:disable Rails/OutputSafety
+    Loofah.scrub_fragment(input, scrubber).to_s.html_safe # rubocop:disable Rails/OutputSafety
 
-    parsed
   end
 
   def prepare_rich_text_videos(input)

+ 10 - 10
app/models/activity_stream.rb

@@ -112,16 +112,16 @@ return all activity entries of an user
     permission_ids = user.permissions_with_child_ids
     group_ids = user.group_ids_access('read')
 
-    stream = if group_ids.blank?
-               ActivityStream.where('(permission_id IN (?) AND group_id IS NULL)', permission_ids)
-                             .order(created_at: :desc)
-                             .limit(limit)
-             else
-               ActivityStream.where('(permission_id IN (?) AND (group_id IS NULL OR group_id IN (?))) OR (permission_id IS NULL AND group_id IN (?))', permission_ids, group_ids, group_ids)
-                             .order(created_at: :desc)
-                             .limit(limit)
-             end
-    stream
+    if group_ids.blank?
+      ActivityStream.where('(permission_id IN (?) AND group_id IS NULL)', permission_ids)
+                    .order(created_at: :desc)
+                    .limit(limit)
+    else
+      ActivityStream.where('(permission_id IN (?) AND (group_id IS NULL OR group_id IN (?))) OR (permission_id IS NULL AND group_id IN (?))', permission_ids, group_ids, group_ids)
+                    .order(created_at: :desc)
+                    .limit(limit)
+    end
+
   end
 
 =begin

+ 1 - 1
app/models/channel/driver/imap.rb

@@ -239,7 +239,7 @@ example
       timeout(FETCH_METADATA_TIMEOUT) do
         message_meta = @imap.fetch(message_id, ['RFC822.SIZE', 'ENVELOPE', 'FLAGS', 'INTERNALDATE', 'RFC822.HEADER'])[0]
       rescue Net::IMAP::ResponseParseError => e
-        raise if !e.message.match?(/unknown token/)
+        raise if !e.message.include?('unknown token')
 
         result = 'error'
         notice += <<~NOTICE

+ 2 - 2
app/models/channel/driver/telegram.rb

@@ -26,8 +26,8 @@ class Channel::Driver::Telegram
     options = check_external_credential(options)
 
     @client = Telegram.new(options[:auth][:api_key])
-    message = @client.from_article(article)
-    message
+    @client.from_article(article)
+
   end
 
 =begin

+ 2 - 2
app/models/chat/session/search.rb

@@ -78,10 +78,10 @@ returns
         # fallback do sql query
         # - stip out * we already search for *query* -
         query.delete! '*'
-        chat_sessions = Chat::Session.where(
+        Chat::Session.where(
           'name LIKE ?', "%#{query}%"
         ).order('name').offset(offset).limit(limit).to_a
-        chat_sessions
+
       end
     end
   end

+ 1 - 2
app/models/concerns/has_rich_text.rb

@@ -150,9 +150,8 @@ Checks if file is used inline
         node['src'] = Rails.application.routes.url_helpers.attachment_path(attachment.id)
       end
 
-      parsed = Loofah.scrub_fragment(raw, scrubber).to_s
+      Loofah.scrub_fragment(raw, scrubber).to_s
 
-      parsed
     end
 
     def has_rich_text_inline_cids(object, attr) # rubocop:disable Naming/PredicateName

+ 2 - 2
app/models/online_notification.rb

@@ -118,13 +118,13 @@ return all online notifications of an object
 
   def self.list_by_object(object_name, o_id)
     object_id = ObjectLookup.by_name(object_name)
-    notifications = OnlineNotification.where(
+    OnlineNotification.where(
       object_lookup_id: object_id,
       o_id:             o_id,
     )
                                       .order(created_at: :desc)
                                       .limit(10_000)
-    notifications
+
   end
 
 =begin

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