IotaSpencer/cloud_party

View on GitHub

Showing 177 of 177 total issues

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

module CloudParty
  module Nodes
    class Accounts
      include CloudParty::Context
      include HTTParty
Severity: Minor
Found in lib/cloud_party/nodes/accounts.rb and 1 other location - About 55 mins to fix
lib/cloud_party/nodes/ips.rb on lines 5..22

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 45.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

      def inspect
        wanted_methods = %i[success messages errors results]
        our_methods    = methods.select do |m|
          wanted_methods.include? m
        end
Severity: Minor
Found in lib/cloud_party/responses/dns_records.rb and 1 other location - About 40 mins to fix
lib/cloud_party/responses/zones.rb on lines 67..76

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 38.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

      def inspect
        wanted_methods = %i[success messages errors results]
        our_methods    = methods.select do |m|
          wanted_methods.include? m
        end
Severity: Minor
Found in lib/cloud_party/responses/zones.rb and 1 other location - About 40 mins to fix
lib/cloud_party/responses/dns_records.rb on lines 73..82

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 38.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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 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

      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

      Similar blocks of code found in 7 locations. Consider refactoring.
      Open

      module CloudParty
        module Errors
          # Page/Endpoint doesn't exist
          class ForbiddenError < RequestError
            def initialize(obj:, method:, response:, endpoint: nil, code: 403)
      Severity: Minor
      Found in lib/cloud_party/exceptions/request_errors/forbidden_error.rb and 6 other locations - About 15 mins to fix
      lib/cloud_party/exceptions/request_errors/bad_request_error.rb on lines 4..19
      lib/cloud_party/exceptions/request_errors/method_not_allowed_error.rb on lines 4..20
      lib/cloud_party/exceptions/request_errors/not_found_error.rb on lines 4..19
      lib/cloud_party/exceptions/request_errors/too_many_requests_error.rb on lines 4..20
      lib/cloud_party/exceptions/request_errors/unauthorized_error.rb on lines 4..19
      lib/cloud_party/exceptions/request_errors/unsupported_media_type_error.rb on lines 4..20

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 25.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 7 locations. Consider refactoring.
      Open

      module CloudParty
        module Errors
          # Page/Endpoint doesn't exist
          class UnauthorizedError < RequestError
            def initialize(obj:, method:, response:, endpoint: nil, code: 401)
      lib/cloud_party/exceptions/request_errors/bad_request_error.rb on lines 4..19
      lib/cloud_party/exceptions/request_errors/forbidden_error.rb on lines 4..19
      lib/cloud_party/exceptions/request_errors/method_not_allowed_error.rb on lines 4..20
      lib/cloud_party/exceptions/request_errors/not_found_error.rb on lines 4..19
      lib/cloud_party/exceptions/request_errors/too_many_requests_error.rb on lines 4..20
      lib/cloud_party/exceptions/request_errors/unsupported_media_type_error.rb on lines 4..20

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 25.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 7 locations. Consider refactoring.
      Open

      module CloudParty
        module Errors
          # Page/Endpoint doesn't exist
          class NotFoundError < RequestError
            def initialize(obj:, method:, response:, endpoint: nil, code: 404)
      Severity: Minor
      Found in lib/cloud_party/exceptions/request_errors/not_found_error.rb and 6 other locations - About 15 mins to fix
      lib/cloud_party/exceptions/request_errors/bad_request_error.rb on lines 4..19
      lib/cloud_party/exceptions/request_errors/forbidden_error.rb on lines 4..19
      lib/cloud_party/exceptions/request_errors/method_not_allowed_error.rb on lines 4..20
      lib/cloud_party/exceptions/request_errors/too_many_requests_error.rb on lines 4..20
      lib/cloud_party/exceptions/request_errors/unauthorized_error.rb on lines 4..19
      lib/cloud_party/exceptions/request_errors/unsupported_media_type_error.rb on lines 4..20

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 25.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 7 locations. Consider refactoring.
      Open

      module CloudParty
        module Errors
          # Request was invalid
          class BadRequestError < RequestError
            def initialize(obj:, method:, response:, endpoint: nil, code: 400)
      Severity: Minor
      Found in lib/cloud_party/exceptions/request_errors/bad_request_error.rb and 6 other locations - About 15 mins to fix
      lib/cloud_party/exceptions/request_errors/forbidden_error.rb on lines 4..19
      lib/cloud_party/exceptions/request_errors/method_not_allowed_error.rb on lines 4..20
      lib/cloud_party/exceptions/request_errors/not_found_error.rb on lines 4..19
      lib/cloud_party/exceptions/request_errors/too_many_requests_error.rb on lines 4..20
      lib/cloud_party/exceptions/request_errors/unauthorized_error.rb on lines 4..19
      lib/cloud_party/exceptions/request_errors/unsupported_media_type_error.rb on lines 4..20

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 25.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 7 locations. Consider refactoring.
      Open

      module CloudParty
        module Errors
          # Page/Endpoint doesn't exist
          class MethodNotAllowedError < RequestError
            def initialize(obj:, method:, response:, endpoint: nil, code: 405)
      lib/cloud_party/exceptions/request_errors/bad_request_error.rb on lines 4..19
      lib/cloud_party/exceptions/request_errors/forbidden_error.rb on lines 4..19
      lib/cloud_party/exceptions/request_errors/not_found_error.rb on lines 4..19
      lib/cloud_party/exceptions/request_errors/too_many_requests_error.rb on lines 4..20
      lib/cloud_party/exceptions/request_errors/unauthorized_error.rb on lines 4..19
      lib/cloud_party/exceptions/request_errors/unsupported_media_type_error.rb on lines 4..20

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 25.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 7 locations. Consider refactoring.
      Open

      module CloudParty
        module Errors
          # Page/Endpoint doesn't exist
          class UnsupportedMediaTypeError < RequestError
            def initialize(obj:, method:, response:, endpoint: nil, code: 415)
      lib/cloud_party/exceptions/request_errors/bad_request_error.rb on lines 4..19
      lib/cloud_party/exceptions/request_errors/forbidden_error.rb on lines 4..19
      lib/cloud_party/exceptions/request_errors/method_not_allowed_error.rb on lines 4..20
      lib/cloud_party/exceptions/request_errors/not_found_error.rb on lines 4..19
      lib/cloud_party/exceptions/request_errors/too_many_requests_error.rb on lines 4..20
      lib/cloud_party/exceptions/request_errors/unauthorized_error.rb on lines 4..19

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 25.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 7 locations. Consider refactoring.
      Open

      module CloudParty
        module Errors
          # Page/Endpoint doesn't exist
          class TooManyRequestsError < RequestError
            def initialize(obj:, method:, response:, endpoint: nil, code: 429)
      lib/cloud_party/exceptions/request_errors/bad_request_error.rb on lines 4..19
      lib/cloud_party/exceptions/request_errors/forbidden_error.rb on lines 4..19
      lib/cloud_party/exceptions/request_errors/method_not_allowed_error.rb on lines 4..20
      lib/cloud_party/exceptions/request_errors/not_found_error.rb on lines 4..19
      lib/cloud_party/exceptions/request_errors/unauthorized_error.rb on lines 4..19
      lib/cloud_party/exceptions/request_errors/unsupported_media_type_error.rb on lines 4..20

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 25.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Useless assignment to variable - spec.
      Open

      spec = Gem::Specification.new do |s|
      Severity: Minor
      Found in cloud_party.gemspec by rubocop

      This cop checks for every useless assignment to local variable in every scope. The basic idea for this cop was from the warning of ruby -cw:

      assigned but unused variable - foo

      Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.

      Example:

      # bad
      
      def some_method
        some_var = 1
        do_something
      end

      Example:

      # good
      
      def some_method
        some_var = 1
        do_something(some_var)
      end

      Add an empty line after magic comments.
      Open

      require 'test-helper.rb'
      Severity: Minor
      Found in test/cloud_party_test.rb by rubocop

      Checks for a newline after the final magic comment.

      Example:

      # good
      # frozen_string_literal: true
      
      # Some documentation for Person
      class Person
        # Some code
      end
      
      # bad
      # frozen_string_literal: true
      # Some documentation for Person
      class Person
        # Some code
      end

      Extra empty line detected at class body beginning.
      Open

      
        A.cfg.instance_variable_get(:@email).wont_be_nil
      Severity: Minor
      Found in test/cloud_party/context_test.rb by rubocop

      This cops checks if empty lines around the bodies of classes match the configuration.

      Example: EnforcedStyle: empty_lines

      # good
      
      class Foo
      
        def bar
          # ...
        end
      
      end

      Example: EnforcedStyle: emptylinesexcept_namespace

      # good
      
      class Foo
        class Bar
      
          # ...
      
        end
      end

      Example: EnforcedStyle: emptylinesspecial

      # good
      class Foo
      
        def bar; end
      
      end

      Example: EnforcedStyle: noemptylines (default)

      # good
      
      class Foo
        def bar
          # ...
        end
      end
      Severity
      Category
      Status
      Source
      Language