railties/lib/rails/application.rb

Summary

Maintainability
D
2 days
Test Coverage

Class Application has 53 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Application < Engine
    autoload :Bootstrap,              "rails/application/bootstrap"
    autoload :Configuration,          "rails/application/configuration"
    autoload :DefaultMiddlewareStack, "rails/application/default_middleware_stack"
    autoload :Finisher,               "rails/application/finisher"
Severity: Major
Found in railties/lib/rails/application.rb - About 7 hrs to fix

    File application.rb has 397 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "yaml"
    require "active_support/core_ext/hash/keys"
    require "active_support/core_ext/object/blank"
    require "active_support/key_generator"
    require "active_support/message_verifiers"
    Severity: Minor
    Found in railties/lib/rails/application.rb - About 5 hrs to fix

      Method config_for has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def config_for(name, env: Rails.env)
            yaml = name.is_a?(Pathname) ? name : Pathname.new("#{paths["config"].existent.first}/#{name}.yml")
      
            if yaml.exist?
              require "erb"
      Severity: Minor
      Found in railties/lib/rails/application.rb - About 2 hrs to fix

      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 env_config has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def env_config
            @app_env_config ||= super.merge(
                "action_dispatch.parameter_filter" => filter_parameters,
                "action_dispatch.redirect_filter" => config.filter_redirect,
                "action_dispatch.secret_key_base" => secret_key_base,
      Severity: Minor
      Found in railties/lib/rails/application.rb - About 1 hr to fix

        There are no issues that match your filters.

        Category
        Status