galoshes/galoshes

View on GitHub

Showing 11 of 11 total issues

Method authorize_ip_permissions has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

  def authorize_ip_permissions
    Chef::Log.info("new_resource.ip_permissions: #{new_resource.ip_permissions}")
    Chef::Log.info("current_reso.ip_permissions: #{@current_resource.ip_permissions}")
    new_ip_permissions = new_resource.ip_permissions.map do |p|
      perm = {}
Severity: Minor
Found in libraries/provider_security_group.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 action_update has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

  def action_update
    if @exists
      filtered_options = @current_resource.class.attributes + [:launch_configuration_name] - [:tags, :instances, :created_at, :arn]
      Chef::Log.debug("filtered_options: #{filtered_options}")
      converged = true
Severity: Minor
Found in libraries/provider_autoscaling_group.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 action_update has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def action_update
    if @exists
      filtered_options = @current_resource.class.attributes + [:launch_configuration_name] - [:tags, :instances, :created_at, :arn]
      Chef::Log.debug("filtered_options: #{filtered_options}")
      converged = true
Severity: Minor
Found in libraries/provider_autoscaling_group.rb - About 1 hr to fix

    Method authorize_ip_permissions has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def authorize_ip_permissions
        Chef::Log.info("new_resource.ip_permissions: #{new_resource.ip_permissions}")
        Chef::Log.info("current_reso.ip_permissions: #{@current_resource.ip_permissions}")
        new_ip_permissions = new_resource.ip_permissions.map do |p|
          perm = {}
    Severity: Minor
    Found in libraries/provider_security_group.rb - About 1 hr to fix

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

        def action_update
          if @exists
            Chef::Log.info("tags cur: #{@current_resource.tags}")
            Chef::Log.info("tags new: #{new_resource.tags}")
            new_tags = new_resource.tags.reject { |k, _| @current_resource.tags.include?(k) || k.match(/^aws/) }
      Severity: Minor
      Found in libraries/provider_server.rb - About 1 hr to fix

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

          def action_update
            if @exists
              Chef::Log.info("tags cur: #{@current_resource.tags}")
              Chef::Log.info("tags new: #{new_resource.tags}")
              new_tags = new_resource.tags.reject { |k, _| @current_resource.tags.include?(k) || k.match(/^aws/) }
        Severity: Minor
        Found in libraries/provider_server.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 action_update has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def action_update
            if @exists
              filtered_options = [:description]
              Chef::Log.debug("filtered_options: #{filtered_options}")
              converged = true
        Severity: Minor
        Found in libraries/provider_dns_zone.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

        Consider simplifying this complex logical expression.
        Open

            if @exists
              Chef::Log.info("tags cur: #{@current_resource.tags}")
              Chef::Log.info("tags new: #{new_resource.tags}")
              new_tags = new_resource.tags.reject { |k, _| @current_resource.tags.include?(k) || k.match(/^aws/) }
              Chef::Log.info("new_tags: #{new_tags}")
        Severity: Major
        Found in libraries/provider_server.rb - About 40 mins to fix

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

            def load_current_resource
              @collection = Fog::Compute::AWS::Subnets.new(:service => service)
          
              Chef::Log.info("vpc_id: #{new_resource.vpc_id}")
          
          
          Severity: Minor
          Found in libraries/provider_subnet.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 action_update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def action_update
              if @exists
                update_attributes = [:id, :image_id, :instance_type, :block_device_mappings, :key_name, :kernel_id, :ramdisk_id, :placement_tenancy, :user_data]
                update_attributes.each do |attr|
                  audit_model_attribute(attr)
          Severity: Minor
          Found in libraries/provider_launch_configuration.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 action_create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

            def action_create
              converge_unless(@exists, "create #{resource_str}") do
                result = service.create_dhcp_options(new_resource.configuration_set)
                if verify_result(result, 'create_dhcp_options')
                  body_set = result.body['dhcpOptionsSet']
          Severity: Minor
          Found in libraries/provider_dhcp_options.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