rumblelabs/asset_sync

View on GitHub
lib/asset_sync/config.rb

Summary

Maintainability
F
3 days
Test Coverage

Method load_yml! has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

    def load_yml!
      self.enabled                = yml["enabled"] if yml.has_key?('enabled')
      self.fog_provider           = yml["fog_provider"]
      self.fog_host               = yml["fog_host"]
      self.fog_port               = yml["fog_port"]
Severity: Minor
Found in lib/asset_sync/config.rb - About 6 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 fog_options has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
Open

    def fog_options
      options = { :provider => fog_provider }
      if aws?
        if aws_iam?
          options.merge!({
Severity: Minor
Found in lib/asset_sync/config.rb - About 5 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

File config.rb has 350 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "active_model"
require "erb"

module AssetSync
  class Config
Severity: Minor
Found in lib/asset_sync/config.rb - About 4 hrs to fix

    Class Config has 30 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Config
        include ActiveModel::Validations
    
        class Invalid < StandardError; end
    
    
    Severity: Minor
    Found in lib/asset_sync/config.rb - About 3 hrs to fix

      Method fog_options has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def fog_options
            options = { :provider => fog_provider }
            if aws?
              if aws_iam?
                options.merge!({
      Severity: Major
      Found in lib/asset_sync/config.rb - About 2 hrs to fix

        Method load_yml! has 57 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def load_yml!
              self.enabled                = yml["enabled"] if yml.has_key?('enabled')
              self.fog_provider           = yml["fog_provider"]
              self.fog_host               = yml["fog_host"]
              self.fog_port               = yml["fog_port"]
        Severity: Major
        Found in lib/asset_sync/config.rb - About 2 hrs to fix

          Avoid deeply nested control flow statements.
          Open

                elsif backblaze?
                  require 'fog/backblaze'
                  options.merge!({
                    :b2_key_id      => b2_key_id,
                    :b2_key_token   => b2_key_token,
          Severity: Major
          Found in lib/asset_sync/config.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                    options.merge!({:environment => fog_region}) if fog_region
            Severity: Major
            Found in lib/asset_sync/config.rb - About 45 mins to fix

              There are no issues that match your filters.

              Category
              Status