piotrmurach/tty-config

View on GitHub

Showing 6 of 6 total issues

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

class Config
include Marshallers
 
# Error raised when failed to load a dependency
DependencyLoadError = Class.new(StandardError)
Severity: Minor
Found in lib/tty/config.rb - About 5 hrs to fix

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

    require "pathname"
     
    require_relative "config/version"
    require_relative "config/marshallers"
    require_relative "config/marshallers/ini_marshaller"
    Severity: Minor
    Found in lib/tty/config.rb - About 4 hrs to fix

      Method fetch has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def fetch(*keys, default: nil, &block)
      # check alias
      real_key = @aliases[flatten_keys(keys)]
      keys = real_key.split(key_delim) if real_key
       
       
      Severity: Minor
      Found in lib/tty/config.rb - About 45 mins to fix

      Method deep_set has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def deep_set(settings, *keys)
      return settings if keys.empty?
       
      key, *rest = *keys
      value = settings[key]
      Severity: Minor
      Found in lib/tty/config.rb - About 35 mins to fix

      Method load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def load
      return if dep_name.nil?
       
      dep_name.empty? ? @block.() : dep_name.each { |dep| require(dep) }
      rescue LoadError, NameError => err
      Severity: Minor
      Found in lib/tty/config/dependency_loader.rb - About 25 mins to fix

      Method deep_merge has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def deep_merge(this_hash, other_hash, &block)
      this_hash.merge(other_hash) do |key, this_val, other_val|
      if this_val.is_a?(::Hash) && other_val.is_a?(::Hash)
      deep_merge(this_val, other_val, &block)
      elsif block_given?
      Severity: Minor
      Found in lib/tty/config.rb - About 25 mins to fix
      Severity
      Category
      Status
      Source
      Language