moviepilot/zeta

View on GitHub

Showing 8 of 8 total issues

Method run has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  def self.run
    options = {}
    parser = OptionParser.new do |opts|
      opts.banner = "#{'Usage:'.red} zeta [options] command"

Severity: Minor
Found in lib/zeta/runner.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 run has 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.run
    options = {}
    parser = OptionParser.new do |opts|
      opts.banner = "#{'Usage:'.red} zeta [options] command"

Severity: Major
Found in lib/zeta/runner.rb - About 2 hrs to fix

    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 http_get has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.http_get(url, verbose)
          retries ||= 3
          masked_url = ENV['ZETA_HTTP_PASSWORD'].blank? ? url : url.sub(ENV['ZETA_HTTP_PASSWORD'], '***')
          print "GET #{masked_url}... " if verbose
          result = HTTParty.get url
      Severity: Minor
      Found in lib/zeta/local_or_remote_file.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 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

      Severity
      Category
      Status
      Source
      Language