From c6b66bbb1ac2b254bac69927fb8590b4aa3236d4 Mon Sep 17 00:00:00 2001 From: Alex <6269576+petestreet@users.noreply.github.com> Date: Fri, 28 Sep 2018 13:08:56 -0500 Subject: [PATCH] Address todos generated by rubocop for files starting with lib/factory_bot_rails (#296) This partially addresses #293. Since rubocop generated quite a few todos, the commits addressing them are split up into a few different PRs that cover different files. --- .rubocop.yml | 22 +++---------------- lib/factory_bot_rails.rb | 2 +- lib/factory_bot_rails/generator.rb | 6 ++--- .../generators/rspec_generator.rb | 2 +- 4 files changed, 8 insertions(+), 24 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index acea765..b65c898 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -5,6 +5,9 @@ AllCops: Exclude: - "tmp/**/*" +Style/EmptyMethod: + EnforcedStyle: expanded + # TODO: # This configuration was generated by # `rubocop --auto-gen-config` @@ -86,24 +89,8 @@ Style/Documentation: Exclude: - 'spec/**/*' - 'test/**/*' - - 'lib/factory_bot_rails.rb' - - 'lib/factory_bot_rails/definition_file_paths.rb' - - 'lib/factory_bot_rails/generator.rb' - - 'lib/factory_bot_rails/generators/non_rspec_generator.rb' - - 'lib/factory_bot_rails/generators/null_generator.rb' - - 'lib/factory_bot_rails/generators/rspec_generator.rb' - - 'lib/factory_bot_rails/railtie.rb' - - 'lib/factory_bot_rails/reloader.rb' - 'lib/generators/factory_bot/model/model_generator.rb' -# Offense count: 2 -# Cop supports --auto-correct. -# Configuration parameters: EnforcedStyle. -# SupportedStyles: compact, expanded -Style/EmptyMethod: - Exclude: - - 'lib/factory_bot_rails/generators/null_generator.rb' - # Offense count: 29 # Cop supports --auto-correct. # Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. @@ -143,9 +130,6 @@ Style/StringLiterals: - 'factory_bot_rails.gemspec' - 'features/step_definitions/rails_steps.rb' - 'features/support/env.rb' - - 'lib/factory_bot_rails.rb' - - 'lib/factory_bot_rails/generator.rb' - - 'lib/factory_bot_rails/generators/rspec_generator.rb' - 'lib/generators/factory_bot.rb' - 'lib/generators/factory_bot/model/model_generator.rb' diff --git a/lib/factory_bot_rails.rb b/lib/factory_bot_rails.rb index a25d277..4f5b4a5 100644 --- a/lib/factory_bot_rails.rb +++ b/lib/factory_bot_rails.rb @@ -1,4 +1,4 @@ -require 'factory_bot_rails/railtie' +require "factory_bot_rails/railtie" module FactoryBotRails end diff --git a/lib/factory_bot_rails/generator.rb b/lib/factory_bot_rails/generator.rb index 14629bc..eff621b 100644 --- a/lib/factory_bot_rails/generator.rb +++ b/lib/factory_bot_rails/generator.rb @@ -1,6 +1,6 @@ -require 'factory_bot_rails/generators/rspec_generator' -require 'factory_bot_rails/generators/non_rspec_generator' -require 'factory_bot_rails/generators/null_generator' +require "factory_bot_rails/generators/rspec_generator" +require "factory_bot_rails/generators/non_rspec_generator" +require "factory_bot_rails/generators/null_generator" module FactoryBotRails class Generator diff --git a/lib/factory_bot_rails/generators/rspec_generator.rb b/lib/factory_bot_rails/generators/rspec_generator.rb index c97809d..9718b77 100644 --- a/lib/factory_bot_rails/generators/rspec_generator.rb +++ b/lib/factory_bot_rails/generators/rspec_generator.rb @@ -16,7 +16,7 @@ module FactoryBotRails end def factory_bot_directory - @generators.options.fetch(:factory_bot, {}).fetch(:dir, 'spec/factories') + @generators.options.fetch(:factory_bot, {}).fetch(:dir, "spec/factories") end end end