padrino/padrino-framework

Very high overall complexity: 614

require 'padrino-support'
require 'padrino-core/path_router' unless defined?(PathRouter)
require 'padrino-core/ext/sinatra'
require 'padrino-core/filter'

Found in Padrino::Routing::ClassMethods - About 5 days to fix

When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

Refactorings

Further Reading

Very complex method in #create_admin

      def create_admin
        self.destination_root = options[:root]
        if in_app_root?
          unless supported_orm.include?(orm)
            say "<= At the moment, Padrino only supports #{supported_orm.join(" or ")}. Sorry!", :yellow
Found in Padrino::Generators::AdminApp - About 5 days to fix

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Very complex method in #route

      def route(verb, path, *args, &block)
        options = case args.size
          when 2
            args.last.merge(:map => args.first)
          when 1
Found in Padrino::Routing::ClassMethods - About 2 days to fix

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Very complex method in #create_controller

      def create_controller
        validate_namespace name
        self.destination_root = options[:root]
        if in_app_root?
          app = options[:app]
Found in Padrino::Generators::Controller - About 2 days to fix

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Very high overall complexity: 317

module Padrino
  module Helpers
    module FormBuilder
      # Base class for Padrino Form Builder
      class AbstractFormBuilder

When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

Refactorings

Further Reading

Very high overall complexity: 307

require 'padrino-support'
require 'padrino-core/path_router' unless defined?(PathRouter)
require 'padrino-core/ext/sinatra'
require 'padrino-core/filter'

Found in Padrino::Routing::InstanceMethods - About 2 days to fix

When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

Refactorings

Further Reading

Very high overall complexity: 290

# -*- coding: utf-8 -*-
module Padrino
  module Generators
    ##
    # Defines the generator for creating a new admin app.
Found in Padrino::Generators::AdminApp - About 1 day to fix

When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

Refactorings

Further Reading

Very complex method in #allowed?

        def allowed?(account=nil, path=nil)
          path = "/" if path.nil? || path.empty?
          role = account.role.to_sym rescue nil
          authorizations = @authorizations.find_all { |auth| auth.roles.include?(:any) }
          allowed_paths  = authorizations.map(&:allowed).flatten.uniq
Found in Padrino::Admin::AccessControl::Base - About 1 day to fix

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Very complex method in #parse_route

      def parse_route(path, options, verb)
        path = path.dup if path.kind_of?(String)
        route_options = {}

        if options[:params] == true
Found in Padrino::Routing::ClassMethods - About 1 day to fix

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Very complex method in #setup_components

      def setup_components
        self.destination_root = options[:root]
        if in_app_root?
          @_components = options.class.new options.select{ |key,_| self.class.component_types.include?(key.to_sym) }
          @app_name = (options[:app] || "App").gsub(/\W/, '_').camelize
Found in Padrino::Generators::Component - About 1 day to fix

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Very complex method in #create_controller

      def create_controller
        self.destination_root = options[:root]
        if in_app_root?
          @app_name = fetch_app_name
          @admin_name = options[:admin_name].classify
Found in Padrino::Generators::AdminPage - About 1 day to fix

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Very high overall complexity: 265

require 'pathname'
require 'padrino-core/reloader/rack'
require 'padrino-core/reloader/storage'

module Padrino
Found in Padrino::Reloader - About 1 day to fix

When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

Refactorings

Further Reading

Very complex method in #setup_project

      def setup_project
        valid_constant? name
        app = (options[:app] || "App")

        @project_name = name.gsub(/\W/, '_').underscore.camelize
Found in Padrino::Generators::Project - About 1 day to fix

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Very high overall complexity: 260

require 'pathname'

module Padrino
  module Generators
    # Raised when an application does not have a resolved root path.
Found in Padrino::Generators::Actions - About 1 day to fix

When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

Refactorings

Further Reading

Very high overall complexity: 257

require 'padrino-helpers/form_helpers/errors'
require 'padrino-helpers/form_helpers/options'
require 'padrino-helpers/form_helpers/security'

module Padrino
Found in Padrino::Helpers::FormHelpers - About 1 day to fix

When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

Refactorings

Further Reading

Very high overall complexity: 256

require 'sinatra/base'
require 'padrino-core/version'
require 'padrino-support'
require 'padrino-support/inflections'
require 'padrino-core/configuration'
Found in Padrino - About 1 day to fix

When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

Refactorings

Further Reading

Very complex method in #output_migration_file

        def output_migration_file(filename, name, columns, options={})
          if behavior == :revoke
            remove_migration(name)
          else
            return if migration_exist?(filename)
Found in Padrino::Generators::Components::Actions - About 1 day to fix

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

High overall complexity: 246

require 'mail'

module Mail # @private
  class Message # @private
    include Sinatra::Templates
Found in Mail::Message - About 1 day to fix

When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

Refactorings

Further Reading

High overall complexity: 243

require 'padrino-core/version'
require 'securerandom' unless defined?(SecureRandom)

module Padrino
  module Generators
Found in Padrino::Generators::Project - About 1 day to fix

When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

Refactorings

Further Reading

High overall complexity: 235

module Padrino
  module Generators
    module Components
      module Actions
        ##
Found in Padrino::Generators::Components::Actions - About 1 day to fix

When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

Refactorings

Further Reading

High overall complexity: 231

require 'padrino/core_ext/output_safety'
require 'padrino-support'
require 'pathname'

module Padrino
Found in Padrino::Rendering::InstanceMethods - About 1 day to fix

When classes take on too many responsibilities, they grow. A large number of instance variables or methods can make a class hard to understand. Large classes tend to have lower cohesion and higher churn.

Often large classes have methods that do not operate on all of the class state. Identifying the groups of data that are used together can point to seams to split out additional collaborator classes or value objects.

Another trick is to look for repeated prefixes or suffixes in method and variable names, or repeated parameter names, and use them to guide extractions.

Refactorings

Further Reading

Very complex method in #invoke_route

      def invoke_route(route, params, first_time)
        @_response_buffer = nil
        @route = request.route_obj = route
        captured_params = captures_from_params(params)

Found in Padrino::Routing::InstanceMethods - About 1 day to fix

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Very complex method in #number_to_human_size

      def number_to_human_size(number, *args)
        return nil if number.nil?

        options = args.last.is_a?(Hash) ? Utils.symbolize_keys(args.pop) : {}

Found in Padrino::Helpers::NumberHelpers - About 1 day to fix

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Very complex method in #create_app

      def create_app
        self.destination_root = options[:root]
        underscore_name = name.gsub(/\W/, '_')
        @app_folder = underscore_name.underscore
        @app_name   = underscore_name.camelize
Found in Padrino::Generators::App - About 7 hrs to fix

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Very complex method in #distance_of_time_in_words

      def distance_of_time_in_words(from_time, to_time = 0, include_seconds = false, options = {})
        from_time = from_time.to_time if from_time.respond_to?(:to_time)
        to_time = to_time.to_time if to_time.respond_to?(:to_time)
        distance_in_minutes = (((to_time.to_i - from_time.to_i).abs)/60).round
        distance_in_seconds = ((to_time.to_i - from_time.to_i).abs).round
Found in Padrino::Helpers::FormatHelpers - About 7 hrs to fix

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Complex method in #output_model_migration

        def output_model_migration(filename, name, columns, options={})
          if behavior == :revoke
            remove_migration(filename)
          else
            return if migration_exist?(filename)
Found in Padrino::Generators::Components::Actions - About 7 hrs to fix

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Complex method in #route!

      def route!(base = settings, pass_block = nil)
        Thread.current['padrino.instance'] = self
        first_time = true

        routes = base.compiled_router.call(@request) do |route, params|
Found in Padrino::Routing::InstanceMethods - About 7 hrs to fix

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Identical code found in 1 other location

if PadrinoTasks.load?(:activerecord, defined?(ActiveRecord))
  # Fixes for Yardoc YRI Building
  begin
    require 'active_record'
    require 'active_record/schema'
Found in ActiveRecord and 1 other location - About 7 hrs to fix
padrino-gen/lib/padrino-gen/padrino-tasks/sequel.rb on lines 76..80

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Refactorings

Further Reading

Complex method in #setup_test_files

      def setup_test_files
        if options[:tiny] && @_components[:test] != :none
          test_component = @_components[:test]
          test_component = "rspec" if test_component == "cucumber"
          uppercase_test_component = test_component.upcase
Found in Padrino::Generators::Project - About 7 hrs to fix

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Complex method in #provides_format

      def provides_format(*types)
        mime_types = types.map{ |type| mime_type(CONTENT_TYPE_ALIASES[type] || type) }
        condition do
          return provides_format?(types, params[:format].to_sym) if params[:format]

Found in Padrino::Routing::ClassMethods - About 6 hrs to fix

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Complex method in #path

      def path(name, *args)
        params = args.last.is_a?(Hash) ? args.pop : {}
        candidates = @routes.select { |route| route.name == name }
        fail InvalidRouteException if candidates.empty?
        route = candidates.sort_by! { |candidate|
Found in Padrino::PathRouter::Router - About 5 hrs to fix

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Complex method in #create_mailer

      def create_mailer
        validate_namespace name
        self.destination_root = options[:root]
        if in_app_root?
          app = options[:app]
Found in Padrino::Generators::Mailer - About 5 hrs to fix

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Complex method in #columns

        def columns
          @columns ||= case orm
            when :activerecord then @klass.columns
            when :minirecord   then @klass.columns
            when :datamapper   then @klass.properties.map { |p| dm_column(p) }
Found in Padrino::Admin::Generators::Orm - About 5 hrs to fix

Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

Refactorings

Read More

Complex class definition

require 'pathname'

# Defines the log level for a Padrino project.
PADRINO_LOG_LEVEL = ENV['PADRINO_LOG_LEVEL'] unless defined?(PADRINO_LOG_LEVEL)

Found in Padrino::Logger::Extensions - About 5 hrs to fix

    Complex method in .setup!

        def self.setup!
          self.logger = begin
            config_level = (PADRINO_LOG_LEVEL || Padrino.env || :test).to_sym # need this for PADRINO_LOG_LEVEL
            config = Config[config_level]
    
    
    Found in Padrino::Logger - About 5 hrs to fix

    Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

    Refactorings

    Read More

    Similar code found in 1 other location

    ##
    # This module is based on Sequel 4.27.0
    # sequel-4.27.0/lib/sequel/model/inflections.rb
    #
    require 'padrino-support/default_inflections'
    Found in Padrino::Inflections and 1 other location - About 5 hrs to fix
    padrino-support/lib/padrino-support/inflections.rb on lines 144..149

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Refactorings

    Further Reading

    Similar code found in 1 other location

    ##
    # This module is based on Sequel 4.27.0
    # sequel-4.27.0/lib/sequel/model/inflections.rb
    #
    require 'padrino-support/default_inflections'
    Found in Padrino::Inflections and 1 other location - About 5 hrs to fix
    padrino-support/lib/padrino-support/inflections.rb on lines 135..140

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Refactorings

    Further Reading

    Complex method in #registered

            def registered(app)
              app.register Padrino::Admin unless app.extensions.include?(Padrino::Admin)
              app.set :session_id, "_padrino_#{Padrino.env}_#{app.app_name}" unless app.respond_to?(:session_id)
              app.set :admin_model, 'Account' unless app.respond_to?(:admin_model)
              app.helpers Padrino::Admin::Helpers::AuthenticationHelpers
    Found in Padrino::Admin::AccessControl - About 5 hrs to fix

    Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

    Refactorings

    Read More

    Complex method in #render

        def render(engine=nil, data=nil, options={}, locals={}, &block)
          locals = @_locals || {} if !options[:locals] && locals.empty?
          @template_cache.clear if settings.reload_templates?
    
          engine ||= message_name
    Found in Mail::Message - About 5 hrs to fix

    Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

    Refactorings

    Read More

    Complex class definition

    require 'sinatra/base'
    require 'padrino-core/version'
    require 'padrino-support'
    require 'padrino-support/inflections'
    require 'padrino-core/configuration'
    Found in Padrino - About 4 hrs to fix

      Complex method in #locate_app_file

          def locate_app_file
            app_const = app_constant
      
            candidates  = []
            candidates << app_const.app_file if app_const.respond_to?(:app_file)
      Found in Padrino::Mounter - About 4 hrs to fix

      Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

      Refactorings

      Read More

      Complex method in #named_routes

          def named_routes
            return [] unless app_obj.respond_to?(:routes)
      
            app_obj.routes.map { |route|
              request_method = route.request_methods.first
      Found in Padrino::Mounter - About 4 hrs to fix

      Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

      Refactorings

      Read More

      Complex method in #rake

            def rake(*args)
              prepare :rake
              args << "-T" if options[:list]
              args << options[:list]  unless options[:list].nil? || options[:list].to_s == "list"
              args << "--trace" if options[:trace]
      Found in Padrino::Cli::Base - About 4 hrs to fix

      Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

      Refactorings

      Read More

      Complex method in #initialize

          def initialize(name, options={})
            @name      = name.to_s
            @app_class = options[:app_class] || Inflections.camelize(@name)
            @gem       = options[:gem]       || Inflections.underscore(@app_class.split("::").first)
            @app_file  = options[:app_file]  || locate_app_file
      Found in Padrino::Mounter - About 4 hrs to fix

      Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

      Refactorings

      Read More

      Complex method in #call

          def call(env)
            began_at = Time.now
            path_info = env["PATH_INFO"].to_s
            script_name = env['SCRIPT_NAME']
            http_host = env['HTTP_HOST']
      Found in Padrino::Router - About 4 hrs to fix

      Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

      Refactorings

      Read More

      Complex method in #included

            def included(base)
              base.send :include, Padrino::Helpers::OutputHelpers
              base.send :include, Padrino::Helpers::TagHelpers
              base.send :include, Padrino::Helpers::AssetTagHelpers
              base.send :include, Padrino::Helpers::FormHelpers
      Found in Padrino::Helpers - About 3 hrs to fix

      Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

      Refactorings

      Read More

      Complex method in #select_template

            def select_template(templates, template_path, content_type, _locale)
              symbol = content_type_symbol(content_type)
              simple_content_type = [:html, :plain].include?(symbol)
              target_path, target_engine = path_and_engine(template_path)
      
      
      Found in Padrino::Rendering::InstanceMethods - About 3 hrs to fix

      Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

      Refactorings

      Read More

      Complex method in #dispatch!

            def dispatch!
              unless @params
                @params = indifferent_params(@request.params)
                force_encoding(@params)
              end
      Found in Padrino::Routing::InstanceMethods - About 3 hrs to fix

      Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

      Refactorings

      Read More

      Complex method in #partial

            def partial(template, options={}, &block)
              options = { :locals => {}, :layout => false }.update(options)
              explicit_engine = options.delete(:engine)
      
              path, _, name = template.to_s.rpartition(File::SEPARATOR)
      Found in Padrino::Helpers::RenderHelpers - About 3 hrs to fix

      Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

      Refactorings

      Read More

      Complex method in #render

                  def render(engine, file=nil, options={}, locals=nil, &block)
                    locals ||= options[:locals] || {}
                    engine, file = file, engine if file.nil?
                    template_engine = engine ? ::Tilt[engine] : ::Tilt.default_mapping[file]
                    fail "Engine #{engine.inspect} is not registered with Tilt" unless template_engine
      Found in Padrino::Helpers::RenderHelpers - About 3 hrs to fix

      Long or complex methods can make code harder to understand. In most circumstances, methods are best as a small chunk of code (the "how") with a clear, understandable name (the "what"). Long methods can also lead to duplication, as it's harder to reuse logic that is tightly coupled to surrounding code.

      Refactorings

      Read More