IotaSpencer/cloud_party

View on GitHub

Showing 12 of 177 total issues

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

      def initialize(method_name, endpoint, response, options)
        @code            = response.code
        @body            = JSON.parse(response.body, symbolize_names: true)
        @parsed_response = response.parsed_response
        @success         = @body[:success]
Severity: Minor
Found in lib/cloud_party/responses/dns_records.rb - About 1 hr to fix

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

          def initialize(method_name, endpoint, response, options)
            @code = response.code
            @body = JSON.parse(response.body, symbolize_names: true)
            @parsed_response = response.parsed_response
            @success = @body[:success]
    Severity: Minor
    Found in lib/cloud_party/responses/zones.rb - About 1 hr to fix

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

            def initialize(result)
              @result = result
              @result.each do |k, v|
                @plan = CloudParty::Responses::Node::Plan.new(@result.dig(:plan)) if @result.fetch(:plan, nil)
                @plan_pending = CloudParty::Responses::Node::PlanPending.new(@result.dig(:plan_pending)) if @result.fetch(:plan_pending, nil)
      Severity: Minor
      Found in lib/cloud_party/responses/zones.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 has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def add(type, name, content, opts, zone:)
              zone_id = nil
              options = {
                  type: type,
                  name: name,
      Severity: Minor
      Found in lib/cloud_party/nodes/dns_records.rb - About 1 hr to fix

        Method initialize has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

              def initialize(method_name, endpoint, response, options)
                @code            = response.code
                @body            = JSON.parse(response.body, symbolize_names: true)
                @parsed_response = response.parsed_response
                @success         = @body[:success]
        Severity: Minor
        Found in lib/cloud_party/responses/dns_records.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 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

              def add(type, name, content, opts, zone:)
                zone_id = nil
                options = {
                    type: type,
                    name: name,
        Severity: Minor
        Found in lib/cloud_party/nodes/dns_records.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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              def initialize(message, method, endpoint, code, response)
        Severity: Minor
        Found in lib/cloud_party/exceptions.rb - About 35 mins to fix

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

                def initialize(message, method, endpoint, code, body)
          Severity: Minor
          Found in lib/cloud_party/exception.rb - About 35 mins to fix

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

                  def self.id_by_name(zone)
                    options = {
                        match: 'all',
                        name: zone,
                        order: 'name'
            Severity: Minor
            Found in lib/cloud_party/nodes/dns_records.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def initialize(result)
                    @result = result
                    @result.each do |k, v|
                      next if k == :permissions
                      next if k == :account
            Severity: Minor
            Found in lib/cloud_party/responses/accounts.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def initialize(method_name, endpoint, response, options)
                    @code = response.code
                    @body = JSON.parse(response.body, symbolize_names: true)
                    @parsed_response = response.parsed_response
                    @success = @body[:success]
            Severity: Minor
            Found in lib/cloud_party/responses/zones.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                  def initialize(result)
                    @result = result
                    @result.each do |k, v|
                      next if k == :permissions
                      next if k == :account
            Severity: Minor
            Found in lib/cloud_party/responses/memberships.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