Class CmsGenerator
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
class CmsGenerator < Rails::Generators::Base
source_root Pathname.new(File.expand_path('../templates', __FILE__))
class_option :update, :type => :boolean, :aliases => nil, :group => :runtime,
:desc => "Update an existing Refinery CMS based application"
File cms_generator.rb
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'pathname'
require 'mkmf'
module Refinery
class CmsGenerator < Rails::Generators::Base
Method sanity_check_heroku_application_name!
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def sanity_check_heroku_application_name!
if heroku? && options[:heroku].to_s.include?('_') || options[:heroku].to_s.length > 30
message = ["\nThe application name '#{options[:heroku]}' that you specified is invalid for Heroku."]
suggested_name = options[:heroku].dup.to_s
if suggested_name.include?('_')
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method prepare_database!
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def prepare_database!
unless self.options[:skip_migrations]
command = %w[railties:install:migrations]
unless self.options[:skip_db]
command |= %w[db:create db:migrate]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method run_additional_generators!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run_additional_generators!
generator_args = []
generator_args << '--quiet' if self.options[:quiet]
generator_args << '--skip-migrations' if self.options[:skip_migrations]
Refinery::CoreGenerator.start generator_args
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method ensure_environments_are_sane!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def ensure_environments_are_sane!
# Massage environment files
%w(development test production).map{ |e| "config/environments/#{e}.rb"}.each do |env|
next unless destination_path.join(env).file?
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method manage_roadblocks!
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def manage_roadblocks!
%w(public/index.html app/views/layouts/application.html.erb).each do |roadblock|
if (roadblock_path = destination_path.join(roadblock)).file?
if self.options[:fresh_installation]
remove_file roadblock_path, :verbose => true
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"