ashrithr/awscli

View on GitHub
lib/awscli/emr.rb

Summary

Maintainability
F
3 days
Test Coverage

Method create_job_flow has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
Open

      def create_job_flow(options)
        # => BOOTSTRAP ACTIONS
        boot_strap_actions = []
        if options[:bootstrap_actions]
          options[:bootstrap_actions].each do |step|
Severity: Minor
Found in lib/awscli/emr.rb - About 1 day 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

File emr.rb has 423 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Awscli
  module Emr
    class EMR
      def initialize(connection)
        @conn = connection
Severity: Minor
Found in lib/awscli/emr.rb - About 6 hrs to fix

    Method create_job_flow has 89 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def create_job_flow(options)
            # => BOOTSTRAP ACTIONS
            boot_strap_actions = []
            if options[:bootstrap_actions]
              options[:bootstrap_actions].each do |step|
    Severity: Major
    Found in lib/awscli/emr.rb - About 3 hrs to fix

      Class EMR has 24 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class EMR
            def initialize(connection)
              @conn = connection
            end
      
      
      Severity: Minor
      Found in lib/awscli/emr.rb - About 2 hrs to fix

        Method parse_instance_groups has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

              def parse_instance_groups(groups)
                #parse instance_groups => instance_count,instance_role(MASTER | CORE | TASK),instance_type,name,bid_price
                instance_groups = []
                groups.each do |group|
                  instance_count, instance_role, instance_size, name, bid_price = group.split(',')
        Severity: Minor
        Found in lib/awscli/emr.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 parse_custom_jar has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

              def parse_custom_jar(steps)
                #parse jar_path(s3)*,name_of_step*,main_class,action_on_failure(TERMINATE_JOB_FLOW | CANCEL_AND_WAIT | CONTINUE),arg1=agr2=arg3,properties(k=v,k=v)
                abort "invalid step pattern, expecting 'jar_path(s3)*,name_of_step*,main_class,action_on_failure,arg1=agr2=arg3,prop_k1=prop_v1,prop_k2=prop_v2)'" unless step =~ /(.*),(.*),(.*),(.*),(.*),(.*),(.*)/
                jar, name, main_class, action_on_failure, extra_args, *job_conf = step.split(',')
                if jar.empty? or name.empty?
        Severity: Minor
        Found in lib/awscli/emr.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 add_instance_group has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_instance_group(options)
                opts = Marshal.load(Marshal.dump(options))
                opts.reject! { |key| key == 'job_flow_id' }
                opts.reject! { |key| key == 'region' }
                abort 'invalid job id' unless @conn.describe_job_flows.body['JobFlows'].map { |job| job['JobFlowId'] }.include?(options[:job_flow_id])
        Severity: Minor
        Found in lib/awscli/emr.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 list has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def list(options)
                validate_job_ids options[:job_flow_ids] if options[:job_flow_ids]
                opts = Marshal.load(Marshal.dump(options))
                opts.reject! { |k| k == 'table' } if options[:table]
                if job_flow_ids = opts.delete(:job_flow_ids)
        Severity: Minor
        Found in lib/awscli/emr.rb - About 1 hr to fix

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

                def parse_instance_groups(groups)
                  #parse instance_groups => instance_count,instance_role(MASTER | CORE | TASK),instance_type,name,bid_price
                  instance_groups = []
                  groups.each do |group|
                    instance_count, instance_role, instance_size, name, bid_price = group.split(',')
          Severity: Minor
          Found in lib/awscli/emr.rb - About 1 hr to fix

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

                  def add_instance_group(options)
                    opts = Marshal.load(Marshal.dump(options))
                    opts.reject! { |key| key == 'job_flow_id' }
                    opts.reject! { |key| key == 'region' }
                    abort 'invalid job id' unless @conn.describe_job_flows.body['JobFlows'].map { |job| job['JobFlowId'] }.include?(options[:job_flow_id])
            Severity: Minor
            Found in lib/awscli/emr.rb - About 1 hr to fix

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

                    def list(options)
                      validate_job_ids options[:job_flow_ids] if options[:job_flow_ids]
                      opts = Marshal.load(Marshal.dump(options))
                      opts.reject! { |k| k == 'table' } if options[:table]
                      if job_flow_ids = opts.delete(:job_flow_ids)
              Severity: Minor
              Found in lib/awscli/emr.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 parse_hbase_backup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def parse_hbase_backup(backup_step, consistent=false)
                      #parse frequency*,frequency_unit*(Days|Hrs|Mins),path(s3)*,start_time*(now|iso-format)
                      frequency, frequency_unit, path, start_time = backup_step.split(',')
                      abort 'Invalid backup step pattern, expecting frequency,frequency_unit(days|hrs|mins),path(s3),start_time(now|iso-format)' unless backup_step =~ /(.*),(.*),(.*),(.*)/
                      if frequency.empty? or frequency_unit.empty? or path.empty? or start_time.empty?
              Severity: Minor
              Found in lib/awscli/emr.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 parse_pig_steps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def parse_pig_steps(step)
                      #parse script_path(s3)*,input_path(s3),output_path(s3),'-p','args1','-p','args2','-p','arg3'
                      path, input_path, output_path, *args = step.split(',')
                      abort 'path to the hive script is required' if path.empty?
                      pig_step = {
              Severity: Minor
              Found in lib/awscli/emr.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 parse_hive_steps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                    def parse_hive_steps(step)
                      #parse script_path(s3)*,input_path(s3),output_path(s3),'-d','args1','-d','args2','-d','arg3'
                      path, input_path, output_path, *args = step.split(',')
                      abort 'path to the hive script is required' if path.empty?
                      hive_step = {
              Severity: Minor
              Found in lib/awscli/emr.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

              There are no issues that match your filters.

              Category
              Status