Browse Source

Maintenance: Apply Rubocop also to files in .gitlab, .github, .rubocop and to RSpec support files.

Martin Gruner 3 years ago
parent
commit
e63510c4d0

+ 5 - 5
.gitlab/configure_environment.rb

@@ -15,11 +15,11 @@ require 'resolv'
 
 class ConfigureEnvironment
 
-  @env_file_content = <<~EOF
-  #!/bin/bash
-  FRESHENVFILE=fresh.env && test -f $FRESHENVFILE && source $FRESHENVFILE
-  true
-  EOF
+  @env_file_content = <<~ENV_FILE_CONTENT
+    #!/bin/bash
+    FRESHENVFILE=fresh.env && test -f $FRESHENVFILE && source $FRESHENVFILE
+    true
+  ENV_FILE_CONTENT
 
   def self.configure_redis
     if ENV['REDIS_URL'].nil? || ENV['REDIS_URL'].empty? # rubocop:disable Rails/Blank

+ 3 - 1
.rubocop/cop/zammad/exists_condition.rb

@@ -1,3 +1,5 @@
+# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
+
 module RuboCop
   module Cop
     module Zammad
@@ -84,7 +86,7 @@ module RuboCop
 
         def handle_node(node)
           if node.send_type?
-            check_offense(*find_by_condition?(node)) # rubocop:disable Rails/DynamicFindBy
+            check_offense(*find_by_condition?(node))
           elsif %i[and or begin].include?(node.type)
             check_node(node)
           end

+ 2 - 0
.rubocop/cop/zammad/exists_date_time_precision.rb

@@ -1,3 +1,5 @@
+# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
+
 module RuboCop
   module Cop
     module Zammad

+ 2 - 0
.rubocop/cop/zammad/exists_reset_column_information.rb

@@ -1,3 +1,5 @@
+# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
+
 module RuboCop
   module Cop
     module Zammad

+ 5 - 4
.rubocop/cop/zammad/have_no_over_not_to.rb

@@ -1,3 +1,5 @@
+# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
+
 require 'capybara/rspec/matchers'
 
 module RuboCop
@@ -23,8 +25,8 @@ module RuboCop
           have_not_no?(matcher_name) && capybara_matcher?(matcher_name)
         end
 
-        def have_not_no?(matcher_name)
-          matcher_name.match?(/^have_(?!no)/)
+        def have_not_no?(matcher_name)  # rubocop:disable Naming/PredicateName
+          matcher_name.match?(%r{^have_(?!no)})
         end
 
         def capybara_matcher?(matcher_name)
@@ -53,10 +55,9 @@ module RuboCop
         end
 
         def message(node)
-          message = format(MSG, replacement: alternative_matcher(node), original: original_matcher(node))
+          format(MSG, replacement: alternative_matcher(node), original: original_matcher(node))
         end
       end
     end
   end
 end
-

+ 2 - 0
.rubocop/cop/zammad/no_to_sym_on_string.rb

@@ -1,3 +1,5 @@
+# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
+
 module RuboCop
   module Cop
     module Zammad

+ 2 - 0
.rubocop/cop/zammad/prefer_negated_if_over_unless.rb

@@ -1,3 +1,5 @@
+# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
+
 module RuboCop
   module Cop
     module Zammad

+ 8 - 0
.rubocop/default.yml

@@ -12,9 +12,17 @@ inherit_from:
   - todo.yml
   - todo.rspec.yml
 
+inherit_mode:
+  merge:
+    - Include
+
 AllCops:
   NewCops: enable
   DisplayCopNames: true
+  Include:
+    - '.gitlab/**/*.rb'
+    - '.github/**/*.rb'
+    - '.rubocop/**/*.rb'
   Exclude:
     - 'bin/*'
     - 'db/schema.rb'

+ 1 - 0
spec/factories/ticket/article.rb

@@ -8,6 +8,7 @@ FactoryBot.define do
     from          { 'factory-customer-1@example.com' }
     to            { 'factory-customer-1@example.com' }
     subject       { 'factory article' }
+
     message_id    { 'factory@id_com_1' }
     body          { 'some message 123' }
     internal      { false }

+ 1 - 0
spec/jobs/trigger_webhook_job/record_payload/base_example.rb

@@ -13,6 +13,7 @@ RSpec.shared_examples 'TriggerWebhookJob::RecordPayload backend' do |factory|
 
   describe '#generate' do
     subject(:generate) { described_class.new(record).generate }
+
     let(:resolved_associations) { described_class.const_get(:ASSOCIATIONS).map(&:to_s) }
     let(:record) { build(factory) }
 

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