goshippo/shippo-ruby-client

View on GitHub

Showing 5 of 48 total issues

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

        def self.inherited(klazz)
          klazz.instance_eval do
            @allowed_values = Set.new
            class << self
              def categories
Severity: Minor
Found in lib/shippo/api/category/base.rb - About 1 hr to fix

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

          def execute
            raise ArgumentError.new('Response is already defined, create another Request object.') if self.response
            validate!
            begin
              self.response        = shippo_phone_home
    Severity: Minor
    Found in lib/shippo/api/request.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 execute has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def execute
            raise ArgumentError.new('Response is already defined, create another Request object.') if self.response
            validate!
            begin
              self.response        = shippo_phone_home
    Severity: Minor
    Found in lib/shippo/api/request.rb - About 1 hr to fix

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

                    def allowed_values(*values)
                      return @allowed_values if values.nil? || values.empty? || !@allowed_values.empty?
      
                      @allowed_values = self.value_transformer(values)
                      @allowed_values.each do |allowed_value|
      Severity: Minor
      Found in lib/shippo/api/category/base.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 url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

                    def url(value = nil)
                      return @url if @url
                      @url ||= value if value
                      @url ||= class_to_url
                    end
      Severity: Minor
      Found in lib/shippo/api/extend/url.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