intuit/heirloom

View on GitHub

Showing 16 of 20 total issues

Class Archive has 29 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Archive

    def initialize(args)
      @config = args[:config]
      @name   = args[:name]
Severity: Minor
Found in lib/heirloom/archive.rb - About 3 hrs to fix

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

          def select(query, opts = {})
            has_more   = true
            next_token = nil
            results    = {}
    
    
    Severity: Minor
    Found in lib/heirloom/aws/simpledb.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 all has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

          def all
            regions = detected_regions
            @logger.info "Querying regions #{regions.join(', ')} for Heirloom catalogs."
            regions.each do |region|
              @config.metadata_region = region
    Severity: Minor
    Found in lib/heirloom/cli/catalog.rb - About 1 hr 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 ensure_valid_options has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

          def ensure_valid_options(args)
            provided = args[:provided]
            required = args[:required]
            config   = args[:config]
            logger   = config.logger
    Severity: Minor
    Found in lib/heirloom/cli/shared.rb - About 1 hr 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 select has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def select(query, opts = {})
            has_more   = true
            next_token = nil
            results    = {}
    
    
    Severity: Minor
    Found in lib/heirloom/aws/simpledb.rb - About 1 hr to fix

      Method start has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def self.start
            cmd = ARGV.shift
      
            case cmd
            when 'authorize'
      Severity: Minor
      Found in lib/heirloom/cli.rb - About 1 hr to fix

        Method cleanup has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def cleanup(opts = {})
              opts[:num_to_keep]      ||= 100
              opts[:remove_preserved] ||= false
        
              num_cleaned = 0
        Severity: Minor
        Found in lib/heirloom/catalog.rb - About 1 hr 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 all has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def all
                regions = detected_regions
                @logger.info "Querying regions #{regions.join(', ')} for Heirloom catalogs."
                regions.each do |region|
                  @config.metadata_region = region
        Severity: Minor
        Found in lib/heirloom/cli/catalog.rb - About 1 hr to fix

          Method upload has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def upload
                  ensure_valid_metadata_region @config
                  ensure_domain_exists :name   => @opts[:name],
                                       :config => @config
                  ensure_buckets_exist :bucket_prefix => @bucket_prefix,
          Severity: Minor
          Found in lib/heirloom/cli/upload.rb - About 1 hr to fix

            Method read_options has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def read_options
                    Trollop::options do
                      version Heirloom::VERSION
                      banner <<-EOS
            
            
            Severity: Minor
            Found in lib/heirloom/cli/download.rb - About 1 hr to fix

              Method read_options has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def read_options
                      Trollop::options do
                        version Heirloom::VERSION
                        banner <<-EOS
              
              
              Severity: Minor
              Found in lib/heirloom/cli/rotate.rb - About 1 hr to fix

                Method read_options has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def read_options
                        Trollop::options do
                          version Heirloom::VERSION
                          banner <<-EOS
                
                
                Severity: Minor
                Found in lib/heirloom/cli/upload.rb - About 1 hr to fix

                  Method read_options has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def read_options
                          Trollop::options do
                            version Heirloom::VERSION
                            banner <<-EOS
                  
                  
                  Severity: Minor
                  Found in lib/heirloom/cli/setup.rb - About 1 hr to fix

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

                        def download(args)
                          @region        = args[:region]
                          @bucket_prefix = args[:bucket_prefix]
                          @secret        = args[:secret]
                          extract        = args[:extract]
                    Severity: Minor
                    Found in lib/heirloom/archive/downloader.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 load_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def load_config(args)
                            opts = args[:opts]
                            logger = args[:logger]
                            config = Config.new :logger => logger, :environment => opts[:environment]
                            config.access_key = opts[:aws_access_key] if opts[:aws_access_key]
                    Severity: Minor
                    Found in lib/heirloom/cli/shared.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

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

                          def read_secret(args)
                            opts   = args[:opts]
                            config = args[:config]
                            logger = config.logger
                    
                    
                    Severity: Minor
                    Found in lib/heirloom/cli/shared.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