From 29a98c259d689a7a8f84c0712323f866bd809e2c Mon Sep 17 00:00:00 2001 From: asatwal Date: Thu, 6 Jul 2023 17:03:19 +0100 Subject: [PATCH] Fix rubocop offenses --- .rubocop.yml | 3 +++ .rubocop_todo.yml | 10 +++++++++- .../matchers/have_been_enqueued_as_analytics_events.rb | 2 +- .../rspec/matchers/have_sent_analytics_event_types.rb | 2 +- spec/dfe/analytics/requests_spec.rb | 1 - spec/dummy/config/environments/production.rb | 2 +- spec/spec_helper.rb | 2 +- 7 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 2b27dd78..c9f04b55 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -46,6 +46,9 @@ Style/EachWithObject: AllCops: TargetRubyVersion: 2.7 + StyleGuide: + Enabled: true + EnforcedStyle: gemspec NewCops: enable Exclude: - 'spec/dummy/db/schema.rb' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 23fea849..862bf687 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,11 +1,19 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2022-06-24 12:31:36 UTC using RuboCop version 1.26.1. +# on 2023-07-11 11:46:02 UTC using RuboCop version 1.54.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. +# Offense count: 14 +# Configuration parameters: EnforcedStyle, AllowedGems, Include. +# SupportedStyles: Gemfile, gems.rb, gemspec +# Include: **/*.gemspec, **/Gemfile, **/gems.rb +Gemspec/DevelopmentDependencies: + Exclude: + - 'dfe-analytics.gemspec' + # Offense count: 1 # Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms. # CheckDefinitionPathHierarchyRoots: lib, spec, test, src diff --git a/lib/dfe/analytics/rspec/matchers/have_been_enqueued_as_analytics_events.rb b/lib/dfe/analytics/rspec/matchers/have_been_enqueued_as_analytics_events.rb index cfecc375..057b31fc 100644 --- a/lib/dfe/analytics/rspec/matchers/have_been_enqueued_as_analytics_events.rb +++ b/lib/dfe/analytics/rspec/matchers/have_been_enqueued_as_analytics_events.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require_relative './helpers' +require_relative 'helpers' RSpec::Matchers.define :have_been_enqueued_as_analytics_events do include DfE::Analytics::RSpec::Matchers::Helpers diff --git a/lib/dfe/analytics/rspec/matchers/have_sent_analytics_event_types.rb b/lib/dfe/analytics/rspec/matchers/have_sent_analytics_event_types.rb index f2dfbf35..fdd79d32 100644 --- a/lib/dfe/analytics/rspec/matchers/have_sent_analytics_event_types.rb +++ b/lib/dfe/analytics/rspec/matchers/have_sent_analytics_event_types.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require_relative './helpers' +require_relative 'helpers' RSpec::Matchers.define :have_sent_analytics_event_types do |*event_types| include DfE::Analytics::RSpec::Matchers::Helpers diff --git a/spec/dfe/analytics/requests_spec.rb b/spec/dfe/analytics/requests_spec.rb index 52dd76c4..2a371b9a 100644 --- a/spec/dfe/analytics/requests_spec.rb +++ b/spec/dfe/analytics/requests_spec.rb @@ -39,7 +39,6 @@ def index end ex.run - ensure Rails.application.routes_reloader.reload! end diff --git a/spec/dummy/config/environments/production.rb b/spec/dummy/config/environments/production.rb index de648f76..a236200d 100644 --- a/spec/dummy/config/environments/production.rb +++ b/spec/dummy/config/environments/production.rb @@ -72,7 +72,7 @@ config.active_support.report_deprecations = false # Use default logging formatter so that PID and timestamp are not suppressed. - config.log_formatter = ::Logger::Formatter.new + config.log_formatter = Logger::Formatter.new # Use a different logger for distributed setups. # require "syslog/logger" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8cda35a9..0690bc1d 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -15,7 +15,7 @@ require_relative '../spec/support/json_schema_validator' -if ::Rails::VERSION::MAJOR >= 7 +if Rails::VERSION::MAJOR >= 7 require 'active_support/testing/tagged_logging' RSpec::Core::ExampleGroup.module_eval do