moviepilot/old-maid

View on GitHub
lib/zeta/instance.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Class Zeta has 25 methods (exceeds 20 allowed). Consider refactoring.
Open

class Zeta
  module Instance
    attr_reader :config

    def initialize(options = {})
Severity: Minor
Found in lib/zeta/instance.rb - About 2 hrs to fix

    Method config has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def config
          @lock.synchronize do
            return @config if @config
            full_config = YAML.load_file(config_file).with_indifferent_access
            env_config  = full_config[env]
    Severity: Minor
    Found in lib/zeta/instance.rb - About 55 mins 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 clear_cache has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def clear_cache
          @lock.synchronize do
            # I'm afraid of FileUtils.rm_rf so I'll just delete all relevant files
            # and then rmdir all empty directories.
            Dir[File.join(cache_dir, "**/*.mson")].each{|f| FileUtils.rm(f) }
    Severity: Minor
    Found in lib/zeta/instance.rb - About 45 mins 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 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def env
          return @options[:env].to_sym if @options[:env]
          if Object.const_defined?('Rails')
            Rails.env.to_sym
          else
    Severity: Minor
    Found in lib/zeta/instance.rb - About 35 mins 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 update_own_contracts has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def update_own_contracts
          @lock.synchronize do
            contract_files.each do |file|
              source_file = File.join(config[:contracts_path], file)
              target_file = File.join(cache_dir, config[:service_name], file)
    Severity: Minor
    Found in lib/zeta/instance.rb - About 25 mins 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

    There are no issues that match your filters.

    Category
    Status