FitnessKeeper/leeroy

View on GitHub

Showing 14 of 89 total issues

File aws.rb has 342 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'aws-sdk'
require 'base64'

require 'leeroy/helpers'
require 'leeroy/helpers/env'
Severity: Minor
Found in lib/leeroy/helpers/aws.rb - About 4 hrs to fix

    Method _getPackerParams has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

          def _getPackerParams(state = self.state, env = self.env, options = self.options)
            begin
              logger.debug "generating Packer params to create an AMI"
              packer_params = Leeroy::Types::Mash.new
    
    
    Severity: Minor
    Found in lib/leeroy/task/packer.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 _getPackerParams has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def _getPackerParams(state = self.state, env = self.env, options = self.options)
            begin
              logger.debug "generating Packer params to create an AMI"
              packer_params = Leeroy::Types::Mash.new
    
    
    Severity: Minor
    Found in lib/leeroy/task/packer.rb - About 1 hr to fix

      Method _genInstanceParams has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def _genInstanceParams(state = self.state, env = self.env, ec2 = self.ec2, options = self.options)
              begin
                logger.debug "generating params for creating an EC2 instance"
      
                # gather the necessary parameters
      Severity: Minor
      Found in lib/leeroy/task/instantiate.rb - About 1 hr to fix

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

              def dump
                begin
                  logger.debug "beginning dump"
        
                  dump_mash = Leeroy::Types::Mash.new
        Severity: Minor
        Found in lib/leeroy/helpers/dumpable.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 filterImages has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def filterImages(selector, collector = lambda { |x| x }, state = self.state, env = self.env, ec2 = self.ec2, options = self.options)
        Severity: Minor
        Found in lib/leeroy/helpers/aws.rb - About 45 mins to fix

          Method createTags has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

                def createTags(tags = {}, resourceids = [], state = self.state, env = self.env, options = self.options)
          Severity: Minor
          Found in lib/leeroy/helpers/aws.rb - About 35 mins to fix

            Method _genImageParams has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                  def _genImageParams(phase, state = self.state, env = self.env, ec2 = self.ec2, options = self.options)
            Severity: Minor
            Found in lib/leeroy/task/image.rb - About 35 mins to fix

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

                    def _resolveResources(state = self.state, env = self.env, ec2 = self.ec2, options = self.options)
                      begin
                        # resolve VPC ID
                        if state.vpcid?
                          vpcid = state.vpcid
              Severity: Minor
              Found in lib/leeroy/task/instantiate.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 resolve has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def self.resolve(candidate, alternate = nil)
                      resolved = candidate.kind_of?(Leeroy::Types::Enum) ? candidate : self.from_s(candidate)
              
                      if candidate.nil?
                        resolved = self.resolve(alternate, nil) unless alternate.nil?
              Severity: Minor
              Found in lib/leeroy/types/enum.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 perform has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def perform(args = self.args, options = self.options, global_options = self.global_options)
                      begin
                        super(args, options, global_options)
              
                        # destroy instance
              Severity: Minor
              Found in lib/leeroy/task/terminate.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 _genInstanceParams has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def _genInstanceParams(state = self.state, env = self.env, ec2 = self.ec2, options = self.options)
                      begin
                        logger.debug "generating params for creating an EC2 instance"
              
                        # gather the necessary parameters
              Severity: Minor
              Found in lib/leeroy/task/instantiate.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 genImageName has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def genImageName(phase = nil, state = self.state, options = self.options)
                      begin
                        # extract phase from state if not provided
                        phase = state.phase if phase.nil?
              
              
              Severity: Minor
              Found in lib/leeroy/helpers/inventory.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 _prepImageCreationPolling has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def _prepImageCreationPolling
                      # poll to make sure image is created
                      self.poll_callback = lambda do |imageid|
                        begin
                          run_params = { :image_ids => [imageid], :owners => ['self'] }
              Severity: Minor
              Found in lib/leeroy/task/image.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